diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-07-27 12:37:16 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-07-27 12:37:16 +0200 |
commit | 877ff1f75ecca4a1d9eece8243f1cde658c14c40 (patch) | |
tree | d4f82cdceda0eefa6ee790da004fc8aa7144b1cf /tests/sva | |
parent | 2336d5508b29b607044f86676db98584b2b04f71 (diff) | |
download | yosys-877ff1f75ecca4a1d9eece8243f1cde658c14c40.tar.gz yosys-877ff1f75ecca4a1d9eece8243f1cde658c14c40.tar.bz2 yosys-877ff1f75ecca4a1d9eece8243f1cde658c14c40.zip |
Add counter.sv SVA test
Diffstat (limited to 'tests/sva')
-rw-r--r-- | tests/sva/counter.sv | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/sva/counter.sv b/tests/sva/counter.sv new file mode 100644 index 000000000..5e4b77e69 --- /dev/null +++ b/tests/sva/counter.sv @@ -0,0 +1,29 @@ +module top (input clk, reset, up, down, output reg [7:0] cnt); + always @(posedge clk) begin + if (reset) + cnt <= 0; + else if (up) + cnt <= cnt + 1; + else if (down) + cnt <= cnt - 1; + end + + default clocking @(posedge clk); endclocking + default disable iff (reset); + + assert property (up |=> cnt == $past(cnt) + 8'd1); + // assert property (up [*2] |=> cnt == $past(cnt, 2) + 8'd2); + // assert property (up ##1 up |=> cnt == $past(cnt, 2) + 8'd2); + +`ifndef FAIL + assume property (down |-> !up); +`endif + assert property (down |=> cnt == $past(cnt) - 8'd1); + + property down_n(n); + down [*n] |=> cnt == $past(cnt, n) + n; + endproperty + + // assert property (down_n(3)); + // assert property (down_n(5)); +endmodule |