Skip to content

Commit

Permalink
Merge branch 'parallaxsw:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy authored Oct 11, 2024
2 parents 81a76b6 + a4e6bed commit 80525a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
28 changes: 11 additions & 17 deletions power/SaifReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ SaifReader::setNetDurations(const char *net_name,
if (in_scope_level_ > 0) {
Instance *parent = path_.empty() ? network_->topInstance() : path_.back();
if (parent) {
const char *net_name1 = unescaped(net_name);
const Pin *pin = sdc_network_->findPin(parent, net_name1);
string unescaped_name = unescaped(net_name);
const Pin *pin = sdc_network_->findPin(parent, unescaped_name.c_str());
if (pin) {
double t1 = durations[static_cast<int>(SaifState::T1)];
float duty = t1 / duration_;
Expand All @@ -195,28 +195,22 @@ SaifReader::setNetDurations(const char *net_name,
}
}
}
stringDelete(net_name);
}

const char *
string
SaifReader::unescaped(const char *token)
{
char *unescaped = new char[strlen(token) + 1];
char *u = unescaped;
size_t token_length = strlen(token);

for (size_t i = 0; i < token_length; i++) {
char ch = token[i];
if (ch == escape_) {
char next_ch = token[i + 1];
*u++ = next_ch;
i++;
}
string unescaped;
for (const char *t = token; *t; t++) {
char ch = *t;
if (ch == escape_)
unescaped += *(t+1);
else
// Just the normal noises.
*u++ = ch;
unescaped += ch;
}
*u = '\0';
debugPrint(debug_, "saif_name", 1, "token %s -> %s", token, unescaped);
debugPrint(debug_, "saif_name", 1, "token %s -> %s", token, unescaped.c_str());
return unescaped;
}

Expand Down
2 changes: 1 addition & 1 deletion power/SaifReaderPvt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public:
void notSupported(const char *feature);

private:
const char *unescaped(const char *token);
string unescaped(const char *token);

const char *filename_;
const char *scope_; // Divider delimited scope to begin annotation.
Expand Down

0 comments on commit 80525a7

Please sign in to comment.