fsm_extract: Initialize celltypes with full design.
authorMarcin Kościelnicki <mwk@0x04.net>
Wed, 18 Mar 2020 19:58:36 +0000 (20:58 +0100)
committerMarcelina Kościelnicka <mwk@0x04.net>
Thu, 19 Mar 2020 17:51:21 +0000 (18:51 +0100)
Fixes #1781.

passes/fsm/fsm_extract.cc
tests/various/bug1781.ys [new file with mode: 0644]

index a85c3bec0661556918d5ad84e35979acf5b78a38..0f7b4d106e242c023b1be23a8442afade9756a7c 100644 (file)
@@ -422,11 +422,7 @@ struct FsmExtractPass : public Pass {
                log_header(design, "Executing FSM_EXTRACT pass (extracting FSM from design).\n");
                extra_args(args, 1, design);
 
-               CellTypes ct;
-               ct.setup_internals();
-               ct.setup_internals_mem();
-               ct.setup_stdcells();
-               ct.setup_stdcells_mem();
+               CellTypes ct(design);
 
                for (auto &mod_it : design->modules_)
                {
diff --git a/tests/various/bug1781.ys b/tests/various/bug1781.ys
new file mode 100644 (file)
index 0000000..60dcc08
--- /dev/null
@@ -0,0 +1,33 @@
+read_verilog <<EOT
+
+module top(input clk, input rst);
+
+reg [1:0] state;
+
+always @(posedge clk, posedge rst) begin
+       if (rst)
+               state <= 0;
+       else
+               case (state)
+                       2'b00: state <= 2'b01;
+                       2'b01: state <= 2'b10;
+                       2'b10: state <= 2'b00;
+               endcase
+end
+
+sub sub_i(.i(state == 0));
+
+endmodule
+
+
+(* blackbox, keep *)
+module sub(input i);
+endmodule
+
+EOT
+
+proc
+fsm
+
+# Make sure there is a driver
+select -assert-any t:sub %ci %a w:* %i %ci c:* %i