Add regression test for drive strength net declarations

Check that drive strength can be specified between the net type and the
data type in a net declaration and that vector gate arrays resolve
strengths correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-05-02 17:54:50 -07:00
parent 11c619e265
commit be3be03fec
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,62 @@
// Check that drive strength can be specified between the net type and the data
// type in a net declaration and that vector gate arrays resolve strengths
// correctly.
module test;
reg [7:0] pullval;
wire (weak0, weak1) [7:0] value = pullval;
reg [7:0] en0;
reg [7:0] en1;
reg failed = 1'b0;
`define check(expr, val) \
if ((expr) !== (val)) begin \
$display("FAILED(%0d): `%s`, expected %0h, got %0h", `__LINE__, \
`"expr`", (val), (expr)); \
failed = 1'b1; \
end
buf (highz0, strong1) drive0 [7:0] (value, en0);
not (strong0, highz1) drive1 [7:0] (value, en1);
initial begin
en0 = 8'h00;
en1 = 8'h00;
pullval = 8'hff;
#1 `check(value, 8'hff)
pullval = 8'h00;
#1 `check(value, 8'h00)
en0 = 8'haa;
pullval = 8'hff;
#1 `check(value, 8'hff)
pullval = 8'h00;
#1 `check(value, 8'haa)
en0 = 8'h00;
en1 = 8'hff;
pullval = 8'hff;
#1 `check(value, 8'h00)
pullval = 8'h00;
#1 `check(value, 8'h00)
en0 = 8'hff;
en1 = 8'hff;
pullval = 8'hff;
#1 `check(value, 8'hxx)
pullval = 8'h00;
#1 `check(value, 8'hxx)
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -118,6 +118,7 @@ dffsynth8 vvp_tests/dffsynth8.json
dffsynth9 vvp_tests/dffsynth9.json
dffsynth10 vvp_tests/dffsynth10.json
dffsynth11 vvp_tests/dffsynth11.json
drive_strength4 vvp_tests/drive_strength4.json
dumpfile vvp_tests/dumpfile.json
early_sig_elab1 vvp_tests/early_sig_elab1.json
early_sig_elab2 vvp_tests/early_sig_elab2.json

View File

@ -0,0 +1,4 @@
{
"type" : "normal",
"source" : "drive_strength4.v"
}