Recognise built-in types (e.g. $_DFF_*)
authorEddie Hung <eddie@fpgeh.com>
Sat, 31 Aug 2019 03:15:09 +0000 (20:15 -0700)
committerEddie Hung <eddie@fpgeh.com>
Mon, 2 Sep 2019 19:13:25 +0000 (12:13 -0700)
backends/aiger/xaiger.cc

index 77d0e94c20366de6b6684421dd2911f5d6b8217b..e1b84236d13654b14caca45d8d6978dbb7fe6365 100644 (file)
@@ -261,11 +261,12 @@ struct XAigerWriter
                                }
                        }
                        else {
-                               bool cell_known = cell->known();
+                               bool cell_known = inst_module || cell->known();
                                for (const auto &c : cell->connections()) {
                                        if (c.second.is_fully_const()) continue;
-                                       auto is_input = !cell_known || cell->input(c.first);
-                                       auto is_output = !cell_known || cell->output(c.first);
+                                       auto port_wire = inst_module ? inst_module->wire(c.first) : nullptr;
+                                       auto is_input = (port_wire && port_wire->port_input) || !cell_known || cell->input(c.first);
+                                       auto is_output = (port_wire && port_wire->port_output) || !cell_known || cell->output(c.first);
                                        if (!is_input && !is_output)
                                                log_error("Connection '%s' on cell '%s' (type '%s') not recognised!\n", log_id(c.first), log_id(cell), log_id(cell->type));