Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drt: PA minor refactoring #5744

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

bnmfw
Copy link
Contributor

@bnmfw bnmfw commented Sep 13, 2024

[Context] This used to be a huge, overwhelming PR, Its contents were splits in PRs #5760 #5770 #5778 #5783 and #5788. As those were merged this PR was updated to not included their changes ('drt: master merge' commits). What remains can be reviewed as a single PR.

This PR contains minor refactoring changes do the PA module

Straight Forward Refactoring Decisions:

  • some variables still needed snake_case.
  • some spaces were added
  • some comments were changed
  • Doxygen was added to some functions missing it
  • genAPEnclosedBoundary was moved to be closer to genAPCentered and genAPOnTrack which are very similar functions
  • in mergePinShapes and auxilary variable tech was created to replace getDesign()->getTech() which was called some times

Other Refactoring Decisions:

Some minor parts of code were changed for a less verbose equivalent, here are they:

Initialize a vector with set size:

std::vector<gtl::polygon_90_set_data<frCoord>> pin_shapes;
...
pin_shapes.clear();
pin_shapes.resize(getDesign()->getTech()->getLayers().size());

changed to

std::vector<gtl::polygon_90_set_data<frCoord>> pin_shapes(num_layers);

Using find directly in if statement:

auto it = coords.find(coord);
if (it == coords.end()) {

changed to

if (coords.find(coord) == coords.end()) {

Cutting unnecessary if statement

if (valid_via_defs.empty()) {
  ap->setAccess(dir, false);
} else {
  ap->setAccess(dir, true);
}

changed to

ap->setAccess(dir, !valid_via_defs.empty());

Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
@bnmfw bnmfw added documentation Improvements or additions to documentation drt Detailed Routing labels Sep 13, 2024
@bnmfw bnmfw mentioned this pull request Sep 13, 2024
Copy link
Contributor

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

src/drt/src/pa/FlexPA_prep.cpp Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_prep.cpp Show resolved Hide resolved
bool use_center_line = false;
if (is_macro_cell_pin) {
auto rect_dir = gtl::guess_orientation(rect);
if ((rect_dir == gtl::HORIZONTAL && is_layer1_horz)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this would benefit from a helper that said LayerMatchesRectOrentation(layer, rect)

Copy link
Contributor Author

@bnmfw bnmfw Sep 16, 2024

Choose a reason for hiding this comment

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

I'm noting this for the subsequent PR. For this one as it became pretty big I do not intend to create new functions

src/drt/src/pa/FlexPA.cpp Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.cpp Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
*
* @param pin pin object which will have figures merged by layer
* @param inst_term instance terminal from which to get xfrom
* @param is_shrink if polygons will be shrinked
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param is_shrink if polygons will be shrinked
* @param is_shrink if polygons will be shrunk

Copy link
Member

Choose a reason for hiding this comment

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

Could you also describe further how it will be shrunk? Something like "if True, pin's polygons will be shrunk by ...."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not completely sure why there is shrinking. Is is_shrink == True then the input rectangle will have the side in the non preferred direction of the layer reduced by half the layer width. I'm not sure why this is the case

src/drt/src/pa/FlexPA_unique.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_unique.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_unique.h Outdated Show resolved Hide resolved
Copy link
Member

@osamahammad21 osamahammad21 left a comment

Choose a reason for hiding this comment

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

I have only looked at FlexPA.h and FlexPA.cpp

src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
*
* @param pin pin object which will have figures merged by layer
* @param inst_term instance terminal from which to get xfrom
* @param is_shrink if polygons will be shrinked
Copy link
Member

Choose a reason for hiding this comment

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

Could you also describe further how it will be shrunk? Something like "if True, pin's polygons will be shrunk by ...."

src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Copy link
Contributor

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

2 similar comments
Copy link
Contributor

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

Copy link
Contributor

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

Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Copy link
Contributor

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

1 similar comment
Copy link
Contributor

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

Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Copy link
Contributor

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

Copy link
Contributor

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

@bnmfw bnmfw marked this pull request as draft September 23, 2024 14:28
Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Copy link
Contributor

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

Copy link
Contributor

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

Signed-off-by: bernardo <bernardoborgessandoval@gmail.com>
Copy link
Contributor

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

1 similar comment
Copy link
Contributor

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

@bnmfw bnmfw changed the title drt: PA minor refactoring and doxygen drt: PA minor refactoring Sep 25, 2024
@bnmfw bnmfw marked this pull request as ready for review September 25, 2024 14:40
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_init.cpp Outdated Show resolved Hide resolved
layerWidths.resize(getDesign()->getTech()->getLayers().size(), 0);
for (int i = 0; i < int(layerWidths.size()); i++) {
layerWidths[i] = getDesign()->getTech()->getLayer(i)->getWidth();
frTechObject* tech = getDesign()->getTech();
Copy link
Member

Choose a reason for hiding this comment

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

better if we have a getTech function in FlexPA. not needed in this PR. just a note

src/drt/src/pa/FlexPA_prep.cpp Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_prep.cpp Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA.h Outdated Show resolved Hide resolved
src/drt/src/pa/FlexPA_prep.cpp Outdated Show resolved Hide resolved
Comment on lines +197 to +200
void FlexPA::genAPEnclosedBoundary(std::map<frCoord, frAccessPointEnum>& coords,
const gtl::rectangle_data<frCoord>& rect,
const frLayerNum layer_num,
const bool is_curr_layer_horz)
Copy link
Member

Choose a reason for hiding this comment

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

Can you move to the same place so that the changes can be seen? (after gen_initializeAccessPoints)
unless there is a reason for moving it here.

Copy link
Contributor Author

@bnmfw bnmfw Sep 26, 2024

Choose a reason for hiding this comment

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

There are no changes in genAPEnclosedBoundary, but it is one of the three functions that generate access points coordinates for a given type (genAPOnTrack, genAPCentered, genAPEnclosedBoundary). I just moved it to be right after the other two instead of being far down.

src/drt/src/pa/FlexPA_prep.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

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

Copy link
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
documentation Improvements or additions to documentation drt Detailed Routing
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants