10.2.1 Specify Blocks A delay between a source input or inout pin and a destination output or inout pin of a module is called a module path delay.. Parallel connection As discussed ear
Trang 1[ Team LiB ]
10.2 Path Delay Modeling
In this section, we discuss various aspects of path delay modeling In this section, the terms pin and port are used interchangeably
10.2.1 Specify Blocks
A delay between a source (input or inout) pin and a destination (output or inout) pin of a module is called a module path delay Path delays are assigned in Verilog within the keywords specify and endspecify The statements within these keywords constitute a specify block
Specify blocks contain statements to do the following:
• Assign pin-to-pin timing delays across module paths
• Set up timing checks in the circuits
• Define specparam constants
For the example in Figure 10-3, we can write the module M with pin-to-pin delays, using specify blocks as follows:
Example 10-3 Pin-to-Pin Delay
//Pin-to-pin delays
module M (out, a, b, c, d);
output out;
input a, b, c, d;
wire e, f;
//Specify block with path delay statements
specify
(a => out) = 9;
(b => out) = 9;
(c => out) = 11;
(d => out) = 11;
endspecify
//gate instantiations
and a1(e, a, b);
and a2(f, c, d);
Trang 2and a3(out, e, f);
endmodule
The specify block is a separate block in the module and does not appear under any other block, such as initial or always The meaning of the statements within specify blocks needs to be clarified In the following subsection, we analyze the statements that are used inside specify blocks
10.2.2 Inside Specify Blocks
In this section, we describe the statements that can be used inside specify blocks
Parallel connection
As discussed earlier, every path delay statement has a source field and a destination field
In the path delay statements in Example 10-3, a, b, c, and d are in the position of the source field and out is the destination field
A parallel connection is specified by the symbol => and is used as shown below
Usage: ( <source_field> => <destination_field>) = <delay_value>;
In a parallel connection, each bit in source field connects to its corresponding bit in the destination field If the source and the destination fields are vectors, they must have the same number of bits; otherwise, there is a mismatch Thus, a parallel connection specifies delays from each bit in source to each bit in destination
Figure 10-4 shows how bits between the source field and destination field are connected
in a parallel connection Example 10-4 shows the Verilog description for a parallel
connection
Example 10-4 Parallel Connection
//bit-to-bit connection both a and out are single-bit
(a => out) = 9;
//vector connection both a and out are 4-bit vectors a[3:0], out[3:0]
//a is source field, out is destination field
(a => out) = 9;
//the above statement is shorthand notation
//for four bit-to-bit connection statements
(a[0] => out[0]) = 9;
(a[1] => out[1]) = 9;
(a[2] => out[2]) = 9;
Trang 3(a[3] => out[3]) = 9;
//illegal connection a[4:0] is a 5-bit vector, out[3:0] is 4-bit
//Mismatch between bit width of source and destination fields
(a => out) = 9; //bit width does not match
Figure 10-4 Parallel Connection
Full connection
A full connection is specified by the symbol *> and is used as shown below
Usage: ( <source_field> *> <destination_field>) = <delay_value>;
In a full connection, each bit in the source field connects to every bit in the destination field If the source and the destination are vectors, then they need not have the same number of bits A full connection describes the delay between each bit of the source and every bit in the destination, as illustrated in Figure 10-5
Figure 10-5 Full Connection
Delays for module M were described in Example 10-3, using a parallel connection Example 10-5 shows how delays are specified by using a full connection
Example 10-5 Full Connection
//Full Connection
module M (out, a, b, c, d);
output out;
input a, b, c, d;
Trang 4wire e, f;
//full connection
specify
(a,b *> out) = 9;
(c,d *> out) = 11;
endspecify
and a1(e, a, b);
and a2(f, c, d);
and a3(out, e, f);
endmodule
The full connection is particularly useful for specifying a delay between each bit of an input vector and every bit in the output vector when bit width of the vectors is large The following example shows how the full connection sometimes specifies delays very concisely
//a[31:0] is a 32-bit vector and out[15:0] is a 16-bit vector
//Delay of 9 between each bit of a and every bit of out
specify
( a *> out) = 9; // you would need 32 X 16 = 352 parallel connection
// statements to accomplish the same result! Why?
endspecify
Edge-Sensitive Paths
An edge-sensitive path construct is used to model the timing of input to output delays, which occurs only when a specified edge occurs at the source signal
//In this example, at the positive edge of clock, a module path
//extends from clock signal to out signal using a rise delay of 10
//and a fall delay of 8 The data path is from in to out, and the
//in signal is not inverted as it propagates to the out signal
(posedge clock => (out +: in)) = (10 : 8);
specparam statements
Special parameters can be declared for use inside a specify block They are declared by the keyword specparam Instead of using hardcoded delay numbers to specify pin-to-pin
Trang 5delays, it is common to define specify parameters by using specparam and then to use those parameters inside the specify block The specparam values are often used to store values for nonsimulation tools, such as delay calculators, synthesis tools, and layout estimators A sample specify block with specparam statements is shown in Example 10-6
Example 10-6 Specparam
//Specify parameters using specparam statement
specify
//define parameters inside the specify block
specparam d_to_q = 9;
specparam clk_to_q = 11;
(d => q) = d_to_q;
(clk => q) = clk_to_q;
endspecify
Note that specify parameters are used only inside their own specify block They are not general-purpose parameters that are declared by the keyword parameter Specify
parameters are provided for convenience in assigning delays It is recommended that all pin-to-pin delay values be expressed in terms of specify parameters instead of hardcoded numbers Thus, if timing specifications of the circuit change, the user has to change only the values of specify parameters
Conditional path delays
Based on the states of input signals to a circuit, the pin-to-pin delays might change
Verilog allows path delays to be assigned conditionally, based on the value of the signals
in the circuit A conditional path delay is expressed with the if conditional statement The operands can be scalar or vector module input or inout ports or their bit-selects or part-selects, locally defined registers or nets or their bit-selects or part-part-selects, or compile time constants (constant numbers and specify block parameters) The conditional expression can contain any logical, bitwise, reduction, concatenation, or conditional operator shown
in Table 6-1 on page 96 The else construct cannot be used Conditional path delays are also known as state dependent path delays(SDPD)
Example 10-7 Conditional Path Delays
//Conditional Path Delays
module M (out, a, b, c, d);
output out;
input a, b, c, d;
wire e, f;
Trang 6//specify block with conditional pin-to-pin timing
specify
//different pin-to-pin timing based on state of signal a
if (a) (a => out) = 9;
if (~a) (a => out) = 10;
//Conditional expression contains two signals b , c
//If b & c is true, delay = 9,
//Conditional Path Delays
if (b & c) (b => out) = 9;
if (~(b & c)) (b => out) = 13;
//Use concatenation operator
//Use Full connection
if ({c,d} == 2'b01)
(c,d *> out) = 11;
if ({c,d} != 2'b01)
(c,d *> out) = 13;
endspecify
and a1(e, a, b);
and a2(f, c, d);
and a3(out, e, f);
endmodule
Rise, fall, and turn-off delays
Pin-to-pin timing can also be expressed in more detail by specifying rise, fall, and turn-off delay values (see Example 10-8) One, two, three, six, or twelve delay values can be specified for any path Four, five, seven, eight, nine, ten, or eleven delay value
specification is illegal The order in which delays are specified must be strictly followed Rise, fall, and turn-off delay specification for gates was discussed in Section 5.2.1, Rise, Fall, and Turn-off Delays We discuss it in this section in the context of pin-to-pin timing specification
Example 10-8 Path Delays Specified by Rise, Fall and Turn-off Values
//Specify one delay only Used for all transitions
specparam t_delay = 11;
(clk => q) = t_delay;
Trang 7//Specify two delays, rise and fall
//Rise used for transitions 0->1, 0->z, z->1
//Fall used for transitions 1->0, 1->z, z->0
specparam t_rise = 9, t_fall = 13;
(clk => q) = (t_rise, t_fall);
//Specify three delays, rise, fall, and turn-off
//Rise used for transitions 0->1, z->1
//Fall used for transitions 1->0, z->0
//Turn-off used for transitions 0->z, 1->z
specparam t_rise = 9, t_fall = 13, t_turnoff = 11;
(clk => q) = (t_rise, t_fall, t_turnoff);
//specify six delays
//Delays are specified in order
//for transitions 0->1, 1->0, 0->z, z->1, 1->z, z->0 Order
//must be followed strictly
specparam t_01 = 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11, t_z0 = 13;
(clk => q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0);
//specify twelve delays
//Delays are specified in order
//for transitions 0->1, 1->0, 0->z, z->1, 1->z, z->0
// 0->x, x->1, 1->x, x->0, x->z, z->x
//Order must be followed strictly
specparam t_01 = 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11, t_z0 = 13;
specparam t_0x = 4, t_x1 = 13, t_1x = 5;
specparam t_x0 = 9, t_xz = 11, t_zx = 7;
(clk => q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0,
t_0x, t_x1, t_1x, t_x0, t_xz, t_zx );
Min, max, and typical delays
Min, max, and typical delay values were discussed earlier for gates in Section 5.2.2, Min/Typ/Max Values Min, max, and typical values can also be specified for pin-to-pin delays Any delay value shown in Example 10-8 can be expressed in min, max, typical delay form Consider the case of the three-delay specification, shown in Example 10-9 Each delay is expressed in min:typ:max form
Trang 8Example 10-9 Path Delays with Min, Max, and Typical Values
//Specify three delays, rise, fall, and turn-off
//Each delay has a min:typ:max value
specparam t_rise = 8:9:10, t_fall = 12:13:14, t_turnoff = 10:11:12;
(clk => q) = (t_rise, t_fall, t_turnoff);
As discussed earlier, min, typical, and max values can be typically invoked with the
runtime option +mindelays, +typdelays, or +maxdelays on the Verilog command line
Default is the typical delay value Invocation may vary with individual simulators
Handling x transitions
Verilog uses the pessimistic method to compute delays for transitions to the x state The
pessimistic approach dictates that if x transition delays are not explicitly specified,
• Transitions from x to a known state should take the maximum possible time
• Transition from a known state to x should take the minimum possible time
A path delay specification with six delays borrowed from Example 10-8 is shown below
//Six delays specified
//for transitions 0->1, 1->0, 0->z, z->1, 1->z, z->0
specparam t_01 = 9, t_10 = 13, t_0z = 11;
specparam t_z1 = 9, t_1z = 11, t_z0 = 13;
(clk => q) = (t_01, t_10, t_0z, t_z1, t_1z, t_z0);
The computation for transitions to x for the above delay specification is shown in the
table below
0->x
1->x
z->x
min(t_01, t_0z) = 9 min(t_10, t_1z) = 11 min(t_z0, t_z1) = 9 x->0
x->1
x->z
max(t_10, t_z0) = 13 max(t_01, t_z1) = 9 max(t_1z, t_0z) = 11
Trang 9[ Team LiB ]