@@ -1824,13 +1824,11 @@ VerilogReader::makeModuleInstNetwork(VerilogModuleInst *mod_inst,
18241824 }
18251825 }
18261826
1827- if (lib_cell) {
1828- // Make all pins so timing arcs are built.
1829- LibertyCellPortBitIterator port_iter (lib_cell);
1830- while (port_iter.hasNext ()) {
1831- LibertyPort *port = port_iter.next ();
1832- network_->makePin (inst, reinterpret_cast <Port*>(port), nullptr );
1833- }
1827+ // Make all pins so timing arcs are built and get_pins finds them.
1828+ ConcreteCellPortBitIterator port_iter (reinterpret_cast <const ConcreteCell*>(cell));
1829+ while (port_iter.hasNext ()) {
1830+ Port *port = reinterpret_cast <Port*>(port_iter.next ());
1831+ network_->makePin (inst, port, nullptr );
18341832 }
18351833 bool is_leaf = network_->isLeaf (cell);
18361834 VerilogBindingTbl bindings (zero_net_name_, one_net_name_);
@@ -1983,12 +1981,16 @@ VerilogReader::makeInstPin(Instance *inst,
19831981 network_->connect (inst, port, net);
19841982 }
19851983 else {
1986- Pin *pin = network_->makePin (inst, port, net);
1987- if (!is_leaf && net) {
1988- const char *port_name = network_->name (port);
1989- Net *child_net = bindings->ensureNetBinding (port_name, inst, network_);
1990- network_->makeTerm (pin, child_net);
1991- }
1984+ // Ensure pin exists (may have been pre-created), then connect to parent
1985+ // net if present. Always create a term for the child-side net.
1986+ Pin *pin = network_->findPin (inst, port);
1987+ if (pin == nullptr )
1988+ pin = network_->makePin (inst, port, net);
1989+ else if (net)
1990+ pin = network_->connect (inst, port, net);
1991+ const char *port_name = network_->name (port);
1992+ Net *child_net = bindings->ensureNetBinding (port_name, inst, network_);
1993+ network_->makeTerm (pin, child_net);
19921994 }
19931995}
19941996
0 commit comments