aboutsummaryrefslogtreecommitdiffstats
path: root/tests/sva/sva_value_change_rose.sv
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2022-05-09 15:04:01 +0200
committerJannis Harder <me@jix.one>2022-05-09 15:04:01 +0200
commita855d62b420446756a8a36f5fd25a5c77ff07e16 (patch)
tree83e61e98317217b5d0563eb6cdf638b2cac79ef4 /tests/sva/sva_value_change_rose.sv
parent58b23954e89a75e726d98716d5029f148c804073 (diff)
downloadyosys-a855d62b420446756a8a36f5fd25a5c77ff07e16.tar.gz
yosys-a855d62b420446756a8a36f5fd25a5c77ff07e16.tar.bz2
yosys-a855d62b420446756a8a36f5fd25a5c77ff07e16.zip
verific: Improve logic generated for SVA value change expressions
The previously generated logic assumed an unconstrained past value in the initial state and did not handle 'x values. While the current formal verification flow uses 2-valued logic, SVA value change expressions require a past value of 'x during the initial state to behave in the expected way (i.e. to consider both an initial 0 and an initial 1 as $changed and an initial 1 as $rose and an initial 0 as $fell). This patch now generates logic that at the same time a) provides the expected behavior in a 2-valued logic setting, not depending on any dont-care optimizations, and b) properly handles 'x values in yosys simulation
Diffstat (limited to 'tests/sva/sva_value_change_rose.sv')
-rw-r--r--tests/sva/sva_value_change_rose.sv20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/sva/sva_value_change_rose.sv b/tests/sva/sva_value_change_rose.sv
new file mode 100644
index 000000000..d1c5290f1
--- /dev/null
+++ b/tests/sva/sva_value_change_rose.sv
@@ -0,0 +1,20 @@
+module top (
+ input clk,
+ input a, b
+);
+ default clocking @(posedge clk); endclocking
+
+ wire a_copy;
+ assign a_copy = a;
+
+ assert property (
+ $rose(a) |-> b
+ );
+
+`ifndef FAIL
+ assume property (
+ $rose(a_copy) |-> b
+ );
+`endif
+
+endmodule