test uninited FFs with const clks and fix btor script for this
authorJannis Harder <me@jix.one>
Wed, 29 Jun 2022 16:00:52 +0000 (18:00 +0200)
committerJannis Harder <me@jix.one>
Mon, 4 Jul 2022 12:03:56 +0000 (14:03 +0200)
sbysrc/sby_core.py
tests/regression/const_clocks.sby [new file with mode: 0644]

index 4e57b21bf8186e62cd0c2a556462102280b421c5..5580d09c15998a4a7f47137acfc976f551dd53ae 100644 (file)
@@ -653,7 +653,7 @@ class SbyTask(SbyConfig):
                     print("abc", file=f)
                     print("opt_clean", file=f)
                 else:
-                    print("opt -fast", file=f)
+                    print("opt -fast -keepdc", file=f)
                 print("delete -output", file=f)
                 print("dffunmap", file=f)
                 print("stat", file=f)
diff --git a/tests/regression/const_clocks.sby b/tests/regression/const_clocks.sby
new file mode 100644 (file)
index 0000000..245358b
--- /dev/null
@@ -0,0 +1,43 @@
+[tasks]
+btor
+smt
+btor_m btor multiclock
+smt_m smt multiclock
+
+[options]
+mode bmc
+
+multiclock: multiclock on
+
+[engines]
+#smtbmc
+btor: btor btormc
+smt: smtbmc boolector
+
+[script]
+read_verilog -formal const_clocks.sv
+prep -flatten -top top
+
+[file const_clocks.sv]
+module top(
+    input clk,
+    input [7:0] d
+);
+
+    (* keep *)
+    wire [7:0] some_const = $anyconst;
+
+    wire [7:0] q;
+
+    ff ff1(.clk(1'b0), .d(d), .q(q));
+
+    initial assume (some_const == q);
+    initial assume (q != 0);
+
+
+    always @(posedge clk) assert(some_const == q);
+endmodule
+
+module ff(input clk, input [7:0] d, (* keep *) output reg [7:0] q);
+    always @(posedge clk) q <= d;
+endmodule