Stop topological sort at abc_flop_q
authorEddie Hung <eddie@fpgeh.com>
Wed, 17 Apr 2019 19:28:19 +0000 (12:28 -0700)
committerEddie Hung <eddie@fpgeh.com>
Wed, 17 Apr 2019 19:28:19 +0000 (12:28 -0700)
backends/aiger/xaiger.cc

index ed0fc656f2416c8dfb63bf70f68bee5a4d7ea64b..070d6d4035747cb8154a206dceb6065f9df7936f 100644 (file)
@@ -180,14 +180,20 @@ struct XAigerWriter
                        toposort.node(cell->name);
                        for (const auto &conn : cell->connections())
                        {
-                               // HACK!!!
-                               if (cell->type.in("\\SB_DFF", "\\SB_DFFE", "\\SB_DFFESR", "\\SB_DFFSR", "\\SB_DFFESS") && conn.first.in("\\Q"))
-                                       continue;
+                               if (!cell->type.in("$_NOT_", "$_AND_")) {
+                                       if (yosys_celltypes.cell_known(cell->type)) {
+                                               if (conn.first.in("\\Q", "\\CTRL_OUT", "\\RD_DATA"))
+                                                       continue;
+                                               if (cell->type == "$memrd" && conn.first == "\\DATA")
+                                                       continue;
+                                       }
 
-                               if (yosys_celltypes.cell_known(cell->type)) {
-                                       if (conn.first.in("\\Q", "\\CTRL_OUT", "\\RD_DATA"))
-                                               continue;
-                                       if (cell->type == "$memrd" && conn.first == "\\DATA")
+                                       RTLIL::Module* inst_module = module->design->module(cell->type);
+                                       log_assert(inst_module);
+                                       RTLIL::Wire* inst_module_port = inst_module->wire(conn.first);
+                                       log_assert(inst_module_port);
+
+                                       if (inst_module_port->attributes.count("\\abc_flop_q"))
                                                continue;
                                }