Skip to content

ram: integrate OpenSTA for timing and power reporting#10784

Open
tnguy19 wants to merge 13 commits into
The-OpenROAD-Project:masterfrom
tnguy19:ram-sta-integration
Open

ram: integrate OpenSTA for timing and power reporting#10784
tnguy19 wants to merge 13 commits into
The-OpenROAD-Project:masterfrom
tnguy19:ram-sta-integration

Conversation

@tnguy19

@tnguy19 tnguy19 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Integrates openSTA into the RAM module to display timing and power after RAM generation

  • Unconstrained worst setup and hold path delays (min clock period and cycle time) and total leakage power are displayed automatically after RAM generation

Type of Change

  • New feature

Impact

After generating a RAM, user can now see timing and power report numbers
image

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 included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

#9392

@rovinski

@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 integrates the Static Timing Analysis (STA) engine into the RAM generator, adding methods to retrieve and report the worst setup slack and total power of the generated RAM. The reviewer recommends adding defensive checks to prevent segmentation faults if these reporting methods are called before a RAM block is generated, as well as handling unconstrained timing values in the Tcl interface to avoid formatting errors.

Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.tcl Outdated
@tnguy19 tnguy19 force-pushed the ram-sta-integration branch from 76ee747 to 95c0df8 Compare June 30, 2026 19:20
@rovinski

rovinski commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

user can now use report_ram_timing to query for worst setup slack number, report_ram_power to query for RAM power, and report_ram_summary to get both numbers

There is no need for a user to manually call these functions. Make them internal functions which are called at the end of the ram generation automatically.

@rovinski

rovinski commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

For now, you should assume that no timing constraints have been applied to the RAM. Report the unconstrained worst slack for both hold and setup, as that represents the cycle time of the RAM.

I don't know what STA gives you for the power number if there aren't any activity factors propagated.

@github-actions github-actions Bot added size/M and removed size/S labels Jul 1, 2026
@tnguy19

tnguy19 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

I have made the updates to the code, ready for review @rovinski

@rovinski rovinski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My comment about the power meant that I don't know myself what STA does when you estimate power, but there haven't been any activity factors applied. It might generate them, or it might just give back bogus results. It is worth finding out.

Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/test/make_8x8_latch_sky130.lefok Outdated
Comment thread src/ram/test/make_8x8_2r1w_sky130.tcl Outdated
Comment on lines -19 to -20
-power_pin VPWR \
-ground_pin VGND \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is usually better to do such changes in a separate PR because the downstream LEF changes are distracting from the main purpose of this PR.

@tnguy19 tnguy19 Jul 6, 2026

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.

Updated in #10832

Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.cpp Outdated
Comment thread src/ram/src/ram.cpp Outdated
@rovinski

rovinski commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

@gemini-code-assist /review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

tnguy19 added 7 commits July 7, 2026 12:16
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
… generate, unconstrained worst slack and leakage power is reported

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
… tidy error

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@maliberty

Copy link
Copy Markdown
Member

@codex review

tnguy19 added 2 commits July 7, 2026 12:21
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
…to specify cell

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>

@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: 3fac55cf1a

ℹ️ 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/ram/src/ram.cpp Outdated
r_ports,
w_ports);

reportTimingAndPower();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Move reports after final RAM generation

In the generate_ram Tcl flow this call runs inside generate_ram_netlist, but ram.tcl then continues with ord::design_created, PDN insertion, pin placement, filler insertion, and routing. For normal generate_ram users the newly logged timing/power therefore describes the pre-PDN/pre-filler netlist; cells inserted by ram_filler are omitted from the reported total power, so the number is stale for the final RAM macro.

Useful? React with 👍 / 👎.

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.

Updated in 7f6271e

Comment thread src/ram/src/ram.cpp
Comment on lines +2113 to +2115
true, /* unconstrained */
scenes, /* scenes */
sta::MinMaxAll::min(), /* min_max */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter zero-length paths before logging minimum delay

With the unconstrained min-path query left unfiltered, designs with primary/clock startpoints at zero arrival can be selected as the “shortest” path; the new goldens all report RAM minimum path delay: 0.000 ns, which is not a useful RAM min/cycle delay. Please constrain/filter the returned path to real data paths before logging it, otherwise users get a silently misleading minimum-delay report.

Useful? React with 👍 / 👎.

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.

Did some investigation and found that because no create_clock is defined in these automated RAM test the fastest min path appear to always be through the latch/flip-flop clock pins which will report a value of zero second which is misleading.

I added in a check to restrict the pin search to only the functional endpoints (flip-flop/latch D pins and primary Q outputs) since this is more accurate of how the RAMs will perform. This should also works with any RAM sizes and configurations instead of trying to define a specific number of pins that we want to restrict the test to.

Update is made in c121752

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the real solution is just that clock should be excluded and everything else should be included.

You may also need to set clocks to propagated? I'm not sure if that affects the datapath timing.

@tnguy19 tnguy19 force-pushed the ram-sta-integration branch from 3fac55c to 025ef12 Compare July 7, 2026 16:45
tnguy19 added 4 commits July 7, 2026 18:24
…to call it at the end of generate_ram after filler insertion and routing

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
…orage/latch D pins and primary Q outputs

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@tnguy19

tnguy19 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review @rovinski @maliberty

@maliberty maliberty marked this pull request as ready for review July 8, 2026 21:55
@maliberty maliberty requested a review from a team as a code owner July 8, 2026 21:55
@maliberty maliberty self-requested a review July 8, 2026 21:55
@maliberty

Copy link
Copy Markdown
Member

@rovinski please do your review first

@maliberty

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: af382e0daa

ℹ️ 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/ram/src/ram.cpp
false, /* hold */
false, /* recovery */
false, /* removal */
false, /* clk_gating_setup */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include clock-gate setup paths in timing report

For RAMs whose write address/enable decoder feeds the clock-gate enable path (the gcand/cg chain in makeSlice), forcing clk_gating_setup off means those control paths are never candidates for the reported maximum path delay. If that path is critical, the new report will understate the RAM cycle/setup requirement even though the generated netlist contains clock-gating checks.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All paths need to be considered

@rovinski rovinski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One other note: it's going to be important to run parasitic extraction (RCX) before doing the timing. I don't think it's being run right now - the timing will not be as accurate unless it's run.

Comment thread src/ram/src/ram.cpp
Comment on lines +2081 to +2082
// restrict path searches to the RAM's data endpoints (storage/latch
// D pins and primary Q outputs) since unconstrained searches

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You need to consider all non-clock inputs as potential start points. This includes A and WE

Comment thread src/ram/src/ram.cpp
false, /* hold */
false, /* recovery */
false, /* removal */
false, /* clk_gating_setup */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All paths need to be considered

Comment thread src/ram/src/ram.cpp
Comment on lines +2113 to +2115
true, /* unconstrained */
scenes, /* scenes */
sta::MinMaxAll::min(), /* min_max */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the real solution is just that clock should be excluded and everything else should be included.

You may also need to set clocks to propagated? I'm not sure if that affects the datapath timing.

Comment thread src/ram/src/ram.i
ram_gen->ramRouting(thread_count);
}

void ram_report_timing_power()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As a side note, I think a lot of this function naming is redundant. It is already inside the ram namespace you could just do ram::report_timing_power, etc. Something to perhaps address in a separate PR.

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.

3 participants