Fix a regression from #3035.
authorMarcelina Kościelnicka <mwk@0x04.net>
Fri, 8 Oct 2021 12:51:57 +0000 (14:51 +0200)
committerMarcelina Kościelnicka <mwk@0x04.net>
Fri, 8 Oct 2021 13:44:07 +0000 (15:44 +0200)
kernel/ffmerge.cc
tests/memories/trans_addr_enable.v [new file with mode: 0644]

index 4ca5bcbb4bbb71cf2a43bf63eb1bb7c1c2826f83..c65108413918755627ff0ccdf67e095ce2b1ff31 100644 (file)
@@ -157,7 +157,7 @@ bool FfMergeHelper::find_output_ff(RTLIL::SigSpec sig, FfData &ff, pool<std::pai
 }
 
 bool FfMergeHelper::find_input_ff(RTLIL::SigSpec sig, FfData &ff, pool<std::pair<Cell *, int>> &bits) {
-       ff = FfData();
+       ff = FfData(module, initvals, NEW_ID);
        sigmap->apply(sig);
 
        bool found = false;
diff --git a/tests/memories/trans_addr_enable.v b/tests/memories/trans_addr_enable.v
new file mode 100644 (file)
index 0000000..f366f41
--- /dev/null
@@ -0,0 +1,21 @@
+// expect-wr-ports 1
+// expect-rd-ports 1
+// expect-rd-clk \clk
+
+module top(input clk, we, rae, input [7:0] addr, wd, output [7:0] rd);
+
+reg [7:0] mem[0:255];
+
+reg [7:0] rra;
+
+always @(posedge clk) begin
+       if (we)
+               mem[addr] <= wd;
+
+       if (rae)
+               rra <= addr;
+end
+
+assign rd = mem[rra];
+
+endmodule