Do not collect disabled $memwr cells
authorClifford Wolf <clifford@clifford.at>
Mon, 6 Jul 2015 11:28:00 +0000 (13:28 +0200)
committerClifford Wolf <clifford@clifford.at>
Mon, 6 Jul 2015 11:28:00 +0000 (13:28 +0200)
passes/memory/memory_collect.cc

index 6bc4b44caf3362a821a9a3b5f3c20a7ac9bbb672..134b5e8e122823a957f793e7c8c01be9d833e51a 100644 (file)
@@ -110,21 +110,24 @@ void handle_memory(RTLIL::Module *module, RTLIL::Memory *memory)
                        SigSpec data = sigmap(cell->getPort("\\DATA"));
                        SigSpec en = sigmap(cell->getPort("\\EN"));
 
-                       clk.extend_u0(1, false);
-                       clk_enable.extend_u0(1, false);
-                       clk_polarity.extend_u0(1, false);
-                       addr.extend_u0(addr_bits, false);
-                       data.extend_u0(memory->width, false);
-                       en.extend_u0(memory->width, false);
-
-                       sig_wr_clk.append(clk);
-                       sig_wr_clk_enable.append(clk_enable);
-                       sig_wr_clk_polarity.append(clk_polarity);
-                       sig_wr_addr.append(addr);
-                       sig_wr_data.append(data);
-                       sig_wr_en.append(en);
-
-                       wr_ports++;
+                       if (!en.is_fully_zero())
+                       {
+                               clk.extend_u0(1, false);
+                               clk_enable.extend_u0(1, false);
+                               clk_polarity.extend_u0(1, false);
+                               addr.extend_u0(addr_bits, false);
+                               data.extend_u0(memory->width, false);
+                               en.extend_u0(memory->width, false);
+
+                               sig_wr_clk.append(clk);
+                               sig_wr_clk_enable.append(clk_enable);
+                               sig_wr_clk_polarity.append(clk_polarity);
+                               sig_wr_addr.append(addr);
+                               sig_wr_data.append(data);
+                               sig_wr_en.append(en);
+
+                               wr_ports++;
+                       }
                        continue;
                }