Your testbench must be separate from the design — not just logically, but also temporally.

Real Hardware Analogy

In a real hardware system:

A hardware tester mimics this timing behavior by:


Testbench Behavior

A testbench should behave like another storage element plus logic:

However, if both the DUT (Design Under Test) and testbench are written purely in Verilog modules, this ideal timing is nearly impossible to achieve.


The Race Condition Problem

If the testbench drives signals exactly at the clock edge, race conditions can occur:

This leads to unpredictable and non-deterministic behavior.


Common (but Problematic) Workarounds

1. Using #0 Delays

2. Using Larger Delays (#1)