Consider the following example, test.v, which includes an instantiated module that simulates explicit delays on certain gates.
`timescale 1ns/1ps
module delay(in, out1, out2, out3, out4, transport, inertial);
input in;
output out1, out2, out3, out4, transport;
output inertial;
reg transport;
wire inertial;
always @in
begin
transport <= #10 in;
end
assign #10 inertial = in;
not#0 g1(out1, in);
not#5 g2(out2, in);
not#10 g3(out3, in);
not g4(out4, in);
specify
( in => out4) = 4;
endspecify
endmodule
module wrapper;
reg IN;
wire OUT1, OUT2, OUT3, OUT4, TRANSPORT, INERTIAL;
delay inst(IN, OUT1, OUT2, OUT3, OUT4, TRANSPORT, INERTIAL);
initial begin
IN = 1’b0;
#50 IN = 1’b1;
#50 IN = 1’b0;
#50 $finish();
end
endmodule
To run this example in direct invocation mode, specify the following commands:
% xmvlog test.v
% xmelab -access +rwc wrapper
% xmsim -tcl -profile -input “@probe -screen *; run; exit” wrapper
Alternatively, to run this example in single-step xrun mode, specify the following:
% xrun -access +rwc -tcl -profile -input “@probe -screen *; run; exit” test.v
The HDL is coded such that this will result in the following waveform by default:
where,
g1 (out1) has zero delay
g2 (out2) has a distributed delay of 5 simulation time units
g3 (out3) has a distributed delay of 10 simulation time units
g4 (out4) has a path delay of 4 simulation time units
inertial and transport both have a delay of 10 simulation time units
The following table shows how the simulation delays are executed when you select one of the global delay modes:
unit delay
Adding -delay_mode unit to the xmelab or xrun command line converts all non-zero structural and continuous assignment delay expressions to a delay of one simulation time unit. This changes the inertial delay, as well as the delays on gates g2 and g3. The delay on gate g4 is ignored since it is a module path delay. The transport delay and the zero delay on gate g1 behave the same as when no delay mode is specified.
zero delay
Adding -delay_mode zero to the xmelab or xrun command line ignores all module path delay information, timing checks, and structural and continuous assignment delays coded in the HDL source. This changes the inertial delay, and the delays on gates g2, g3, and g4. Gate g1 is already a zero delay, and remains unchanged. The transport delay behaves the same as when no delay mode is specified.
distributed delay
Adding -delay_mode distributed to the xmelab or xrun command ignores specparam and module path specifications. Only gate g4 is ignored in this case since it is a module path delay. All other delay specifications will behave the same as when no global delay mode is specified.
path delay
Adding -delay_mode path to the xmelab or xrun command line uses the module path delay information in the HDL source and ignores all distributed delay specifications. This changes the inertial delay, and the delays on gates g1, g2, and g3. The transport delay and the module path delay on gate g4 behave the same as when no delay mode is specified.
punit delay
Adding -delay_mode punit to the xmelab or xrun command line ignores all timing checks and sets all path delays to simulate with the value of one simulation time unit. Only gate g4 is changed in this case since it is a module path delay. All other delay specifications will behave the same as when no delay mode is specified.