My understanding of "specify" is that it controls the propagation delay from input to output.
So ..
I expect the code below to show 'o' changing at 118 - ie 10 time units after 108 when 'b' changed but instead the 'b' change is incorporated at 115 which is 10 units after a changed.
>A T= 0 a 0 b 0 o x
>B T= 0 a 0 b 0 o x
O T= 10 a 0 b 0 o 0
>A T= 105 a 1 b 0 o 0
>B T= 108 a 1 b 1 o 0
O T= 115 a 1 b 1 o 2
I expected this ....
>A T= 0 a 0 b 0 o x
>B T= 0 a 0 b 0 o x
O T= 10 a 0 b 0 o 0
>A T= 105 a 1 b 0 o 0
>B T= 108 a 1 b 1 o 0
O T= 115 a 1 b 1 o 1
O T= 118 a 1 b 1 o 2
Have I misunderstood 'specify'?
See https://www.edaplayground.com/x/eBUY
module check(a,b,o);
output wire [1:0] o;
input [1:0] a,b;
specify
( a => o ) = 10;
( b => o ) = 10;
endspecify
assign o = a + b;
always @ (a)
$display (">A T=%4t a %2d b %2d o %2d ", $time, a, b, o);
always @ (b)
$display (">B T=%4t a %2d b %2d o %2d ", $time, a, b, o);
always @ (o)
$display (" O T=%4t a %2d b %2d o %2d ", $time, a, b, o);
endmodule
module test;
wire [1:0] o;
logic [1:0] a,b;
check t1(.a,.b,.o);
initial begin
a = 0;
b = 0;
end
initial begin
#105 a = 1;
end
initial begin
#108 b = 1; // I EXPECT o TO CHANGE AS 108+10 BUT IT CHANGES AT 115
end
endmodule
=========
Updated ...
Two alternatives that seem to work the way I expected See below and https://www.edaplayground.com/x/P7kB
module check(a,b,o);
output reg [1:0] o;
input [1:0] a,b;
// OPTION 1 - put the delays on the individual wires
wire #10 a_delayed = a;
wire #10 b_delayed = b;
assign o = a_delayed + b_delayed;
// OPTION 2
// Use non-blocking with RHS delay as per https://www-inst.eecs.berkeley.edu/~cs152/fa06/handouts/CummingsHDLCON1999_BehavioralDelays_Rev1_1.pdf
// always @*
// o <= #10 a + b;
always @ (a)
$display (">A T=%4t a %2d b %2d o %2d ", $time, a, b, o);
always @ (b)
$display (">B T=%4t a %2d b %2d o %2d ", $time, a, b, o);
always @ (o)
$display (" O T=%4t a %2d b %2d o %2d ", $time, a, b, o);
endmodule
Both option 1 nd 2 produce the same output ...
>A T= 0 a 0 b 0 o x
>B T= 0 a 0 b 0 o x
O T= 10 a 0 b 0 o 0
>A T= 105 a 1 b 0 o 0
>B T= 108 a 1 b 1 o 0
O T= 115 a 1 b 1 o 1
O T= 118 a 1 b 1 o 2
Is there a better way to get the individual input to output propagation delays to work?
BTW This quesiton is actually part of a more complictated usecase that this question was motivated by. I am creating a timed model of a 74HCT151 and wanted the timings to be accurate as I want to generate the settling glitches that the published timing implies.
Should I create a separate question for that?