Problem Statement
IfElse Operations in OpenQASM can be based on more than just equality conditions.
The underlying MQT Core framework already supports all of the different types of IFElse Operations, such as different comparison conditions and checks that only use subsets of classical registers or single classical bits.
Furthermore, we currently only allow IfElse Operations that contain only a single instruction in the "then" block. This makes tracking the current operation easier, but obviously does not match the full OpenQASM standard. We should therefore implement support for multi-instruction bodies accordingly.
The following are some code examples that should work in standard OpenQASM but are not allowed/parsed correctly by the debugger:
qreg q[3];
creg c[3];
...
if (c == 0) {
x q[0];
}
This only works without the if body:
qreg q[3];
creg c[3];
...
if (c == 0) {
x q[0];
}
This is not supported by the Debugger's parser at all.
The debugger only supports equality conditions for if blocks, but the simulation backend supports other conditions, too, so this should be a straightforward enhancement.
Proposed Solution
In the DDSimDebug.cpp backend and the CodePreprocessor.cpp, support for the corresponding operation types should be added when stepping through the code.
Problem Statement
IfElseOperations in OpenQASM can be based on more than just equality conditions.The underlying MQT Core framework already supports all of the different types of
IFElseOperations, such as different comparison conditions and checks that only use subsets of classical registers or single classical bits.Furthermore, we currently only allow
IfElseOperations that contain only a single instruction in the "then" block. This makes tracking the current operation easier, but obviously does not match the full OpenQASM standard. We should therefore implement support for multi-instruction bodies accordingly.The following are some code examples that should work in standard OpenQASM but are not allowed/parsed correctly by the debugger:
This only works without the
ifbody:This is not supported by the Debugger's parser at all.
The debugger only supports equality conditions for
ifblocks, but the simulation backend supports other conditions, too, so this should be a straightforward enhancement.Proposed Solution
In the
DDSimDebug.cppbackend and theCodePreprocessor.cpp, support for the corresponding operation types should be added when stepping through the code.