My testbench generates a clock with always #5 clk = ~clk; and applies stimulus with @(posedge clk) din = 8'h3C;. The registered design samples din on the rising edge. In one simulator the new value is captured on the very edge where I apply it; in another it is captured one cycle later. My result check, if (dout != 8'h3C) $display("FAIL");, also stays silent while dout is still X.
Which simulator is right, how should a testbench drive and check a synchronous design, and how do I end the run cleanly?




