sdc escaped verilog matching
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
bbec15c772
commit
e4410498a1
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
|
using std::to_string;
|
||||||
|
|
||||||
static string
|
static string
|
||||||
escapeDividers(const char *token,
|
escapeDividers(const char *token,
|
||||||
const Network *network);
|
const Network *network);
|
||||||
|
|
@ -670,12 +672,11 @@ SdcNetwork::findPortsMatching(const Cell *cell,
|
||||||
matches = network_->findPortsMatching(cell, &escaped_pattern1);
|
matches = network_->findPortsMatching(cell, &escaped_pattern1);
|
||||||
if (matches.empty()) {
|
if (matches.empty()) {
|
||||||
// Try escaping base foo\[0\][1]
|
// Try escaping base foo\[0\][1]
|
||||||
string escaped2;
|
string escaped_name = escapeBrackets(bus_name.c_str(), this);
|
||||||
string escaped_bus_name = escapeBrackets(bus_name.c_str(), this);
|
escaped_name += '[';
|
||||||
stringPrint(escaped2, "%s[%d]",
|
escaped_name += to_string(index);
|
||||||
escaped_bus_name.c_str(),
|
escaped_name += ']';
|
||||||
index);
|
PatternMatch escaped_pattern2(escaped_name.c_str(), pattern);
|
||||||
PatternMatch escaped_pattern2(escaped2.c_str(), pattern);
|
|
||||||
matches = network_->findPortsMatching(cell, &escaped_pattern2);
|
matches = network_->findPortsMatching(cell, &escaped_pattern2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -929,8 +930,11 @@ SdcNetwork::visitPinTail(const Instance *instance,
|
||||||
Port *port = port_iter->next();
|
Port *port = port_iter->next();
|
||||||
const char *port_name = network_->name(port);
|
const char *port_name = network_->name(port);
|
||||||
if (network_->hasMembers(port)) {
|
if (network_->hasMembers(port)) {
|
||||||
bool bus_matches = tail->match(port_name)
|
bool bus_matches = tail->match(port_name);
|
||||||
|| tail->match(escapeDividers(port_name, network_));
|
if (!bus_matches) {
|
||||||
|
string escaped_name = escapeDividers(port_name, network_);
|
||||||
|
bus_matches = tail->match(escaped_name);
|
||||||
|
}
|
||||||
PortMemberIterator *member_iter = network_->memberIterator(port);
|
PortMemberIterator *member_iter = network_->memberIterator(port);
|
||||||
while (member_iter->hasNext()) {
|
while (member_iter->hasNext()) {
|
||||||
Port *member_port = member_iter->next();
|
Port *member_port = member_iter->next();
|
||||||
|
|
@ -942,8 +946,12 @@ SdcNetwork::visitPinTail(const Instance *instance,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const char *member_name = network_->name(member_port);
|
const char *member_name = network_->name(member_port);
|
||||||
if (tail->match(member_name)
|
bool member_matches = tail->match(member_name);
|
||||||
|| tail->match(escapeDividers(member_name, network_))) {
|
if (!member_matches) {
|
||||||
|
string escaped_name = escapeDividers(member_name, network_);
|
||||||
|
member_matches = tail->match(escaped_name);
|
||||||
|
}
|
||||||
|
if (member_matches) {
|
||||||
matches.push_back(pin);
|
matches.push_back(pin);
|
||||||
found_match = true;
|
found_match = true;
|
||||||
}
|
}
|
||||||
|
|
@ -952,8 +960,13 @@ SdcNetwork::visitPinTail(const Instance *instance,
|
||||||
}
|
}
|
||||||
delete member_iter;
|
delete member_iter;
|
||||||
}
|
}
|
||||||
else if (tail->match(port_name)
|
else {
|
||||||
|| tail->match(escapeDividers(port_name, network_))) {
|
bool port_matches = tail->match(port_name);
|
||||||
|
if (!port_matches) {
|
||||||
|
string escaped_name = escapeDividers(port_name, network_);
|
||||||
|
port_matches = tail->match(escaped_name);
|
||||||
|
}
|
||||||
|
if (port_matches) {
|
||||||
Pin *pin = network_->findPin(instance, port);
|
Pin *pin = network_->findPin(instance, port);
|
||||||
if (pin) {
|
if (pin) {
|
||||||
matches.push_back(pin);
|
matches.push_back(pin);
|
||||||
|
|
@ -961,6 +974,7 @@ SdcNetwork::visitPinTail(const Instance *instance,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete port_iter;
|
delete port_iter;
|
||||||
}
|
}
|
||||||
return found_match;
|
return found_match;
|
||||||
|
|
@ -1125,9 +1139,9 @@ SdcNetwork::visitMatches(const Instance *parent,
|
||||||
network_->findChildrenMatching(parent, &matcher, matches);
|
network_->findChildrenMatching(parent, &matcher, matches);
|
||||||
if (has_brkts && matches.empty()) {
|
if (has_brkts && matches.empty()) {
|
||||||
// Look for matches after escaping brackets.
|
// Look for matches after escaping brackets.
|
||||||
const PatternMatch escaped_brkts(escapeBrackets(inst_path, this),
|
string escaped_brkts = escapeBrackets(inst_path, this);
|
||||||
pattern);
|
const PatternMatch escaped_pattern(escaped_brkts, pattern);
|
||||||
network_->findChildrenMatching(parent, &escaped_brkts, matches);
|
network_->findChildrenMatching(parent, &escaped_pattern, matches);
|
||||||
}
|
}
|
||||||
if (!matches.empty()) {
|
if (!matches.empty()) {
|
||||||
// Found instance matches for the sub-path up to this divider.
|
// Found instance matches for the sub-path up to this divider.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue