Add a regression test for calling $bits() with a data type
Check that $bits() can be called with packed data types. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
c4feb89957
commit
ef42df6fef
|
|
@ -0,0 +1,34 @@
|
|||
// Check that passing a data type to $bits works as expected
|
||||
|
||||
module test;
|
||||
|
||||
bit failed = 1'b0;
|
||||
|
||||
`define check(type, value) \
|
||||
if ($bits(type) !== value) begin \
|
||||
$display("FAILED: $bits(", `"type`", ") is %0d", $bits(type), " expected %0d", value); \
|
||||
failed = 1'b1; \
|
||||
end
|
||||
|
||||
typedef int T1;
|
||||
typedef int T2[3:0];
|
||||
|
||||
initial begin
|
||||
`check(reg, 1);
|
||||
`check(logic, 1);
|
||||
`check(bit, 1);
|
||||
`check(logic [3:0], 4);
|
||||
`check(byte, 8);
|
||||
`check(shortint, 16);
|
||||
`check(int, 32);
|
||||
`check(longint, 64);
|
||||
`check(struct packed { int x; shortint y; }, 32 + 16);
|
||||
`check(T1, 32);
|
||||
`check(T2, 4 * 32);
|
||||
|
||||
if (failed == 1'b0) begin
|
||||
$display("PASSED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -101,6 +101,7 @@ assign_op_type normal,-g2009 ivltests
|
|||
bitp1 normal,-g2005-sv ivltests
|
||||
bits normal,-g2005-sv ivltests
|
||||
bits2 normal,-g2005-sv ivltests
|
||||
bits3 normal,-g2005-sv ivltests
|
||||
br884 normal,-g2009 ivltests
|
||||
br917a normal,-g2009 ivltests
|
||||
br917b normal,-g2009 ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue