diff --git a/doc/OpenSTA.odt b/doc/OpenSTA.odt index 6fd8fedb..7d1012b7 100644 Binary files a/doc/OpenSTA.odt and b/doc/OpenSTA.odt differ diff --git a/doc/OpenSTA.pdf b/doc/OpenSTA.pdf index c39a5717..681d3745 100644 Binary files a/doc/OpenSTA.pdf and b/doc/OpenSTA.pdf differ diff --git a/sdc/Sdc.i b/sdc/Sdc.i index 909bb927..92639c8f 100644 --- a/sdc/Sdc.i +++ b/sdc/Sdc.i @@ -1270,30 +1270,41 @@ all_outputs_cmd() return sta->sdc()->allOutputs(); } +template Vector +filter_objects(const char *property, + const char *op, + const char *pattern, + Vector *objects) +{ + Vector filtered_objects; + if (objects) { + Sta *sta = Sta::sta(); + bool exact_match = stringEq(op, "=="); + bool pattern_match = stringEq(op, "=~"); + bool not_match = stringEq(op, "!="); + bool not_pattern_match = stringEq(op, "!~"); + for (T *object : *objects) { + PropertyValue value(getProperty(object, property, sta)); + const char *prop = value.asString(sta->network()); + if (prop && + ((exact_match && stringEq(prop, pattern)) + || (not_match && !stringEq(prop, pattern)) + || (pattern_match && patternMatch(pattern, prop)) + || (not_pattern_match && !patternMatch(pattern, prop)))) + filtered_objects.push_back(object); + } + delete objects; + } + return filtered_objects; +} + PortSeq filter_ports(const char *property, const char *op, const char *pattern, PortSeq *ports) { - PortSeq filtered_ports; - if (ports) { - Sta *sta = Sta::sta(); - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (const Port *port : *ports) { - PropertyValue value(getProperty(port, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_ports.push_back(port); - } - delete ports; - } - return filtered_ports; + return filter_objects(property, op, pattern, ports); } InstanceSeq @@ -1302,25 +1313,7 @@ filter_insts(const char *property, const char *pattern, InstanceSeq *insts) { - InstanceSeq filtered_insts; - if (insts) { - Sta *sta = Sta::sta(); - cmdLinkedNetwork(); - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (const Instance *inst : *insts) { - PropertyValue value(getProperty(inst, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_insts.push_back(inst); - } - delete insts; - } - return filtered_insts; + return filter_objects(property, op, pattern, insts); } PinSeq @@ -1329,24 +1322,7 @@ filter_pins(const char *property, const char *pattern, PinSeq *pins) { - PinSeq filtered_pins; - if (pins) { - Sta *sta = Sta::sta(); - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (const Pin *pin : *pins) { - PropertyValue value(getProperty(pin, property, sta)); - const char *prop = value.asString(sta->sdcNetwork()); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_pins.push_back(pin); - } - delete pins; - } - return filtered_pins; + return filter_objects(property, op, pattern, pins); } EdgeSeq @@ -1355,22 +1331,7 @@ filter_timing_arcs(const char *property, const char *pattern, EdgeSeq *edges) { - Sta *sta = Sta::sta(); - EdgeSeq filtered_edges; - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (Edge *edge : *edges) { - PropertyValue value(getProperty(edge, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_edges.push_back(edge); - } - delete edges; - return filtered_edges; + return filter_objects(property, op, pattern, edges); } //////////////////////////////////////////////////////////////// diff --git a/sdc/Sdc.tcl b/sdc/Sdc.tcl index e840545d..eb52c098 100644 --- a/sdc/Sdc.tcl +++ b/sdc/Sdc.tcl @@ -935,7 +935,7 @@ proc get_ports { args } { return $ports } -variable filter_regexp1 {@?([a-zA-Z_]+) *(==|!=|=~) *([0-9a-zA-Z_\*]+)} +variable filter_regexp1 {@?([a-zA-Z_]+) *(==|!=|=~|!~) *([0-9a-zA-Z_\*]+)} variable filter_or_regexp "($filter_regexp1) *\\|\\| *($filter_regexp1)" variable filter_and_regexp "($filter_regexp1) *&& *($filter_regexp1)"