Skip to content

Commit 55303bc

Browse files
committed
SystemVerilog: test for cast from packed struct to vector
1 parent 5cca195 commit 55303bc

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
structs4.sv
3+
--bound 0
4+
^\[main\.p0\] always main\.w == 'h173: PROVED up to bound 0$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module main;
2+
3+
// The first field is the most-significant bit.
4+
struct packed {
5+
bit field1, field2;
6+
bit [6:0] field3;
7+
} s;
8+
9+
initial begin
10+
s.field1 = 1;
11+
s.field2 = 0;
12+
s.field3 = 'b1110011;
13+
end
14+
15+
// structs can be converted without cast to bit-vectors
16+
wire [8:0] w = s;
17+
18+
// Expected to pass.
19+
p0: assert property (w == 'b1_0_1110011);
20+
21+
endmodule

0 commit comments

Comments
 (0)