ram: integrate OpenSTA for timing and power reporting#10784
Conversation
There was a problem hiding this comment.
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.
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
76ee747 to
95c0df8
Compare
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
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. |
|
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>
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>
|
I have made the updates to the code, ready for review @rovinski |
rovinski
left a comment
There was a problem hiding this comment.
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.
| "No Liberty libraries loaded. Please run read_liberty before " | ||
| "generate_ram to enable timing and power report."); |
There was a problem hiding this comment.
If that's the only way this can happen then it shouldn't, because it will crash much earlier without liberty loaded.
| 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); |
There was a problem hiding this comment.
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*/,
...
| : static_cast<float>(setup_ends[0]->dataArrivalTime(sta_)); | ||
|
|
||
| // Find worst unconstrained hold path delay/shortest path | ||
| sta::PathEndSeq hold_ends = sta_->findPathEnds(nullptr, |
| FOREIGN RAM8x8 0 0 ; | ||
| CLASS BLOCK ; | ||
| SIZE 95.68 BY 27.2 ; | ||
| SIZE 92 BY 27.2 ; |
There was a problem hiding this comment.
Didn't you deal with this before? Why is it back?
| -power_pin VPWR \ | ||
| -ground_pin VGND \ |
There was a problem hiding this comment.
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.
| : static_cast<float>(hold_ends[0]->dataArrivalTime(sta_)); | ||
|
|
||
| logger_->info( | ||
| RAM, 44, "RAM worst setup path delay: {:.6f} ns", setup_delay * 1e9); |
There was a problem hiding this comment.
"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.
| 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); |
There was a problem hiding this comment.
"Minimum path delay"
Same note about time unit
| sta_->power( | ||
| sta_->cmdScene(), total, sequential, combinational, clock, macro, pad); | ||
| logger_->info( | ||
| RAM, 46, "RAM total power (no activity): {:.6f} W", total.total()); |
There was a problem hiding this comment.
"estimated power:"
Do not hardcode W, get the unit prefix from sta.
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
Impact
After generating a RAM, user can now see timing and power report numbers

Verification
./etc/Build.sh).Related Issues
#9392
@rovinski