Do not clean up buffer cells with "keep" attribute, closes #1128
authorClifford Wolf <clifford@clifford.at>
Wed, 26 Jun 2019 09:00:44 +0000 (11:00 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 26 Jun 2019 09:01:03 +0000 (11:01 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
passes/opt/opt_clean.cc

index cfb0f788a5f8173c3753ddcc04ae0a0d1dbe6e6e..5f75288e2b00df7277a440dfe55541360c118789 100644 (file)
@@ -480,7 +480,7 @@ void rmunused_module(RTLIL::Module *module, bool purge_mode, bool verbose, bool
 
        std::vector<RTLIL::Cell*> delcells;
        for (auto cell : module->cells())
-               if (cell->type.in("$pos", "$_BUF_")) {
+               if (cell->type.in("$pos", "$_BUF_") && !cell->has_keep_attr()) {
                        bool is_signed = cell->type == "$pos" && cell->getParam("\\A_SIGNED").as_bool();
                        RTLIL::SigSpec a = cell->getPort("\\A");
                        RTLIL::SigSpec y = cell->getPort("\\Y");