grt: implement resistance-aware for CUGR#10594
Conversation
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…es-aware Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…ware cost Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…ROAD into grt_cugr_resistance_aware
…ROAD into grt_cugr_resistance_aware
…tween congestion and timing Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
There was a problem hiding this comment.
Code Review
This pull request implements a resistance-aware routing feature in the CUGR global router, allowing critical nets to be biased toward lower-resistance upper metal layers. Key changes include calculating wire and via resistance costs, computing resistance-aware net scores, and integrating these costs into pattern routing, alongside several timing and mechanism validation tests. Feedback on these changes highlights opportunities to improve robustness: specifically, finding the first non-zero layer resistance as a reference instead of assuming layer 0 is valid, adding defensive null-checks for the STA network access, and ensuring markResAwareNets early-returns when the critical net percentage is zero to avoid incorrectly marking nets.
| const double ref = design_->getLayer(0).getViaResistance(); | ||
| const double via_r = design_->getLayer(lower_layer).getViaResistance(); | ||
| // Techs that leave cut-layer resistance unpopulated make this 0 | ||
| if (ref <= 0.0 || via_r <= 0.0) { | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Using design_->getLayer(0).getViaResistance() as the reference ref is risky. In many PDKs, the bottom-most layer (layer 0) or its contact/via layer might have zero or undefined via resistance, while higher routing layers have valid via resistances. If layer 0's via resistance is 0.0, ref becomes 0.0, which silently disables the via resistance penalty for all layers. We should iterate through the layers to find the first non-zero via resistance to use as the reference.
| const double ref = design_->getLayer(0).getViaResistance(); | |
| const double via_r = design_->getLayer(lower_layer).getViaResistance(); | |
| // Techs that leave cut-layer resistance unpopulated make this 0 | |
| if (ref <= 0.0 || via_r <= 0.0) { | |
| return 0; | |
| } | |
| double ref = 0.0; | |
| for (int l = 0; l < getNumLayers(); ++l) { | |
| ref = design_->getLayer(l).getViaResistance(); | |
| if (ref > 0.0) { | |
| break; | |
| } | |
| } | |
| const double via_r = design_->getLayer(lower_layer).getViaResistance(); | |
| // Techs that leave cut-layer resistance unpopulated make this 0 | |
| if (ref <= 0.0 || via_r <= 0.0) { | |
| return 0; | |
| } |
| if (!resistance_aware_) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
If percentage is 0.0f, the function still executes and will mark the worst net(s) as critical/res-aware because threshold_index becomes 0 and slack_th is set to slacks[0]. This contradicts the warning in CUGR::route() which states that -resistance_aware has no effect when -critical_nets_percentage is 0. We should early return if percentage <= 0.0f.
if (!resistance_aware_ || percentage <= 0.0f) {
return;
}| // Layer-0 sheet resistance is the reference (matches FastRoute); 0 if | ||
| // any input is undefined. | ||
| const double ref = design_->getLayer(0).getResistance(); | ||
| if (width <= 0.0 || ref <= 0.0 || layer.getResistance() <= 0.0) { | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
For consistency and robustness, we should also find the first non-zero routing layer resistance as the reference ref in case layer 0 has zero or undefined resistance.
// Find the first non-zero sheet resistance as the reference (matches FastRoute); 0 if
// any input is undefined.
double ref = 0.0;
for (int l = 0; l < getNumLayers(); ++l) {
ref = design_->getLayer(l).getResistance();
if (ref > 0.0) {
break;
}
}
if (width <= 0.0 || ref <= 0.0 || layer.getResistance() <= 0.0) {
return 0;
}
Summary
Implement resistance-aware cost to CUGR routing flow.
Type of Change
Impact
When using -resistance_aware flag, CUGR now responds with computing costs and prioritizing nets, in order to prioritize low-resistance metal layers for long, high fanout, critical nets. The core logic tries to mimic how FastRoute handles resistance aware, but the costs are mainly applied to the PatterRoute stages.
New unit tests were added for validation. CI is running.
Verification
./etc/Build.sh).