Description
Environment information
- OS: Windows 10 x64
- C++ Compiler: clang 17.0.3
- MQT-Core: 3.0.3
- MQT-Syrec: Commit #a95ae75
Description
PR #220 added an option in the syrec::ReadProgramSettings
of the parser to define how integer constants are truncated to the expected bitwidth in an expression with the help of the utils::IntegerConstantTruncationOperation
enum. However, for certain statements or expressions, the expected bitwidth is not known when the statement is processed by the parser but only when its synthesized as shown with the example below:
module main(inout a(2))
for $i = 1 to (#a - 1) step 1 do
a.(#a - 2):$i ^= 3
rof
Since the bitwidth of the left-hand side of the assignment is not known, the bitwidth of the numeric expression created to store the integer constant 3 on the right-hand side of the assignment is set to 32 (the maximum for an unsigned integer).
If the unrolled assign statements of the for
loop are synthesized the bitwidths of the left and right side of the assignments to not match (iteration: 0, lhs= 2, rhs =32) and (iteration: 1, lhs=1, rhs = 32) and thus cannot be synthesized.
Expected behavior
Integer constants should be truncated (if not already done in the parser) to the expected bitwidth in an expression.
How to Reproduce
- Perform a build from source of mqt.syrec
- Launch the syrec-editor python application and copy the SyReC circuit from the bug description into the code editor
- Select either the cost or line aware synthesis radio button and then press the 'Build' button