Add regression tests for invalid size casts
Check that an error is reported for size casts with either a value of 0, a negative value or an undefined value. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
4436dc41ab
commit
5685eac1be
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Check that an error is reported when using a zero value for a size cast.
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
localparam integer N = 0;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
int x, y;
|
||||||
|
y = N'(x); // This should fail, N is zero
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Check that an error is reported when using a negative value for a size cast.
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
localparam integer N = -1;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
int x, y;
|
||||||
|
y = N'(x); // This should fail, N is negative
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Check that an error is reported when using an undefined value for a size cast.
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
localparam integer N = 32'hx;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
int x, y;
|
||||||
|
y = N'(x); // This should fail, N is undefined
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -465,6 +465,9 @@ size_cast2 normal,-g2005-sv ivltests
|
||||||
size_cast3 normal,-g2009 ivltests
|
size_cast3 normal,-g2009 ivltests
|
||||||
size_cast4 normal,-g2009 ivltests
|
size_cast4 normal,-g2009 ivltests
|
||||||
size_cast5 normal,-g2009 ivltests
|
size_cast5 normal,-g2009 ivltests
|
||||||
|
size_cast_fail1 CE,-g2009 ivltests
|
||||||
|
size_cast_fail2 CE,-g2009 ivltests
|
||||||
|
size_cast_fail3 CE,-g2009 ivltests
|
||||||
slongint_test normal,-g2005-sv ivltests
|
slongint_test normal,-g2005-sv ivltests
|
||||||
sshortint_test normal,-g2005-sv ivltests
|
sshortint_test normal,-g2005-sv ivltests
|
||||||
string_events normal,-g2009 ivltests gold=string_events.gold
|
string_events normal,-g2009 ivltests gold=string_events.gold
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue