-
Notifications
You must be signed in to change notification settings - Fork 10
Synthesis of shift expressions with shift amount larger or equal to bitwidth of to be shift expression. #297
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
Synthesis of shift expressions with shift amount larger or equal to bitwidth of to be shift expression. #297
Conversation
… only simulated input/output pairs
…n the bitwidth of the to be shift expression (N) is equal to the creation of N ancillary qubits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…uring synthesis and equal to the bitwidth of the to be shifted expression
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the synthesis of shift expressions by optimizing cases where the shift amount is greater than or equal to the bitwidth of the shifted expression. In such cases, the result is mathematically equivalent to zero, so the PR simplifies the synthesis to create N ancillary qubits (where N is the bitwidth) instead of performing the actual shift operation.
- Fixes #258 by optimizing shift expressions with large shift amounts
- Updates synthesis logic to return early when shift amount >= bitwidth
- Improves parameter naming for better code clarity
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
test/unittests/simulation/test_synthesis_basic_operations.cpp | Adds comprehensive test cases for shift expression synthesis edge cases |
test/unittests/simulation/data/test_synthesis_of_basic_operations.json | Provides test data for all new shift expression test cases |
src/algorithms/synthesis/syrec_synthesis.cpp | Implements the optimization logic and improves parameter naming |
include/algorithms/synthesis/syrec_synthesis.hpp | Updates function signatures with more descriptive parameter names |
…d modulo operations.
Description
With this PR the synthesis of a shift expression in which the defined shift amount is larger or equal to the bitwidth of the to be shifted expression (N) is "simplified" to the creation of N ancillary qubits (i.e. equal to an substitution of the shift expression with the constant 0) with the latter storing the result of the shift expression.
Fixes #258
Checklist: