Skip to content

syn: Fix combinational mapper; extend tests#10495

Merged
povik merged 5 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:syn-fixes
May 23, 2026
Merged

syn: Fix combinational mapper; extend tests#10495
povik merged 5 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:syn-fixes

Conversation

@povik
Copy link
Copy Markdown
Contributor

@povik povik commented May 22, 2026

Summary

Undo the collateral damage done in 169f2b2 and extend test coverage to make sure we will catch it next time. Resolves the issue reported in #10492

Type of Change

  • Bug fix

Impact

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 included tests to prevent regressions.
  • I have signed my commits (DCO).

povik added 4 commits May 22, 2026 17:52
Partially revert a recent tidying commit which introduced a bug
by removing those casts.

Signed-off-by: Martin Povišer <povik@cutebit.org>
Assisted-by: Claude (various models)
Signed-off-by: Martin Povišer <povik@cutebit.org>
Assisted-by: Claude (various models)
Signed-off-by: Martin Povišer <povik@cutebit.org>
Assisted-by: Claude (various models)
Signed-off-by: Martin Povišer <povik@cutebit.org>
@povik povik requested review from a team as code owners May 22, 2026 18:05
@povik povik requested a review from maliberty May 22, 2026 18:05
@povik povik self-assigned this May 22, 2026
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 introduces a new combinational mapping test suite (cm_test) with associated liberty files and build system updates. It also enhances the IR parser with output width validation, fixes signed/unsigned comparison warnings in the combinational mapper, and updates Bazel scripts to prevent recursive submodule traversal. A review comment suggests refactoring the width validation logic in Parse.cc to improve readability by using a local variable for the calculated slot count.

Comment thread src/syn/src/ir/Parse.cc
Comment on lines +542 to +547
const uint32_t expected_slots = std::max(width, 1u);
if (g->tableSize() != id + expected_slots) {
error("'" + keyword + "' declared output width " + std::to_string(width)
+ " but produced " + std::to_string(g->tableSize() - id) + " slot"
+ (g->tableSize() - id == 1 ? "" : "s"));
}
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.

medium

The calculation g->tableSize() - id is repeated multiple times in this block. Storing this value in a local variable (e.g., actual_slots) would improve code readability and maintainability by making the validation logic more explicit and avoiding redundant calculations.

Suggested change
const uint32_t expected_slots = std::max(width, 1u);
if (g->tableSize() != id + expected_slots) {
error("'" + keyword + "' declared output width " + std::to_string(width)
+ " but produced " + std::to_string(g->tableSize() - id) + " slot"
+ (g->tableSize() - id == 1 ? "" : "s"));
}
const uint32_t actual_slots = g->tableSize() - id;
const uint32_t expected_slots = std::max(width, 1u);
if (actual_slots != expected_slots) {
error("'" + keyword + "' declared output width " + std::to_string(width)
+ " but produced " + std::to_string(actual_slots) + " slot"
+ (actual_slots == 1 ? "" : "s"));
}

@github-actions
Copy link
Copy Markdown
Contributor

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

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

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

Comment on lines +678 to +679
for (int i = -1; i < (int) cache[n1->fid].ps.size(); i++) {
for (int j = -1; j < (int) cache[n2->fid].ps.size(); j++) {
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.

Oops - sorry about that

@maliberty
Copy link
Copy Markdown
Member

[2026-05-22T19:14:04.162Z] In file included from /OpenROAD/src/syn/src/synthesis.cpp:18:
[2026-05-22T19:14:04.162Z] /OpenROAD/src/syn/src/flow/bitblast.h:10:6: error: redundant redeclaration of ‘void syn::bitblast(syn::Graph&, bool)’ in same scope [-Werror=redundant-decls]
[2026-05-22T19:14:04.162Z]    10 | void bitblast(Graph& g, bool blast_arith);
[2026-05-22T19:14:04.162Z]       |      ^~~~~~~~
[2026-05-22T19:14:04.162Z] In file included from /OpenROAD/src/syn/src/synthesis.cpp:4:
[2026-05-22T19:14:04.162Z] /OpenROAD/src/syn/src/../include/syn/synthesis.h:120:6: note: previous declaration of ‘void syn::bitblast(syn::Graph&, bool)’
[2026-05-22T19:14:04.162Z]   120 | void bitblast(Graph& g, bool blast_arith = true);

Signed-off-by: Martin Povišer <povik@cutebit.org>
@povik povik requested review from a team and precisionmoon and removed request for a team May 22, 2026 21:42
@povik povik enabled auto-merge May 22, 2026 21:48
@github-actions
Copy link
Copy Markdown
Contributor

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

@povik povik merged commit 9d18ad6 into The-OpenROAD-Project:master May 23, 2026
16 checks passed
@openroad-ci openroad-ci deleted the syn-fixes branch May 23, 2026 01:09
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.

2 participants