dbSta: add -bin_size flag to report_timing_histogram#9727
dbSta: add -bin_size flag to report_timing_histogram#9727Pavankumar07s wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Conversation
aabd075 to
0663635
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces a -bin_size option to the report_timing_histogram command, allowing users to specify a fixed bin width for the histogram. The changes include modifications to the command-line interface, C++ implementation, SWIG bridge, documentation, and test cases. The code introduces a new algorithm for generating histograms with fixed bin sizes and ensures mutual exclusivity between the -bin_size and -num_bins options.
|
Hello @maliberty , should i consider gemini review? |
src/dbSta/src/dbSta.cc
Outdated
| if (num_bins <= 0) { | ||
| logger_->warn(utl::STA, 70, "The number of bins must be positive."); | ||
| return; | ||
| } | ||
| if (bin_size < 0.0) { | ||
| logger_->warn(utl::STA, 71, "bin_size must be non-negative."); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Thankyou @maliberty , i will replace the manual warn+return pattern with utl::Validator.Looking at other usages in the codebase for the correct pattern.
src/dbSta/src/dbSta.cc
Outdated
| hist_max = std::ceil(max_slack / bin_size) * bin_size; | ||
| actual_bin_width = bin_size; | ||
| actual_num_bins | ||
| = static_cast<int>(std::round((hist_max - hist_min) / bin_size)); |
There was a problem hiding this comment.
Yes, you are right Mr @maliberty . Since hist_min and hist_max are already snapped to multiples of bin_size via floor/ceil, the division should be exact but may result in a floating-point value like 4.9999. std::ceil is the safe choice. I will fix.
src/dbSta/src/dbSta.cc
Outdated
|
|
||
| const char* bracket_end = (i == actual_num_bins - 1) ? "]" : ")"; | ||
|
|
||
| logger_->report("[{:>{}.{}f}, {:>{}.{}f}{}: {} ({})", |
There was a problem hiding this comment.
Why does this no longer user the Histogram class?
There was a problem hiding this comment.
ohh I have bypassed the Histogram class when implementing the fixed
bin size mode. I'll refactor to extend Histogram with a generateBinsWithFixedSize()
Thankyou @maliberty .
|
Gemini has the usual caveats as any LLM, often right but occasionally hallucinating. Read it and see if you agree rather than reflexively following its advice. |
|
Alright @maliberty I will see which gemini feedback is really need to be considered. |
Signed-off-by: Pavankumar07s <pawankumar14662693@gmail.com>
0663635 to
802a47d
Compare
|
Hello @maliberty, could you please check again when you have time? |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Looks good to me! |
|
Thankyou @ovebryne for review. |
dbSta: add -bin_size flag to report_timing_histogram
Closes #9445
Description
Adds a
-bin_sizeoption to thereport_timing_histogramcommand, allowing users to specify a fixed bin width (in nanoseconds) instead of a fixed number of bins.Motivation
The existing
-num_binsflag distributes slacks into equal-count bins, but users analyzing timing closure often need uniform, human-readable bucket widths (e.g.,0.1 ns,0.05 ns) for consistent comparison across runs and design revisions.Changes
src/dbSta/include/db_sta/dbSta.hh— Addedbin_sizeparameter toreportTimingHistogram()src/dbSta/src/dbSta.cc— Implemented fixed-bin algorithm with snap-to-grid alignment using floor/ceil roundingsrc/dbSta/src/dbSta.i— Updated SWIG bridge to passbin_sizefrom TCL to C++src/dbSta/src/dbSta.tcl— Added-bin_sizeflag parsing with mutual exclusivity check against-num_binssrc/README.md— Documented the new optionsrc/dbSta/test/report_timing_histogram.tcl— Added regression tests for-bin_sizewith-setupand-holdsrc/dbSta/test/report_timing_histogram.ok— Updated expected output for new test casesUsage
Example Output
Bins snap to clean multiples of
bin_size, ensuring consistent axis labels across design revisions.Test Results
All regression tests pass, including the new

-bin_sizetest cases.