More cleanup
authorEddie Hung <eddie@fpgeh.com>
Wed, 28 Aug 2019 17:11:09 +0000 (10:11 -0700)
committerEddie Hung <eddie@fpgeh.com>
Wed, 28 Aug 2019 17:11:09 +0000 (10:11 -0700)
passes/pmgen/xilinx_srl.cc

index b3bab6021ec4fc775539b51e98567ab88291f8c2..f665820254a2ff5263b214954b37cde6d77fe159 100644 (file)
@@ -36,8 +36,6 @@ void run_fixed(xilinx_srl_pm &pm)
        auto &ud = pm.ud_fixed;
        log("Found fixed chain of length %d (%s):\n", GetSize(ud.longest_chain), log_id(st.first->type));
 
-       auto first_cell = ud.longest_chain.back();
-
        SigSpec initval;
        for (auto cell : ud.longest_chain) {
                log_debug("    %s\n", log_id(cell));
@@ -61,10 +59,10 @@ void run_fixed(xilinx_srl_pm &pm)
                }
                else
                        log_abort();
-               if (cell != first_cell)
-                       pm.autoremove(cell);
+               pm.autoremove(cell);
        }
 
+       auto first_cell = ud.longest_chain.back();
        auto last_cell = ud.longest_chain.front();
        Cell *c = pm.module->addCell(NEW_ID, ID($__XILINX_SHREG_));
        pm.module->swap_names(c, first_cell);
@@ -117,9 +115,6 @@ void run_variable(xilinx_srl_pm &pm)
 
        log("Found variable chain of length %d (%s):\n", GetSize(ud.chain), log_id(st.first->type));
 
-       auto first_cell = ud.chain.back().first;
-       auto first_slice = ud.chain.back().second;
-
        SigSpec initval;
        for (const auto &i : ud.chain) {
                auto cell = i.first;
@@ -139,11 +134,13 @@ void run_variable(xilinx_srl_pm &pm)
                }
                else
                        log_abort();
-               if (cell != first_cell)
-                       cell->connections_.at(ID(Q))[slice] = pm.module->addWire(NEW_ID);
+               cell->connections_.at(ID(Q))[slice] = pm.module->addWire(NEW_ID);
        }
        pm.autoremove(st.shiftx);
 
+       auto first_cell = ud.chain.back().first;
+       auto first_slice = ud.chain.back().second;
+
        Cell *c = pm.module->addCell(NEW_ID, ID($__XILINX_SHREG_));
        pm.module->swap_names(c, first_cell);