Fix opt_rmdff handling of $_DFFSR_???_ and $_DLATCHSR_???_, fixes #816
authorClifford Wolf <clifford@clifford.at>
Thu, 21 Feb 2019 12:48:23 +0000 (13:48 +0100)
committerClifford Wolf <clifford@clifford.at>
Thu, 21 Feb 2019 12:49:45 +0000 (13:49 +0100)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
passes/opt/opt_rmdff.cc

index 5880254c1446639b36588e623db7d41fa6b8deba..e8570f0ebe75869cf49e827558ef028060361a12 100644 (file)
@@ -174,8 +174,6 @@ bool handle_dffsr(RTLIL::Module *mod, RTLIL::Cell *cell)
                        cell->unsetParam("\\CLR_POLARITY");
                        cell->unsetPort("\\SET");
                        cell->unsetPort("\\CLR");
-
-                       return true;
                }
                else
                {
@@ -186,11 +184,12 @@ bool handle_dffsr(RTLIL::Module *mod, RTLIL::Cell *cell)
                        cell->unsetParam("\\CLR_POLARITY");
                        cell->unsetPort("\\SET");
                        cell->unsetPort("\\CLR");
-
-                       return true;
                }
+
+               return true;
        }
-       else
+
+       if (!hasreset)
        {
                IdString new_type;
 
@@ -207,8 +206,10 @@ bool handle_dffsr(RTLIL::Module *mod, RTLIL::Cell *cell)
                cell->unsetPort("\\S");
                cell->unsetPort("\\R");
 
-               return did_something;
+               return true;
        }
+
+       return did_something;
 }
 
 bool handle_dlatch(RTLIL::Module *mod, RTLIL::Cell *dlatch)