Skip to content

rcx: refactor to isolate extraction rules parsing logic into its own function#10909

Open
AcKoucher wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:rcx-set-corners-refactor
Open

rcx: refactor to isolate extraction rules parsing logic into its own function#10909
AcKoucher wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:rcx-set-corners-refactor

Conversation

@AcKoucher

@AcKoucher AcKoucher commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The multi chip extractor will be the owner of the rules model (the internal representation of the extraction rules).

What's really going on here is: the function setCorners is being split as it was doing several things at the same time:

  1. Parsing extraction rules. Now isolated in parseRules.
  2. Initializing the internal structures according to the number of corners and the rules data. Now isolated in registerRulesModel.
  3. Scaled corner count assertion. This was under a debug flag - I made it an actual error.
  4. Setting the number of process corners inside ODB. This is a legacy operation that, once we redefine the architecture used for the process corners, should go away.

This PR also:

  • Makes dbTech the source of truth for the extraction rules file.
  • Moves the deprecation warning from .tcl / .py into the extract pass to both remove duplicated warnings and guarantee that, if the user calls the SWIG API directly, we fallback accordingly.

The result of this refactoring is far from ideal. In other to fully address the multiple inconsistencies that exist in the code, we'll need considerably more refactoring rounds. As the current priority is 3D extraction, I'll tackle this in the future.

Type of Change

  • Refactoring

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).

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
   1) Move corner-related variables clearing to register method.
   2) Tiny refactor for readability.
   3) Rename parseRules corner-table parameter to extractor_corner_table.
   4) Make parseRules a free factory function in the rcx namespace.
   5) Make registerRulesModel take a raw pointer instead of a unique_ptr.

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
@AcKoucher AcKoucher requested a review from a team as a code owner July 14, 2026 16:19
@AcKoucher AcKoucher requested a review from maliberty July 14, 2026 16:19

@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 extraction rules parsing and corner registration flow by replacing the setCorners method with a standalone parseRules function and a registerRulesModel method, removing the member variable rules_file_path_. Feedback points out a critical stack buffer overflow risk in parseRules where a fixed-size array of size 10 is populated without bounds checking, as well as a potential null pointer dereference when calling fclose on a file handle that failed to open.

Comment thread src/rcx/src/netRC.cpp Outdated
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
@eder-matheus

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa937409eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/rcx/src/netRC.cpp
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
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