RTL Studio Open IDE

Wiki Verification basics Delay control in the TB

Delay control in the TB

Hash delays sequence stimulus in simulation; they are not synthesizable RTL.

#N waits N time units in simulation. Use it in testbenches to space stimulus. Do not put # delays in synthesizable DUT code.

sequenceDiagram
  participant TB
  participant DUT
  TB->>DUT: poke inputs
  Note over TB: #10
  TB->>DUT: next poke
initial begin
  rst_n = 0;
  #20 rst_n = 1;
  #10 din = 8'hA5;
  #10 din = 8'h00;
end

Pair delays with a clock generator (forever #5 clk = ~clk) so edges land on a known grid. For cycle-accurate tests, wait @(posedge clk) instead of magic # counts.

Wrong vs right

Wrong — #1 inside always @(posedge clk) in RTL you intend to synthesize.

Right — delays only in initial / TB tasks; DUT uses clocks and resets.

See also