Skip to content

Conversation

@LucasYuki
Copy link
Contributor

Closes #7908

Changes:

  • Fixes possible infinity loop.
  • Calls createNetSingleWire with mlayer->getDirection(), instead of always using dbTechLayerDir::HORIZONTAL.

@LucasYuki LucasYuki requested a review from maliberty December 21, 2025 14:26
@LucasYuki
Copy link
Contributor Author

Still running secure-CI

Copy link
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 addresses two issues. First, it correctly fixes a potential infinite recursion in dbCreateNetUtil::createNetSingleWire, which is a critical bug fix. Second, it refactors extMeasure::createContextNets to simplify how context nets are created. However, the refactoring seems to have introduced a logic error in determining the orientation of the context nets. My review includes a suggestion to correct this logic.

Comment on lines +360 to +368
net = _create_net_util.createNetSingleWire(netName,
ll[0],
ll[1],
ur[0],
ur[1],
met,
mlayer->getDirection(),
false);

Copy link
Contributor

Choose a reason for hiding this comment

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

high

The logic for determining the direction of the context nets appears to be incorrect. The context nets are created perpendicular to the main wire. _dir is the direction of the main wire, and the loop iterates along !_dir to create parallel context nets. This means if the main wire is HORIZONTAL, the context nets are VERTICAL, and vice-versa.

The current code passes mlayer->getDirection(), which is the direction of the main layer, not the context nets. This will cause createNetSingleWire to misinterpret the width of the wire from the bounding box coordinates. The direction should be perpendicular to mlayer->getDirection().

    odb::dbTechLayerDir context_dir =
        (mlayer->getDirection() == odb::dbTechLayerDir::HORIZONTAL)
            ? odb::dbTechLayerDir::VERTICAL
            : odb::dbTechLayerDir::HORIZONTAL;
    net = _create_net_util.createNetSingleWire(netName,
                                               ll[0],
                                               ll[1],
                                               ur[0],
                                               ur[1],
                                               met,
                                               context_dir,
                                               false);

Copy link
Contributor Author

@LucasYuki LucasYuki Dec 21, 2025

Choose a reason for hiding this comment

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

@maliberty

I don't think it should always be perpendicular to mlayer->getDirection().

Perhaps it should be the direction of the met layer (layer->getDirection()), since in the createNetSingleWire method, the layer used to determine the minimum width is the same as layer, not mlayer.

Copy link
Member

Choose a reason for hiding this comment

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

This code is never exercised, it is for some variation support we've left unused. I think mlayer is the layer for the net of interest and layer is for the context nets (based on met as an argument). It appears you think otherwise so please explain further.

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

if (dir == odb::dbTechLayerDir::NONE) {
return createNetSingleWire(
netName, x1, y1, x2, y2, routingLayer, dir, skipBterms);
dir = odb::dbTechLayerDir::HORIZONTAL;
Copy link
Member

Choose a reason for hiding this comment

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

Let's just make this an error since I don't expect us to extract on a non-routing layer and clearly it wouldn't work if you do currently.

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.

Possible fix needed?

2 participants