assignment comparison in verilog

Status
Not open for further replies.

eda_student

Newbie
Joined
Jul 5, 2023
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
23
Hi,

what is difference between following 2 assignments?


Code:
always @(*)
    begin
     out_data = in_data;
     end

Code:
assign out_data = in_data;
 

the physical hardware generated by both statements will be the same.

there is only one verilog conceptual difference that the assigned inside the always block can only be done to a *reg* datatype. the assignment using the assign keyword can only be done to a *wire* datatype.
 
Synthesis treats the the two construct the same here. But one significant simulation difference is the always @* waits for a change on the RHS first before executing the assignment. If the RHS is a constant, it won't work.

The continuous assign statement executes once at time 0. The SystemVerilog always_comb statement does that too.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…