Verilog Assignment Delays
Verilog Assignment Delays
Clifford E. Cummings
Sunburst Design, Inc.
15870 SW Breccia Drive
Beaverton, OR 97007
[email protected]
+pulse_r/30 +pulse_e/70
2.0 Inertial and transport delay modeling reject pulses less than 30%, propagate unknowns for
pulses between 30-70% and pass all pulses greater
Inertial delay models only propagate signals to an than 70% of propagation delay.
output after the input signals have remained unchanged
(been stable) for a time period equal to or greater than the
always @(a) Procedural blocking Adding delays to the left hand side (LHS) of any
#5 y = ~a; assignment - LHS delay sequence of blocking assignments to model
combinational logic is also flawed.
The adder_t7a example shown in Figure 4 places
always @(a) Procedural blocking the delay on the first blocking assignment and no delay on
y = #5 ~a; assignment - RHS delay the second assignment. This will have the same flawed
behavior as the adder_t1 example.
Figure 1 - Blocking Assignments with Delays The adder_t7b example, also shown in Figure 4,
places the delay on the second blocking assignment and
For the adder_t1 example shown in Figure 2, the no delay on the first. This model will sample the inputs on
outputs should be updated 12ns after input changes. If the the first input change and assign the outputs to a
a input changes at time 15 as shown in Figure 3, then if temporary location until after completion of the specified
the a, b and ci inputs all change during the next 9ns, the blocking delay. Then the outputs will be written with the
outputs will be updated with the latest values of a, b and old temporary output values that are no longer valid.
ci. This modeling style has just permitted the ci input to Other input changes within the 12ns delay period will not
propagate a value to the sum and carry outputs after be evaluated, which means old erroneous values will
only 3ns instead of the required 12ns propagation delay. remain on the outputs until more input changes occur.
0 12 15 17 19 21 24 27 29 31 33 36
a 0 A 2 F
b 0 3
ci 0 1
sum X 0 3
co X 0 1
0 12 15 17 19 21 24 27 29 31 33 36
a F
0 A 2
b 3
0
ci 0
sum 2
X 0 A D 5
co 1
X 0
Trigger the
assign statement
0 12 15 17 19 21 24 27 29 31 33 36
a F
0 A 2
b 3
0
ci 0
sum 2
X 0
co 1
X 0
6.0 Conclusions
5.2 Mixed no-delay always blocks and Any delay added to statements inside of an always
continuous assignments block does not accurately model the behavior of real
Modeling logic functionality in an always block with hardware and should not be done. The one exception is to
no delays, then passing the always block intermediate carefully add delays to the right hand side of nonblocking
values to a continuous assignment with delays as, shown assignments, which will accurately model transport
in Figure 16, will accurately model combinational logic delays, generally at the cost of simulator performance.
Adding delays to any sequence of continuous
assignments, or modeling complex logic with no delays
module adder_t5 (co, sum, a, b, ci);
inside of an always block and driving the always block
output co;
output [3:0] sum; outputs through continuous assignments with delays, both
input [3:0] a, b; accurately model inertial delays and are recommended
input ci; coding styles for modeling combinational logic.
reg [4:0] tmp;