Skip to content

Sta update latest 0505#357

Merged
maliberty merged 28 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_latest_0505
May 12, 2026
Merged

Sta update latest 0505#357
maliberty merged 28 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_latest_0505

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Weekly upstream pull 05/05 has fix for one parallaxsw/OpenSTA#429 and another memory leak

jjcherry56 and others added 7 commits April 25, 2026 16:05
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: James Cherry <cherry@parallaxsw.com>
@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 introduces support for a -mode argument in the write_sdc command and refactors the Sta class to track the current mode independently of the command scene. Review feedback highlights a critical bug in VerilogWriter.cc where C-style strings are compared by address rather than content, and a potential logic error in Sdc.tcl where a pointer is used instead of a mode name. Additionally, the removal of an empty string check in setCmdMode and a typo in the documentation example should be addressed.

Comment thread verilog/VerilogWriter.cc
&& (network_->direction(port)->isAnyOutput()
|| (include_pwr_gnd_ && network_->direction(port)->isPowerGround()))
&& !stringEqual(network_->name(port), network_->name(net))) {
&& network_->name(port) != network_->name(net)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

This condition compares two const char* pointers using !=, which compares their memory addresses instead of their string content. This is a bug. The previous implementation used !stringEqual(...), which was likely correct. You should use a proper string comparison method, such as strcmp or by converting the C-style strings to std::string before comparison.

          && std::string(network_->name(port)) != std::string(network_->name(net))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hallucination: Both Network::name(Port*) and Network::name(Net*) return std::string, not const char*. operator!= on std::string does content comparison. No bug

Comment thread sdc/Sdc.tcl
Comment on lines +72 to +75
set mode [cmd_mode]
if { [info exists keys(-mode)] } {
set mode $keys(-mode)
}
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

There is a potential bug in how the mode variable is being set. The [cmd_mode] command returns a Mode* object, not the mode's name as a string. When this object is passed to write_sdc_cmd, it will likely be converted to a string representation of the pointer, causing findMode in the C++ code to fail when no -mode is specified. You should use [cmd_mode_name] to retrieve the name of the current mode.

  set mode [cmd_mode_name]
  if { [info exists keys(-mode)] } {
    set mode $keys(-mode)
  }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Search.i:822 cmd_mode() returns Mode* (SWIG pointer string _xxx_p_Mode).
Sdc.i:96 write_sdc_cmd expects std::string mode_name.
Line 72 set mode [cmd_mode] passes pointer string to wrapper expecting mode name --> findMode fails.

Line 48 already uses [cmd_mode_name] for prev_mode. Same pattern needed in line 72

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ignore

Comment thread search/Sta.cc
}

void
Sta::setCmdMode(std::string_view mode_name)
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 check for an empty mode_name has been removed from this function. The previous implementation had a check if (!mode_name.empty()). Without it, calling setCmdMode with an empty string could lead to a Mode with an empty name being created, which might result in an invalid state or unexpected behavior. It would be safer to restore a check for an empty mode_name at the beginning of the function.

Copy link
Copy Markdown
Contributor

@dsengupta0628 dsengupta0628 May 5, 2026

Choose a reason for hiding this comment

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

Commit f622da7 removed if (!mode_name.empty()) guard. Now empty mode_name:

  • findKey miss (no "" entry)
  • Falls to else branch → new Mode("", ...) registered in map
  • Invalid Mode with empty name lingers

Fix: guard early in function:

void
 Sta::setCmdMode(std::string_view mode_name)
 {
   if (mode_name.empty())
     return;
   Mode *mode = findKey(mode_name_map_, std::string(mode_name));
   ...

Or report_->error(...) instead of silent return.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ignore

Comment thread doc/ChangeLog.txt Outdated

The write_sdc command supports a -mode argument.

read_sdc [-mode mode]
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 appears to be a typo in the example provided. The note is about the write_sdc command, but the example shows read_sdc. To avoid confusion, the example should probably be for write_sdc.

  write_sdc [-mode mode]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fixed

@dsengupta0628
Copy link
Copy Markdown
Contributor

parallaxsw/OpenSTA#432

jjcherry56 and others added 17 commits May 5, 2026 14:27
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: 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: 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: James Cherry <cherry@parallaxsw.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
@dsengupta0628
Copy link
Copy Markdown
Contributor

OpenROAD compilation will not succeed as we need the change in src/dbSta/CMakeLists.txt to update ${OPENSTA_HOME}/tcl/Variables.tcl to ${OPENSTA_HOME}/sdc/Variables.tcl as this file has been moved in OpenSTA to sdc/ from tcl/

@dsengupta0628
Copy link
Copy Markdown
Contributor

@dsengupta0628 dsengupta0628 requested a review from jhkim-pii May 12, 2026 15:40
@maliberty maliberty merged commit 2110ea7 into The-OpenROAD-Project:master May 12, 2026
5 of 7 checks passed
@openroad-ci openroad-ci deleted the sta_update_latest_0505 branch May 12, 2026 17:20
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.

5 participants