wht will output for this verilog code

Status
Not open for further replies.

shiv_emf

Advanced Member level 2
Joined
Aug 31, 2005
Messages
605
Helped
22
Reputation
44
Reaction score
6
Trophy points
1,298
Activity points
4,106
Given the following verilog code, What value of "a" is displayed ?

always@(clk)begin
a=0;
a<=1;
$display(a);
end
 

Hello!!!
Cannot use in one always the blocking assignment and nonblocking assignment together!!


a=0 !!!
 

well ....... I want output nt ur views !!
its posible to write tht code n ... or may b it cant be synthesiable .. but ths nt da issue ..

Wht will be the value of a ......... a=??
 

Shurik already said the correct answer.

Assuming "a" is a register ...
After each clock edge: a is set to 0, then a is displayed, then a is set to 1.

Remember that a<=1 schedules the assignment for the end of the time step.

For more info, see IEEE Std 1364-2005, section 9.2.2, Example 1.
 

    shiv_emf

    Points: 2
    Helpful Answer Positive Rating
a will display "0" always !!!!
 

    shiv_emf

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…