Add testcase
authorEddie Hung <eddie@fpgeh.com>
Fri, 13 Dec 2019 18:26:30 +0000 (10:26 -0800)
committerEddie Hung <eddie@fpgeh.com>
Fri, 13 Dec 2019 18:26:30 +0000 (10:26 -0800)
tests/opt/opt_merge_init.ys [new file with mode: 0644]

diff --git a/tests/opt/opt_merge_init.ys b/tests/opt/opt_merge_init.ys
new file mode 100644 (file)
index 0000000..a29c29d
--- /dev/null
@@ -0,0 +1,49 @@
+read_verilog -icells <<EOT
+module top(input clk, i, (* init = 1'b0 *) output o, p);
+  \$dff  #(
+    .CLK_POLARITY(1'h1),
+    .WIDTH(32'd1)
+  ) ffo  (
+    .CLK(clk),
+    .D(i),
+    .Q(o)
+  );
+  \$dff  #(
+    .CLK_POLARITY(1'h1),
+    .WIDTH(32'd1)
+  ) ffp  (
+    .CLK(clk),
+    .D(i),
+    .Q(p)
+  );
+endmodule
+EOT
+
+opt_merge
+select -assert-count 1 a:init=1'0
+
+
+design -reset
+read_verilog -icells <<EOT
+module top(input clk, i, (* init = 2'b11 *) output [1:0] o);
+  \$dff  #(
+    .CLK_POLARITY(1'h1),
+    .WIDTH(32'd1)
+  ) ff1  (
+    .CLK(clk),
+    .D(i),
+    .Q(o[1])
+  );
+  \$dff  #(
+    .CLK_POLARITY(1'h1),
+    .WIDTH(32'd1)
+  ) ff0  (
+    .CLK(clk),
+    .D(i),
+    .Q(o[0])
+  );
+endmodule
+EOT
+
+opt_merge
+select -assert-count 1 a:init=2'bx1