sumeet1990
Newbie level 5
- Joined
- Mar 29, 2013
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,348
1)
2)
3)
Hello,
I am new to SV please help me with the codes above
1)In the first code I used forever loop with blocking assignments and with and timing procederals and everything works nicely.I get red,blue,green,yellow resp.
2)Int the second code I am using non blocking statements and while simulating it hangs the simulation by displaying "red","0"
3) in the third code I just added a delay and simulation works fine displaying values after specified delay
Now, I now the working of blocking and non blocking assignments but just can get how it is working in the above codes. also, I don't quite get how this delay addition affects the code.
thank you in advance
Code:
module enum_test;
enum {red,green,blue,yellow} c;
initial
begin
c=c.first;
forever
begin
$display("%s %d",c.name,c);
if(c==c.last)
break;
c=c.next;
end
end
endmodule
2)
Code:
module enum_test;
enum {red,green,blue,yellow} c;
initial
begin
c<=c.first;
forever
begin
$display("%s %d",c.name,c);
if(c==c.last)
break;
c<=c.next;
end
end
endmodule
Code:
module enum_test;
enum {red,green,blue,yellow} c;
initial
begin
c<=c.first;
forever
begin
#10 //<<<<<-------------------things change by adding this
$display("%s %d",c.name,c);
if(c==c.last)
break;
c<=c.next;
end
end
endmodule
I am new to SV please help me with the codes above
1)In the first code I used forever loop with blocking assignments and with and timing procederals and everything works nicely.I get red,blue,green,yellow resp.
2)Int the second code I am using non blocking statements and while simulating it hangs the simulation by displaying "red","0"
3) in the third code I just added a delay and simulation works fine displaying values after specified delay
Now, I now the working of blocking and non blocking assignments but just can get how it is working in the above codes. also, I don't quite get how this delay addition affects the code.
thank you in advance
Last edited by a moderator: