1.3. Conditional Branching

The qctoolkit was designed to model conditional branching in pulse execution using the classes BranchPulseTemplate and LoopPulseTemplate of the pulse template definition classes. The software is intended to support use of trigger-based hardware jumps between waveforms as well as software-based evaluation of branching conditions, if the hardware does not support triggers or highly sophisticated evaluation of measured data is required. These options are represented as instances of the Condition class: BranchPulseTemplate and LoopPulseTemplate both contain unique identifiers (chosen by the user) of a condition. In the beginning of the sequencing process, the user provides a dictionary of Condition instances which are used to determine how the conditions for each template are evaluated. Currently, two different subclasses of Condition exist: SoftwareCondition represents a software-evaluated condition and accepts a function reference to any evaluation function which must return a boolean value indicating whether or not the condition is fulfilled or None, if it cannot yet be evaluated; HardwareCondition represents trigger-based hardware evaluation and basically stores a reference to a trigger which will later be evaluated by the specific hardware driver to set up the device accordingly. Note that software-based evaluation will interrupt the sequencing process and thus the execution of the pulse if the evaluation cannot be performed during the sequencing run, e.g., if the evaluation of the condition is based on measurement data made during pulse execution. In this case, the pulse instruction sequence is only generated up to the branching and must be re-invoked later on, after executing this first part and obtaining the required data. Software-based evaluation is thus not feasible when high performance is required.

1.3.1. Future Work

Currently, the implemented hardware support does not support any triggers or conditional branching. This is still an open task.

It is possible for hardware to allow triggers that are represented not only a boolean signal but, e.g., any 8-bit signal, thus enabling more than two branching options. While this could still be represented by the current classes by nesting BranchPulseTemplate objects and configuring triggers appropriately, the implementation of a template class which acts like a C-style switch statement might be a worthwhile consideration.