Add regression tests for invalid part select base expressions

Check that a invalid part select base expression results in a compile
error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-12-27 09:14:26 -08:00
parent e7e663056a
commit 8f006a22b4
13 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// Check that a non-existent index into a vector results in an elaboration error.
module test;
reg [31:0] a;
wire b;
assign b = a[does_not_exist]; // Error: Invalid index
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that a non-existent index into a vector results in an elaboration error.
module test;
reg [31:0] a;
wire [1:0] b;
assign b = a[does_not_exist+:2]; // Error: Invalid base index
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that a non-existent index into a vector results in an elaboration error.
module test;
reg [31:0] a;
wire [1:0] b;
assign b = a[does_not_exist-:2]; // Error: Invalid base index
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,15 @@
// Check that a non-existent index into a parameter results in an elaboration error.
module test;
parameter [31:0] P = 'h0;
wire x;
assign x = P[does_not_exist]; // Error: Invalid index
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,15 @@
// Check that a non-existent index into a parameter results in an elaboration error.
module test;
parameter [31:0] P = 'h0;
wire [1:0] x;
assign x = P[does_not_exist+:2]; // Error: Invalid base index
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,15 @@
// Check that a non-existent index into a parameter results in an elaboration error.
module test;
parameter [31:0] P = 'h0;
wire [1:0] x;
assign x = P[does_not_exist-:2]; // Error: Invalid base index
initial begin
$display("FAILED");
end
endmodule

View File

@ -86,6 +86,12 @@ module_ordered_list2 vvp_tests/module_ordered_list2.json
module_port_array1 vvp_tests/module_port_array1.json
module_port_array_init1 vvp_tests/module_port_array_init1.json
non-polymorphic-abs vvp_tests/non-polymorphic-abs.json
partsel_invalid_idx1 vvp_tests/partsel_invalid_idx1.json
partsel_invalid_idx2 vvp_tests/partsel_invalid_idx2.json
partsel_invalid_idx3 vvp_tests/partsel_invalid_idx3.json
partsel_invalid_idx4 vvp_tests/partsel_invalid_idx4.json
partsel_invalid_idx5 vvp_tests/partsel_invalid_idx5.json
partsel_invalid_idx6 vvp_tests/partsel_invalid_idx6.json
param_test3 vvp_tests/param_test3.json
param-width vvp_tests/param-width.json
param-width-vlog95 vvp_tests/param-width-vlog95.json

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx1.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx2.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx3.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx4.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx5.v"
}

View File

@ -0,0 +1,4 @@
{
"type" : "CE",
"source" : "partsel_invalid_idx6.v"
}