mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
verilog: fix $past's signedness
This commit is contained in:
parent
63c9c9be5c
commit
b75fa62e9b
4 changed files with 40 additions and 1 deletions
35
tests/verilog/past_signedness.ys
Normal file
35
tests/verilog/past_signedness.ys
Normal file
|
@ -0,0 +1,35 @@
|
|||
logger -expect-no-warnings
|
||||
|
||||
read_verilog -formal <<EOT
|
||||
module top(input clk);
|
||||
reg signed [3:0] value = -1;
|
||||
reg ready = 0;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (ready)
|
||||
assert ($past(value) == -1);
|
||||
ready <= 1;
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
|
||||
prep -top top
|
||||
sim -n 3 -clock clk
|
||||
|
||||
design -reset
|
||||
|
||||
read_verilog -formal <<EOT
|
||||
module top(input clk);
|
||||
reg signed [3:0] value = -1;
|
||||
reg ready = 0;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (ready)
|
||||
assert ($past(value + 4'b0000) == 15);
|
||||
ready <= 1;
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
|
||||
prep -top top
|
||||
sim -n 3 -clock clk
|
Loading…
Add table
Add a link
Reference in a new issue