Skip to content

Commit 8251b11

Browse files
authored
Merge pull request #1277 from diffblue/shift-tests
Verilog: Move shift tests
2 parents b735c44 + 60f5264 commit 8251b11

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

regression/verilog/asic-world-operators/shift.sv

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ module main(input[31:0] in1, in2, in3);
33
// follows
44
// http://www.asic-world.com/verilog/operators2.html
55

6-
// logical shift
6+
// logical left shift
77
always assert shift_p1: 4'b1001 << 1 === 4'b0010;
88
always assert shift_p2: 4'b10x1 << 1 === 4'b0x10;
99
always assert shift_p3: 4'b10z1 << 1 === 4'b0z10;
10+
// right shift
1011
always assert shift_p4: 4'b1001 >> 1 === 4'b0100;
1112
always assert shift_p5: 4'b10x1 >> 1 === 4'b010x;
1213
always assert shift_p6: 4'b10z1 >> 1 === 4'b010z;
13-
always assert shift_p7: 4'b1111 << 1 === 5'b11110;
14-
always assert shift_p8: 1 << 6 === 64;
15-
16-
// arithmetic shift
17-
always assert shift_p9: -1 >>> 1 === -1;
18-
always assert shift_p10: 1 >>> 1 === 0;
19-
always assert shift_p11: -2 >>> 1 === -1;
2014

2115
endmodule
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
shl4.sv
3+
--bound 0
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
This gives the wrong answer.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module main;
2+
3+
assert final (4'b1111 << 1 === 5'b11110);
4+
assert final (1 << 6 === 64);
5+
6+
endmodule
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
shr4.sv
3+
--bound 0
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module main;
2+
3+
// arithmetic shift
4+
assert final (-1 >>> 1 === -1);
5+
assert final (1 >>> 1 === 0);
6+
assert final (-2 >>> 1 === -1);
7+
8+
endmodule

0 commit comments

Comments
 (0)