rsz: hold repair rolls back a buffer for any loss of worst setup slack (0.1 ps vetoes a 527 ps hold fix)

Aperta
#12,584 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@precisionmoon ci sta già lavorando.

Dal 5/12/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug rsz
Describe the bug

repair_timing hold repair rolls back a hold buffer whenever the design's worst setup slack gets any worse (openroad/rsz/src/RepairHold.cc, around line 818):

if (slew_factor > 1.20
    || (!allow_setup_violations
        && sta::fuzzyLess(setup_slack_after, setup_slack_before)
        && setup_slack_after < setup_margin)) {
  resizer_->journalRestore();

setup_slack_before/after is the worst setup slack of the whole design, and the comparison has effectively zero tolerance. When the worst setup endpoint and the worst hold violation are the same flop, a buffer that fixes the hold violation and costs a fraction of a picosecond of setup is always rolled back. Repair then gives up with the violation in place.

On test/aes_sky130hd.tcl with the placement from #12491, after CTS, the worst hold violation and the worst setup endpoint are both _33728_/D:

  • On each of ~265 passes, hold repair inserts a delay buffer on the key[13] input path to _18263_/A1 and rolls it back.
  • The buffer slows a shared mux's slew enough to cost 0.1 ps of setup on _33728_/D, which already fails setup.
  • That 0.1 ps vetoes a 527 ps hold gain. Worst hold slack after repair stays at −0.598 ns.

Inserting the same buffer by hand (exp_hold.tcl below): worst hold −0.5984 → −0.0716 ns, worst setup −0.5678 → −0.5679 ns.

The trigger is #12526 (81dea25818, relaxation_factor_ 0.01 → 0.05 in Rebuffer.hh): it moves where setup repair ends, which puts the worst setup endpoint on that flop. On the same CTS database, running only repair_timing:

Binary Worst hold after repair Worst setup after repair
8706758cfd (master before #12526) +0.003 −0.516
81dea25818 (#12526) and later, through 4b53353e5f −0.598 −0.568

#12526 is not the bug; the rollback rule is. Any change that lands the worst setup endpoint on a hold-violating flop hits it.

For comparison only: a local change that lets the rollback tolerate a setup loss below 1 % of the inserted buffer's delay gives worst hold +0.003 and worst setup −0.568 (unchanged) on this database. The 1 % is arbitrary.

Expected Behavior

A hold buffer that removes most of a hold violation is kept when its setup cost is negligible (here 0.1 ps on an endpoint that already fails setup by 568 ps), or the tolerance is stated and adjustable. Worst hold slack after CTS repair near 0 instead of −0.598 ns.

Environment
OpenROAD master 4b53353e5f (and every commit from 81dea25818 on)
bazelisk build -c opt //:openroad
Linux x86_64
To Reproduce
  1. The CTS database: build OpenROAD at #12491's head 3958d3e29d and run test/aes_sky130hd.tcl from test/. It writes results/aes_sky130hd_cts-tcl.db. (The database is 28 MB; the PR's placement is what puts both violations on one flop.)
  2. Hold repair alone, from test/, with master: CTS_DB=results/aes_sky130hd_cts-tcl.db openroad -exit repro_hold.tcl → worst slack min -0.598. With 8706758cfd → worst slack min 0.003. About 2 minutes per run.
  3. The counter-check, inserting the buffer by hand: CTS_DB=results/aes_sky130hd_cts-tcl.db openroad -exit exp_hold.tcl.

repro_hold.tcl:

source "helpers.tcl"
source "flow_helpers.tcl"
source "sky130hd/sky130hd.vars"
read_libraries
read_db $::env(CTS_DB)
read_sdc aes_sky130hd.sdc
set_thread_count 4
sta::set_thread_count 1
source $layer_rc_file
set_wire_rc -signal -layer $wire_rc_layer
set_wire_rc -clock -layer $wire_rc_layer_clk
set_dont_use $dont_use
set_propagated_clock [all_clocks]
estimate_parasitics -placement
report_worst_slack -min -digits 3
report_worst_slack -max -digits 3
report_checks -path_delay min -to _33728_/D -digits 3 -fields {fanout cap slew}
report_checks -path_delay max -to _33728_/D -digits 3
repair_timing -skip_gate_cloning
report_worst_slack -min -digits 3
report_worst_slack -max -digits 3
puts "hold_buffers [rsz::hold_buffer_count]"
report_checks -path_delay min -digits 3 -fields {fanout cap slew}

exp_hold.tcl:

source "helpers.tcl"
source "flow_helpers.tcl"
source "sky130hd/sky130hd.vars"
read_libraries
read_db $::env(CTS_DB)
read_sdc aes_sky130hd.sdc
set_thread_count 4
sta::set_thread_count 1
source $layer_rc_file
set_wire_rc -signal -layer $wire_rc_layer
set_wire_rc -clock -layer $wire_rc_layer_clk
set_dont_use $dont_use
set_propagated_clock [all_clocks]
estimate_parasitics -placement
set hb [lindex [get_cells hold*] 0]
proc show {tag} {
  puts "== $tag: wns [format %.4f [sta::worst_slack -max]] whs [format %.4f [sta::worst_slack -min]]"
  report_checks -path_delay min -to _33728_/D -digits 4 -format end
  report_checks -path_delay max -to _33728_/D -digits 4 -format end
}
show before
# split the key[13] net: port -> delay buffer -> mux input
set block [ord::get_db_block]
set db [ord::get_db]
set master [$db findMaster [get_property $hb ref_name]]
set mi [$block findInst _18263_]
set mux_it [$mi findITerm A1]
set old_net [$mux_it getNet]
set inst [odb::dbInst_create $block $master hexp]
$inst setLocation [[$mi getBBox] xMin] [[$mi getBBox] yMin]
$inst setPlacementStatus PLACED
set nn [odb::dbNet_create $block hexp_net]
$mux_it disconnect
$mux_it connect $nn
foreach it [$inst getITerms] {
  set mt [$it getMTerm]
  if {[$mt getSigType] ne "SIGNAL"} continue
  if {[$mt getIoType] eq "INPUT"} { $it connect $old_net } elseif {[$mt getIoType] eq "OUTPUT"} { $it connect $nn }
}
estimate_parasitics -placement
show after
Relevant log output
# repro_hold.tcl, master 4b53353e5f
[INFO RSZ-0032] Inserted 379 hold buffers.
worst slack min -0.598
worst slack max -0.568

# repro_hold.tcl, 8706758cfd
[INFO RSZ-0032] Inserted 381 hold buffers.
worst slack min 0.003
worst slack max -0.516

# exp_hold.tcl, master
== before: wns -0.5678 whs -0.5984
== after: wns -0.5679 whs -0.0716
Screenshots

None.

Additional Context

Found on #12491, whose pr-head trips RSZ::worst_slack_min on aes_sky130hd (−0.598 against a limit of −0.373) after merging master past #12526. Global route repair recovers it later in that flow (+0.012), so the end result is fine; the CTS-stage metric is not.

Lingua principale
Verilog
Stelle
3.4k
Fork
1.1k
Merge medio
3g 11h
PR unite (30g)
245

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di The-OpenROAD-Project/OpenROAD

Tutte le issue di The-OpenROAD-Project/OpenROAD

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.