Add regression tests for parameters in generate blocks
In Verilog a parameter in a generate block is invalid and should result in a compile error. In SystemVerilog on the other hand it is valid, but it is equivalent to a localparam and can't be overridden. Add regression tests that check for this. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
9a94e6b43b
commit
47e6c71113
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Check whether it is possible to declare a parameter in a generate block
|
||||||
|
// In Verilog this should fail, in SystemVerilog the parameter is elaborated as
|
||||||
|
// localparam and the test should pass.
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
generate
|
||||||
|
genvar i;
|
||||||
|
for (i = 0; i < 2; i = i + 1) begin : loop
|
||||||
|
parameter A = i;
|
||||||
|
reg [A:0] r = A+1;
|
||||||
|
end
|
||||||
|
endgenerate
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
if (loop[0].r == 1 && loop[1].r == 2) begin
|
||||||
|
$display("PASSED");
|
||||||
|
end else begin
|
||||||
|
$display("FAILED");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Check that it is not possible to override parameters in generate blocks
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
generate
|
||||||
|
genvar i;
|
||||||
|
for (i = 0; i < 2; i = i + 1) begin : loop
|
||||||
|
parameter A = i;
|
||||||
|
reg [A:0] r = A+1;
|
||||||
|
end
|
||||||
|
endgenerate
|
||||||
|
|
||||||
|
defparam loop[0].A = 10;
|
||||||
|
defparam loop[1].A = 20;
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -77,6 +77,7 @@ br_gh25b normal ivltests
|
||||||
br_gh567 normal ivltests
|
br_gh567 normal ivltests
|
||||||
check_constant_3 normal ivltests
|
check_constant_3 normal ivltests
|
||||||
function4 normal ivltests
|
function4 normal ivltests
|
||||||
|
parameter_in_generate1 normal ivltests
|
||||||
pr1963962 normal ivltests gold=pr1963962-fsv.gold
|
pr1963962 normal ivltests gold=pr1963962-fsv.gold
|
||||||
pr3015421 CE ivltests gold=pr3015421-fsv.gold
|
pr3015421 CE ivltests gold=pr3015421-fsv.gold
|
||||||
resetall normal,-Wtimescale ivltests gold=resetall-fsv.gold
|
resetall normal,-Wtimescale ivltests gold=resetall-fsv.gold
|
||||||
|
|
|
||||||
|
|
@ -313,6 +313,7 @@ named_fork normal,-g2009 ivltests
|
||||||
named_fork_fail CE,-g2009 ivltests
|
named_fork_fail CE,-g2009 ivltests
|
||||||
packeda normal,-g2009 ivltests
|
packeda normal,-g2009 ivltests
|
||||||
packeda2 normal,-g2009 ivltests
|
packeda2 normal,-g2009 ivltests
|
||||||
|
parameter_in_generate2 CE,-g2005-sv ivltests
|
||||||
parameter_invalid_override CE,-g2005-sv ivltests gold=parameter_invalid_override.gold
|
parameter_invalid_override CE,-g2005-sv ivltests gold=parameter_invalid_override.gold
|
||||||
parameter_type2 normal,-g2009 ivltests
|
parameter_type2 normal,-g2009 ivltests
|
||||||
parpkg_test normal,-g2009 ivltests
|
parpkg_test normal,-g2009 ivltests
|
||||||
|
|
|
||||||
|
|
@ -694,6 +694,7 @@ param_test3 normal ivltests gold=param_test3.gold # PR#293
|
||||||
param_test4 normal ivltests
|
param_test4 normal ivltests
|
||||||
param_times normal ivltests # param has multiplication.
|
param_times normal ivltests # param has multiplication.
|
||||||
parameter_type normal ivltests gold=parameter_type.gold
|
parameter_type normal ivltests gold=parameter_type.gold
|
||||||
|
parameter_in_generate1 CE ivltests
|
||||||
patch1268 normal ivltests
|
patch1268 normal ivltests
|
||||||
pca1 normal ivltests # Procedural Continuous Assignment in a mux
|
pca1 normal ivltests # Procedural Continuous Assignment in a mux
|
||||||
pic normal contrib pictest gold=pic.gold
|
pic normal contrib pictest gold=pic.gold
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue