Repository navigation
Keep power activity annotations across scan_replace and cluster_flops - #12025
Merged
maliberty merged 9 commits intoNov 3, 2026
Conversation
…y when pin deleted Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com> # Conflicts: # src/sta
scan_replace and cluster_flops replace cells by creating new instances and deleting the old ones. Since OpenSTA drops the activity annotation of a deleted pin, the user/SAIF/VCD activity on the replaced flop pins was lost and their power fell back to the propagated estimate, even though the new pins carry the same signals on the same nets. After cluster_flops the original instance names no longer exist, so re-reading the SAIF cannot recover it. Add dbSta::copyUserActivity(from, to) and call it before the old cell is destroyed: - dft utils::ReplaceCell (scan_replace and its rollback): copy each old pin to the new pin given by the port mapping. ReplaceCell now takes the dbSta. - gpl MBFF::ModifyPinConnections (cluster_flops): copy each flop's D and Q/QN pin to the tray pin it is reconnected to. New pins without a counterpart (scan in/enable) and shared tray pins (clock, scan enable, preset, clear) keep the default activity. Add dft scan_replace_activity_sky130 and gpl mbff_activity. Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
dbSta::copyUserActivity uses Power::hasUserActivity()/userActivity(), which are public only in the OpenROAD fork of OpenSTA. Guard it with STA_OPENROAD_FORK so OpenROAD still builds with stock OpenSTA, where the annotation is not copied. CMake now defines STA_OPENROAD_FORK for dbSta_lib in C++ as well as swig; Bazel gets it from opensta_lib. Bump src/sta for the opensta_lib define. Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to preserve user, SAIF, and VCD activity annotations on pins during netlist edits, such as cell replacement and flop clustering. It implements copyUserActivity in dbSta and integrates it into the DFT cell replacement and GPL multi-bit flip-flop clustering flows, accompanied by new tests. The review feedback recommends adding defensive null checks for the input terms and their corresponding STA pins in copyUserActivity, as well as checking if the sta pointer is null in ReplaceCell before dereferencing it.
gudeh
approved these changes
Oct 28, 2026
Contributor
Author
|
The OpenSTA change will come from upstream (I merged there), so needs to be pulled in 1st before this can be merged |
…ions correctly Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
…is_phase1-bugfix Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com> # Conflicts: # src/dbSta/src/CMakeLists.txt
Power::hasUserActivity()/userActivity() are public in upstream OpenSTA now, so the copy no longer needs the fork-only guard. Bazel does not define STA_OPENROAD_FORK for C++, so the guard turned copyUserActivity into a no-op. Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
Master now picks sdfstp_1 instead of sdfsbp_1 for this design, as in one_cell_sky130. The activity lines are unchanged. Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
maliberty
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User activity annotations (
set_power_activity -pins/-input_ports,read_saif,read_vcd) were lost or corrupted by netlist edits:scan_replaceerased every pin annotation in the design, including pins it never touched.cluster_flopsand other edits left stale entries behind:report_activity_annotationcounted them;-report_annotatedcould crash on them;The OpenSTA side is already in upstream OpenSTA and in
src/staon master:Powerkeeps pin annotations acrossnetworkChangedNonSdc(), drops an annotation when its pin is deleted, andPower::hasUserActivity()/userActivity()are public.This PR adds
dbSta::copyUserActivity(from, to)and calls it before the old cell is destroyed:utils::ReplaceCell(scan_replaceand its rollback): each old pin's annotation is copied to the new pin given by the port mapping.ReplaceCellnow takes thedbSta.MBFF::ModifyPinConnections(cluster_flops): each flop's D and Q/QN annotation is copied to the tray pin it is reconnected to.New pins without a counterpart (scan in/enable) and shared tray pins (clock, scan enable, preset, clear) keep the default activity, as before.
Why copy the annotation
The new D/Q/QN pins carry the same signal on the same net as the pins they replace, so the measured activity still applies. Resizing (
swapMaster) already keeps annotations, because the pins stay the same. Aftercluster_flopsthe original instance names no longer exist, so re-reading the SAIF cannot re-annotate the tray. Copying is the only way to keep the data.Effect on the reported case
scan_replacecluster_flopsreport_activity_annotation -report_annotatedTesting
dft/test/scan_replace_activity_sky130:ff1/Q, runsscan_replace;ff1/Qon the new scan cell keeps 0.05 with originuser.gpl/test/mbff_activity:cluster_flopsinto a 4-bit tray;Not covered
dbStaCbk::inDbBTermDestroyonly disconnects it) still leaves a stale annotation.