@@ -301,9 +301,14 @@ Descriptor::Properties LibertyCellDescriptor::getProperties(
301301
302302 std::array<SelectionSet, 8 > ports;
303303 sta::LibertyCellPortIterator port_iter (cell);
304+ SelectionSet pg_ports;
304305 while (port_iter.hasNext ()) {
305306 auto port = port_iter.next ();
306- ports[port->direction ()->index ()].insert (gui->makeSelected (port));
307+ if (port->isPwrGnd ()) {
308+ pg_ports.insert (gui->makeSelected (port));
309+ } else {
310+ ports[port->direction ()->index ()].insert (gui->makeSelected (port));
311+ }
307312 }
308313 for (auto dir : {sta::PortDirection::input (),
309314 sta::PortDirection::output (),
@@ -321,11 +326,6 @@ Descriptor::Properties LibertyCellDescriptor::getProperties(
321326 }
322327 }
323328
324- SelectionSet pg_ports;
325- sta::LibertyCellPgPortIterator pg_port_iter (cell);
326- while (pg_port_iter.hasNext ()) {
327- pg_ports.insert (gui->makeSelected (pg_port_iter.next ()));
328- }
329329 props.push_back ({" PG Ports" , pg_ports});
330330
331331 SelectionSet insts;
@@ -476,9 +476,12 @@ Descriptor::Properties LibertyPortDescriptor::getProperties(
476476 std::any ground_pin;
477477 const char * power_pin_name = port->relatedPowerPin ();
478478 const char * ground_pin_name = port->relatedGroundPin ();
479- sta::LibertyCellPgPortIterator pg_port_iter (port->libertyCell ());
479+ sta::LibertyCellPortIterator pg_port_iter (port->libertyCell ());
480480 while (pg_port_iter.hasNext ()) {
481481 auto * pg_port = pg_port_iter.next ();
482+ if (!pg_port->isPwrGnd ()) {
483+ continue ;
484+ }
482485 if (power_pin_name != nullptr
483486 && strcmp (pg_port->name (), power_pin_name) == 0 ) {
484487 power_pin = gui->makeSelected (pg_port);
@@ -541,132 +544,6 @@ void LibertyPortDescriptor::visitAllObjects(
541544
542545// ////////////////////////////////////////////////
543546
544- static const char * typeNameStr (sta::LibertyPgPort::PgType type)
545- {
546- switch (type) {
547- case sta::LibertyPgPort::unknown:
548- return " unknown" ;
549- case sta::LibertyPgPort::primary_power:
550- return " primary_power" ;
551- case sta::LibertyPgPort::primary_ground:
552- return " primary_ground" ;
553- case sta::LibertyPgPort::backup_power:
554- return " backup_power" ;
555- case sta::LibertyPgPort::backup_ground:
556- return " backup_ground" ;
557- case sta::LibertyPgPort::internal_power:
558- return " internal_power" ;
559- case sta::LibertyPgPort::internal_ground:
560- return " internal_ground" ;
561- case sta::LibertyPgPort::nwell:
562- return " nwell" ;
563- case sta::LibertyPgPort::pwell:
564- return " pwell" ;
565- case sta::LibertyPgPort::deepnwell:
566- return " deepnwell" ;
567- case sta::LibertyPgPort::deeppwell:
568- return " deeppwell" ;
569- }
570- return " <unexpected>" ;
571- }
572-
573- LibertyPgPortDescriptor::LibertyPgPortDescriptor (sta::dbSta* sta) : sta_(sta)
574- {
575- }
576-
577- std::string LibertyPgPortDescriptor::getName (const std::any& object) const
578- {
579- return std::any_cast<sta::LibertyPgPort*>(object)->name ();
580- }
581-
582- std::string LibertyPgPortDescriptor::getTypeName () const
583- {
584- return " Liberty PG port" ;
585- }
586-
587- bool LibertyPgPortDescriptor::getBBox (const std::any& object,
588- odb::Rect& bbox) const
589- {
590- return false ;
591- }
592-
593- void LibertyPgPortDescriptor::highlight (const std::any& object,
594- Painter& painter) const
595- {
596- odb::dbMTerm* mterm = getMTerm (object);
597-
598- if (mterm != nullptr ) {
599- auto * mterm_desc = Gui::get ()->getDescriptor <odb::dbMTerm*>();
600- mterm_desc->highlight (mterm, painter);
601- }
602- }
603-
604- Descriptor::Properties LibertyPgPortDescriptor::getProperties (
605- const std::any& object) const
606- {
607- auto port = std::any_cast<sta::LibertyPgPort*>(object);
608-
609- auto gui = Gui::get ();
610-
611- Properties props;
612- props.push_back ({" Cell" , gui->makeSelected (port->cell ())});
613- props.push_back ({" Type" , typeNameStr (port->pgType ())});
614- props.push_back ({" Voltage name" , port->voltageName ()});
615-
616- odb::dbMTerm* mterm = getMTerm (object);
617- if (mterm != nullptr ) {
618- props.push_back ({" Terminal" , gui->makeSelected (mterm)});
619- }
620-
621- return props;
622- }
623-
624- Selected LibertyPgPortDescriptor::makeSelected (const std::any& object) const
625- {
626- if (auto port = std::any_cast<sta::LibertyPgPort*>(&object)) {
627- return Selected (*port, this );
628- }
629- return Selected ();
630- }
631-
632- bool LibertyPgPortDescriptor::lessThan (const std::any& l,
633- const std::any& r) const
634- {
635- auto l_port = std::any_cast<sta::LibertyPgPort*>(l);
636- auto r_port = std::any_cast<sta::LibertyPgPort*>(r);
637- return strcmp (l_port->name (), r_port->name ()) < 0 ;
638- }
639-
640- void LibertyPgPortDescriptor::visitAllObjects (
641- const std::function<void (const Selected&)>& func) const
642- {
643- sta::dbNetwork* network = sta_->getDbNetwork ();
644- std::unique_ptr<sta::LibertyLibraryIterator> lib_iter{
645- network->libertyLibraryIterator ()};
646-
647- while (lib_iter->hasNext ()) {
648- sta::LibertyLibrary* library = lib_iter->next ();
649- sta::LibertyCellIterator cell_iter (library);
650- while (cell_iter.hasNext ()) {
651- sta::LibertyCell* cell = cell_iter.next ();
652- sta::LibertyCellPgPortIterator port_iter (cell);
653- while (port_iter.hasNext ()) {
654- sta::LibertyPgPort* port = port_iter.next ();
655- func ({port, this });
656- }
657- }
658- }
659- }
660-
661- odb::dbMTerm* LibertyPgPortDescriptor::getMTerm (const std::any& object) const
662- {
663- auto port = std::any_cast<sta::LibertyPgPort*>(object);
664- odb::dbMaster* master = sta_->getDbNetwork ()->staToDb (port->cell ());
665- odb::dbMTerm* mterm = master->findMTerm (port->name ());
666-
667- return mterm;
668- }
669-
670547CornerDescriptor::CornerDescriptor (sta::dbSta* sta) : sta_(sta)
671548{
672549}
0 commit comments