From abf9ff68a07d85f05e3617e079896165c95896da Mon Sep 17 00:00:00 2001 From: Eder Monteiro Date: Tue, 2 Jun 2026 15:28:54 -0300 Subject: [PATCH] grt: add unit test for parasitics estimation during guides restore Signed-off-by: Eder Monteiro --- src/grt/test/BUILD | 1 + src/grt/test/CMakeLists.txt | 1 + src/grt/test/incremental_restore_vias.ok | 8 ++++ src/grt/test/incremental_restore_vias.tcl | 46 +++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 src/grt/test/incremental_restore_vias.ok create mode 100644 src/grt/test/incremental_restore_vias.tcl diff --git a/src/grt/test/BUILD b/src/grt/test/BUILD index 9d676f1f7d4..ac03abda6ed 100644 --- a/src/grt/test/BUILD +++ b/src/grt/test/BUILD @@ -34,6 +34,7 @@ TESTS = [ "gcd_cugr", "gcd_flute", "increase_capacity1", + "incremental_restore_vias", "incremental_update_net", "infinite_cap", "inst_pin_out_of_die", diff --git a/src/grt/test/CMakeLists.txt b/src/grt/test/CMakeLists.txt index 8306b5d5e9a..5b6803f7373 100644 --- a/src/grt/test/CMakeLists.txt +++ b/src/grt/test/CMakeLists.txt @@ -31,6 +31,7 @@ or_integration_tests( gcd_cugr gcd_flute increase_capacity1 + incremental_restore_vias incremental_update_net infinite_cap inst_pin_out_of_die diff --git a/src/grt/test/incremental_restore_vias.ok b/src/grt/test/incremental_restore_vias.ok new file mode 100644 index 00000000000..264e0bfb720 --- /dev/null +++ b/src/grt/test/incremental_restore_vias.ok @@ -0,0 +1,8 @@ +[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells +[INFO ODB-0128] Design: gcd +[INFO ODB-0130] Created 54 pins. +[INFO ODB-0131] Created 676 components and 2850 component-terminals. +[INFO ODB-0133] Created 579 nets and 1498 connections. +[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file. +Summary 1 / 1 (100% pass) +pass diff --git a/src/grt/test/incremental_restore_vias.tcl b/src/grt/test/incremental_restore_vias.tcl new file mode 100644 index 00000000000..4860ea209bc --- /dev/null +++ b/src/grt/test/incremental_restore_vias.tcl @@ -0,0 +1,46 @@ +# Routes restored from DB guides during an incremental ECO must be +# electrically connected by construction (GlobalRouter::addImplicitVias). +# +# When guides do not carry explicit via info, boxToGlobalRouting leaves layer +# transitions implicit, so the per-net parasitic network splits into +# disconnected islands. The driver-reduced wire capacitance then collapses to +# zero (the orphaned cap is unreachable from the driver), even though the SPEF +# still dumps every node. addImplicitVias bridges the coincident adjacent-layer +# points so the restored route is a single connected network. +# +# This test forces the incremental single-net guide-restore path +# (loadRoutingFromDBGuides) via the ODB journal: deleting a net's guides inside +# an ECO and undoing it recreates the guides and fires the +# inDbNetPostGuideRestore callback, marking the net for route restoration. +source "helpers.tcl" +read_lef Nangate45/Nangate45.lef +read_liberty Nangate45/Nangate45_typ.lib +read_def gcd.def +read_guides est_rc3.guide +set_routing_layers -signal metal2-metal10 + +set block [ord::get_db_block] +set clk_net [$block findNet "clk"] + +# Trigger the journal-driven guide restore for clk. +global_route -start_incremental +odb::dbDatabase_beginEco $block +foreach guide [$clk_net getGuides] { + odb::dbGuide_destroy $guide +} +odb::dbDatabase_undoEco $block +global_route -end_incremental + +# Estimate parasitics from the restored route and read the driver-reduced wire +# capacitance (this is what collapses to 0 when the network is fragmented). +estimate_parasitics -global_routing +with_output_to_variable report { report_net -digits 5 clk } +regexp {Wire capacitance:\s+([0-9.]+)} $report -> wire_cap + +# Without addImplicitVias the restored clk network is fragmented and this is +# 0.0; with the fix the driver reaches the whole net (~17.3). +check "restored clk route is connected (non-zero wire capacitance)" { + expr {$wire_cap > 1.0} +} 1 + +exit_summary