00:00:00.000 A register samples at the rising edge Start with the basic register. It samples D when the clock rises from zero to one. A nonblocking assignment schedules the update of Q. Between rising edges, D may change while Q keeps its saved value. 00:00:17.542 Synchronous reset has priority over enable This version checks reset first. Active-low reset clears Q at the rising edge, even if enable is high. With reset released, high enable loads D. If neither branch requests an update, Q holds. 00:00:35.667 The mux switches before the register samples The first rising edge clears Q. The next captures A. At twenty nanoseconds the mux selects B, while Q holds A. Enable is low at the next rising edge, so Q holds. The last rising edge captures B. 00:00:53.792 Distinguish the sampled value from the update At the final enabled edge, D already holds B. Q changes after the scheduled update. In the testbench, drive the inputs away from the sampling edge and check Q after the update.