qblox_scheduler.backends.qblox.operation_handling.virtual#

Classes for handling operations that are neither pulses nor acquisitions.

Attributes#

Classes#

IdleStrategy

Defines the behavior for an operation that does not produce any output.

NcoPhaseShiftStrategy

Strategy for operation that does not produce any output, but rather applies a

NcoResetClockPhaseStrategy

Strategy for operation that does not produce any output, but rather resets

NcoSetClockFrequencyStrategy

Strategy for operation that does not produce any output, but rather sets

AwgOffsetStrategy

Strategy for compiling a DC voltage offset instruction. The generated Q1ASM contains

ResetFeedbackTriggersStrategy

Strategy for resetting the count of feedback trigger addresses.

UpdateParameterStrategy

Strategy for compiling an "update parameters" real-time instruction.

LoopStrategy

Strategy for compiling a "Loop" control flow instruction.

ConditionalStrategy

Strategy for compiling a "Conditional" control flow instruction.

ControlFlowReturnStrategy

Strategy for compiling "ControlFlowReturn" control flow instruction.

TimestampStrategy

Strategy for compiling

AssignStrategy

Strategy for compiling an Assign

Module Contents#

class IdleStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: qblox_scheduler.backends.qblox.operation_handling.base.IOperationStrategy

Defines the behavior for an operation that does not produce any output.

Parameters:

operation_info (qblox_scheduler.backends.types.qblox.OpInfo) – The operation info that corresponds to this operation.

_op_info[source]#
property operation_info: qblox_scheduler.backends.types.qblox.OpInfo[source]#

Property for retrieving the operation info.

property generates_path_Q_output: bool[source]#

If True, this strategy compiles to instructions that generate output on Q. If False, the instructions either generate no output, or output only on path I.

generate_data(wf_dict: dict[str, Any]) None[source]#

Returns None as no waveforms are generated in this strategy.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Add the assembly instructions for the Q1 sequence processor that corresponds to this operation.

Not an abstractmethod, since it is allowed to use the IdleStrategy directly (e.g. for IdlePulses), but can be overridden in subclass to add some assembly instructions despite not outputting any data.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

class NcoPhaseShiftStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for operation that does not produce any output, but rather applies a phase shift to the NCO. Implemented as set_ph_delta and an upd_param of 8 ns, leading to a total duration of 8 ns before the next command can be issued.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Inserts the instructions needed to shift the NCO phase by a specific amount.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

class NcoResetClockPhaseStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for operation that does not produce any output, but rather resets the phase of the NCO.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Inserts the instructions needed to reset the NCO phase.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

class NcoSetClockFrequencyStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for operation that does not produce any output, but rather sets the frequency of the NCO. Implemented as set_freq and an upd_param of 4 ns, leading to a total duration of 4 ns before the next command can be issued.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Inserts the instructions needed to set the NCO frequency.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

class AwgOffsetStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling a DC voltage offset instruction. The generated Q1ASM contains only the set_awg_offs instruction and no upd_param instruction.

property generates_path_Q_output: bool[source]#

If True, this strategy compiles to instructions that generate output on Q. If False, the instructions either generate no output, or output only on path I.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Add the Q1ASM instruction for a DC voltage offset.

Parameters:

qasm_program (QASMProgram) – The QASMProgram to add the assembly instructions to.

class ResetFeedbackTriggersStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for resetting the count of feedback trigger addresses.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Add the assembly instructions for the Q1 sequence processor that corresponds to this pulse.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

class UpdateParameterStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling an “update parameters” real-time instruction.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Add the upd_param assembly instruction for the Q1 sequence processor.

Parameters:

qasm_program (QASMProgram) – The QASMProgram to add the assembly instructions to.

class LoopStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling a “Loop” control flow instruction.

Empty as it is used for isinstance.

class ConditionalStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo, trigger_condition: qblox_scheduler.backends.qblox.conditional.FeedbackTriggerCondition)[source]#

Bases: IdleStrategy

Strategy for compiling a “Conditional” control flow instruction.

trigger_condition[source]#
class ControlFlowReturnStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling “ControlFlowReturn” control flow instruction.

Empty as it is used for isinstance.

class TimestampStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling Timestamp.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Inserts the instructions needed insert a time reference.

Parameters:

qasm_program – The QASMProgram to add the assembly instructions to.

_BINARY_OP_TO_Q1ASM: dict[str, str][source]#
class AssignStrategy(operation_info: qblox_scheduler.backends.types.qblox.OpInfo)[source]#

Bases: IdleStrategy

Strategy for compiling an Assign statement into backend register instructions.

Complex expressions are compiled recursively: each sub-expression is evaluated into a temporary register that is freed as soon as it is consumed, keeping register pressure at O(expression depth) rather than O(expression size).

* (constant times runtime value only) requires a target with QASMISACapabilities.multiplication (Q1 ISA version >= 2.0, cluster firmware >= 1.1) and raises NotImplementedError otherwise; see _compile_multiplication() for the fixed-point details. / and // are always unsupported, since Q1ASM has no divide instruction.

insert_qasm(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Add register related assembly instruction for the Q1 sequence processor.

Parameters:

qasm_program (QASMProgram) – The QASMProgram to add the assembly instructions to.

_compile_into(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram, expr: qblox_scheduler.operations.expressions.Expression | int | float, dtype: qblox_scheduler.operations.expressions.DType, destination_register: str) None[source]#

Compile expr and store the result directly into destination_register.

_compile_multiplication(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram, expr: qblox_scheduler.operations.expressions.BinaryExpression, dtype: qblox_scheduler.operations.expressions.DType, dst_reg: str) None[source]#

Compile constant * expr (or expr * constant) into dst_reg.

The runtime operand stays in its dtype’s fixed-point representation; the constant is represented as c_fixed = round(constant * 2**k) which is a dimensionless scale factor, encoded here as k-bit integer with k as large as possible (at most 31). The full 64-bit product operand * c_fixed is assembled from muls32h (higher 32 bits) and muls32l (lower 32 bits) and then shifted right by k to restore the constant’s fixed-point scale (2**k).

_get_operand(qasm_program: qblox_scheduler.backends.qblox.qasm_program.QASMProgram, expr: qblox_scheduler.operations.expressions.Expression | int | float, dtype: qblox_scheduler.operations.expressions.DType) collections.abc.Iterator[str | int][source]#

Yield a register or immediate for expr, freeing any temp register on exit.