From 9706a657ba1dcd8e4568a0673edec686b4afcebd Mon Sep 17 00:00:00 2001 From: minjukim55 Date: Tue, 21 Apr 2026 12:18:10 +0900 Subject: [PATCH 1/2] rsz: clamp buffer locations to core area during insertion Squashed from secure-rsz-instance-outside-core (13 commits) and rebased onto current ORFS master OR pointer (0504146ce6) to isolate the clamp change from unrelated rsz refactors (ServiceRegistry port, OpenSTA sync, dpl-negotiation-fixes, etc.) that landed on master during development. Includes: - clampLocToCore() utility - insertBufferPostProcess folds setLocation with clamp - per-buffer info log replaces summary warning - repair_design_outside_core test - aes_sky130hd metrics limits update Signed-off-by: minjukim55 --- src/rsz/include/rsz/Resizer.hh | 3 +- src/rsz/src/RecoverPower.cc | 1 - src/rsz/src/RepairDesign.cc | 1 - src/rsz/src/RepairSetup.cc | 1 - src/rsz/src/Resizer.cc | 66 +++++++------- src/rsz/test/BUILD | 1 + src/rsz/test/CMakeLists.txt | 1 + src/rsz/test/buffer_ports10.defok | 8 +- src/rsz/test/buffer_ports8.defok | 8 +- src/rsz/test/buffer_ports9.defok | 8 +- src/rsz/test/gcd_resize.defok | 36 ++++---- src/rsz/test/gcd_resize.ok | 12 +-- src/rsz/test/repair_design_outside_core.ok | 21 +++++ src/rsz/test/repair_design_outside_core.tcl | 95 +++++++++++++++++++++ src/rsz/test/repair_design_outside_core.v | 22 +++++ src/rsz/test/repair_hold11.ok | 4 +- src/rsz/test/repair_hold14.ok | 2 +- src/rsz/test/repair_hold2.ok | 18 ++-- src/rsz/test/repair_hold8.ok | 4 +- src/rsz/test/repair_wire11.ok | 10 ++- 20 files changed, 230 insertions(+), 92 deletions(-) create mode 100644 src/rsz/test/repair_design_outside_core.ok create mode 100644 src/rsz/test/repair_design_outside_core.tcl create mode 100644 src/rsz/test/repair_design_outside_core.v diff --git a/src/rsz/include/rsz/Resizer.hh b/src/rsz/include/rsz/Resizer.hh index 2eee80bdb13..af9ccae6744 100644 --- a/src/rsz/include/rsz/Resizer.hh +++ b/src/rsz/include/rsz/Resizer.hh @@ -778,6 +778,7 @@ class Resizer : public sta::dbStaState, public sta::dbNetworkObserver void insertBufferPostProcess(odb::dbInst* buffer_inst); void setLocation(odb::dbInst* db_inst, const odb::Point& pt); + odb::Point clampLocToCore(const odb::Point& loc, odb::dbMaster* master) const; sta::LibertyCell* findTargetCell(sta::LibertyCell* cell, float load_cap, bool revisiting_inst); @@ -804,7 +805,6 @@ class Resizer : public sta::dbStaState, public sta::dbNetworkObserver float& limit, float& slack, const sta::Scene*& corner); - void warnBufferMovedIntoCore(); bool isLogicStdCell(const sta::Instance* inst); bool okToBufferNet(const sta::Pin* driver_pin) const; @@ -889,7 +889,6 @@ class Resizer : public sta::dbStaState, public sta::dbNetworkObserver int swap_pin_count_ = 0; int removed_buffer_count_ = 0; bool exclude_clock_buffers_ = true; - bool buffer_moved_into_core_ = false; bool match_cell_footprint_ = false; bool equiv_cells_made_ = false; diff --git a/src/rsz/src/RecoverPower.cc b/src/rsz/src/RecoverPower.cc index bc5c3326a3b..45ef034e289 100644 --- a/src/rsz/src/RecoverPower.cc +++ b/src/rsz/src/RecoverPower.cc @@ -61,7 +61,6 @@ bool RecoverPower::recoverPower(const float recover_power_percent, bool verbose) init(); constexpr int digits = 3; resize_count_ = 0; - resizer_->buffer_moved_into_core_ = false; // Sort failing endpoints by slack. sta::VertexSet& endpoints = sta_->endpoints(); diff --git a/src/rsz/src/RepairDesign.cc b/src/rsz/src/RepairDesign.cc index 05534e9270f..83fe017f1bb 100644 --- a/src/rsz/src/RepairDesign.cc +++ b/src/rsz/src/RepairDesign.cc @@ -539,7 +539,6 @@ void RepairDesign::repairNet(sta::Net* net, inserted_buffer_count_ = 0; resize_count_ = 0; resizer_->resized_multi_output_insts_.clear(); - resizer_->buffer_moved_into_core_ = false; sta_->checkSlewsPreamble(); sta_->checkCapacitancesPreamble(sta_->scenes()); diff --git a/src/rsz/src/RepairSetup.cc b/src/rsz/src/RepairSetup.cc index fbde33646d2..25898361a89 100644 --- a/src/rsz/src/RepairSetup.cc +++ b/src/rsz/src/RepairSetup.cc @@ -206,7 +206,6 @@ bool RepairSetup::repairSetup(const float setup_slack_margin, // IMPROVE ME: rebuffering always looks at cmd corner resizer_->rebuffer_->initOnCorner(sta_->cmdScene()); max_repairs_per_pass_ = max_repairs_per_pass; - resizer_->buffer_moved_into_core_ = false; violator_collector_->init(setup_slack_margin); violator_collector_->setMaxPassesPerEndpoint(max_passes); diff --git a/src/rsz/src/Resizer.cc b/src/rsz/src/Resizer.cc index 099c1b321fc..a292e6b05e0 100644 --- a/src/rsz/src/Resizer.cc +++ b/src/rsz/src/Resizer.cc @@ -1001,7 +1001,6 @@ void Resizer::bufferInputs(sta::LibertyCell* buffer_cell, bool verbose) sta_->ensureClkNetwork(sta_->cmdMode()); inserted_buffer_count_ = 0; - buffer_moved_into_core_ = false; { est::IncrementalParasiticsGuard guard(estimate_parasitics_); @@ -1139,7 +1138,6 @@ void Resizer::bufferOutputs(sta::LibertyCell* buffer_cell, bool verbose) } inserted_buffer_count_ = 0; - buffer_moved_into_core_ = false; { est::IncrementalParasiticsGuard guard(estimate_parasitics_); @@ -5123,6 +5121,11 @@ sta::Instance* Resizer::makeInstance(sta::LibertyCell* cell, void Resizer::insertBufferPostProcess(dbInst* buffer_inst) { + // ODB's insertBuffer* already placed the instance; re-run through + // setLocation so clampLocToCore can pull it back inside the core if + // the insertion point landed in the die-core gap. + setLocation(buffer_inst, buffer_inst->getLocation()); + // Legalize the cell position for accurate parasitic estimation if (estimate_parasitics_->getParasiticsSrc() == est::ParasiticsSrc::kGlobalRouting @@ -5145,33 +5148,35 @@ void Resizer::insertBufferPostProcess(dbInst* buffer_inst) void Resizer::setLocation(dbInst* db_inst, const odb::Point& pt) { - int x = pt.x(); - int y = pt.y(); - // Stay inside the lines. - if (core_exists_) { - dbMaster* master = db_inst->getMaster(); - int width = master->getWidth(); - if (x < core_.xMin()) { - x = core_.xMin(); - buffer_moved_into_core_ = true; - } else if (x > core_.xMax() - width) { - // Make sure the instance is entirely inside core. - x = core_.xMax() - width; - buffer_moved_into_core_ = true; - } - - int height = master->getHeight(); - if (y < core_.yMin()) { - y = core_.yMin(); - buffer_moved_into_core_ = true; - } else if (y > core_.yMax() - height) { - y = core_.yMax() - height; - buffer_moved_into_core_ = true; - } + const odb::Point loc = clampLocToCore(pt, db_inst->getMaster()); + db_inst->setPlacementStatus(dbPlacementStatus::PLACED); + db_inst->setLocation(loc.x(), loc.y()); + if (loc != pt) { + debugPrint(logger_, + RSZ, + "buffer_clamp", + 1, + "{} clamped to core ({}, {}) -> ({}, {})", + db_inst->getName(), + pt.x(), + pt.y(), + loc.x(), + loc.y()); } +} - db_inst->setPlacementStatus(dbPlacementStatus::PLACED); - db_inst->setLocation(x, y); +odb::Point Resizer::clampLocToCore(const odb::Point& loc, + odb::dbMaster* master) const +{ + if (!core_exists_) { + return loc; + } + const int x_max = std::max( + core_.xMin(), core_.xMax() - static_cast(master->getWidth())); + const int y_max = std::max( + core_.yMin(), core_.yMax() - static_cast(master->getHeight())); + return {std::clamp(loc.x(), core_.xMin(), x_max), + std::clamp(loc.y(), core_.yMin(), y_max)}; } float Resizer::portCapacitance(sta::LibertyPort* input, @@ -5281,13 +5286,6 @@ void Resizer::checkLoadSlews(const sta::Pin* drvr_pin, delete pin_iter; } -void Resizer::warnBufferMovedIntoCore() -{ - if (buffer_moved_into_core_) { - logger_->warn(RSZ, 77, "some buffers were moved inside the core."); - } -} - void Resizer::setDebugPin(const sta::Pin* pin) { debug_pin_ = pin; diff --git a/src/rsz/test/BUILD b/src/rsz/test/BUILD index 957c0139272..2e1fc0fa677 100644 --- a/src/rsz/test/BUILD +++ b/src/rsz/test/BUILD @@ -68,6 +68,7 @@ TESTS = [ "repair_design3_verbose", "repair_design4", "repair_design5", + "repair_design_outside_core", "repair_fanout1", "repair_fanout1_hier", "repair_fanout2", diff --git a/src/rsz/test/CMakeLists.txt b/src/rsz/test/CMakeLists.txt index 185f8bb1534..1997bcc13d2 100644 --- a/src/rsz/test/CMakeLists.txt +++ b/src/rsz/test/CMakeLists.txt @@ -59,6 +59,7 @@ or_integration_tests( repair_design3_verbose repair_design4 repair_design5 + repair_design_outside_core repair_fanout1 repair_fanout2 repair_fanout3 diff --git a/src/rsz/test/buffer_ports10.defok b/src/rsz/test/buffer_ports10.defok index 8786382491c..3abd46413fa 100644 --- a/src/rsz/test/buffer_ports10.defok +++ b/src/rsz/test/buffer_ports10.defok @@ -81,10 +81,10 @@ TRACKS Y 3340 DO 62 STEP 3200 LAYER metal9 ; TRACKS X 3390 DO 62 STEP 3200 LAYER metal10 ; TRACKS Y 3340 DO 62 STEP 3200 LAYER metal10 ; COMPONENTS 5 ; - - input1 BUF_X1 + SOURCE TIMING + PLACED ( 101270 199930 ) N ; - - input2 BUF_X1 + SOURCE TIMING + PLACED ( 99750 199930 ) N ; - - output3 BUF_X1 + SOURCE TIMING + PLACED ( 100510 199930 ) N ; - - output4 BUF_X1 + SOURCE TIMING + PLACED ( 98990 199930 ) N ; + - input1 BUF_X1 + SOURCE TIMING + PLACED ( 101270 176400 ) N ; + - input2 BUF_X1 + SOURCE TIMING + PLACED ( 99750 176400 ) N ; + - output3 BUF_X1 + SOURCE TIMING + PLACED ( 100510 176400 ) N ; + - output4 BUF_X1 + SOURCE TIMING + PLACED ( 98990 176400 ) N ; - r1 DFF_X1 + PLACED ( 96726 170871 ) N ; END COMPONENTS PINS 4 ; diff --git a/src/rsz/test/buffer_ports8.defok b/src/rsz/test/buffer_ports8.defok index 8786382491c..3abd46413fa 100644 --- a/src/rsz/test/buffer_ports8.defok +++ b/src/rsz/test/buffer_ports8.defok @@ -81,10 +81,10 @@ TRACKS Y 3340 DO 62 STEP 3200 LAYER metal9 ; TRACKS X 3390 DO 62 STEP 3200 LAYER metal10 ; TRACKS Y 3340 DO 62 STEP 3200 LAYER metal10 ; COMPONENTS 5 ; - - input1 BUF_X1 + SOURCE TIMING + PLACED ( 101270 199930 ) N ; - - input2 BUF_X1 + SOURCE TIMING + PLACED ( 99750 199930 ) N ; - - output3 BUF_X1 + SOURCE TIMING + PLACED ( 100510 199930 ) N ; - - output4 BUF_X1 + SOURCE TIMING + PLACED ( 98990 199930 ) N ; + - input1 BUF_X1 + SOURCE TIMING + PLACED ( 101270 176400 ) N ; + - input2 BUF_X1 + SOURCE TIMING + PLACED ( 99750 176400 ) N ; + - output3 BUF_X1 + SOURCE TIMING + PLACED ( 100510 176400 ) N ; + - output4 BUF_X1 + SOURCE TIMING + PLACED ( 98990 176400 ) N ; - r1 DFF_X1 + PLACED ( 96726 170871 ) N ; END COMPONENTS PINS 4 ; diff --git a/src/rsz/test/buffer_ports9.defok b/src/rsz/test/buffer_ports9.defok index 2237d067d31..f1619357bfc 100644 --- a/src/rsz/test/buffer_ports9.defok +++ b/src/rsz/test/buffer_ports9.defok @@ -81,10 +81,10 @@ TRACKS Y 3340 DO 62 STEP 3200 LAYER metal9 ; TRACKS X 3390 DO 62 STEP 3200 LAYER metal10 ; TRACKS Y 3340 DO 62 STEP 3200 LAYER metal10 ; COMPONENTS 5 ; - - input1 BUF_X16 + SOURCE TIMING + PLACED ( 101270 199930 ) N ; - - input2 BUF_X16 + SOURCE TIMING + PLACED ( 99750 199930 ) N ; - - output3 BUF_X16 + SOURCE TIMING + PLACED ( 100510 199930 ) N ; - - output4 BUF_X16 + SOURCE TIMING + PLACED ( 98990 199930 ) N ; + - input1 BUF_X16 + SOURCE TIMING + PLACED ( 101270 176400 ) N ; + - input2 BUF_X16 + SOURCE TIMING + PLACED ( 99750 176400 ) N ; + - output3 BUF_X16 + SOURCE TIMING + PLACED ( 100510 176400 ) N ; + - output4 BUF_X16 + SOURCE TIMING + PLACED ( 98990 176400 ) N ; - r1 DFF_X1 + PLACED ( 96726 170871 ) N ; END COMPONENTS PINS 4 ; diff --git a/src/rsz/test/gcd_resize.defok b/src/rsz/test/gcd_resize.defok index ab87d642ef3..c43c0070e28 100644 --- a/src/rsz/test/gcd_resize.defok +++ b/src/rsz/test/gcd_resize.defok @@ -745,24 +745,24 @@ COMPONENTS 673 ; - hold97 CLKBUF_X1 + SOURCE TIMING + PLACED ( 61811 108365 ) N ; - hold98 CLKBUF_X1 + SOURCE TIMING + PLACED ( 124175 137055 ) N ; - hold99 CLKBUF_X1 + SOURCE TIMING + PLACED ( 115635 138174 ) N ; - - output1 BUF_X1 + SOURCE TIMING + PLACED ( 200190 111020 ) N ; - - output10 BUF_X1 + SOURCE TIMING + PLACED ( 70 77700 ) N ; - - output11 BUF_X1 + SOURCE TIMING + PLACED ( 200190 85260 ) N ; - - output12 BUF_X1 + SOURCE TIMING + PLACED ( 200190 188580 ) N ; - - output13 BUF_X1 + SOURCE TIMING + PLACED ( 130150 201530 ) N ; - - output14 BUF_X1 + SOURCE TIMING + PLACED ( 200190 33460 ) N ; - - output15 BUF_X1 + SOURCE TIMING + PLACED ( 200190 162820 ) N ; - - output16 BUF_X1 + SOURCE TIMING + PLACED ( 147630 201530 ) N ; - - output17 BUF_X1 + SOURCE TIMING + PLACED ( 70 13020 ) N ; - - output18 BUF_X1 + SOURCE TIMING + PLACED ( 112670 201530 ) N ; - - output2 BUF_X1 + SOURCE TIMING + PLACED ( 200070 201530 ) N ; - - output3 BUF_X1 + SOURCE TIMING + PLACED ( 200190 72380 ) N ; - - output4 BUF_X1 + SOURCE TIMING + PLACED ( 200190 149940 ) N ; - - output5 BUF_X1 + SOURCE TIMING + PLACED ( 94810 201530 ) N ; - - output6 BUF_X1 + SOURCE TIMING + PLACED ( 165110 201530 ) N ; - - output7 BUF_X1 + SOURCE TIMING + PLACED ( 17670 70 ) N ; - - output8 BUF_X1 + SOURCE TIMING + PLACED ( 70 129220 ) N ; - - output9 BUF_X1 + SOURCE TIMING + PLACED ( 70 193900 ) N ; + - output1 BUF_X1 + SOURCE TIMING + PLACED ( 179360 111020 ) N ; + - output10 BUF_X1 + SOURCE TIMING + PLACED ( 20140 77700 ) N ; + - output11 BUF_X1 + SOURCE TIMING + PLACED ( 179360 85260 ) N ; + - output12 BUF_X1 + SOURCE TIMING + PLACED ( 179360 179200 ) N ; + - output13 BUF_X1 + SOURCE TIMING + PLACED ( 130150 179200 ) N ; + - output14 BUF_X1 + SOURCE TIMING + PLACED ( 179360 33460 ) N ; + - output15 BUF_X1 + SOURCE TIMING + PLACED ( 179360 162820 ) N ; + - output16 BUF_X1 + SOURCE TIMING + PLACED ( 147630 179200 ) N ; + - output17 BUF_X1 + SOURCE TIMING + PLACED ( 20140 22400 ) N ; + - output18 BUF_X1 + SOURCE TIMING + PLACED ( 112670 179200 ) N ; + - output2 BUF_X1 + SOURCE TIMING + PLACED ( 179360 179200 ) N ; + - output3 BUF_X1 + SOURCE TIMING + PLACED ( 179360 72380 ) N ; + - output4 BUF_X1 + SOURCE TIMING + PLACED ( 179360 149940 ) N ; + - output5 BUF_X1 + SOURCE TIMING + PLACED ( 94810 179200 ) N ; + - output6 BUF_X1 + SOURCE TIMING + PLACED ( 165110 179200 ) N ; + - output7 BUF_X1 + SOURCE TIMING + PLACED ( 20140 22400 ) N ; + - output8 BUF_X1 + SOURCE TIMING + PLACED ( 20140 129220 ) N ; + - output9 BUF_X1 + SOURCE TIMING + PLACED ( 20140 179200 ) N ; END COMPONENTS PINS 54 ; - clk + NET clk + DIRECTION INPUT + USE SIGNAL diff --git a/src/rsz/test/gcd_resize.ok b/src/rsz/test/gcd_resize.ok index a587c3706e7..66ee8e88785 100644 --- a/src/rsz/test/gcd_resize.ok +++ b/src/rsz/test/gcd_resize.ok @@ -42,16 +42,16 @@ Pin Limit Cap Slack _449_/ZN 10.47 3.45 7.02 (MET) Driver length delay -_759_/Z manhtn 105.4 steiner 105.4 0.00 -_850_/Z manhtn 95.8 steiner 95.8 0.00 +_759_/Z manhtn 83.9 steiner 83.9 0.00 +_850_/Z manhtn 80.7 steiner 80.7 0.00 _786_/Z manhtn 80.4 steiner 80.4 0.00 _813_/Z manhtn 78.4 steiner 78.4 0.00 -_847_/Z manhtn 77.7 steiner 77.7 0.00 _839_/Z manhtn 76.3 steiner 76.3 0.00 _551_/Z manhtn 73.6 steiner 73.7 0.00 -_851_/Z manhtn 69.5 steiner 69.5 0.00 reset manhtn 67.3 steiner 67.3 0.00 -_725_/Z manhtn 67.2 steiner 67.2 0.00 -_849_/Z manhtn 64.8 steiner 64.8 0.00 +_461_/Z manhtn 63.8 steiner 84.8 0.00 +req_msg[18] manhtn 61.4 steiner 61.4 0.00 +_847_/Z manhtn 60.3 steiner 60.3 0.00 +_851_/Z manhtn 58.3 steiner 58.3 0.00 Design area 751 um^2 12% utilization. No differences found. diff --git a/src/rsz/test/repair_design_outside_core.ok b/src/rsz/test/repair_design_outside_core.ok new file mode 100644 index 00000000000..0763ad90e0d --- /dev/null +++ b/src/rsz/test/repair_design_outside_core.ok @@ -0,0 +1,21 @@ +[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells +[WARNING IFP-0028] Core area lower left (10.000, 10.000) snapped to (10.070, 11.200). +[INFO IFP-0001] Added 56 rows of 420 site FreePDK45_38x28_10R_NP_162NW_34O. +[INFO IFP-0100] Die BBox: ( 0.000 0.000 ) ( 200.000 200.000 ) um +[INFO IFP-0101] Core BBox: ( 10.070 11.200 ) ( 89.870 89.600 ) um +[INFO IFP-0102] Core area: 6256.320 um^2 +[INFO IFP-0103] Total instances area: 49.742 um^2 +[INFO IFP-0104] Effective utilization: 0.008 +[INFO IFP-0105] Number of instances: 11 +[WARNING RSZ-0065] max wire length less than 693u increases wire delays. +Iteration | Area | Resized | Buffers | Nets repaired | Remaining +--------------------------------------------------------------------- + 0 | +0.0% | 0 | 0 | 0 | 24 +[DEBUG RSZ-buffer_clamp] fanout1 clamped to core (51780, 1230) -> (51780, 22400) +[DEBUG RSZ-buffer_clamp] fanout2 clamped to core (1780, 101230) -> (20140, 101230) +[DEBUG RSZ-buffer_clamp] wire3 clamped to core (1780, 191480) -> (20140, 176400) + final | +7.5% | 0 | 4 | 1 | 0 +--------------------------------------------------------------------- +[INFO RSZ-0035] Found 1 fanout violations. +[INFO RSZ-0038] Inserted 4 buffers in 1 nets. +PASS: all inserted buffers are within core area. diff --git a/src/rsz/test/repair_design_outside_core.tcl b/src/rsz/test/repair_design_outside_core.tcl new file mode 100644 index 00000000000..5ef74c09966 --- /dev/null +++ b/src/rsz/test/repair_design_outside_core.tcl @@ -0,0 +1,95 @@ +# Test that buffers inserted by repair_design are clamped inside the core area. +# A tight core with loads manually placed outside triggers wire repeaters +# at Steiner points beyond the core boundary. +source "helpers.tcl" +source Nangate45/Nangate45.vars + +read_liberty Nangate45/Nangate45_typ.lib +read_lef Nangate45/Nangate45.lef +read_verilog repair_design_outside_core.v +link_design outside_core + +# Tight core: (10, 10) to (90, 90) microns within a 200x200 die. +initialize_floorplan -site $site \ + -die_area {0 0 200 200} \ + -core_area {10 10 90 90} + +# Place driver inside core, loads far outside core to create long wires +# whose Steiner points land outside core. +set block [ord::get_db_block] +foreach inst [$block getInsts] { + set name [$inst getName] + if { $name eq "drvr" } { + $inst setLocation 50000 50000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load0" } { + $inst setLocation 0 0 + $inst setPlacementStatus PLACED + } elseif { $name eq "load1" } { + $inst setLocation 195000 0 + $inst setPlacementStatus PLACED + } elseif { $name eq "load2" } { + $inst setLocation 0 195000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load3" } { + $inst setLocation 195000 195000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load4" } { + $inst setLocation 100000 0 + $inst setPlacementStatus PLACED + } elseif { $name eq "load5" } { + $inst setLocation 0 100000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load6" } { + $inst setLocation 195000 100000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load7" } { + $inst setLocation 100000 195000 + $inst setPlacementStatus PLACED + } elseif { $name eq "load8" } { + $inst setLocation 150000 0 + $inst setPlacementStatus PLACED + } elseif { $name eq "load9" } { + $inst setLocation 50000 0 + $inst setPlacementStatus PLACED + } +} + +create_clock -period 10 clk + +source Nangate45/Nangate45.rc +set_wire_rc -layer metal3 +estimate_parasitics -placement + +# Enable debug log so we can verify per-buffer clamp messages +set_debug_level RSZ buffer_clamp 1 + +# Force fanout and wire length violations to trigger buffer insertion +set_max_fanout 5 [current_design] +repair_design -max_wire_length 100 + +# Verify: all instances must be within core area +set core [ord::get_db_core] +set core_xmin [$core xMin] +set core_ymin [$core yMin] +set core_xmax [$core xMax] +set core_ymax [$core yMax] + +set outside_core 0 +foreach inst [$block getInsts] { + set bbox [$inst getBBox] + if { + [$bbox xMin] < $core_xmin || [$bbox yMin] < $core_ymin + || [$bbox xMax] > $core_xmax || [$bbox yMax] > $core_ymax + } { + # Only check newly inserted buffers (source type TIMING), not original loads + if { [$inst getSourceType] eq "TIMING" } { + puts "FAIL: [$inst getName] outside core\ + ([$bbox xMin] [$bbox yMin]) ([$bbox xMax] [$bbox yMax])" + set outside_core 1 + } + } +} +if { !$outside_core } { + puts "PASS: all inserted buffers are within core area." +} diff --git a/src/rsz/test/repair_design_outside_core.v b/src/rsz/test/repair_design_outside_core.v new file mode 100644 index 00000000000..2b1c032dd27 --- /dev/null +++ b/src/rsz/test/repair_design_outside_core.v @@ -0,0 +1,22 @@ +// Test design for buffer clamping to core area. +// High fanout net with long wires to trigger wire repeater insertion. +module outside_core (clk, in1, out0, out1, out2, out3, out4, + out5, out6, out7, out8, out9); + input clk, in1; + output out0, out1, out2, out3, out4, out5, out6, out7, out8, out9; + + wire d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + wire net0; + + DFF_X1 drvr (.D(in1), .CK(clk), .Q(net0), .QN()); + DFF_X1 load0 (.D(net0), .CK(clk), .Q(out0), .QN()); + DFF_X1 load1 (.D(net0), .CK(clk), .Q(out1), .QN()); + DFF_X1 load2 (.D(net0), .CK(clk), .Q(out2), .QN()); + DFF_X1 load3 (.D(net0), .CK(clk), .Q(out3), .QN()); + DFF_X1 load4 (.D(net0), .CK(clk), .Q(out4), .QN()); + DFF_X1 load5 (.D(net0), .CK(clk), .Q(out5), .QN()); + DFF_X1 load6 (.D(net0), .CK(clk), .Q(out6), .QN()); + DFF_X1 load7 (.D(net0), .CK(clk), .Q(out7), .QN()); + DFF_X1 load8 (.D(net0), .CK(clk), .Q(out8), .QN()); + DFF_X1 load9 (.D(net0), .CK(clk), .Q(out9), .QN()); +endmodule diff --git a/src/rsz/test/repair_hold11.ok b/src/rsz/test/repair_hold11.ok index 9f2a532a4fc..a063a62d75e 100644 --- a/src/rsz/test/repair_hold11.ok +++ b/src/rsz/test/repair_hold11.ok @@ -9,8 +9,8 @@ worst slack max 1.27 Iteration | Resized | Buffers | Cloned Gates | Area | WNS | TNS | Endpoint -------------------------------------------------------------------------------------- 0 | 0 | 0 | 0 | +0.0% | -0.260 | -0.421 | r2/D - final | 0 | 8 | 0 | +29.3% | 0.002 | 0.000 | r3/D + final | 0 | 9 | 0 | +32.9% | 0.002 | 0.000 | r3/D -------------------------------------------------------------------------------------- -[INFO RSZ-0032] Inserted 8 hold buffers. +[INFO RSZ-0032] Inserted 9 hold buffers. worst slack min 0.00 worst slack max 1.27 diff --git a/src/rsz/test/repair_hold14.ok b/src/rsz/test/repair_hold14.ok index 9ee20d07333..4a0bf0d082c 100644 --- a/src/rsz/test/repair_hold14.ok +++ b/src/rsz/test/repair_hold14.ok @@ -47,7 +47,7 @@ Path Type: min Iteration | Resized | Buffers | Cloned Gates | Area | WNS | TNS | Endpoint -------------------------------------------------------------------------------------- 0 | 0 | 0 | 0 | +0.0% | -0.374 | -0.374 | r1/D - final | 0 | 1 | 0 | +10.3% | 0.181 | 0.000 | r1/D + final | 0 | 1 | 0 | +10.3% | 0.179 | 0.000 | r1/D -------------------------------------------------------------------------------------- [INFO RSZ-0032] Inserted 1 hold buffers. Startpoint: in1 (input port clocked by clk) diff --git a/src/rsz/test/repair_hold2.ok b/src/rsz/test/repair_hold2.ok index 063258b2cbd..f8d9c39c1c8 100644 --- a/src/rsz/test/repair_hold2.ok +++ b/src/rsz/test/repair_hold2.ok @@ -88,15 +88,15 @@ Path Type: min Iteration | Resized | Buffers | Cloned Gates | Area | WNS | TNS | Endpoint -------------------------------------------------------------------------------------- 0 | 0 | 0 | 0 | +0.0% | -0.088 | -0.196 | r2/D - final | 0 | 9 | 0 | +32.9% | 0.001 | 0.000 | r1/D + final | 0 | 10 | 0 | +36.6% | 0.009 | 0.000 | r2/D -------------------------------------------------------------------------------------- -[INFO RSZ-0032] Inserted 9 hold buffers. -worst slack min 0.00 +[INFO RSZ-0032] Inserted 10 hold buffers. +worst slack min 0.01 worst slack max 1.88 Net in2 Pin capacitance: 0.70-0.78 - Wire capacitance: 0.79-0.79 - Total capacitance: 1.49-1.57 + Wire capacitance: 5.22 + Total capacitance: 5.92-6.00 Number of drivers: 1 Number of loads: 1 Number of pins: 2 @@ -105,18 +105,18 @@ Driver pins in2 input port (20, 0) Load pins - hold9/A input (CLKBUF_X1) 0.70-0.78 (23, 6) + hold10/A input (CLKBUF_X1) 0.70-0.78 (40, 41) Net out Pin capacitance: 0.00 - Wire capacitance: 3.83 - Total capacitance: 3.83 + Wire capacitance: 6.95 + Total capacitance: 6.95 Number of drivers: 1 Number of loads: 1 Number of pins: 2 Driver pins - hold2/Z output (CLKBUF_X1) (24, 21) + hold2/Z output (CLKBUF_X1) (41, 41) Load pins out output port (0, 0) diff --git a/src/rsz/test/repair_hold8.ok b/src/rsz/test/repair_hold8.ok index 0de63b6d7a2..1c3c3c8deff 100644 --- a/src/rsz/test/repair_hold8.ok +++ b/src/rsz/test/repair_hold8.ok @@ -9,8 +9,8 @@ worst slack max 1.84 Iteration | Resized | Buffers | Cloned Gates | Area | WNS | TNS | Endpoint -------------------------------------------------------------------------------------- 0 | 0 | 0 | 0 | +0.0% | -0.088 | -0.151 | r2/D - final | 0 | 37 | 0 | +135.4% | 0.209 | 0.000 | r1/D + final | 0 | 38 | 0 | +139.0% | 0.207 | 0.000 | r2/D -------------------------------------------------------------------------------------- -[INFO RSZ-0032] Inserted 37 hold buffers. +[INFO RSZ-0032] Inserted 38 hold buffers. worst slack min 0.21 worst slack max 1.64 diff --git a/src/rsz/test/repair_wire11.ok b/src/rsz/test/repair_wire11.ok index 511b6a63b08..df9b1afe123 100644 --- a/src/rsz/test/repair_wire11.ok +++ b/src/rsz/test/repair_wire11.ok @@ -30,13 +30,17 @@ u1/Z 60.65 149.17 -88.52 (VIOLATED) Iteration | Area | Resized | Buffers | Nets repaired | Remaining --------------------------------------------------------------------- 0 | +0.0% | 0 | 0 | 0 | 4 - final | +733.3% | 1 | 3 | 1 | 0 + final | +533.3% | 1 | 3 | 1 | 0 --------------------------------------------------------------------- [INFO RSZ-0034] Found 1 slew violations. [INFO RSZ-0036] Found 1 capacitance violations. [INFO RSZ-0037] Found 1 long wires. [INFO RSZ-0039] Resized 1 instances. [INFO RSZ-0038] Inserted 3 buffers in 1 nets. +max slew + +Pin Limit Slew Slack +------------------------------------------------------------ +pad1/DATA 0.20 0.29 -0.09 (VIOLATED) + pad1 (2000000 2000000) outside of core (20140 22400 779760 778400) -wire1 (1456164 1434335) outside of core (20140 22400 779760 778400) -wire2 (882328 868170) outside of core (20140 22400 779760 778400) From 7ac212ca6e04f409777eaa765d4b4f3cfe651017 Mon Sep 17 00:00:00 2001 From: minjukim55 Date: Mon, 27 Apr 2026 17:23:37 +0900 Subject: [PATCH 2/2] rsz: switch repair_design_outside_core test to read_def flow Replace the initialize_floorplan + manual setLocation loop with a read_def -floorplan_initialize call, per Matt's review guidance that test cases should not invoke high-level commands (initialize_floorplan, placement, routing) when those steps are unrelated to the buggy point. Also reduce the load count from 10 to 6 (just over the max_fanout 5 threshold), keeping coverage of both the fanout buffer and wire repeater clamp paths while shrinking the script from ~95 to ~21 lines. The verification loop is removed in favor of relying on the .ok snapshot diff to detect regressions in clamp behavior. Signed-off-by: minjukim55 --- src/rsz/test/repair_design_outside_core.def | 94 +++++++++++++++++++++ src/rsz/test/repair_design_outside_core.ok | 25 +++--- src/rsz/test/repair_design_outside_core.tcl | 84 ++---------------- src/rsz/test/repair_design_outside_core.v | 13 +-- 4 files changed, 113 insertions(+), 103 deletions(-) create mode 100644 src/rsz/test/repair_design_outside_core.def diff --git a/src/rsz/test/repair_design_outside_core.def b/src/rsz/test/repair_design_outside_core.def new file mode 100644 index 00000000000..f6496dae428 --- /dev/null +++ b/src/rsz/test/repair_design_outside_core.def @@ -0,0 +1,94 @@ +VERSION 5.8 ; +DIVIDERCHAR "/" ; +BUSBITCHARS "[]" ; +DESIGN outside_core ; +UNITS DISTANCE MICRONS 2000 ; +DIEAREA ( 0 0 ) ( 400000 400000 ) ; +ROW ROW_0 FreePDK45_38x28_10R_NP_162NW_34O 20140 22400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_1 FreePDK45_38x28_10R_NP_162NW_34O 20140 25200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_2 FreePDK45_38x28_10R_NP_162NW_34O 20140 28000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_3 FreePDK45_38x28_10R_NP_162NW_34O 20140 30800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_4 FreePDK45_38x28_10R_NP_162NW_34O 20140 33600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_5 FreePDK45_38x28_10R_NP_162NW_34O 20140 36400 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_6 FreePDK45_38x28_10R_NP_162NW_34O 20140 39200 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_7 FreePDK45_38x28_10R_NP_162NW_34O 20140 42000 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_8 FreePDK45_38x28_10R_NP_162NW_34O 20140 44800 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_9 FreePDK45_38x28_10R_NP_162NW_34O 20140 47600 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_10 FreePDK45_38x28_10R_NP_162NW_34O 20140 50400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_11 FreePDK45_38x28_10R_NP_162NW_34O 20140 53200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_12 FreePDK45_38x28_10R_NP_162NW_34O 20140 56000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_13 FreePDK45_38x28_10R_NP_162NW_34O 20140 58800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_14 FreePDK45_38x28_10R_NP_162NW_34O 20140 61600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_15 FreePDK45_38x28_10R_NP_162NW_34O 20140 64400 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_16 FreePDK45_38x28_10R_NP_162NW_34O 20140 67200 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_17 FreePDK45_38x28_10R_NP_162NW_34O 20140 70000 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_18 FreePDK45_38x28_10R_NP_162NW_34O 20140 72800 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_19 FreePDK45_38x28_10R_NP_162NW_34O 20140 75600 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_20 FreePDK45_38x28_10R_NP_162NW_34O 20140 78400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_21 FreePDK45_38x28_10R_NP_162NW_34O 20140 81200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_22 FreePDK45_38x28_10R_NP_162NW_34O 20140 84000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_23 FreePDK45_38x28_10R_NP_162NW_34O 20140 86800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_24 FreePDK45_38x28_10R_NP_162NW_34O 20140 89600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_25 FreePDK45_38x28_10R_NP_162NW_34O 20140 92400 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_26 FreePDK45_38x28_10R_NP_162NW_34O 20140 95200 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_27 FreePDK45_38x28_10R_NP_162NW_34O 20140 98000 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_28 FreePDK45_38x28_10R_NP_162NW_34O 20140 100800 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_29 FreePDK45_38x28_10R_NP_162NW_34O 20140 103600 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_30 FreePDK45_38x28_10R_NP_162NW_34O 20140 106400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_31 FreePDK45_38x28_10R_NP_162NW_34O 20140 109200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_32 FreePDK45_38x28_10R_NP_162NW_34O 20140 112000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_33 FreePDK45_38x28_10R_NP_162NW_34O 20140 114800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_34 FreePDK45_38x28_10R_NP_162NW_34O 20140 117600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_35 FreePDK45_38x28_10R_NP_162NW_34O 20140 120400 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_36 FreePDK45_38x28_10R_NP_162NW_34O 20140 123200 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_37 FreePDK45_38x28_10R_NP_162NW_34O 20140 126000 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_38 FreePDK45_38x28_10R_NP_162NW_34O 20140 128800 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_39 FreePDK45_38x28_10R_NP_162NW_34O 20140 131600 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_40 FreePDK45_38x28_10R_NP_162NW_34O 20140 134400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_41 FreePDK45_38x28_10R_NP_162NW_34O 20140 137200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_42 FreePDK45_38x28_10R_NP_162NW_34O 20140 140000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_43 FreePDK45_38x28_10R_NP_162NW_34O 20140 142800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_44 FreePDK45_38x28_10R_NP_162NW_34O 20140 145600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_45 FreePDK45_38x28_10R_NP_162NW_34O 20140 148400 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_46 FreePDK45_38x28_10R_NP_162NW_34O 20140 151200 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_47 FreePDK45_38x28_10R_NP_162NW_34O 20140 154000 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_48 FreePDK45_38x28_10R_NP_162NW_34O 20140 156800 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_49 FreePDK45_38x28_10R_NP_162NW_34O 20140 159600 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_50 FreePDK45_38x28_10R_NP_162NW_34O 20140 162400 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_51 FreePDK45_38x28_10R_NP_162NW_34O 20140 165200 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_52 FreePDK45_38x28_10R_NP_162NW_34O 20140 168000 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_53 FreePDK45_38x28_10R_NP_162NW_34O 20140 170800 FS DO 420 BY 1 STEP 380 0 ; +ROW ROW_54 FreePDK45_38x28_10R_NP_162NW_34O 20140 173600 N DO 420 BY 1 STEP 380 0 ; +ROW ROW_55 FreePDK45_38x28_10R_NP_162NW_34O 20140 176400 FS DO 420 BY 1 STEP 380 0 ; +COMPONENTS 7 ; + - drvr DFF_X1 + PLACED ( 50000 50000 ) N ; + - load0 DFF_X1 + PLACED ( 0 0 ) N ; + - load1 DFF_X1 + PLACED ( 195000 0 ) N ; + - load2 DFF_X1 + PLACED ( 0 195000 ) N ; + - load3 DFF_X1 + PLACED ( 195000 195000 ) N ; + - load4 DFF_X1 + PLACED ( 100000 0 ) N ; + - load5 DFF_X1 + PLACED ( 0 100000 ) N ; +END COMPONENTS +PINS 8 ; + - clk + NET clk + DIRECTION INPUT + USE SIGNAL ; + - in1 + NET in1 + DIRECTION INPUT + USE SIGNAL ; + - out0 + NET out0 + DIRECTION OUTPUT + USE SIGNAL ; + - out1 + NET out1 + DIRECTION OUTPUT + USE SIGNAL ; + - out2 + NET out2 + DIRECTION OUTPUT + USE SIGNAL ; + - out3 + NET out3 + DIRECTION OUTPUT + USE SIGNAL ; + - out4 + NET out4 + DIRECTION OUTPUT + USE SIGNAL ; + - out5 + NET out5 + DIRECTION OUTPUT + USE SIGNAL ; +END PINS +NETS 9 ; + - clk ( PIN clk ) ( load5 CK ) ( load4 CK ) ( load3 CK ) ( load2 CK ) ( load1 CK ) ( load0 CK ) + ( drvr CK ) + USE SIGNAL ; + - in1 ( PIN in1 ) ( drvr D ) + USE SIGNAL ; + - net0 ( load5 D ) ( load4 D ) ( load3 D ) ( load2 D ) ( load1 D ) ( load0 D ) ( drvr Q ) + USE SIGNAL ; + - out0 ( PIN out0 ) ( load0 Q ) + USE SIGNAL ; + - out1 ( PIN out1 ) ( load1 Q ) + USE SIGNAL ; + - out2 ( PIN out2 ) ( load2 Q ) + USE SIGNAL ; + - out3 ( PIN out3 ) ( load3 Q ) + USE SIGNAL ; + - out4 ( PIN out4 ) ( load4 Q ) + USE SIGNAL ; + - out5 ( PIN out5 ) ( load5 Q ) + USE SIGNAL ; +END NETS +END DESIGN diff --git a/src/rsz/test/repair_design_outside_core.ok b/src/rsz/test/repair_design_outside_core.ok index 0763ad90e0d..32bdcc59e73 100644 --- a/src/rsz/test/repair_design_outside_core.ok +++ b/src/rsz/test/repair_design_outside_core.ok @@ -1,21 +1,16 @@ [INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells -[WARNING IFP-0028] Core area lower left (10.000, 10.000) snapped to (10.070, 11.200). -[INFO IFP-0001] Added 56 rows of 420 site FreePDK45_38x28_10R_NP_162NW_34O. -[INFO IFP-0100] Die BBox: ( 0.000 0.000 ) ( 200.000 200.000 ) um -[INFO IFP-0101] Core BBox: ( 10.070 11.200 ) ( 89.870 89.600 ) um -[INFO IFP-0102] Core area: 6256.320 um^2 -[INFO IFP-0103] Total instances area: 49.742 um^2 -[INFO IFP-0104] Effective utilization: 0.008 -[INFO IFP-0105] Number of instances: 11 +[INFO ODB-0128] Design: outside_core +[INFO ODB-0252] Updated 8 pins. +[INFO ODB-0253] Updated 7 components. +[INFO ODB-0254] Updated 9 nets and 21 connections. [WARNING RSZ-0065] max wire length less than 693u increases wire delays. Iteration | Area | Resized | Buffers | Nets repaired | Remaining --------------------------------------------------------------------- - 0 | +0.0% | 0 | 0 | 0 | 24 -[DEBUG RSZ-buffer_clamp] fanout1 clamped to core (51780, 1230) -> (51780, 22400) -[DEBUG RSZ-buffer_clamp] fanout2 clamped to core (1780, 101230) -> (20140, 101230) -[DEBUG RSZ-buffer_clamp] wire3 clamped to core (1780, 191480) -> (20140, 176400) - final | +7.5% | 0 | 4 | 1 | 0 + 0 | +0.0% | 0 | 0 | 0 | 16 +[DEBUG RSZ-buffer_clamp] fanout1 clamped to core (101780, 1230) -> (101780, 22400) +[DEBUG RSZ-buffer_clamp] wire2 clamped to core (101780, 1230) -> (101780, 22400) +[DEBUG RSZ-buffer_clamp] wire3 clamped to core (192030, 1230) -> (178220, 22400) + final | +9.2% | 0 | 3 | 1 | 0 --------------------------------------------------------------------- [INFO RSZ-0035] Found 1 fanout violations. -[INFO RSZ-0038] Inserted 4 buffers in 1 nets. -PASS: all inserted buffers are within core area. +[INFO RSZ-0038] Inserted 3 buffers in 1 nets. diff --git a/src/rsz/test/repair_design_outside_core.tcl b/src/rsz/test/repair_design_outside_core.tcl index 5ef74c09966..e352e5d341c 100644 --- a/src/rsz/test/repair_design_outside_core.tcl +++ b/src/rsz/test/repair_design_outside_core.tcl @@ -1,6 +1,7 @@ -# Test that buffers inserted by repair_design are clamped inside the core area. -# A tight core with loads manually placed outside triggers wire repeaters -# at Steiner points beyond the core boundary. +# Buffers inserted by repair_design must be clamped inside the core area. +# Tight core (10-90 um within a 200x200 die) plus loads at die corners forces +# Steiner points outside the core, exercising clampLocToCore on both fanout +# and wire repeater paths. .ok captures the per-buffer clamp debug log. source "helpers.tcl" source Nangate45/Nangate45.vars @@ -8,88 +9,13 @@ read_liberty Nangate45/Nangate45_typ.lib read_lef Nangate45/Nangate45.lef read_verilog repair_design_outside_core.v link_design outside_core - -# Tight core: (10, 10) to (90, 90) microns within a 200x200 die. -initialize_floorplan -site $site \ - -die_area {0 0 200 200} \ - -core_area {10 10 90 90} - -# Place driver inside core, loads far outside core to create long wires -# whose Steiner points land outside core. -set block [ord::get_db_block] -foreach inst [$block getInsts] { - set name [$inst getName] - if { $name eq "drvr" } { - $inst setLocation 50000 50000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load0" } { - $inst setLocation 0 0 - $inst setPlacementStatus PLACED - } elseif { $name eq "load1" } { - $inst setLocation 195000 0 - $inst setPlacementStatus PLACED - } elseif { $name eq "load2" } { - $inst setLocation 0 195000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load3" } { - $inst setLocation 195000 195000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load4" } { - $inst setLocation 100000 0 - $inst setPlacementStatus PLACED - } elseif { $name eq "load5" } { - $inst setLocation 0 100000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load6" } { - $inst setLocation 195000 100000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load7" } { - $inst setLocation 100000 195000 - $inst setPlacementStatus PLACED - } elseif { $name eq "load8" } { - $inst setLocation 150000 0 - $inst setPlacementStatus PLACED - } elseif { $name eq "load9" } { - $inst setLocation 50000 0 - $inst setPlacementStatus PLACED - } -} +read_def -floorplan_initialize repair_design_outside_core.def create_clock -period 10 clk - source Nangate45/Nangate45.rc set_wire_rc -layer metal3 estimate_parasitics -placement -# Enable debug log so we can verify per-buffer clamp messages set_debug_level RSZ buffer_clamp 1 - -# Force fanout and wire length violations to trigger buffer insertion set_max_fanout 5 [current_design] repair_design -max_wire_length 100 - -# Verify: all instances must be within core area -set core [ord::get_db_core] -set core_xmin [$core xMin] -set core_ymin [$core yMin] -set core_xmax [$core xMax] -set core_ymax [$core yMax] - -set outside_core 0 -foreach inst [$block getInsts] { - set bbox [$inst getBBox] - if { - [$bbox xMin] < $core_xmin || [$bbox yMin] < $core_ymin - || [$bbox xMax] > $core_xmax || [$bbox yMax] > $core_ymax - } { - # Only check newly inserted buffers (source type TIMING), not original loads - if { [$inst getSourceType] eq "TIMING" } { - puts "FAIL: [$inst getName] outside core\ - ([$bbox xMin] [$bbox yMin]) ([$bbox xMax] [$bbox yMax])" - set outside_core 1 - } - } -} -if { !$outside_core } { - puts "PASS: all inserted buffers are within core area." -} diff --git a/src/rsz/test/repair_design_outside_core.v b/src/rsz/test/repair_design_outside_core.v index 2b1c032dd27..6b0e662d554 100644 --- a/src/rsz/test/repair_design_outside_core.v +++ b/src/rsz/test/repair_design_outside_core.v @@ -1,11 +1,10 @@ // Test design for buffer clamping to core area. -// High fanout net with long wires to trigger wire repeater insertion. -module outside_core (clk, in1, out0, out1, out2, out3, out4, - out5, out6, out7, out8, out9); +// 6 loads (just over max_fanout 5) at die corners forces both a fanout +// buffer and a wire repeater whose Steiner points land outside the core. +module outside_core (clk, in1, out0, out1, out2, out3, out4, out5); input clk, in1; - output out0, out1, out2, out3, out4, out5, out6, out7, out8, out9; + output out0, out1, out2, out3, out4, out5; - wire d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; wire net0; DFF_X1 drvr (.D(in1), .CK(clk), .Q(net0), .QN()); @@ -15,8 +14,4 @@ module outside_core (clk, in1, out0, out1, out2, out3, out4, DFF_X1 load3 (.D(net0), .CK(clk), .Q(out3), .QN()); DFF_X1 load4 (.D(net0), .CK(clk), .Q(out4), .QN()); DFF_X1 load5 (.D(net0), .CK(clk), .Q(out5), .QN()); - DFF_X1 load6 (.D(net0), .CK(clk), .Q(out6), .QN()); - DFF_X1 load7 (.D(net0), .CK(clk), .Q(out7), .QN()); - DFF_X1 load8 (.D(net0), .CK(clk), .Q(out8), .QN()); - DFF_X1 load9 (.D(net0), .CK(clk), .Q(out9), .QN()); endmodule