Skip to content

use maximum start_x from overlapping blockages found when cutting rows#10161

Open
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:cutrows-xorigin-bugfix
Open

use maximum start_x from overlapping blockages found when cutting rows#10161
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:cutrows-xorigin-bugfix

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Summary

Fixes #10146.
Use std::max when updating start_origin_x.

Type of Change

  • Bug fix

Impact

Tapcell are not placed overlapping with macros.

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

#10146

Signed-off-by: João Mai <jmai@precisioninno.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 modifies the cutRow function in src/odb/src/db/util.cpp to ensure start_origin_x is updated correctly using std::max when handling blockages. A review comment identifies a potential issue where invalid segments could still be created if seg_end is less than start_origin_x, suggesting a conditional check or interval merging as a more robust solution.

Comment thread src/odb/src/db/util.cpp
Comment on lines +104 to +106
start_origin_x = std::max(
start_origin_x,
makeSiteLoc(blockage.second, site_width, false, start_origin_x));
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.

high

While this change correctly updates start_origin_x for overlapping blockages, it doesn't prevent the creation of invalid segments. If a blockage overlaps with a previous one, start_origin_x could be greater than blockage.first in the next iteration. This would cause seg_end (calculated on line 102) to be less than start_origin_x, leading to an invalid segment being created on line 103.

A check should be added before line 103 to ensure seg_end > start_origin_x, for example:

if (seg_end > start_origin_x) {
  segments.emplace_back(start_origin_x, seg_end);
}

A more robust long-term solution would be to merge the overlapping row_blockage_xs intervals after sorting. This would simplify the loop and make the logic clearer.

References
  1. When analyzing code within a loop, consider the entire loop structure. Operations at the beginning of the loop or pre-processing (like merging intervals) can affect the logic within the loop body, potentially simplifying it or making certain checks redundant.

@github-actions
Copy link
Copy Markdown
Contributor

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

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.

Tapcells placed on top of macros when they are closely placed

2 participants