syn: Fix combinational mapper; extend tests#10495
Conversation
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>
There was a problem hiding this comment.
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.
| 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")); | ||
| } |
There was a problem hiding this comment.
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.
| 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")); | |
| } |
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
|
clang-tidy review says "All clean, LGTM! 👍" |
| for (int i = -1; i < (int) cache[n1->fid].ps.size(); i++) { | ||
| for (int j = -1; j < (int) cache[n2->fid].ps.size(); j++) { |
|
Signed-off-by: Martin Povišer <povik@cutebit.org>
|
clang-tidy review says "All clean, LGTM! 👍" |
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
Impact
Verification
./etc/Build.sh).