Skip to content

rcx: create struct for the unit scale factors to avoid duplicated code on 3D pass - #11176

Open
AcKoucher wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:rcx-spef-scale-factors
Open

rcx: create struct for the unit scale factors to avoid duplicated code on 3D pass#11176
AcKoucher wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:rcx-spef-scale-factors

Conversation

@AcKoucher

Copy link
Copy Markdown
Contributor

Summary

We'll use the new struct/method to ensure that all SPEFs have consistent units on #11124.

Type of Change

  • New feature

Impact

None.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

#11005.

…e on 3D pass

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
@AcKoucher
AcKoucher requested a review from a team as a code owner August 18, 2026 18:32
@AcKoucher
AcKoucher requested a review from maliberty August 18, 2026 18:32

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

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.

Code Review

This pull request refactors the scale factor handling in extSpef by introducing a ScaleFactors struct to replace the individual _res_unit and _cap_unit member variables, and encapsulates their calculation into a new static method computeScaleFactors. The feedback suggests renaming computeScaleFactors to computeWriteScaleFactors to clarify its specific use for exporting SPEF and to avoid developer confusion during reading operations. Additionally, it is recommended to change the parameter types from const std::string& to const char* to prevent unnecessary string allocations and safely handle potential null pointers.

Comment thread src/rcx/include/rcx/extSpef.h
Comment thread src/rcx/src/extSpef.cpp
Comment thread src/rcx/src/extSpef.cpp
Comment thread src/rcx/src/extSpef.cpp
Comment on lines +1725 to +1733
if (capacitance_unit == "PF") {
scale_factors.capacitance = 0.001;
}

if (resistance_unit == "MOHM") {
scale_factors.resistance = 1000.0;
} else if (resistance_unit == "KOHM") {
scale_factors.resistance = 0.001;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know you moved the code be we might as well make it right while we are here

Image

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
@AcKoucher
AcKoucher requested a review from maliberty August 18, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants