write_cxxrtl: ignore disconnected module ports.
authorwhitequark <whitequark@whitequark.org>
Tue, 14 Apr 2020 12:34:35 +0000 (12:34 +0000)
committerwhitequark <whitequark@whitequark.org>
Tue, 14 Apr 2020 12:36:20 +0000 (12:36 +0000)
E.g. port `q` in `submod x(.p(p), .q());`.

Fixes #1920.

backends/cxxrtl/cxxrtl.cc

index 465882858f5f8d553de3d763a5d5b2432fc8cd0d..6038f87b1d080a13fa2a0f2128a46841b4f1d178 100644 (file)
@@ -970,6 +970,8 @@ struct CxxrtlWorker {
                                                continue;
                                }
                                if (cell->output(conn.first)) {
+                                       if (conn.second.empty())
+                                               continue; // ignore disconnected ports
                                        f << indent;
                                        dump_sigspec_lhs(conn.second);
                                        f << " = " << mangle(cell) << "." << mangle_wire_name(conn.first) << ".curr;\n";