Skip to content

Commit 8cf03ca

Browse files
authored
Merge pull request #1334 from diffblue/integer_literals2
Verilog: tests for unsigned integer literals
2 parents 565f1c6 + 13fdd27 commit 8cf03ca

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
integer_literals2.sv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module main;
2+
3+
// 1800-2017 5.7.1
4+
5+
// "If the size of the unsigned number is smaller than the size specified
6+
// for the literal constant, the unsigned number shall be padded to the
7+
// left with zeros."
8+
initial assert (4'b1 === 4'b0001);
9+
10+
// "If the leftmost bit in the unsigned number is an x or a z, then
11+
// an x or a z shall be used to pad to the left, respectively."
12+
initial assert (4'bz1 === 4'bzzz1);
13+
initial assert (4'bx1 === 4'bxxx1);
14+
15+
// "If the size of the unsigned number is larger than the size specified
16+
// for the literal constant, the unsigned number shall be truncated from
17+
// the left."
18+
initial assert (4'b1111_1111 === 4'b1111);
19+
20+
endmodule

0 commit comments

Comments
 (0)