Skip to content

drt: generate pin access points on preferred upper-layer tracks - #12096

Open
phsauter wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
phsauter:drt-pin-access-generation
Open

phsauter wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
phsauter:drt-pin-access-generation

Conversation

@phsauter

@phsauter phsauter commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends pin access generation to find more viable access points aligned with the preferred upper-layer tracks. It preserves preexisting candidates and via alternatives and just expands on it using an expanded NearbyGrid search when too few access points are found so far.

Type of Change

  • New feature

Impact

Pin access should be able to find more access points especially for pins with few APs before. It still retains and uses the other candidates so I would not expect any impact for most simpler pins.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

@phsauter
phsauter requested a review from a team as a code owner November 2, 2026 19:00
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new via access search algorithm (ViaAccessSearch) in FlexPA to generate via access points for standard cell pins, along with associated unit tests. The review feedback suggests adding an underflow check for track coordinates on layers to prevent potential out-of-bounds values, and adding a defensive null check for pin_access in revertAccessPoints to avoid a potential null pointer dereference.

Comment on lines +146 to +154
if (count != 0
&& start + (count - 1) * spacing
> std::numeric_limits<frCoord>::max()) {
logger_->error(DRT,
kMsgIdPinAccessCoordinateDomain,
"Last pin-access track coordinate on layer {} is outside "
"the native coordinate range.",
layer_num);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current check only validates if the last track coordinate exceeds the maximum limit. However, the track coordinates can also underflow the minimum limit of frCoord (e.g., if start is extremely negative). To ensure complete robustness, we should check both the start and last coordinates against the minimum and maximum limits of frCoord.

    if (count != 0) {
      const int64_t last = start + (count - 1) * spacing;
      if (start < std::numeric_limits<frCoord>::min()
          || last > std::numeric_limits<frCoord>::max()) {
        logger_->error(DRT,
                       kMsgIdPinAccessCoordinateDomain,
                       "Track coordinates on layer {} are outside "
                       "the native coordinate range.",
                       layer_num);
      }
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start is already of type frCoord and spacing is unsigned, so coords cannot fall below its minimum. Only an overflow is possible, which the existing check covers.

Comment on lines 2084 to 2085
auto pin_access = pin->getPinAccess(pin_access_idx);
for (auto& access_point : pin_access->getAccessPoints()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If pin_access is null (e.g., if pin access generation failed or was skipped for this pin), dereferencing it with pin_access->getAccessPoints() will cause a null pointer dereference crash. Adding a defensive null check prevents this.

      auto pin_access = pin->getPinAccess(pin_access_idx);
      if (!pin_access) {
        continue;
      }
      for (auto& access_point : pin_access->getAccessPoints()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialization allocates an access container for every pin including skipped pins. No APs leave an empty container, generation failures throw before this. So a null check would just mask an initialization bug.

@phsauter phsauter mentioned this pull request Nov 3, 2026
5 tasks done
@phsauter
phsauter requested a review from a team as a code owner November 3, 2026 12:12
@phsauter

phsauter commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

I had to update metrics to make this pass. I had a look at all of them and to me this does not seem like a failure or problem with this PR but rather just noise from routing.
This is how they change:

Design Setup timing Clock skew Worst slew margin Worst capacitance margin
AES Sky130 HD 17 ps worse 20 ps worse +4.91% → −0.68% +6.65% → −1.05%
Ibex Sky130 HD 29 ps worse 11 ps better +4.91% → +3.56% +3.46% → +2.04%
JPEG Sky130 HD 24 ps better 9 ps worse −1.22% → −1.41% −3.61% → −2.93%

Setup is fine, clock skew fails for AES and worst slew margin and worst cap fail for all three.
Looking at AES, preferred APs on non-antenna cells remain unchanged. All five actual pin-contact vias on the affected net are also identical. The wire is 0.55% shorter with the same vias, the difference is just a longer parallel run which increases wire cap.

@phsauter
phsauter force-pushed the drt-pin-access-generation branch from 8182e7d to 4393a0f Compare November 4, 2026 15:19
Use pin and via enclosure geometry to find additional via origins on preferred upper-layer tracks after ordinary pin access generation. Sample manufacturing-grid positions in short intervals and endpoints and midpoints in longer intervals.

Retain native candidates and per-pin work limits, and validate additions through the native directional checker. Preserve distinct via identities and continue NearbyGrid generation when the existing pool is insufficient.

Keep planar-only and upward-via choices separate at a shared location so pattern checking can retain the original no-via alternative.

Enable this generation as normal pin-access behavior with no mode controls. Cover sampling, native access preservation, budgets and coordinate limits with portable fixtures.

Signed-off-by: Philippe Sauter <phsauter@iis.ee.ethz.ch>
Regenerate the RAM routing references and post-route antenna-repair log from unchanged stock tests. Additional access choices change route geometry; the stale-wire and routing-demand checks remain zero.

Signed-off-by: Philippe Sauter <phsauter@iis.ee.ethz.ch>
@phsauter
phsauter force-pushed the drt-pin-access-generation branch from 4393a0f to 26a6e0b Compare November 4, 2026 21:15
@phsauter
phsauter requested a review from a team as a code owner November 4, 2026 21:15
@phsauter
phsauter requested a review from luis201420 November 4, 2026 21:15
@osamahammad21
osamahammad21 requested a review from bnmfw November 5, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant