MCPcopy Create free account
hub / github.com/PKU-IDEA/OpenPARF / buildNetlist

Method buildNetlist

openparf/database/placedb.cpp:514–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512}
513
514void PlaceDB::buildNetlist() {
515 auto const &design = db_->design();
516 auto const &layout = db_->layout();
517 auto top_module_inst = design.topModuleInst();
518 openparfAssert(top_module_inst);
519 // assume flat netlist for now
520 auto const &netlist = top_module_inst->netlist();
521
522 // sort instances
523 sortInstsByPlaceStatus();
524
525 // initialize netlist information
526
527 // build inst_pins_ and pin2inst_
528 inst_pins_.reserve(netlist.numInsts(), netlist.numPins());
529 pin2inst_.resize(netlist.numPins());
530 IndexType count = 0;
531 // must traverse in new order
532 for (auto inst_id : new2old_inst_ids_) {
533 auto const &inst = netlist.inst(inst_id);
534 inst_pins_.pushBackIndexBegin(count);
535 for (auto const &pin_id : inst.pinIds()) {
536 inst_pins_.pushBack(pin_id);
537 // must convert to new ids
538 pin2inst_.at(pin_id) = newInstId(inst.id());
539 ++count;
540 }
541 }
542
543 // build net_pins_ and pin2net_
544 net_pins_.reserve(netlist.numNets(), netlist.numPins());
545 pin2net_.resize(netlist.numPins());
546 count = 0;
547 for (auto const &net_id : netlist.netIds()) {
548 auto const &net = netlist.net(net_id);
549 net_pins_.pushBackIndexBegin(count);
550 for (auto const &pin_id : net.pinIds()) {
551 net_pins_.pushBack(pin_id);
552 pin2net_.at(pin_id) = net.id();
553 ++count;
554 }
555 }
556
557 // check if have one-pin net
558 for (auto const &net_id : netlist.netIds()) {
559 auto const &net = netlist.net(net_id);
560 if (net.pinIds().size() == 1) {
561 openparfPrint(kWarn, "Net %s have only one pins.\n", net.attr().name().c_str());
562 }
563 }
564
565 // initialize inst_id and inst name mapping
566 IndexType newId = 0;
567 for (auto inst_id : new2old_inst_ids_) {
568 auto const &inst = netlist.inst(inst_id);
569 auto &n = inst.attr().name();
570 openparfAssert(name_to_inst.find(n) == name_to_inst.end());
571 name_to_inst.insert({n, newId});

Callers

nothing calls this directly

Calls 15

openparfPrintFunction · 0.85
topModuleInstMethod · 0.80
pushBackIndexBeginMethod · 0.80
pushBackMethod · 0.80
reserveMethod · 0.45
numInstsMethod · 0.45
numPinsMethod · 0.45
resizeMethod · 0.45
instMethod · 0.45
atMethod · 0.45
idMethod · 0.45
numNetsMethod · 0.45

Tested by

no test coverage detected