Update Property.cc

Add support for more property types
This commit is contained in:
Akash Levy 2024-07-10 15:16:54 -07:00 committed by GitHub
parent 3ba6f0e527
commit 51e7e63fd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 0 deletions

View File

@ -889,6 +889,7 @@ getProperty(const Instance *inst,
Sta *sta) Sta *sta)
{ {
auto network = sta->cmdNetwork(); auto network = sta->cmdNetwork();
LibertyCell *libertyCell = network->libertyCell(inst);
if (stringEqual(property, "name")) if (stringEqual(property, "name"))
return PropertyValue(network->name(inst)); return PropertyValue(network->name(inst));
else if (stringEqual(property, "full_name")) else if (stringEqual(property, "full_name"))
@ -899,6 +900,18 @@ getProperty(const Instance *inst,
return PropertyValue(network->libertyCell(inst)); return PropertyValue(network->libertyCell(inst));
else if (stringEqual(property, "cell")) else if (stringEqual(property, "cell"))
return PropertyValue(network->cell(inst)); return PropertyValue(network->cell(inst));
else if (stringEqual(property, "is_hierarchical"))
return PropertyValue(network->isHierarchical(inst));
else if (stringEqual(property, "is_buffer"))
return PropertyValue(libertyCell && libertyCell->isBuffer());
else if (stringEqual(property, "is_clock_gate"))
return PropertyValue(libertyCell && libertyCell->isClockGate());
else if (stringEqual(property, "is_inverter"))
return PropertyValue(libertyCell && libertyCell->isInverter());
else if (stringEqual(property, "is_macro"))
return PropertyValue(libertyCell && libertyCell->isMacro());
else if (stringEqual(property, "is_memory_cell"))
return PropertyValue(libertyCell && libertyCell->isMemory());
else else
throw PropertyUnknown("instance", property); throw PropertyUnknown("instance", property);
} }
@ -918,6 +931,10 @@ getProperty(const Pin *pin,
return PropertyValue(network->pathName(pin)); return PropertyValue(network->pathName(pin));
else if (stringEqual(property, "direction")) else if (stringEqual(property, "direction"))
return PropertyValue(network->direction(pin)->name()); return PropertyValue(network->direction(pin)->name());
else if (stringEqual(property, "is_hierarchical"))
return PropertyValue(network->isHierarchical(pin));
else if (stringEqual(property, "is_port"))
return PropertyValue(network->isTopLevelPort(pin));
else if (stringEqual(property, "is_register_clock")) { else if (stringEqual(property, "is_register_clock")) {
const LibertyPort *port = network->libertyPort(pin); const LibertyPort *port = network->libertyPort(pin);
return PropertyValue(port && port->isRegClk()); return PropertyValue(port && port->isRegClk());
@ -1163,10 +1180,18 @@ getProperty(Clock *clk,
return PropertyValue(clk->period(), sta->units()->timeUnit()); return PropertyValue(clk->period(), sta->units()->timeUnit());
else if (stringEqual(property, "sources")) else if (stringEqual(property, "sources"))
return PropertyValue(clk->pins()); return PropertyValue(clk->pins());
else if (stringEqual(property, "generated"))
return PropertyValue(clk->isGenerated());
else if (stringEqual(property, "virtual"))
return PropertyValue(clk->isVirtual());
else if (stringEqual(property, "propagated")) else if (stringEqual(property, "propagated"))
return PropertyValue(clk->isPropagated()); return PropertyValue(clk->isPropagated());
else if (stringEqual(property, "is_generated")) else if (stringEqual(property, "is_generated"))
return PropertyValue(clk->isGenerated()); return PropertyValue(clk->isGenerated());
else if (stringEqual(property, "is_virtual"))
return PropertyValue(clk->isVirtual());
else if (stringEqual(property, "is_propagated"))
return PropertyValue(clk->isPropagated());
else else
throw PropertyUnknown("clock", property); throw PropertyUnknown("clock", property);
} }