DDSimDebug.hpp¶
Contains the implementation of the SimulationState interface for the DD simulator and related data structures and tools.
-
namespace mqt
-
namespace debugger
Enums
-
enum InstructionType
Represents the different types of an instruction.
Values:
-
enumerator NOP
Nothing happens when this instruction is encountered, as the simulation backend already handled it at “compile”-time.
-
enumerator SIMULATE
The instruction is a quantum operation that has to be simulated on the simulation backend.
-
enumerator ASSERTION
The instruction is an assertion that has to be checked.
-
enumerator CALL
The instruction is a custom gate call.
-
enumerator RETURN
The instruction returns from a custom gate call.
-
enumerator NOP
-
struct ClassicalRegisterDefinition
- #include <DDSimDebug.hpp>
Represents a classical register in the code.
Public Members
-
std::string name
The name of the register.
-
size_t index
The index of the register in the set of classical variables.
-
size_t size
The size of the register.
-
std::string name
-
struct DDSimulationState
- #include <DDSimDebug.hpp>
The DD-simulator implementation of the
SimulationStateinterface.Public Members
-
SimulationState interface
The
SimulationStateinterface.
-
size_t currentInstruction
The current instruction during execution.
-
std::string code
The code being executed.
-
std::string processedCode
The code being executed, after preprocessing.
-
bool ready
Indicates whether the debugger is ready to start simulation.
-
std::vector<std::unique_ptr<qc::Operation>>::iterator iterator
The iterator pointing to the current instruction in the simulation.
-
dd::VectorDD simulationState
The DD vector representing the current simulation state.
-
std::vector<InstructionType> instructionTypes
A vector containing the
InstructionTypeof each instruction.
-
std::vector<size_t> instructionStarts
A vector containing the start positions in the code of each instruction.
-
std::vector<size_t> instructionEnds
A vector containing the end positions in the code of each instruction.
-
std::set<size_t> functionDefinitions
A vector containing the instruction indices of all function definitions.
-
std::map<size_t, std::unique_ptr<Assertion>> assertionInstructions
A map containing the instruction indices of all assertion, mapped to their
Assertionobjects.
-
std::map<size_t, size_t> successorInstructions
Maps each instruction to its successor instruction.
-
std::vector<QubitRegisterDefinition> qubitRegisters
A vector containing all qubit registers.
This vector is already populated before the simulation starts and the respective declaration is found.
-
std::vector<ClassicalRegisterDefinition> classicalRegisters
A vector containing all classical registers.
This vector is already populated before the simulation starts and the respective declaration is found.
-
std::map<std::string, Variable> variables
Maps the names of all classical variables to their values.
-
std::vector<std::unique_ptr<std::string>> variableNames
A vector containing the names of all classical variables.
-
std::vector<size_t> previousInstructionStack
The current stack of previous instructions. Stepping backward pops this stack.
The stack will be cleared when a measurement is encountered.
-
std::vector<size_t> callReturnStack
The current stack of return instructions. Reaching a
RETURNinstruction pops this stack.
-
std::map<size_t, std::map<std::string, std::string>> callSubstitutions
Maps each custom gate call instruction to the substitutions for this call.
The substitution maps the names of the parameters of the custom gate to the names of the variables used to call the custom gate.
-
std::vector<std::pair<size_t, size_t>> restoreCallReturnStack
Saves elements removed from the
callReturnStackso that they can be reused when stepping back.
-
std::map<size_t, std::vector<std::pair<size_t, size_t>>> dataDependencies
Maps each instruction index to a vector of its immediate data dependencies.
For each variable used by this instruction, this vector contains a reference to the last instruction that used it. It also contains the index of the variable in that dependency’s argument list, so that it can be identified exactly.
-
std::map<size_t, std::set<size_t>> functionCallers
Maps each custom gate definition to a set of all instructions that call it.
-
std::set<size_t> breakpoints
A set of all breakpoints set by the user.
-
std::vector<std::vector<std::string>> targetQubits
A vector containing the names of all target qubits for each instruction.
-
bool paused
Indicates whether the simulation should be paused.
-
size_t lastFailedAssertion
Stores the last instruction that failed an assertion.
-
size_t lastMetBreakpoint
Stores the last instruction that hit a breakpoint.
-
DDDiagnostics diagnostics
The diagnostics instance used for analysis.
-
std::vector<Instruction> instructionObjects
Object representations of all parsed instructions.
-
SimulationState interface
-
struct QubitRegisterDefinition
- #include <DDSimDebug.hpp>
Represents a qubit register in the code.
Public Members
-
std::string name
The name of the register.
-
size_t index
The index of the register in the set of quantum variables.
-
size_t size
The size of the register.
-
std::string name
-
enum InstructionType
-
namespace debugger