Skip to main content

Delay Controls

· loading · loading · · ·
HDL Verilog HDL
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents
Verilog HDL Series - This article is part of a series.
Part 15: This Article

⏱️ Delay Controls
#

Delay controls simulate time-based or event-driven behavior and are used in testbenches or other non-synthesizable contexts.

🔹 #delay — Time Delay (simulation only)
#

#10 a = 1;  // Wait 10 time units before executing

Not allowed in synthesizable RTL — Using # delays in RTL logic breaks synthesis and must be avoided.


🔹 @event — Event-Based Control
#

@(posedge clk) q = d;   // Wait until rising edge of clk
@(a or b) out = a & b;  // Wait until 'a' or 'b' changes

🔹 wait — Blocking Wait Statement
#

The wait statement blocks execution until a condition becomes true.

wait (ready == 1);   // Wait until 'ready' is asserted
a = data_in;         // Then execute assignment

🔹 Combined Example
#

always @(posedge clk) begin
  wait (ready);       // Wait until 'ready' is high
  a = temp;           // Then assign 'temp' to 'a'
end

repeat with intra-assignment vs regular delay
#

Syntax Meaning
a = repeat(3) @(posedge clk) b; Captures b immediately, then waits 3 rising edges before assigning to a.
repeat(3) @(posedge clk); a = b; Waits for 3 rising edges, then assigns current value of b to a.

🎯 Difference: The first captures b early, the second uses b after the delay.


Verilog HDL Series - This article is part of a series.
Part 15: This Article

Related

Blocking vs Non-Blocking Assignments
· loading · loading
HDL Verilog HDL
Command-Line Input
· loading · loading
HDL Verilog HDL
Compiler Directives & Macros
· loading · loading
HDL Verilog HDL
Control Flow
· loading · loading
HDL Verilog HDL
Hierarchical Reference
· loading · loading
HDL Verilog HDL
Module Definition, Usage, and Constructs
· loading · loading
HDL Verilog HDL