get_* -filter property==non_string_value

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2024-06-01 16:15:11 -07:00
parent 89f82a825c
commit f24d907bf4
3 changed files with 45 additions and 1 deletions

View File

@ -79,6 +79,7 @@ public:
Type type() const { return type_; }
const Unit *unit() const { return unit_; }
const char *asString(const Network *network) const;
const char *stringValue() const { return string_; }
float floatValue() const { return float_; }
bool boolValue() const { return bool_; }

View File

@ -576,6 +576,49 @@ PropertyValue::operator=(PropertyValue &&value)
return *this;
}
const char *
PropertyValue::asString(const Network *network) const
{
switch (type_) {
case Type::type_string:
return string_;
case Type::type_float:
return unit_->asString(float_, 6);
case Type::type_bool:
// true/false would be better but these are TCL true/false values.
if (bool_)
return "1";
else
return "0";
case Type::type_liberty_library:
return liberty_library_->name();
case Type::type_liberty_cell:
return liberty_cell_->name();
case Type::type_liberty_port:
return liberty_port_->name();
case Type::type_library:
return network->name(library_);
case Type::type_cell:
return network->name(cell_);
case Type::type_port:
return network->name(port_);
case Type::type_instance:
return network->pathName(inst_);
case Type::type_pin:
return network->pathName(pin_);
case Type::type_net:
return network->pathName(net_);
case Type::type_clk:
return clk_->name();
case Type::type_none:
case Type::type_pins:
case Type::type_clks:
case Type::type_path_refs:
case Type::type_pwr_activity:
return nullptr;
}
}
////////////////////////////////////////////////////////////////
PropertyValue

View File

@ -1175,7 +1175,7 @@ filter_pins(const char *property,
bool not_match = stringEq(op, "!=");
for (const Pin *pin : *pins) {
PropertyValue value(getProperty(pin, property, sta));
const char *prop = value.stringValue();
const char *prop = value.asString(sta->sdcNetwork());
if (prop &&
((exact_match && stringEq(prop, pattern))
|| (not_match && !stringEq(prop, pattern))