diff --git a/include/sta/Property.hh b/include/sta/Property.hh index 698d1948..be06b272 100644 --- a/include/sta/Property.hh +++ b/include/sta/Property.hh @@ -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_; } diff --git a/search/Property.cc b/search/Property.cc index 1dc6f0fd..89974166 100644 --- a/search/Property.cc +++ b/search/Property.cc @@ -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 diff --git a/tcl/StaTcl.i b/tcl/StaTcl.i index 272251e1..26b9ac97 100644 --- a/tcl/StaTcl.i +++ b/tcl/StaTcl.i @@ -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))