Skip to content

refactor, restructure and add some checks to our write RC mechanism - #4388

Merged
eder-matheus merged 6 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:write-rc-re-work
Aug 3, 2026
Merged

eder-matheus merged 6 commits into
The-OpenROAD-Project:masterfrom
AcKoucher:write-rc-re-work

Conversation

@AcKoucher

Copy link
Copy Markdown
Contributor

Resolve #4383.

Functional Changes

  • Bundle write_net_rc and write_segment_rc into write_rc which now generates two .csv files: one for the nets' data, another one for the segments' data.
  • Make correlateRC.py able to consume both files via two keys: -nets_rc_file and -segments_rc_file. The net data is used only for plotting parasitics differences between GRT/DRT. The segment data is used for the actual fitting and generation of set_layer_rc and set_wire_rc commands.

Refactoring Changes

  • We now have a single script write_rc.tcl responsible for generating the net and segment data. The functions used on it are defined in write_rc_helper.tcl.
  • I applied the same file structure to correlateRC.py which was too big and messy. Its functions definitions are now inside correlateRCHelper.py.

What's New in correlateRC.py

  • -segments_rc_file is now required, as the set_layer_rc and set_wire_rc commands are the product of every run.
  • -plot_cap/-plot_res require -nets_rc_file.
  • Each .csv starts with a header naming its data and listing the layer stack so a file given to the wrong key is caught instead of being parsed as the other kind of data.
  • The header must come before any data row, the rows must have the expected number of columns, and every segment's layer must be listed in the header.
  • Files combined under the same key must have been written for the same routing layers.
  • Empty inputs fail instead of producing empty results.
  • We inform the user if there are nets/segments with zero parasitics.
  • Commands are generated before plots to prevent a plot issue from interfering with it.

Collateral

  • Adjusted the make directives correlate_rc and correlate_platform_rc to use the new mechanism.

    1) Bundle write_segment_rc and write_net_rc into write_rc which now
       generates two .csv files.
    2) Make correlateRC.py be able to consume both files as input. Nets
       file is used for plotting, segments file is used for set_layer_rc.
    3) Adjust make commands accordingly and remove unused code comment.

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
…he fit

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
    1) Drop the wirelength columns of the nets .csv along with the
       CORRELATE_DRT_WIRELENGTH handling, as nothing consumes them.
    2) Name the data in the header of each .csv and check it, so that
       swapped and mismatched input files are caught for both of them.
    3) Only report zero parasitics when there are any and only read the
       nets file when a plot was requested.
    4) Document that the .csv files are not regenerated on their own.

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
    1) Fetch and write the nets data of hierarchical designs, which now
       also blocked the segments data as a single script writes both.
    2) Error out on a segment whose layer is not in the header instead
       of dropping it silently, and inform when the nets and the
       segments data list different routing layers.
    3) Warn instead of failing when no layer was fitted, inform that the
       nets file is only read to plot and report unknown units on stderr.

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>

@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 RC correlation flow by consolidating the net and segment RC generation into a single target and script, and modularizing the Python correlation code into a helper library. The review feedback highlights a compatibility issue in the Makefile where the grouped target syntax (&:) requires GNU Make 4.3 or newer, which may break on older LTS environments. Additionally, there are bugs in the CSV parsing functions (read_nets_rc and read_segments_rc) where header validation is not properly reset per file when processing multiple files.

Comment thread flow/util/utils.mk Resolved
Comment thread flow/util/correlateRCHelper.py Resolved
Comment thread flow/util/correlateRCHelper.py Resolved
    1) Require a header on each input file, so that a file of another
       kind is not read against the header of the previous one, and name
       the file that is missing it.
    2) Write both .csv files with a pattern rule, as the grouped target
       syntax requires GNU Make 4.3 while we support older releases.

Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
@AcKoucher

Copy link
Copy Markdown
Contributor Author

@jeffng-or FYI.

@AcKoucher
AcKoucher requested a review from eder-matheus August 3, 2026 15:01
@eder-matheus

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: bb38c3d775

ℹ️ 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".

@eder-matheus
eder-matheus merged commit ab244fc into The-OpenROAD-Project:master Aug 3, 2026
9 checks passed
@AcKoucher
AcKoucher deleted the write-rc-re-work branch August 3, 2026 17:52
@AcKoucher
AcKoucher restored the write-rc-re-work branch August 5, 2026 14:57
@AcKoucher
AcKoucher deleted the write-rc-re-work branch August 6, 2026 14:52
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.

The scripts and methodology for RC correlation need clean up and clarification

2 participants