Skip to content

odb: accept numeric edge type names in macro LEF58_EDGETYPE parser#10965

Merged
osamahammad21 merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-lef58-macro-edgetype-numeric
Jul 23, 2026
Merged

odb: accept numeric edge type names in macro LEF58_EDGETYPE parser#10965
osamahammad21 merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-lef58-macro-edgetype-numeric

Conversation

@maliberty

Copy link
Copy Markdown
Member

Fixes #10953

The LEF58_EDGETYPE macro property parser used the shared _string rule, which requires the edge type name to start with an alphabetic character. Numeric names such as 2 failed to parse and were rejected with ODB-0299, dropping the edge type from the database.

This replaces _string with a local rule that accepts any non-blank token for the edge type name, mirroring the earlier fix for the same problem in the CELLEDGESPACINGTABLE parser (#10668). The shared _string rule is left untouched since other parsers rely on its alpha-first behavior for disambiguation.

Adds a regression test (Fixture.TestLef58MacroNumericEdgeType) covering numeric names as well as the pre-existing alpha names and RANGE clause; the test fails without the parser change.

The LEF58_EDGETYPE macro property parser used the shared _string rule,
which requires the edge type name to start with an alphabetic character.
Numeric names such as "2" failed to parse and were rejected with
ODB-0299.

Use a rule that accepts any non-blank token for the edge type name,
matching the earlier CELLEDGESPACINGTABLE fix for issue The-OpenROAD-Project#10668.

Fixes The-OpenROAD-Project#10953

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty maliberty self-assigned this Jul 21, 2026
@maliberty

Copy link
Copy Markdown
Member Author

@codex review

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

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.

Code Review

This pull request updates the LEF macro edge type parser to support numeric edge type names (such as "2") by introducing a new EDGE_TYPE parser rule, and adds corresponding regression tests. A review comment suggests improving the robustness of the parser rule by subtracting space instead of blank - '\n' to correctly handle carriage return (\r) characters in files with Windows/DOS line endings.

Comment thread src/odb/src/lefin/lefMacroEdgeTypeParser.cpp Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: be298c051c

ℹ️ 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".

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Matt Liberty <matt.liberty@gmail.com>
@maliberty
maliberty marked this pull request as ready for review July 21, 2026 18:00
@maliberty
maliberty requested a review from a team as a code owner July 21, 2026 18:00
@maliberty
maliberty requested a review from osamahammad21 July 21, 2026 18:01
@openroad-ci
openroad-ci deleted the fix-lef58-macro-edgetype-numeric branch July 21, 2026 18:01
@maliberty
maliberty restored the fix-lef58-macro-edgetype-numeric branch July 21, 2026 18:01
@maliberty maliberty reopened this Jul 21, 2026
Comment on lines +64 to +66
// Edge type names may start with any non-blank character (e.g. "2")
qi::rule<std::string::const_iterator, std::string(), space_type> EDGE_TYPE
= lexeme[+(char_ - space - ';')];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I remember specifically that I defined the _string rule to start with an alphabet in order to disallow parsing a number as a string. If the more permissive rule is actually the more correct one, maybe we should just generalize it into _string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The LEF manual gives no clear guidance on what is legal. I did experiment with the SITE <> construct and <> can be 1 or even 1.1. The LEF parser specifically disables numeric parsing where strings are expected. The suggests this should be allowed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Likely there are more places to update but I left that for future work.

@osamahammad21
osamahammad21 merged commit 2fc7ce1 into The-OpenROAD-Project:master Jul 23, 2026
0 checks passed
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.

OpenROAD fails to parse edge spacing rule

4 participants