Skip to content

ram: add PDN strap pitch vs die size error check in ramPdngen() to prevent segfault#9968

Merged
maliberty merged 5 commits intoThe-OpenROAD-Project:masterfrom
tnguy19:ram-pdn-size-check
Apr 6, 2026
Merged

ram: add PDN strap pitch vs die size error check in ramPdngen() to prevent segfault#9968
maliberty merged 5 commits intoThe-OpenROAD-Project:masterfrom
tnguy19:ram-pdn-size-check

Conversation

@tnguy19
Copy link
Copy Markdown
Contributor

@tnguy19 tnguy19 commented Mar 26, 2026

Summary

When the die area is smaller than the PDN strap pitch, calling RamGen::ramPdngen() can result in a segfault. This adds a check at the top of ramPdngen() to compare die dimensions against the strap pitch and give an error instead

Type of Change

  • Bug fix

Impact

Instead of a segfault when PDN strap pitch is larger than the die size, user will get a clear error message indicating which dimension is too small and suggesting they use a smaller pitch

Before Fix Sample Error Message:

[INFO PDN-0001] Inserting grid: ram_grid
Signal 11 received
 2# odb::dbTrackGrid::getGridY() in openroad
 3# pdn::TechLayer::populateGrid(odb::dbBlock*, odb::dbTechLayerDir) in openroad
 4# pdn::Straps::makeShapes(...) in openroad
 8# pdn::PdnGen::buildGrids(bool) in openroad
 9# ram::RamGen::ramPdngen(...) in openroad
Segmentation fault (core dumped)

After Fix Sample Error Message:

[ERROR RAM-0031] Die height (13600 DBU) is less than horizontal strap pitch (20000 DBU). Use a smaller -hor_layer pitch.

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 signed my commits (DCO).

Related Issues

#9961

@rovinski
@gadfort

…event segfault

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
Copy link
Copy Markdown
Contributor

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

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 validation checks in the RamGen::ramPdngen function to ensure that the die dimensions are sufficient for the specified horizontal and vertical strap pitches. Specifically, it adds error logging if the die height is less than the horizontal pitch or if the die width is less than the vertical pitch. I have no feedback to provide as there are no review comments.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@gadfort
Copy link
Copy Markdown
Collaborator

gadfort commented Mar 28, 2026

@rovinski I think this check makes sense even if the tool is no longer segfaulting

@rovinski
Copy link
Copy Markdown
Collaborator

Yep, I had the same feedback via email

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Collaborator

@rovinski rovinski left a comment

Choose a reason for hiding this comment

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

Pedantic changes

@rovinski
Copy link
Copy Markdown
Collaborator

Afterwards mark as ready for review

Signed-off-by: Thinh Nguyen <nguyenthinh19011@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@tnguy19 tnguy19 marked this pull request as ready for review April 2, 2026 02:57
@rovinski rovinski requested a review from gadfort April 2, 2026 05:38
@rovinski
Copy link
Copy Markdown
Collaborator

rovinski commented Apr 2, 2026

CI failure unrelated

@tnguy19
Copy link
Copy Markdown
Contributor Author

tnguy19 commented Apr 3, 2026

Ready for review @gadfort @maliberty

Co-authored-by: Matt Liberty <matt.liberty@gmail.com>
Signed-off-by: Thinh Nguyen <114105118+tnguy19@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

clang-tidy review says "All clean, LGTM! 👍"

@rovinski rovinski requested a review from maliberty April 5, 2026 18:36
@maliberty maliberty merged commit 08e488f into The-OpenROAD-Project:master Apr 6, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants