diff --git a/include/sta/EquivCells.hh b/include/sta/EquivCells.hh index d695b79b..400e1ec7 100644 --- a/include/sta/EquivCells.hh +++ b/include/sta/EquivCells.hh @@ -73,4 +73,8 @@ bool equivCellSequentials(const LibertyCell *cell1, const LibertyCell *cell2); +bool +equivCellFootprints(const LibertyCell *cell1, + const LibertyCell *cell2); + } // namespace diff --git a/include/sta/Liberty.hh b/include/sta/Liberty.hh index 4763a8d0..dc2de8b5 100644 --- a/include/sta/Liberty.hh +++ b/include/sta/Liberty.hh @@ -541,6 +541,8 @@ public: // for all the defined corners. static void checkLibertyCorners(); void ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps); + const char *footprint() const; + void setFootprint(const char *footprint); protected: void addPort(ConcretePort *port); @@ -631,6 +633,7 @@ protected: bool has_internal_ports_; bool have_voltage_waveforms_; std::mutex waveform_lock_; + const char *footprint_; private: friend class LibertyLibrary; diff --git a/liberty/EquivCells.cc b/liberty/EquivCells.cc index 5e43cb98..113ec673 100644 --- a/liberty/EquivCells.cc +++ b/liberty/EquivCells.cc @@ -325,7 +325,8 @@ equivCells(const LibertyCell *cell1, && equivCellPgPorts(cell1, cell2) && equivCellSequentials(cell1, cell2) && equivCellStatetables(cell1, cell2) - && equivCellTimingArcSets(cell1, cell2); + && equivCellTimingArcSets(cell1, cell2) + && equivCellFootprints(cell1, cell2); } bool @@ -525,4 +526,11 @@ equivCellTimingArcSets(const LibertyCell *cell1, } } +bool +equivCellFootprints(const LibertyCell *cell1, + const LibertyCell *cell2) +{ + return stringEqIf(cell1->footprint(), cell2->footprint()); +} + } // namespace diff --git a/liberty/Liberty.cc b/liberty/Liberty.cc index ac15e702..055aaf27 100644 --- a/liberty/Liberty.cc +++ b/liberty/Liberty.cc @@ -940,7 +940,8 @@ LibertyCell::LibertyCell(LibertyLibrary *library, leakage_power_(0.0), leakage_power_exists_(false), has_internal_ports_(false), - have_voltage_waveforms_(false) + have_voltage_waveforms_(false), + footprint_(nullptr) { liberty_cell_ = this; } @@ -968,6 +969,8 @@ LibertyCell::~LibertyCell() ocv_derate_map_.deleteContents(); pg_port_map_.deleteContents(); + + stringDelete(footprint_); } LibertyPort * @@ -1989,6 +1992,18 @@ LibertyCell::ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps) } } +void +LibertyCell::setFootprint(const char *footprint) +{ + footprint_ = stringCopy(footprint); +} + +const char* +LibertyCell::footprint() const +{ + return footprint_; +} + //////////////////////////////////////////////////////////////// LibertyCellPortIterator::LibertyCellPortIterator(const LibertyCell *cell) : diff --git a/liberty/LibertyReader.cc b/liberty/LibertyReader.cc index b5033005..032a5376 100644 --- a/liberty/LibertyReader.cc +++ b/liberty/LibertyReader.cc @@ -310,6 +310,7 @@ LibertyReader::defineVisitors() defineAttrVisitor("switch_cell_type", &LibertyReader::visitSwitchCellType); defineAttrVisitor("interface_timing", &LibertyReader::visitInterfaceTiming); defineAttrVisitor("scaling_factors", &LibertyReader::visitScalingFactors); + defineAttrVisitor("cell_footprint", &LibertyReader::visitCellFootprint); // Pins defineGroupVisitor("pin", &LibertyReader::beginPin,&LibertyReader::endPin); @@ -3065,6 +3066,16 @@ LibertyReader::visitClockGatingIntegratedCell(LibertyAttr *attr) } } +void +LibertyReader::visitCellFootprint(LibertyAttr *attr) +{ + if (cell_) { + const char *footprint = getAttrString(attr); + if (footprint) + cell_->setFootprint(stringCopy(footprint)); + } +} + //////////////////////////////////////////////////////////////// void diff --git a/liberty/LibertyReaderPvt.hh b/liberty/LibertyReaderPvt.hh index 9a812f3c..23106440 100644 --- a/liberty/LibertyReaderPvt.hh +++ b/liberty/LibertyReaderPvt.hh @@ -205,6 +205,7 @@ public: virtual void visitInterfaceTiming(LibertyAttr *attr); virtual void visitScalingFactors(LibertyAttr *attr); virtual void visitCellLeakagePower(LibertyAttr *attr); + virtual void visitCellFootprint(LibertyAttr *attr); virtual void beginPin(LibertyGroup *group); virtual void endPin(LibertyGroup *group);