Add regression tests for specparam reference order

Check separately that a module-body specparam declaration following a
reference is rejected and that a specparam declared in a specify block
remains visible before its declaration.

Run both tests through the native and vlog95 backends.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-08-02 12:37:21 -07:00
parent dd403e7ea0
commit c5dbdddf7b
5 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// Check that a module-body specparam is declared before it is referenced.
module test;
wire value;
assign value = delay;
specparam delay = 1;
endmodule

View File

@ -0,0 +1,18 @@
// Check that specify-block specparams can be referenced before declaration.
module test;
specify
specparam value = delay;
specparam delay = 42;
endspecify
initial begin
if (value !== 42) begin
$display("FAILED. Expected 42, got %0d", value);
end else begin
$display("PASSED");
end
end
endmodule

View File

@ -234,6 +234,8 @@ sf_onehot_fail vvp_tests/sf_onehot_fail.json
sf_onehot0_fail vvp_tests/sf_onehot0_fail.json sf_onehot0_fail vvp_tests/sf_onehot0_fail.json
shift6 vvp_tests/shift6.json shift6 vvp_tests/shift6.json
single_element_array vvp_tests/single_element_array.json single_element_array vvp_tests/single_element_array.json
specparam_reference_order_fail vvp_tests/specparam_reference_order_fail.json
specparam_specify_reference_order vvp_tests/specparam_specify_reference_order.json
struct_enum_partsel vvp_tests/struct_enum_partsel.json struct_enum_partsel vvp_tests/struct_enum_partsel.json
struct_field_left_right vvp_tests/struct_field_left_right.json struct_field_left_right vvp_tests/struct_field_left_right.json
struct_nested1 vvp_tests/struct_nested1.json struct_nested1 vvp_tests/struct_nested1.json

View File

@ -0,0 +1,5 @@
{
"type" : "CE",
"source" : "specparam_reference_order_fail.v",
"iverilog-args" : [ "-g2001" ]
}

View File

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