-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
What's the problem this feature will solve?
The current SyReC grammar (see RevLib 2.0.1- Page 2 restricts parameter arguments in Call-/UncallStatements to variable identifiers. Passing certain bits, bit ranges or only a specific value of a dimension as anparameter argument requires the user to create ancillary qubits as shown in the example below:
module add(in a(1), in b(1), out c(1))
c += (a + b)
module main(inout a(3))
wire t_0(1), t_1(1), t_2(1)
t_0 ^= a.0; t.1 ^= a.1;
call add(t_0, t_1, t_2);
a.2 ^= t_2
Describe the solution you'd like
Assuming that no non-compile-time constant expressions are used in any component of a VariableAccess then passing bits/bitranges or a value of a dimension as a parameter argument should require no additionally ancillary qubits with the previous example simplifying to:
module add(in a(1), in b(1), out c(1))
c += (a + b)
module main(inout a(3))
call add(a.0, a.1, a.2)
However, this would introduce a breaking change between the reference and the supported SyReC grammar of this library and documented accordingly. An additional parser configuration flag could be used to:
- Restrict oneself to the reference grammar
- Support both version of the grammar and optionally transforming a SyReC program using the "extended" grammar to a SyReC program conforming to the reference grammar.