-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from diffblue/structs4
SystemVerilog: test for cast from packed struct to vector
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
structs4.sv | ||
--bound 0 | ||
^\[main\.p0\] always main\.w == 'h173: PROVED up to bound 0$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module main; | ||
|
||
// The first field is the most-significant bit. | ||
struct packed { | ||
bit field1, field2; | ||
bit [6:0] field3; | ||
} s; | ||
|
||
initial begin | ||
s.field1 = 1; | ||
s.field2 = 0; | ||
s.field3 = 'b1110011; | ||
end | ||
|
||
// structs can be converted without cast to bit-vectors | ||
wire [8:0] w = s; | ||
|
||
// Expected to pass. | ||
p0: assert property (w == 'b1_0_1110011); | ||
|
||
endmodule |