Skip to content

ram: integrate OpenSTA for timing and power reporting#10784

Draft
tnguy19 wants to merge 9 commits into
The-OpenROAD-Project:masterfrom
tnguy19:ram-sta-integration
Draft

ram: integrate OpenSTA for timing and power reporting#10784
tnguy19 wants to merge 9 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
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@tnguy19 tnguy19 force-pushed the ram-sta-integration branch from 76ee747 to 95c0df8 Compare June 30, 2026 19:20
tnguy19 added 2 commits June 30, 2026 19:57
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@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.

… generate, unconstrained worst slack and leakage power is reported

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@github-actions github-actions Bot added size/M and removed size/S labels Jul 1, 2026
tnguy19 added 5 commits July 1, 2026 19:19
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>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@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
Comment on lines +2078 to +2079
"No Liberty libraries loaded. Please run read_liberty before "
"generate_ram to enable timing and power report.");

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.

If that's the only way this can happen then it shouldn't, because it will crash much earlier without liberty loaded.

Comment thread src/ram/src/ram.cpp
Comment on lines +2086 to +2105
sta::PathEndSeq setup_ends = sta_->findPathEnds(nullptr,
nullptr,
nullptr,
true,
scenes,
sta::MinMaxAll::max(),
1,
1,
false,
false,
-sta::INF,
sta::INF,
true,
group_names,
true,
false,
false,
false,
false,
false);

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's a good idea, and I've seen elsewhere in the code, to put in-line comments with the argument name, e.g.

(nullptr /*arg name 1*/,
 nullptr /*arg name 2*/,
...

Comment thread src/ram/src/ram.cpp
: static_cast<float>(setup_ends[0]->dataArrivalTime(sta_));

// Find worst unconstrained hold path delay/shortest path
sta::PathEndSeq hold_ends = sta_->findPathEnds(nullptr,

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.

same

FOREIGN RAM8x8 0 0 ;
CLASS BLOCK ;
SIZE 95.68 BY 27.2 ;
SIZE 92 BY 27.2 ;

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.

Didn't you deal with this before? Why is it back?

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.

Comment thread src/ram/src/ram.cpp
: static_cast<float>(hold_ends[0]->dataArrivalTime(sta_));

logger_->info(
RAM, 44, "RAM worst setup path delay: {:.6f} ns", setup_delay * 1e9);

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.

"maximum path delay"

Do not hardcode ns, and do not multiply by 1e9. The unit changes depending on the library loaded. Use sta to get the time unit prefix, and use sta to get the timescale factor.

Comment thread src/ram/src/ram.cpp
logger_->info(
RAM, 44, "RAM worst setup path delay: {:.6f} ns", setup_delay * 1e9);
logger_->info(
RAM, 45, "RAM worst hold path delay: {:.6f} ns", hold_delay * 1e9);

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.

"Minimum path delay"

Same note about time unit

Comment thread src/ram/src/ram.cpp
sta_->power(
sta_->cmdScene(), total, sequential, combinational, clock, macro, pad);
logger_->info(
RAM, 46, "RAM total power (no activity): {:.6f} W", total.total());

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.

"estimated power:"

Do not hardcode W, get the unit prefix from sta.

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