-
Notifications
You must be signed in to change notification settings - Fork 537
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 #1164 from larsclausen/fix-undefined-delay
Fix vector assignment with undefined delay
- Loading branch information
Showing
4 changed files
with
61 additions
and
2 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,54 @@ | ||
module test; | ||
// Test that intra-assignment delay values of 'z and 'x get treated as a zero | ||
// delay. Check this for different types of assignments. The assignment should | ||
// not be skipped. | ||
|
||
reg failed = 1'b0; | ||
|
||
`define check(expr, val) \ | ||
if (expr !== val) begin \ | ||
$display("FAILED(%0d): `%s`, expected %0x, got %0x", `__LINE__, `"expr`", val, expr); \ | ||
failed = 1'b1; \ | ||
end | ||
|
||
|
||
integer delay_x = 32'hx; | ||
wire [31:0] delay_z; | ||
|
||
reg [31:0] x; | ||
reg [31:0] a[0:1]; | ||
integer i = 0, j = 0; | ||
|
||
`define test(var) \ | ||
// Non-blocking \ | ||
var = 0; \ | ||
var <= #delay_x 1; \ | ||
#1 `check(var, 1) \ | ||
var = 0; \ | ||
var <= #delay_z 1; \ | ||
#1 `check(var, 1) \ | ||
// blocking \ | ||
var = 0; \ | ||
var = #delay_x 1; \ | ||
`check(var, 1) \ | ||
var = 0; \ | ||
var = #delay_z 1; \ | ||
`check(var, 1) | ||
|
||
initial begin | ||
`test(x) | ||
`test(x[0]) | ||
`test(x[i]) | ||
`test(a[0]) | ||
`test(a[0][0]) | ||
`test(a[0][j]) | ||
`test(a[i]) | ||
`test(a[i][0]) | ||
`test(a[i][j]) | ||
|
||
if (!failed) begin | ||
$display("PASSED"); | ||
end | ||
end | ||
|
||
endmodule |
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
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,4 @@ | ||
{ | ||
"type" : "normal", | ||
"source" : "vardly_undefined_vec.v" | ||
} |
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