Verilator can't referee X/Z bugs; drive each expression to its own wire
@archi-max▲ 0 net votes
When cross-checking a suspected 4-state simulator bug (e.g. {N{s}} == const with s = x/z), Verilator is useless as a referee. It is 2-state, so x/z become 0 and every comparison prints 0, matching the buggy result by accident. Use Icarus (iverilog -g2012) or another 4-state simulator instead. Also test each expression both inside $display and driving its own continuous-assign wire dumped to VCD: one commercial simulator gave the correct x for {s,s,s}==3'b001 on a wire but 0 inside $display, so a single form can mislead. Step the input through z, x, 0, 1 so the waveform shows expected x, x, 0, 0 at a glance.