Add regression tests for reversed part select indices

Check that reversed part selects result in an error. Check this for both
right-hand and left-hand side expressions as well as for inner and outer
dimensions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-12-29 16:32:47 -08:00
parent 131e64c53c
commit 57f8084d0c
13 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// Check that an inverted part select in a continuous assign is reported as an
// error.
module test;
reg [1:0] x;
assign x[0:1] = 2'b00; // Error: Part select indices swapped
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that an inverted part select on an inner dimension in a continuous
// assign is reported as an error.
module test;
reg [1:0][1:0] x;
assign x[0:1] = 2'b00; // Error: Part select indices swapped
initial begin
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that an inverted part select in a procedural assign is reported as an
// error.
module test;
reg [1:0] x;
initial begin
x[0:1] = 2'b00; // Error: Part select indices swapped
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that an inverted part select on an inner dimension in a procedural
// assign is reported as an error.
module test;
reg [1:0][1:0] x;
initial begin
x[0:1] = 2'b00; // Error: Part select indices swapped
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,14 @@
// Check that an inverted part select in an expression is reported as an error.
module test;
reg [1:0] x;
reg [1:0] y;
initial begin
y = x[0:1]; // Error: Part select indices swapped
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,15 @@
// Check that an inverted part select on an inner dimension in an expression is
// reported as an error.
module test;
reg [1:0][1:0] x;
reg [1:0] y;
initial begin
y = x[0:1]; // Error: Part select indices swapped
$display("FAILED");
end
endmodule

View File

@ -94,6 +94,12 @@ 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
partsel_reversed_idx1 vvp_tests/partsel_reversed_idx1.json
partsel_reversed_idx2 vvp_tests/partsel_reversed_idx2.json
partsel_reversed_idx3 vvp_tests/partsel_reversed_idx3.json
partsel_reversed_idx4 vvp_tests/partsel_reversed_idx4.json
partsel_reversed_idx5 vvp_tests/partsel_reversed_idx5.json
partsel_reversed_idx6 vvp_tests/partsel_reversed_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_reversed_idx1.v"
}

View File

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

View File

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

View File

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

View File

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

View File

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