# Timing Rules

LabOne Q follows strict rules to determine the timing of pulses defined in the DSL. In the following, these rules are presented in an abstract, but unambiguous way. The documentation chapter on Sections and Pulses gives a more descriptive introduction.

## Definitions

### Pulse

A pulse describes a waveform. A pulse can either be defined through its functional form (drawn from the pulse library), or as a sequence of samples (a numpy array). Pulses are played on experiment signal lines as part of the experiment definition.

### Signals

Experiment Signals provide an abstract line on which pulses can be laid out during the experiment definition.

Logical Signals have a 1-to-1 mapping to Experiment Signals. Each logical signal is linked to physical instrument channels and possesses calibration properties.

 The section on Logical Signal Lines explains the signal lines and types in greater detail.

### Sections

Sections help the user structure their experiment into logical units with predictable timing relations. Sections can contain either other sections or pulses.

Sections govern the timing and order of the pulses or sub-sections they contain. Sections are said to "use" all experiment signals that they contain either directly or through their sub-sections.

### Control Elements

Control elements themselves do not produce pulses, but govern how pulses are played back. We distinguish three types of control elements:

1. Software Control Elements: They are executed by the LabOne Q Controller in near-time. Software control elements must be executed before or after the real-time section of an experiment. They can be used e.g. to sweep instrument nodes in near-time.

2. Instrument Control Elements: These control elements involve changing settings or other parameters that affect strictly one instrument. An example is the real-time change of the phase of a hardware oscillator. Instrument control elements are normally aligned to the System Timing grid of the specific instrument. See rule 5 below for a definition of the different timing grids.

3. System Control Elements: System control elements affect all instruments in the experiment and include real-time loops with run-time determined end conditions, triggering of qubit readout.

## Rules

The following list is a consistent set of rules that determine the timing of pulses played as part of any Experiment in LabOne Q.

1. Pulses are bound to signals.

2. Sections may contain pulses or other sections. Sections that are executed in sample-precise real-time may contain either other sections or pulses, but not both.

3. A section is bound to the signals it contains, as well as to the union of all signals its child sections contain.

4. Signals that are used in a section A cannot be accessed at the same time in any other section which is not a subsection of section A.

5. There are two timing grids the LabOne Q software uses (see the table below):

1. The signal timing grid is determined by the sampling rate of the given signal line

2. The system timing grid for a single instrument is determined by its sequencer clock rate.

3. The system timing grid of the whole setup is determined by the commensurate system timing grid of all instruments in the measurement setup.

6. Pulses are aligned to the signal timing grid of the signal lines they are bound to.

7. Sections are aligned to the signal or system timing grid, depending on their contents. This means they must both start and end on their grid.

1. Sections containing only signals with the same signal timing grid, and no system control elements, are aligned to the signal timing grid of the used signals.

2. Sections containing signals with different signal timing grids are aligned to the system timing grid.

3. Sections with control elements are aligned to the system timing grid.

4. Sections containing subsections that are aligned to the system timing grid are themselves aligned to the system timing grid.

8. Pulses on the same signal are scheduled sequentially, and pulses on separate signals are scheduled in parallel, unless prevented by user-defined constraints.

9. Sections are scheduled in parallel if there is no overlap in the signals used by them, and unless prevented by user-defined constraints.

10. Sections have a minimum allowed length:

1. Sections aligned to the system grid (see Rule 7) have a minimum section length determined by the sequencers controlling the waveform playback (see table below).

2. Sections aligned to the signal grid (see table below) have a minimum section length of 1 sample.

3. Sections can have length 0, regardless of their alignment requirements. This allows e.g. the creation of barriers.

11. The length of a section can be

1. determined automatically by the length and placement of pulses played on the signals within that section, including subsections, as well as padding to satisfy the timing rules.

2. specified by the user. Then, the given section length is the minimum length the section must have. The compiler might apply the necessary padding to satisfy the timing rules.

12. Lengths are specified in units of seconds with the default value 0 ns. Lengths must be greater than or equal to 0 ns.

13. Sections can be left aligned or right aligned.

1. Left-aligned sections are constructed from left to right, with a start point determined by the timing grid of that section. All elements are scheduled to be played as early as possible, given all constraints. If necessary, the section is zero-padded on the right to bring its end to the relevant timing grid.

2. Right-aligned sections are constructed from right to left, with an endpoint determined by the timing grid of that section. All elements are scheduled to be played as late as possible, given all constraints. If necessary, the section is zero-padded on the left to bring its start to the relevant timing grid.

14. The alignment of sections applies to all pulses and sections directly contained within the first section, but does not propagate to the sub-sections.

15. An error is generated at compile time when user requirements for pulse and section timings cannot be fulfilled.

Table 1. Signal and system timing grids for single instruments and instrument combinations.
Instruments Signal Timing Grid [ns] System Timing Grid [ns]

HDAWG (@2.4 GSa/s)

0.417

3.333

UHFQA

0.556

4.444

SHF* or HDAWG @2.0 GSa/s

0.5

4.0

HDAWG + UHFQA

N/A

13.3

HDAWG + SHF*

0.5

4.0

 Refer to the description of the setup definition to learn more about instrument combinations and their sampling rates.