Skip to content

Commit 0944ff0

Browse files
committed
Merge remote-tracking branch 'origin/master' into secure-new-slew-fix
2 parents dd520f4 + 3e09946 commit 0944ff0

File tree

13 files changed

+49
-179
lines changed

13 files changed

+49
-179
lines changed

src/cut/src/abc_library_factory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static bool HasNonInputOutputPorts(sta::LibertyCell* cell)
9999
if (port->direction()->isInput()) {
100100
continue;
101101
}
102+
if (port->isPwrGnd()) {
103+
continue;
104+
}
102105

103106
return true;
104107
}

src/dbSta/src/dbNetwork.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ void dbNetwork::makeCell(Library* library, dbMaster* master)
22372237
mterm->getSigType().getString());
22382238
mterm->setSigType(dbSigType::CLOCK);
22392239
}
2240-
} else if (!dir->isPowerGround() && !lib_cell->findPgPort(port_name)) {
2240+
} else if (!dir->isPowerGround() && !lib_cell->findPort(port_name)) {
22412241
logger_->warn(ORD,
22422242
2001,
22432243
"LEF macro {} pin {} missing from liberty cell.",
@@ -2397,7 +2397,7 @@ void dbNetwork::readLibertyAfter(LibertyLibrary* lib)
23972397
cport->setLibertyPort(lport);
23982398
lport->setExtPort(cport->extPort());
23992399
} else if (!cport->direction()->isPowerGround()
2400-
&& !lcell->findPgPort(port_name)) {
2400+
&& !lcell->findPort(port_name)) {
24012401
logger_->warn(ORD,
24022402
2002,
24032403
"Liberty cell {} pin {} missing from LEF macro.",

src/dft/src/replace/ScanReplace.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ sta::LibertyPort* FindEquivalentPortInScanCell(
3737
sta::LibertyCellPortIterator scan_cell_ports_iter(scan_cell);
3838
while (scan_cell_ports_iter.hasNext()) {
3939
sta::LibertyPort* scan_cell_port = scan_cell_ports_iter.next();
40-
40+
if (scan_cell_port->isPwrGnd()) {
41+
continue;
42+
}
4143
bool port_equiv
4244
= non_scan_cell_port->direction() == scan_cell_port->direction();
4345
if (non_scan_cell_port->function() == nullptr
@@ -62,15 +64,18 @@ sta::LibertyPort* FindEquivalentPortInScanCell(
6264
// Checks the power ports between non scan cell and scan cell and checks if they
6365
// are equivalent. Returns the equivalent port found, otherwise nullptr if there
6466
// is none
65-
sta::LibertyPgPort* FindEquivalentPortInScanCell(
66-
const sta::LibertyPgPort* non_scan_cell_port,
67+
sta::LibertyPort* FindEquivalentPgPortInScanCell(
68+
const sta::LibertyPort* non_scan_cell_port,
6769
const sta::LibertyCell* scan_cell)
6870
{
69-
sta::LibertyCellPgPortIterator scan_cell_ports_iter(scan_cell);
71+
sta::LibertyCellPortIterator scan_cell_ports_iter(scan_cell);
7072
while (scan_cell_ports_iter.hasNext()) {
71-
sta::LibertyPgPort* scan_cell_port = scan_cell_ports_iter.next();
73+
sta::LibertyPort* scan_cell_port = scan_cell_ports_iter.next();
74+
if (!scan_cell_port->isPwrGnd()) {
75+
continue;
76+
}
7277
const bool port_equiv
73-
= sta::LibertyPgPort::equiv(non_scan_cell_port, scan_cell_port);
78+
= sta::LibertyPort::equiv(non_scan_cell_port, scan_cell_port);
7479
if (port_equiv) {
7580
return scan_cell_port;
7681
}
@@ -91,6 +96,9 @@ bool IsScanEquivalent(
9196
sta::LibertyCellPortIterator non_scan_cell_ports_iter(non_scan_cell);
9297
while (non_scan_cell_ports_iter.hasNext()) {
9398
sta::LibertyPort* non_scan_cell_port = non_scan_cell_ports_iter.next();
99+
if (non_scan_cell_port->isPwrGnd()) {
100+
continue;
101+
}
94102
sta::LibertyPort* scan_equiv_port
95103
= FindEquivalentPortInScanCell(non_scan_cell_port, scan_cell);
96104
if (!scan_equiv_port) {
@@ -101,12 +109,15 @@ bool IsScanEquivalent(
101109
seen_on_scan_cell.insert(scan_equiv_port);
102110
}
103111

104-
sta::LibertyCellPgPortIterator non_scan_cell_pg_ports_iter(non_scan_cell);
112+
sta::LibertyCellPortIterator non_scan_cell_pg_ports_iter(non_scan_cell);
105113
while (non_scan_cell_pg_ports_iter.hasNext()) {
106-
sta::LibertyPgPort* non_scan_cell_pg_port
114+
sta::LibertyPort* non_scan_cell_pg_port
107115
= non_scan_cell_pg_ports_iter.next();
108-
sta::LibertyPgPort* scan_equiv_port
109-
= FindEquivalentPortInScanCell(non_scan_cell_pg_port, scan_cell);
116+
if (!non_scan_cell_pg_port->isPwrGnd()) {
117+
continue;
118+
}
119+
sta::LibertyPort* scan_equiv_port
120+
= FindEquivalentPgPortInScanCell(non_scan_cell_pg_port, scan_cell);
110121
if (!scan_equiv_port) {
111122
return false;
112123
}
@@ -121,6 +132,9 @@ bool IsScanEquivalent(
121132
sta::LibertyCellPortIterator scan_cell_ports_iter(scan_cell);
122133
while (scan_cell_ports_iter.hasNext()) {
123134
sta::LibertyPort* scan_cell_port = scan_cell_ports_iter.next();
135+
if (scan_cell_port->isPwrGnd()) {
136+
continue;
137+
}
124138
if (seen_on_scan_cell.find(scan_cell_port) != seen_on_scan_cell.end()) {
125139
continue;
126140
}

src/gpl/src/mbff.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ MBFF::DataToOutputsMap MBFF::GetPinMapping(dbInst* tray)
753753
if (port->isBus() || port->isBundle()) {
754754
continue;
755755
}
756-
if (port->isClock()) {
756+
if (port->isPwrGnd() || port->isClock()) {
757757
continue;
758758
}
759759
if (port->direction()->isInput()) {

src/gui/src/mainWindow.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,6 @@ void MainWindow::init(sta::dbSta* sta, const std::string& help_path)
634634
new LibertyLibraryDescriptor(sta));
635635
gui->registerDescriptor<sta::LibertyCell*>(new LibertyCellDescriptor(sta));
636636
gui->registerDescriptor<sta::LibertyPort*>(new LibertyPortDescriptor(sta));
637-
gui->registerDescriptor<sta::LibertyPgPort*>(
638-
new LibertyPgPortDescriptor(sta));
639637
gui->registerDescriptor<sta::Instance*>(new StaInstanceDescriptor(sta));
640638
gui->registerDescriptor<sta::Clock*>(new ClockDescriptor(sta));
641639

src/gui/src/staDescriptors.cpp

Lines changed: 10 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
670547
CornerDescriptor::CornerDescriptor(sta::dbSta* sta) : sta_(sta)
671548
{
672549
}

src/gui/src/staDescriptors.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,6 @@ class LibertyPortDescriptor : public Descriptor
9090
sta::dbSta* sta_;
9191
};
9292

93-
class LibertyPgPortDescriptor : public Descriptor
94-
{
95-
public:
96-
LibertyPgPortDescriptor(sta::dbSta* sta);
97-
98-
std::string getName(const std::any& object) const override;
99-
std::string getTypeName() const override;
100-
bool getBBox(const std::any& object, odb::Rect& bbox) const override;
101-
102-
void highlight(const std::any& object, Painter& painter) const override;
103-
104-
Properties getProperties(const std::any& object) const override;
105-
Selected makeSelected(const std::any& object) const override;
106-
bool lessThan(const std::any& l, const std::any& r) const override;
107-
108-
void visitAllObjects(
109-
const std::function<void(const Selected&)>& func) const override;
110-
111-
private:
112-
odb::dbMTerm* getMTerm(const std::any& object) const;
113-
114-
sta::dbSta* sta_;
115-
};
116-
11793
class CornerDescriptor : public Descriptor
11894
{
11995
public:

src/rsz/src/BaseMove.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ vector<const LibertyPort*> BaseMove::getOutputPorts(const LibertyCell* cell)
864864
sta::LibertyCellPortIterator port_iter(cell);
865865
while (port_iter.hasNext()) {
866866
const LibertyPort* port = port_iter.next();
867-
if (port->direction()->isOutput()) {
867+
if (!port->isPwrGnd() && port->direction()->isOutput()) {
868868
fanouts.push_back(port);
869869
}
870870
}

src/rsz/src/RepairDesign.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ bool RepairDesign::getLargestSizeCin(const Pin* drvr_pin, float& cin)
589589
int nports = 0;
590590
while (port_iter.hasNext()) {
591591
const LibertyPort* port = port_iter.next();
592-
if (port->direction() == PortDirection::input()) {
592+
if (!port->isPwrGnd() && port->direction() == PortDirection::input()) {
593593
size_cin += port->capacitance();
594594
nports++;
595595
}
@@ -618,7 +618,7 @@ bool RepairDesign::getCin(const Pin* drvr_pin, float& cin)
618618
int nports = 0;
619619
while (port_iter.hasNext()) {
620620
const LibertyPort* port = port_iter.next();
621-
if (port->direction() == PortDirection::input()) {
621+
if (!port->isPwrGnd() && port->direction() == PortDirection::input()) {
622622
cin += port->capacitance();
623623
nports++;
624624
}

src/rsz/src/Resizer.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,9 @@ std::vector<sta::LibertyPort*> Resizer::libraryPins(LibertyCell* cell) const
15381538
sta::LibertyCellPortIterator itr(cell);
15391539
while (itr.hasNext()) {
15401540
auto port = itr.next();
1541-
pins.emplace_back(port);
1541+
if (!port->isPwrGnd()) {
1542+
pins.emplace_back(port);
1543+
}
15421544
}
15431545
return pins;
15441546
}

0 commit comments

Comments
 (0)