Add regression tests for parameters without default
SystemVerilog supports parameters without default values in parameter port list. Add regression tests to check this feature. Also add a regression test to check that modules without a default parameter are not automatically picked as a toplevel module. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
4a87bee3c0
commit
91579c7c79
|
|
@ -0,0 +1,20 @@
|
|||
// SystemVerilog allows parameters without default values in the parameter port
|
||||
// list. Check that this is supported. The test should fail in Verilog mode.
|
||||
|
||||
module a #(
|
||||
parameter A
|
||||
);
|
||||
|
||||
initial begin
|
||||
if (A == 1) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module test;
|
||||
a #(.A(1)) i_a();
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// Check that not providing a value during module instantiation for a parameter
|
||||
// without a default value generates an error.
|
||||
|
||||
module a #(
|
||||
parameter A
|
||||
);
|
||||
|
||||
initial begin
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module test;
|
||||
a i_a();
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// Check that parameters without default values outside the parameter port list
|
||||
// generate an error.
|
||||
|
||||
module a;
|
||||
|
||||
parameter A;
|
||||
|
||||
initial begin
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module test;
|
||||
a #(.A(10)) i_a();
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Check that modules with undefined parameters do not get picked as top-level
|
||||
// modules.
|
||||
|
||||
module a #(
|
||||
parameter A
|
||||
);
|
||||
initial $display("FAILED");
|
||||
endmodule
|
||||
|
||||
module b #(
|
||||
parameter B = 1
|
||||
);
|
||||
initial $display("PASSED");
|
||||
endmodule
|
||||
|
|
@ -78,6 +78,7 @@ br_gh567 normal ivltests
|
|||
check_constant_3 normal ivltests
|
||||
function4 normal ivltests
|
||||
parameter_in_generate1 normal ivltests
|
||||
parameter_no_default normal ivltests
|
||||
parameter_omit1 normal ivltests
|
||||
parameter_omit2 normal ivltests
|
||||
parameter_omit3 normal ivltests
|
||||
|
|
|
|||
|
|
@ -317,6 +317,10 @@ packeda 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_no_default CE,-g2005-sv ivltests
|
||||
parameter_no_default_fail1 CE ivltests
|
||||
parameter_no_default_fail2 CE ivltests
|
||||
parameter_no_default_toplvl normal,-g2005-sv ivltests
|
||||
parameter_type2 normal,-g2009 ivltests
|
||||
parpkg_test normal,-g2009 ivltests
|
||||
parpkg_test2 normal,-g2009 ivltests
|
||||
|
|
|
|||
|
|
@ -696,6 +696,7 @@ param_test4 normal ivltests
|
|||
param_times normal ivltests # param has multiplication.
|
||||
parameter_type normal ivltests gold=parameter_type.gold
|
||||
parameter_in_generate1 CE ivltests
|
||||
parameter_no_default CE ivltests
|
||||
parameter_omit1 CE ivltests
|
||||
parameter_omit2 CE ivltests
|
||||
parameter_omit3 CE ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue