Skip to content

Sta update latest 0514#363

Open
dsengupta0628 wants to merge 9 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_latest_0514
Open

Sta update latest 0514#363
dsengupta0628 wants to merge 9 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_latest_0514

Conversation

@dsengupta0628
Copy link
Copy Markdown
Contributor

Latest upstream 5/14
Has support for user defined reporting fields.

Here's an example of how to add a field for an attribute at TCL level.

[get_cell r2] set_attribute orig_name og_r2
sta::make_report_path_attr_field "orig_name" 20
report_checks -fields {orig_name}

From the client code (like mbff) use sta_->makeReportPathField to create the fields

jjcherry56 and others added 8 commits May 6, 2026 08:51
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
… levelizObserver for dbsta

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
@dsengupta0628 dsengupta0628 self-assigned this May 14, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ dsengupta0628
❌ jjcherry56
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the timing path reporting system to support dynamic and custom fields via a new callback mechanism and map-based field management. It also introduces a LevelizeObserver for cache invalidation during re-levelization and a stringLong utility for robust integer parsing. Feedback identifies a high-severity formatting issue where custom report fields may cause column misalignment, a behavioral discrepancy in whitespace handling between the C++17 and fallback paths of stringLong, and a missing type check in LibertyGroup::findAttrInt that could lead to unsafe type access.

Comment thread search/ReportPath.cc Outdated
Comment on lines +3254 to +3257
else if (field == field_case_)
line += line_case;
else if (field->getValue())
line += field->value(path, this);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The field_case_ and custom fields (via getValue()) are appended to the output line without being passed through reportField. This will cause misalignment in the report columns because these fields won't be padded to their specified width. You should use reportField to ensure consistent formatting and alignment.

      else if (field == field_case_)
        reportField(line_case, field, line);
      else if (field->getValue())
        reportField(field->value(path, this), field, line);

Comment thread util/StringUtil.cc
Comment on lines +86 to +104
#if defined(__cpp_lib_to_chars) && __cpp_lib_to_chars >= 201611L
auto [ptr, ec] = std::from_chars(str.data(), str.data() + str.size(), value, base);

// Check for success and that we consumed the entire string
if (ec == std::errc() && ptr == str.data() + str.size())
return {value, true};
else
return {0LL, false};
#else
char *ptr;
errno = 0;
// strtoll handles "long long" specifically
value = std::strtoll(str.data(), &ptr, base);

if (errno == ERANGE || *ptr != '\0' || ptr == str.data())
return {0LL, false};
else
return {value, true};
#endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a behavioral discrepancy between the two implementations of stringLong. std::from_chars (C++17) does not skip leading whitespace and will return an error if the string starts with a space. In contrast, std::strtoll (used in the fallback) skips leading whitespace. This could lead to inconsistent parsing results depending on the compiler and C++ standard library version used. Consider explicitly trimming the string or using a consistent approach for both paths.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing upstream

Comment thread liberty/LibertyParser.cc
Comment on lines +516 to +522
else {
const std::string &int_str = attr_value.stringValue();
auto [value1, valid1] = stringLong(int_str);
value = value1;
exists = valid1;
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In LibertyGroup::findAttrInt, the else block assumes that if an attribute value is not a float, it must be a string that can be parsed as a long. However, LibertyAttrValue could potentially hold other types depending on the parser state. Accessing stringValue() without verifying the type (e.g., via isString()) might lead to undefined behavior or assertions if the value is of an unexpected type.

    else if (attr_value.isString()) {
      const std::string &int_str = attr_value.stringValue();
      auto [value1, valid1] = stringLong(int_str);
      value = value1;
      exists = valid1;
      return;
    }

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
@dsengupta0628
Copy link
Copy Markdown
Contributor Author

OpenROAD unit test failure (mbff_orig_name.tcl) is expected as we need OpenROAD side change for the regression to work as well. Check results there- regressions clean there The-OpenROAD-Project/OpenROAD#10437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants