Commit c957958f authored by Adriaan's avatar Adriaan
Browse files

Merge branch 'virtual-z' into 'main'

Qblox backend - Add clock phase shift operation support

See merge request !346
parents 7f1b8afc 05662a88
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,10 +23,12 @@ Merged branches and closed issues
* Operations - Sudden Net Zero from Negirneac 2021 added to the `pulse_library` (!339)
* Compilation - Added a new compilation backend `compilation.backends.circuit_to_device.compile_circuit_to_device` for the quantum-circuit to quantum-device layer (#64, #67, !339).
* Compilation - Fixed `add_pulse_information_transmon` when using "Trace" acquisition mode (!300)
* Pulse library - Added `ShiftClockPhase` operation that can be used to shift the phase of a clock during execution of a `Schedule` (!346)
* Visualization - Adds visualisation of acquisitions to plotly pulse diagrams (!304)
* Visualization - Add `plot_pulse_diagram` and `plot_circuit_diagram` to schedule for easier method names, and enable plotly visualization directly from `ScheduleBase` (!313)
* Instrument Coordinator - IC now adds a GenericInstrumentCoordinator to itself on instantiation by default.
* Qblox ICCs - `_QRMAcquisitionManager._get_scope_data` now has correct return type (#232, !300)
* Qblox backend - Added logic for changing the nco phase during execution of a `Schedule` (!346)
* Qblox backend - Compilation with local oscillators changed to work with generic instrument coordinator components (!306)
* Qblox backend - Refactored operation handling and greatly increased test coverage (!301).
* Qblox backend - Made max duration of wait instructions (!319).
+8 −2
Original line number Diff line number Diff line
@@ -1036,7 +1036,9 @@ class QbloxBaseModule(ControlDeviceCompiler, ABC):
        for portclock, pulse_data_list in self._pulses.items():
            for seq in self.sequencers.values():
                instr_gen_pulses = seq.instruction_generated_pulses_enabled
                if seq.portclock == portclock:
                if seq.portclock == portclock or (
                    portclock[0] is None and portclock[1] == seq.clock
                ):
                    partial_func = partial(
                        get_operation_strategy,
                        instruction_generated_pulses_enabled=instr_gen_pulses,
@@ -1046,7 +1048,11 @@ class QbloxBaseModule(ControlDeviceCompiler, ABC):
                        partial_func,
                        pulse_data_list,
                    )
                    seq.pulses = list(func_map)
                    if seq.pulses is None:
                        seq.pulses = []

                    for pulse_strategy in func_map:
                        seq.pulses.append(pulse_strategy)

        for portclock, acq_data_list in self._acquisitions.items():
            for seq in self.sequencers.values():
+15 −0
Original line number Diff line number Diff line
@@ -12,6 +12,21 @@ IMMEDIATE_SZ_OFFSET = pow(2, 16) - 1
"""Size of offset instruction immediates in Q1ASM programs."""
REGISTER_SIZE = pow(2, 32) - 1
"""Size of registers in Q1ASM programs."""
NCO_PHASE_DEG_STEP_COURSE = 0.9
"""The phase (in deg) corresponding to an increase of 1 in the course argument of the
q1asm instructions related to the NCO phases."""
NCO_PHASE_NUM_STEP_COURSE = 400
"""The maximum value of the course argument of the nco phase instructions."""
NCO_PHASE_DEG_STEP_FINE = 2.25e-3
"""The phase (in deg) corresponding to an increase of 1 in the fine argument of the
q1asm instructions related to the NCO phases."""
NCO_PHASE_NUM_STEP_FINE = 400
"""The maximum value of the fine argument of the nco phase instructions."""
NCO_PHASE_DEG_STEP_U_FINE = 3.6e-7
"""The phase (in deg) corresponding to an increase of 1 in the ultra-fine argument of
the q1asm instructions related to the NCO phases."""
NCO_PHASE_NUM_STEP_U_FINE = 6250
"""The maximum value of the ultra-fine argument of the nco phase instructions."""

GRID_TIME = 4  # ns
"""
+28 −0
Original line number Diff line number Diff line
@@ -362,3 +362,31 @@ def is_multiple_of_grid_time(
    """
    time_ns = int(round(time * 1e9))
    return time_ns % grid_time_ns == 0


def get_nco_phase_arguments(phase_deg: float) -> Tuple[int, int, int]:
    """
    Converts a phase in degrees to the int arguments the NCO phase instructions expect.

    Parameters
    ----------
    phase_deg
        The phase in degrees

    Returns
    -------
    :
        The three ints corresponding to the phase arguments (course, fine, ultra-fine).
    """
    phase_course: int = int(phase_deg // constants.NCO_PHASE_DEG_STEP_COURSE)
    assert phase_course <= constants.NCO_PHASE_NUM_STEP_COURSE

    remaining_phase = phase_deg % constants.NCO_PHASE_DEG_STEP_COURSE
    phase_fine: int = int(remaining_phase // constants.NCO_PHASE_DEG_STEP_FINE)
    assert phase_fine <= constants.NCO_PHASE_NUM_STEP_FINE

    remaining_phase = remaining_phase % constants.NCO_PHASE_DEG_STEP_FINE
    phase_ultra_fine: int = int(remaining_phase // constants.NCO_PHASE_DEG_STEP_U_FINE)
    assert phase_fine <= constants.NCO_PHASE_NUM_STEP_U_FINE

    return phase_course, phase_fine, phase_ultra_fine
+6 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ from quantify_scheduler.backends.qblox.operation_handling import (
    base,
    pulses,
    acquisitions,
    virtual,
)


@@ -36,6 +37,11 @@ def get_operation_strategy(
    :
        The instantiated strategy object.
    """
    if operation.data["port"] is None:
        if operation.name == "ShiftClockPhase":
            return virtual.NcoPhaseShiftStrategy(operation)
        return virtual.IdleStrategy(operation)

    if operation.is_acquisition:
        return _get_acquisition_strategy(operation)
    return _get_pulse_strategy(
Loading