HDL & Verification
Intending combinational logic, someone wrote the code above. What problem can occur?
always @(a)
y = a & b;
- Ab is removed from the circuit and y becomes equal to a
- BSynthesis fails and no circuit is produced
- CWhen only b changes, simulation does not update y, so it disagrees with the synthesized circuit, where y follows b
Show answer and explanation
Answer: C. When only b changes, simulation does not update y, so it disagrees with the synthesized circuit, where y follows b
A simulator runs the block only when a signal in the sensitivity list changes, so when only b changes, y keeps its stale value. Logic synthesis, however, ignores the list and builds an AND gate from the block's contents, so in the real circuit changes in b do reach y. This is dangerous: simulation looks right while the hardware behaves differently. Writing "@(*)" prevents it.
- A. Synthesis builds an AND gate.
- B. Most synthesis tools warn but still build the circuit.
- C. Correct. It is the classic sensitivity-list omission.