keep footprint string inside its cell

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
This commit is contained in:
Arthur Koucher 2024-09-04 18:17:47 -03:00
parent 253b6bf458
commit c0cf80ef56
4 changed files with 13 additions and 41 deletions

View File

@ -83,8 +83,6 @@ typedef Map<const char *, float, CharPtrLess> SupplyVoltageMap;
typedef Map<const char *, LibertyPgPort*, CharPtrLess> LibertyPgPortMap;
typedef Map<const char *, DriverWaveform*, CharPtrLess> DriverWaveformMap;
typedef Vector<DcalcAnalysisPt*> DcalcAnalysisPtSeq;
typedef int LibertyCellFootprintIndex;
typedef Vector<const char *> LibertyCellFootprintSeq;
enum class ClockGateType { none, latch_posedge, latch_negedge, other };
@ -144,7 +142,6 @@ public:
// Liberty cells that are buffers.
LibertyCellSeq *buffers();
LibertyCellSeq *inverters();
void addFootprint(const char *footprint);
DelayModelType delayModelType() const { return delay_model_type_; }
void setDelayModelType(DelayModelType type);
@ -374,7 +371,6 @@ protected:
SupplyVoltageMap supply_voltage_map_;
LibertyCellSeq *buffers_;
LibertyCellSeq *inverters_;
LibertyCellFootprintSeq footprints_;
DriverWaveformMap driver_waveform_map_;
// Unnamed driver waveform.
DriverWaveform *driver_waveform_default_;
@ -545,8 +541,8 @@ public:
// for all the defined corners.
static void checkLibertyCorners();
void ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps);
void setFootprintIndex(LibertyCellFootprintIndex footprint_index);
const char *footprint() const;
void setFootprint(const char *footprint);
protected:
void addPort(ConcretePort *port);
@ -637,7 +633,7 @@ protected:
bool has_internal_ports_;
bool have_voltage_waveforms_;
std::mutex waveform_lock_;
LibertyCellFootprintIndex footprint_index_;
const char *footprint_;
private:
friend class LibertyLibrary;

View File

@ -128,9 +128,6 @@ LibertyLibrary::~LibertyLibrary()
delete inverters_;
driver_waveform_map_.deleteContents();
delete driver_waveform_default_;
for (auto footprint : footprints_)
stringDelete(footprint);
}
LibertyCell *
@ -184,12 +181,6 @@ LibertyLibrary::buffers()
return buffers_;
}
void
LibertyLibrary::addFootprint(const char *footprint)
{
footprints_.push_back(stringCopy(footprint));
}
void
LibertyLibrary::setDelayModelType(DelayModelType type)
{
@ -950,7 +941,7 @@ LibertyCell::LibertyCell(LibertyLibrary *library,
leakage_power_exists_(false),
has_internal_ports_(false),
have_voltage_waveforms_(false),
footprint_index_(-1)
footprint_(nullptr)
{
liberty_cell_ = this;
}
@ -978,6 +969,8 @@ LibertyCell::~LibertyCell()
ocv_derate_map_.deleteContents();
pg_port_map_.deleteContents();
stringDelete(footprint_);
}
LibertyPort *
@ -2000,18 +1993,18 @@ LibertyCell::ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps)
}
void
LibertyCell::setFootprintIndex(LibertyCellFootprintIndex footprint_index)
LibertyCell::setFootprint(const char *footprint)
{
footprint_index_ = footprint_index;
footprint_ = stringCopy(footprint);
}
const char*
LibertyCell::footprint() const
{
if (footprint_index_ != -1) {
return libertyLibrary()->footprints_[footprint_index_];
}
return "";
if (footprint_)
return footprint_;
else
return "";
}
////////////////////////////////////////////////////////////////

View File

@ -726,9 +726,6 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
if (missing_threshold)
libError(1149, group, "Library %s is missing one or more thresholds.",
library_->name());
for (auto [footprint, footprint_index] : footprint_index_map_)
stringDelete(footprint);
}
void
@ -3074,19 +3071,8 @@ LibertyReader::visitCellFootprint(LibertyAttr *attr)
{
if (cell_) {
const char *footprint = getAttrString(attr);
if (!footprint) {
return;
}
LibertyCellFootprintIndex footprint_index;
auto itr = footprint_index_map_.find(footprint);
if (itr != footprint_index_map_.end()) {
footprint_index = itr->second;
} else {
footprint_index = static_cast<int>(footprint_index_map_.size());
footprint_index_map_[stringCopy(footprint)] = footprint_index;
library()->addFootprint(stringCopy(footprint));
}
cell_->setFootprintIndex(footprint_index);
if (footprint)
cell_->setFootprint(stringCopy(footprint));
}
}

View File

@ -65,8 +65,6 @@ typedef Vector<LeakagePowerGroup*> LeakagePowerGroupSeq;
typedef void (LibertyPort::*LibertyPortBoolSetter)(bool value);
typedef Vector<OutputWaveform*> OutputWaveformSeq;
typedef vector<string> StdStringSeq;
typedef Map<const char*, LibertyCellFootprintIndex,
CharPtrLess> LibertyCellFootprintIndexMap;
class LibertyReader : public LibertyGroupVisitor
{
@ -666,7 +664,6 @@ protected:
float reference_time_;
bool reference_time_exists_;
const char *driver_waveform_name_;
LibertyCellFootprintIndexMap footprint_index_map_;
static constexpr char escape_ = '\\';