drt: pa edge cost refactor and no more division by 2#10739
Conversation
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request refactors FlexPA::getEdgeCost to simplify the cost evaluation logic, introduces named constants for repeated access point and violation costs, and modernizes container lookups by replacing .find() != .end() with .contains(). The review feedback highlights a critical bug where cached DRC violations are ignored because has_vio is not checked in the final cost evaluation block, and suggests using inline constexpr instead of static constexpr in the header file to prevent duplicate definitions across translation units.
25d5879 to
a5ad11f
Compare
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
a5ad11f to
4f8463f
Compare
| return violation_cost; | ||
| } | ||
|
|
||
| // edge not known to be a violation of not |
There was a problem hiding this comment.
Typo. vio_edges[] contains either 0 (edge has no violation), 1 (edge has a violation), -1 (not know yet, will be determined in the loop.
|
I'm missing where the division by 2 was |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f8463f800
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
line 550. |
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
| return violation_cost; | ||
| } | ||
|
|
||
| // edge not known to be of violation or not |
There was a problem hiding this comment.
Sorry but I still struggle to parse this.
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
Summary
Slightly refactors the edge cost code to have a constant value for violation and used access points. Implements some early returns and most importantly, eliminates the division by 2 for the standard edge cost. This division by 2 when applies to some integers would cause them to round down and give the wrong value. Now every edge is double the original value, which gives the same results, except no rounding error.
Type of Change
Impact
In some cases where access points have costs that are only 1 less than the others they would not be chosen as the preferred ones, now they are, as intended.
Verification
./etc/Build.sh).Related Issues
Suports 10486