Which of the following assignments is syntactically illegal in Verilog HDL?
Which of the following assignments is syntactically illegal in Verilog HDL?
- assign out = a & b; where out is declared as wire out;
- always @(*) out = a & b; where out is declared as reg out;
- assign out = a & b; where out is declared as reg out;
- always @(*) out <= a & b; where out is declared as reg out;
Correct answer
C. assign out = a & b; where out is declared as reg out;
Explanation
Continuous assignments ( assign ) can only drive net types such as wire , tri , or wand . Driving a variable type ( reg , integer ) with a continuous assign statement violates Verilog syntax. Variable types must be driven inside procedural blocks ( initial or always ).