AWG Tab
The AWG tab is available on UHFAWG Arbitrary Waveform Generator instruments and on UHFLI Lock-in Amplifier instruments with installed UHF-AWG Arbitrary Waveform Generator option (see Information section in the Device tab).
Features
-
Dual-channel arbitrary waveform generator
-
128 MSa waveform memory per channel
-
Sequence branching
-
Digital modulation
-
Multi-instrument synchronization
-
Sequence program distribution over multiple instruments
-
Cross-domain trigger engine
-
Sequence Editor with code highlighting and auto completion
-
High-level programming language with waveform generation and editing toolset
-
Waveform viewer
Description
The AWG tab gives access to the arbitrary waveform generator functionality. Whenever the tab is closed or an additional one of the same type is needed, clicking the following icon will open a new instance of the tab.
Control/Tool | Option/Range | Description |
---|---|---|
AWG |
Generate arbitrary signals using sequencing and sample-by-sample definition of waveforms. |
The AWG tab (see Figure 1) consists of a settings section on the right side and the Sequence and Waveform Viewer sub-tabs on the left side. The settings section is further divided into Control, Waveform, Trigger, and Advanced sub-tabs. The Sequence sub-tab is used for displaying, editing and compiling a LabOne sequence program. The sequence program defines which waveforms are played and in which order. The Sequence Editor is the main tool for operating the AWG.

A number of sequence programming examples are available through a drop-down menu at the top of the Sequence Editor, and additional ones can be found in Arbitrary Waveform Generator . The LabOne sequence programming language is specified in detail in LabOne Sequence Programming. The language comes with a number of predefined waveforms, such as Gaussian, Blackman, sine, or square functions. By combining those predefined waveforms using the waveform editing tools (add, multiply, cut, concatenate, etc), signals with a high level of complexity can be generated directly from the Sequence Editor window. Sample-by-sample definition of the output signal is possible by using comma-separated value (CSV) files specified by the user , see Waveform Generation and Playbackfor an example.
The AWG features a compiler which translates the high-level sequence program into machine instructions and waveform data to be stored in the instrument memory as shown in Figure 2. The sequence program is written using high-level control structures and syntax that are inspired by human language, whereas machine instructions reflect exactly what happens on the hardware level. Writing the sequence program using a high-level language represents a more natural and efficient way of working in comparison to writing lists of machine instructions, which is the traditional way of programming AWGs. Concretely, the improvements rely on features such as:
-
combination of waveform generation, editing, and playback sequence in a single script
-
easily readable syntax and naming for run-time variables and constants
-
optimized waveform memory management, reduced transfers upon waveform changes
-
definition of user functions and procedures for advanced structuring
-
syntax validation
By design, there is no one-to-one link between the list of statements in the high-level language and the list of instructions executed by the Sequencer. There are cases in which a more detailed understanding of the Sequencer instruction list, and in particular its execution timing, is needed. Typically this is the case when observing delays or other signal timing properties that are unexpected from looking at the high-level script. Often such problems can be solved with a few adjustments to the program. Please see Debugging Sequencer Programs for practical advice.
The Sequence Editor provides the editing, compilation, and transfer functionality for sequence programs. A program typed into the Editor is compiled upon clicking . If the compilation is successful and Automatic Upload is enabled, the program including all necessary waveform data is transferred to the device. If the compilation fails, the Status field will display debug messages. Clicking on
allows you to choose a new name for the program. The name of the program that is currently edited is displayed at the top of the editor. External program files as well as waveform data files can be transferred to the right location easily using the file drag-and-drop zone in the Config Tab so they become accessible from the user interface. The files can be managed in the File Manager Tab and their location in the directory structure is shown in Table 2. The program name is displayed in a drop-down box. The box allows quick access to all programs in the standard sequence program location. It is possible to quickly switch between programs using the box. Changes made in one program will be preserved when switching to a different program. The file name of a program will be postfixed by an asterisk in case there are unsaved changes in the source file. Note that switching programs in the editor is not sufficient to also update the program in the instrument. In order to send a newly selected program to the instrument, the
button must be clicked.
File type | Location |
---|---|
Waveform files (Windows) |
|
Sequence programs (Windows) |
|
Waveform files (Linux) |
|
Sequence programs (Linux) |
|
In the Control sub-tab the user configures signal parameters and controls the execution of the AWG. The AWG can be started in by clicking on . When enabling the Rerun button, the Sequencer will be restarted automatically when its program completes. The continuous mode is a simple way to create an infinite loop, but it results in a considerable timing jitter. To avoid this jitter, it is recommended to specify infinite loops directly in the sequence program.
The Sampling Rate field is used to control the default playback sampling rate of the AWG. The sampling rate is dynamic, i.e., can be specified for each waveform by using an optional argument in the waveform playback instructions in the sequence program. This allows for considerably reducing waveform upload time for signals that contain both fast and slow components. The two Output sections are used to configure the AWG output mode and signal amplitude. The AWG output channels are not the same as the physical Signal Outputs of the instrument. The AWG output channels are routed to the Signal Outputs of the device. The Amplitude value is a gain parameter, 1.0 by default, that is applied to waveforms on the way from the AWG output channel to the Signal Output. The Amplitude value gives a means to rescale the signal independently of the programmed waveforms. The Mode control is used to enable or disable the modulation mode . With enabled modulation, the signal of an AWG Output is multiplied with an oscillator signal prior to being sent to the Signal Output. This is useful for the case where the desired signal can be described as a sinusoidal carrier with a shaped envelope. Please refer to Architecture and Signalling for a description and block diagram of the signalling in modulation mode.
The Waveform sub-tab displays information about the waveforms that are used by the current sequence program, such as their length and channel number. Together with the Waveform viewer sub-tab, it is a useful tool to visualize the waveforms used in the sequence program.
On the Trigger sub-tab you can configure the trigger inputs of the AWG and control the Cross-Domain Trigger functionality of the instrument. The AWG has four trigger input channels which can be configured to probe a variety of signals . This means that the AWG trigger input channels are not the same as physical device inputs. Two of the trigger input channels are called analog (meaning they can accept signals of continuous, analog-like character), and two are called digital (meaning they can accept binary signals). Trigger Level and Hysteresis may be configured for the Analog Triggers, and the user can select between rising and falling edge trigger functionality. The primary use of the triggers is to control the timing of the AWG signal relative to an external device. Another use of triggers is to implement sequence branching.
The Advanced sub-tab displays the compiled list of sequencer instructions and the current state of the sequencer on the instrument. This can help an advanced user in debugging a sequence program and understanding its execution.
Sequence Editor Keyboard Shortcuts
The tables below list a number of helpful keyboard shortcuts that are applicable in the LabOne Sequence Editor.
Shortcut | Action |
---|---|
Ctrl-D |
Remove line |
Alt-Shift-Down |
Copy lines down |
Alt-Shift-Up |
Copy lines up |
Alt-Down |
Move lines down |
Alt-Up |
Move lines up |
Alt-Delete |
Remove to line end |
Alt-Backspace |
Remove to line start |
Ctrl-Backspace |
Remove word left |
Ctrl-Delete |
Remove word right |
Shortcut | Action |
---|---|
Ctrl-A |
Select all |
Shift-Left |
Select left |
Shift-Right |
Select right |
Ctrl-Shift-Left |
Select word left |
Ctrl-Shift-Right |
Select word right |
Shift-Home |
Select line start |
Shift-End |
Select line end |
Alt-Shift-Right |
Select to line end |
Alt-Shift-Left |
Select to line start |
Shift-Up |
Select up |
Shift-Down |
Select down |
Shift-PageUp |
Select page up |
Shift-PageDown |
Select page down |
Ctrl-Shift-Home |
Select to start |
Ctrl-Shift-End |
Select to end |
Ctrl-Shift-D |
Duplicate selection |
Ctrl-Shift-P |
Select to matching bracket |
Shortcut | Action |
---|---|
Left |
Go to left |
Right |
Go to right |
Ctrl-Left |
Go to word left |
Ctrl-Right |
Go to word right |
Up |
Go line up |
Down |
Go line down |
Alt-Left, Home |
Go to line start |
Alt-Right, End |
Go to line end |
PageUp |
Go to page up |
PageDown |
Go to page down |
Ctrl-Home |
Go to start |
Ctrl-End |
Go to end |
Ctrl-L |
Go to line |
Ctrl-Down |
Scroll line down |
Ctrl-Up |
Scroll line up |
Ctrl-P |
Go to matching bracket |
Shortcut | Action |
---|---|
Ctrl-F |
Find |
Ctrl-H |
Replace |
Ctrl-K |
Find next |
Ctrl-Shift-K |
Find previous |
Shortcut | Action |
---|---|
Alt-L |
Fold selection |
Alt-Shift-L |
Unfold |
Shortcut | Action |
---|---|
Tab |
Indent |
Shift-Tab |
Outdent |
Ctrl-Z |
Undo |
Ctrl-Shift-Z,Ctrl-Y |
Redo |
Ctrl-/ |
Toggle comment |
Ctrl-Shift-U |
Change to lower case |
Ctrl-U |
Change to upper case |
Insert |
Overwrite |
Ctrl-Shift-E |
Macros replay |
Ctrl-Alt-E |
Macros recording |
Delete |
Delete |
LabOne Sequence Programming
A Simple Example
The syntax of the LabOne AWG Sequencer programming language is based on C, but with a few simplifications. Each statement is concluded with a semicolon, several statements can be grouped with curly brackets, and comment lines are identified with a double slash. The following example shows some of the fundamental functionalities: waveform generation, repeated playback, triggering, and single/dual-channel waveform playback. See Arbitrary Waveform Generator for a step-by-step introduction with more examples.
// Define an integer constant const N = 4096; // Create two Gaussian pulses with length N points, // amplitude +1.0 (-1.0), center at N/2, and a width of N/8 wave gauss_pos = 1.0*gauss(N, N/2, N/8); wave gauss_neg = -1.0*gauss(N, N/2, N/8); // execute playback sequence 100 times repeat (100) { // Play pulse on AWG channel 1 playWave(gauss_pos); // Play pulses simultaneously on both AWG channels playWave(gauss_pos, gauss_neg); // Wait 8000 samples playZero(8000); }
Multi-Instrument Support
The UHFQA supports multi-instrument operation by two important features
-
Automatic synchronization
-
Multi-instrument sequence program compilation
The first feature ensures that signals of multiple AWGs are precisely aligned in time and the user does not have to worry about cable delays, or about varying trigger delays after power cycles. The second feature greatly simplifies writing sequence program, as it allows to treat a setup with multiple AWGs conceptually like a single instrument.
Automatic synchronization can be set up using the Multi-Device Sync tab and is explained in detail in Multi Device Sync Tab . We assume that two UHFQA have been successfully synchronized according to the instructions in this section. Here we show an example of a sequence program to generate synchronized signals on two instruments
As part of the synchronization procedure using MDS, the LabOne Data Server running on the host PC is connected to both instruments.
In the AWG tab, enable the Multi-Device button.
The LabOne AWG Compiler is then able to distribute the high-level, multi-channel program the user enters in the AWG tab across all instruments. The Signal Output on which a given wave w
is played is controlled by the integer argument sig_out
in the instruction playWave(sig_out, w)
.
The numbering of the Signal Outputs is as follows:
Channel number in sequence program | Instrument number (according to order in MDS tab) | Signal Output number |
---|---|---|
1 |
Leader |
1 |
2 |
Leader |
2 |
3 |
Follower 1 |
1 |
4 |
Follower 1 |
2 |
5 |
Follower 2 |
1 |
… |
… |
… |
The sequence program below contains three playWave
instructions: the first instruction generates a pulse on instrument no. 1, the second one on instrument no. 2, and the third playWave
instruction generates pulses simultaneously on both instruments.
wave w_gauss = gauss(8000, 4000, 1000); while (true) { setTrigger(1); // Pulse on AWG 1 (Signal Output 1): playWave(1, w_gauss); // Pulse on AWG 2 (Signal Output 1): playWave(3, w_gauss); // Pulse on AWG 1 (Signal Outputs 1 & 2) // and on AWG 2 (Signal Outputs 1 & 2): playWave(1, w_gauss, 2, w_gauss, 3, w_gauss, 4, w_gauss); setTrigger(0); wait(100); }
Keywords and Comments
The following table lists the keywords used in the LabOne AWG Sequencer language.
Keyword | Description |
---|---|
|
Constant declaration |
|
Integer variable declaration |
|
Compile-time variable declaration |
|
Constant string declaration |
|
Boolean true constant |
|
Boolean false constant |
|
For-loop declaration |
|
While-loop declaration |
|
Repeat-loop declaration |
|
If-statement |
|
Else-part of an if-statement |
|
Switch-statement |
|
Case-statement within a switch |
|
Default-statement within a switch |
|
Return from function or procedure, optionally with a return value |
The following code example shows how to use comments.
const a = 10; // This is a line comment. Everything between the double // slash and the end of the line will be ignored. /* This is a block comment. Everything between the start-of-block-comment and end-of-block-comment markers is ignored. For example, the following statement will be ignored by the compiler. const b = 100; */
Constants and Variables
Constants may be used to make the program more readable. They may be of integer or floating-point type. It must be possible for the compiler to compute the value of a constant at compile time, i.e., on the host computer. Constants are declared using the const
keyword.
Compile-time variables may be used in computations and loop iterations during compile time, e.g. to create large numbers of waveforms in a loop. They may be of integer or floating-point type. They are used in a similar way as constants, except that they can change their value during compile time operations. Compile-time variables are declared using the cvar
keyword.
Variables may be used for making simple computations during run time, i.e., on the instrument. The Sequencer supports integer variables, addition, and subtraction. Not supported are floating-point variables, multiplication, and division. Typical uses of variables are to step waiting times
, to output DIO values,
or to tag digital measurement data with a numerical identifier. Variables are declared using the var
keyword.
The following code example shows how to use variables.
var b = 100; // Create and initialize a variable // Repeat the following block of statements 100 times repeat (100) { b = b + 1; // Increment b wait(b); // Wait 'b' cycles }
The following table shows the predefined constants. These constants are intended to be used as arguments in certain run-time evaluated functions that encode device parameters with integer numbers. For example, the AWG Sampling Rate is specified as an integer exponent n in the expression (1.8 GSa/s)/2n.
Name | Value | Description |
---|---|---|
commandTableEntries |
{4096} |
|
AWG_RATE_1800MHZ |
0 |
Constant to set Sampling Rate to 1.8 GHz. |
AWG_RATE_900MHZ |
1 |
Constant to set Sampling Rate to 900 MHz. |
AWG_RATE_450MHZ |
2 |
Constant to set Sampling Rate to 450 MHz. |
AWG_RATE_225MHZ |
3 |
Constant to set Sampling Rate to 225 MHz. |
AWG_RATE_112MHZ |
4 |
Constant to set Sampling Rate to 112 MHz. |
AWG_RATE_56MHZ |
5 |
Constant to set Sampling Rate to 56 MHz. |
AWG_RATE_28MHZ |
6 |
Constant to set Sampling Rate to 28 MHz. |
AWG_RATE_14MHZ |
7 |
Constant to set Sampling Rate to 14 MHz. |
AWG_RATE_7MHZ |
8 |
Constant to set Sampling Rate to 7 MHz. |
AWG_RATE_3P5MHZ |
9 |
Constant to set Sampling Rate to 3.5 MHz. |
AWG_RATE_1P8MHZ |
10 |
Constant to set Sampling Rate to 1.8 MHz. |
AWG_RATE_880KHZ |
11 |
Constant to set Sampling Rate to 880 kHz. |
AWG_RATE_440KHZ |
12 |
Constant to set Sampling Rate to 440 kHz. |
AWG_RATE_220KHZ |
13 |
Constant to set Sampling Rate to 220 kHz. |
AWG_MONITOR_TRIGGER |
0x0000020 |
Constant to activate the trigger of the Monitor unit. |
AWG_INTEGRATION_TRIGGER |
0x0000010 |
Constant to activate the trigger of the Integration units. |
AWG_INTEGRATION_ARM |
0x3ff0000 |
Constant to arm the Integration units. |
DEVICE_SAMPLE_RATE |
<actual device sample rate> |
|
ZSYNC_DATA_RAW |
0 |
Constant to use as argument to getZSyncData. |
QA_INT_0 |
0b0000000001 << 16 |
Constant to enable Integration unit 0 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_1 |
0b0000000010 << 16 |
Constant to enable Integration unit 1 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_2 |
0b0000000100 << 16 |
Constant to enable Integration unit 2 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_3 |
0b0000001000 << 16 |
Constant to enable Integration unit 3 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_4 |
0b0000010000 << 16 |
Constant to enable Integration unit 4 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_5 |
0b0000100000 << 16 |
Constant to enable Integration unit 5 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_6 |
0b0001000000 << 16 |
Constant to enable Integration unit 6 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_7 |
0b0010000000 << 16 |
Constant to enable Integration unit 7 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_8 |
0b0100000000 << 16 |
Constant to enable Integration unit 8 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_9 |
0b1000000000 << 16 |
Constant to enable Integration unit 9 in the Integration unit enable mask of the function startQA(). To construct more elaborate masks that enable multiple units, combine these predefined constants using the operator | (bit-wise OR). |
QA_INT_ALL |
0b1111111111 << 16 |
Constant to enable all Integration units in the Integration unit enable mask of the function startQA(). |
AWG_CHAN1 |
1 |
Constant to select channel 1. |
AWG_CHAN2 |
2 |
Constant to select channel 2. |
AWG_MARKER1 |
1 |
Constant to select marker 1. |
AWG_MARKER2 |
2 |
Constant to select marker 2. |
AWG_OSC_PHASE_START |
1 |
Constant to trigger the oscillator phase on the positive edge. |
AWG_OSC_PHASE_MIDDLE |
0 |
Constant to trigger the oscillator phase on the negative edge. |
AWG_USERREG_SWEEP_COUNT0 |
35 |
Constant for the sweep count register 0. |
AWG_USERREG_SWEEP_COUNT1 |
36 |
Constant for the sweep count register 1. |
Numbers can be expressed using either of the following formatting.
const a = 10; // Integer notation const b = -10; // Negative number const h = 0xdeadbeef; // Hexadecimal integer const bin = 0b10101; // Binary integer const f = 0.1e-3; // Floating point number. const not_float = 10e3; // Not a floating point number
Booleans are specified with the keywords true
and false
. Furthermore, all numbers that evaluate to a nonzero value are considered true. All numbers that evaluate to zero are considered false.
Strings are delimited using "" and are interpreted as constants. Strings may be concatenated using the + operator.
string AWG_PATH = "awgs/0/"; string AWG_GAIN_PATH = AWG_PATH + "gains/0";
Waveform Generation and Editing
The following table contains the definition of functions for waveform generation.
resulting waveform
wave zeros(const samples)
samples:
Number of samples in the waveform
resulting waveform
wave ones(const samples)
samples:
Number of samples in the waveform
resulting waveform
wave sine(const samples, const amplitude=1.0, const phaseOffset, const nrOfPeriods)
amplitude:
Amplitude of the signal (optional)nrOfPeriods:
Number of Periods within the defined number of samplesphaseOffset:
Phase offset of the signal in radianssamples:
Number of samples in the waveform
resulting waveform
wave cosine(const samples, const amplitude=1.0, const phaseOffset, const nrOfPeriods)
amplitude:
Amplitude of the signal (optional)nrOfPeriods:
Number of Periods within the defined number of samplesphaseOffset:
Phase offset of the signal in radianssamples:
Number of samples in the waveform
resulting waveform
wave sinc(const samples, const amplitude=1.0, const position, const beta)
amplitude:
Amplitude of the signal (optional)beta:
Width of the functionposition:
Peak position of the functionsamples:
Number of samples in the waveform
resulting waveform
wave ramp(const samples, const startLevel, const endLevel)
endLevel:
level at the last sample of the waveformsamples:
Number of samples in the waveformstartLevel:
level at the first sample of the waveform
resulting waveform
wave sawtooth(const samples, const amplitude=1.0, const phaseOffset, const nrOfPeriods)
amplitude:
Amplitude of the signalnrOfPeriods:
Number of Periods within the defined number of samplesphaseOffset:
Phase offset of the signal in radianssamples:
Number of samples in the waveform
resulting waveform
wave triangle(const samples, const amplitude=1.0, const phaseOffset, const nrOfPeriods)
amplitude:
Amplitude of the signalnrOfPeriods:
Number of Periods within the defined number of samplesphaseOffset:
Phase offset of the signal in radianssamples:
Number of samples in the waveform
resulting waveform
wave gauss(const samples, const amplitude=1.0, const position, const width)
amplitude:
Amplitude of the signal (optional)position:
Peak position of the pulsesamples:
Number of samples in the waveformwidth:
Width of the pulse
resulting waveform
wave drag(const samples, const amplitude=1.0, const position, const width)
amplitude:
Amplitude of the signal (optional)position:
Center point position of the pulsesamples:
Number of samples in the waveformwidth:
Width of the pulse
resulting waveform
wave blackman(const samples, const amplitude=1.0, const alpha)
alpha:
Width of the functionamplitude:
Amplitude of the signal (optional)samples:
Number of samples in the waveform
resulting waveform
wave hamming(const samples, const amplitude=1.0)
amplitude:
Amplitude of the signal (optional)samples:
Number of samples in the waveform
resulting waveform
wave hann(const samples, const amplitude=1.0)
amplitude:
Amplitude of the signalsamples:
Number of samples in the waveform
resulting waveform
wave rect(const samples, const amplitude)
amplitude:
Amplitude of the signalsamples:
Number of samples in the waveform
resulting waveform
wave marker(const samples, const markerValue)
markerValue:
Value of the marker bitssamples:
Number of samples in the waveform
resulting waveform
wave rand(const samples, const amplitude=1.0, const mean, const stdDev)
amplitude:
Amplitude of the signalmean:
Average signal levelsamples:
Number of samples in the waveformstdDev:
Standard deviation of the noise signal
resulting waveform
wave randomGauss(const samples, const amplitude=1.0, const mean, const stdDev)
amplitude:
Amplitude of the signalmean:
Average signal levelsamples:
Number of samples in the waveformstdDev:
Standard deviation of the noise signal
resulting waveform
wave randomUniform(const samples, const amplitude=1.0)
amplitude:
Amplitude of the signalsamples:
Number of samples in the waveform
resulting waveform
wave lfsrGaloisMarker(const samples, const markerBit, const polynomial, const initial)
initial:
LFSR initial state, any nonzero value will work, usually 0x1markerBit:
Marker bit to set (1 or 2)polynomial:
LFSR characteristic polynomial in binary representation (max shift length 32), use 0x90000 for QRSS / PRBS-20samples:
Number of samples in the waveform
resulting waveform
wave chirp(const samples, const amplitude=1.0, const startFreq, const stopFreq, const phase=0)
amplitude:
Amplitude of the signal (optional)phase:
Initial phase of the signal (optional)samples:
Number of samples in the waveformstartFreq:
Start frequency of the signalstopFreq:
Stop Frequency of the signal
Resulting waveform
wave rrc(const samples, const amplitude=1.0, const position, const beta, const width)
amplitude:
Amplitude of the signalbeta:
Roll-off factorposition:
Center point position of the pulsesamples:
Number of samples in the waveformwidth:
Width of the pulse
resulting waveform
wave vect(const value,…)
value:
Waveform amplitude at the respective sample
waveform object
wave placeholder(const samples, const marker0=false, const marker1=false)
marker0:
true if marker bit 0 must be used (default false)marker1:
true if marker bit 1 must be used (default false)samples:
Number of samples in the waveform
The following table contains the definition of functions for waveform editing.
joined waveform
wave join(wave wave1, wave wave2, const interpolLength=0)
interpolLength:
Number of samples to interpolate between waveforms (optional, default 0)wave1:
Input waveformwave2:
Input waveform
joined waveform
wave join(wave wave1, wave wave2,…)
wave1:
Input waveformwave2:
Input waveform
interleaved waveform
wave interleave(wave wave1, wave wave2,…)
wave1:
Input waveformwave2:
Input waveform
sum waveform
wave add(wave wave1, wave wave2,…)
wave1:
Input waveformwave2:
Input waveform
product waveform
wave multiply(wave wave1, wave wave2,…)
wave1:
Input waveformwave2:
Input waveform
scaled waveform
wave scale(wave waveform, const factor)
factor:
Scaling factorwaveform:
Input waveform
flipped waveform
wave flip(wave waveform)
waveform:
Input waveform
cut waveform
wave cut(wave waveform, const from, const to)
from:
First sample of the cut waveformto:
Last sample of the cut waveformwaveform:
Input waveform
filtered waveform
wave filter(wave b, wave a, wave x)
a:
Denominator coefficientsb:
Numerator coefficientsx:
Input waveform
circularly shifted waveform
wave circshift(wave a, const n)
n:
Number of elements to shiftwaveform:
Input waveform
Waveform Playback and Predefined Functions
The following table contains the definition of functions for waveform playback and other purposes.
The value can be either a const or a var value. Configure the Mode setting in the DIO tab when using this command. The DIO interface speed of 50 MHz limits the rate at which the DIO output value is updated.
void setDIO(var value)
value:
The value to write to the DIO (const or var)
var containing the read value
var getDIO()
var containing the read value
var getDIOTriggered()
The state of all four AWG Trigger output signals is represented by the bits in the binary representation of the integer value. Binary notation of the form 0b0000 is recommended for readability.
void setTrigger(var value)
value:
to be written to the trigger output lines
void wait(var cycles)
cycles:
number of cycles to wait
void waitTrigger(const mask, const value)
mask:
mask to be applied to the input signalvalue:
value to be compared with the trigger input
void waitDIOTrigger()
The physical signal connected to the AWG Digital Trigger input is to be configured in the Trigger sub-tab of the AWG tab. trigger state, either 0 or 1
var getDigTrigger(const index)
index:
index of the Digital Trigger input to be read; can be either 1 or 2 on UHF, or 1-8 on HDAWG
void error(string msg,…)
msg:
Message to be displayed
void info(string msg,…)
msg:
Message to be displayed
If the path does not start with a device identifier, then the current device is assumed.
void setInt(string path, var value)
path:
The node path to be written tovalue:
The integer value to be written
If the path does not start with a device identifier, then the current device is assumed.
void setDouble(string path, var value)
path:
The node path to be written tovalue:
The integer or floating point value to be written
If the path does not start with a device identifier, then the current device is assumed.
void setDouble(string path, var value, const scale)
path:
The node path to be written toscale:
Scaling value to be applied to the value before writing to the nodevalue:
The integer or floating point value to be written
void setID(var id)
id:
The new ID to be attached to streaming data of the device
void setSeqIndex(var id)
id:
The new ID to be attached to streaming data of the device
Only for programs running on multiply synchronized instruments.
void sync()
void waitWave()
void setRate(const rate)
rate:
New default sampling rate
void randomSeed()
void assignWaveIndex(const output, wave waveform, const index)
index:
index to assignoutput:
defines on which output the following waveform to be playedwaveform:
waveform to be played
void assignWaveIndex(wave waveform, const index)
index:
index to assignwaveform:
waveform to be played
void playWave(const output, wave waveform, const rate=AWG_RATE_DEFAULT)
output:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWave(const output, wave waveform,…)
output:
defines on which output the following waveform is playedwaveform:
waveform to be played
void playWave(wave waveform, const rate=AWG_RATE_DEFAULT)
rate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWave(wave waveform,…)
waveform:
waveform to be played
The User Registers may be used for communicating information to the LabOne User Interface or a running API program.
void setUserReg(const register, var value)
register:
The register index (0 to 15) to be written tovalue:
The integer value to be written
current register value
var getUserReg(const register)
register:
The register to be read (0 to 15)
void playZero(const samples)
void playZero(const samples, const rate)
void playWaveNow(const output, wave waveform, const rate=AWG_RATE_DEFAULT)
output:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWaveNow(const output, wave waveform,…)
output:
defines on which output the following waveform is playedwaveform:
waveform to be played
void playWaveNow(wave waveform, const rate=AWG_RATE_DEFAULT)
rate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWaveNow(wave waveform,…)
waveform:
waveform to be played
void playWaveIndexed(const output, wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformoutput:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWaveIndexed(wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWaveIndexedNow(const output, wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformoutput:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playWaveIndexedNow(wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playDIOWave(wave waveform, const rate=AWG_RATE_DEFAULT)
rate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playDIOWave(wave waveform,…)
waveform:
waveform to be played
void playAuxWave(const output, wave waveform, const rate=AWG_RATE_DEFAULT)
output:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playAuxWave(const output, wave waveform,…)
output:
defines on which output the following waveform is playedwaveform:
waveform to be played
void playAuxWave(wave waveform, const rate=AWG_RATE_DEFAULT)
rate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playAuxWave(wave waveform,…)
waveform:
waveform to be played
void playAuxWaveIndexed(const output, wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformoutput:
defines on which output the following waveform is playedrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void playAuxWaveIndexed(wave waveform, var offset, const length, const rate=AWG_RATE_DEFAULT)
length:
number of samples to be played from this waveformoffset:
offset in samples from the start of the waveformrate:
sample rate with which the AWG plays the waveforms (default set in the user interface).waveform:
waveform to be played
void waitAnaTrigger(const index, const value)
index:
index of the analog trigger input to be waited on; can be either 1 or 2 on UHF, or 1 to 8 on HDAWGvalue:
value to be compared with the Analog Trigger input, can be either 0 or 1
The physical signal connected to the AWG Analog Trigger inputs as well as the trigger level is to be configured in the Trigger sub-tab of the AWG tab. trigger state, either 0 or 1
var getAnaTrigger(const index)
index:
index of the Analog Trigger input to be read; an be either 1 or 2 on UHF, or 1-8 on HDAWG
length configured by the Sweeper
var getSweeperLength(const index)
index:
The index of the Sweeper parameter. Currently only the value of 1 is accepted.
void now()
void at(var time)
time:
value to wait for
void lock(wave waveform)
waveform:
The waveform to lock
Only valid after the waveform was previously locked using the lock command.
void unlock(wave waveform)
waveform:
The waveform to unlock
void waitDigTrigger(const index, const value)
index:
index of the digital trigger input to be waited on; can be either 1 or 2value:
value to be compared with the digital trigger input, can be either 0 or 1
void startQA(const weighted_integrator_mask, const monitor, const result_address, const trigger)
monitor:
Enable for QA monitor, default: falseresult_address:
Set address associated with result, default: 0x0trigger:
Trigger value, default: 0x0weighted_integrator_mask:
Integration unit enable mask, default: QA_INT_ALL
var startQAResult(const mask, const trigger)
mask:
bitmask defining which of the ten qubit results should be readtrigger:
bitmask to apply to the normal trigger outputs, similar in use to the setTrigger command
var startQAMonitor(const trigger)
trigger:
bitmask to apply to the normal trigger outputs, similar in use to the setTrigger command
void setReadoutRegisterAddress(var results_address)
current state of all measured qubits
var getQAResult()
void waitQAResultTrigger()
void resetOscPhase()
var containing the read value
var getZSyncData(const data_type)
data_type:
Specifies which data the function should return: ZSYNC_DATA_RAW: Return the data received on the ZSync as-is without parsing. The structure of the message can change across different LabOne releases.
var getZSyncData(const data_type, var wait_cycles)
var containing the read value
var getFeedback(const data_type)
data_type:
Specifies which data the function should return: ZSYNC_DATA_RAW: Return the data received on the ZSync as-is without parsing. The structure of the message can change across different LabOne releases.
var getFeedback(const data_type, var wait_cycles)
void playWaveZSync(const data_type)
void playWaveZSync(const data_type, var wait_cycles)
void waitZSyncTrigger()
void resetRTLoggerTimestamp()
Accessing Instrument Settings
Using the sequencer instructions setInt
and setDouble
, a large number of instrument settings
may be accessed directly from the sequencer with a much shorter latency than when accessed via the LabOne API.
The nodes accessible with setInt
setDouble
are a subset of the full list
of device nodes accessible via the LabOne API (see
Device Node Tree
) and are
listed in the table below together with their data type, latency class, and timing determinicity characteristics.
There are 3 levels of latency performance depending on how the node settings are processed on the instrument.
Nodes that are classified with latency "medium" are processed with the instrument firmware by a
non-realtime processor. These nodes are set typically within 100 microseconds, however not with
deterministic timing. For some of the nodes, additional time is needed to take effect
due to the time scale of the related hardware settings, e.g. changing the settings of the
analog signal path. This needs to be taken into account by including sufficient waiting time by a wait
sequencer instruction after setting the node.
Nodes classified with latency "low" are processed with deterministic timing
on a dedicated bus inside the FPGA. The latency is of the order of 100 nanoseconds. Nodes
classified with latency "ultra-low", such as timing-critical phase changes, are accessed via their dedicated
signal path on the FPGA, and offer similarly low and deterministic latency as e.g. playWave
instructions.
Providing the node as a character string is less flexible from the AWG sequencer than from the API: wildcards (*) are not supported, the node cannot start with a dash (/), and the device ID cannot be specified since it is excluded that the sequencer accesses other devices. This code example illustrates these restrictions:
setInt("sigouts/1/on", 1); // permitted setInt("sigouts/*/on", 1); // not permitted setInt("dev8000/sigouts/1/on", 1); // not permitted setInt("/dev8000/sigouts/1/on", 1); // not permitted setInt("/sigouts/1/on", 1); // not permitted setInt("/sigouts/1/on", 1);
In the table, the sequence [i-j] indicate a numeric range of valid indices from i to j
Node | Data type | Latency | Deterministic timing |
---|---|---|---|
scopes/0/enable |
Integer |
medium |
no |
scopes/0/time |
Integer |
medium |
no |
scopes/0/trigenable |
Integer |
medium |
no |
scopes/0/trigrising |
Integer |
medium |
no |
scopes/0/trigfalling |
Integer |
medium |
no |
scopes/0/triglevel |
Float |
medium |
no |
scopes/0/length |
Integer |
medium |
no |
scopes/0/trigholdoff |
Float |
medium |
no |
scopes/0/trigchannel |
Integer |
medium |
no |
scopes/0/channels/[0-1]/inputselect |
Integer |
medium |
no |
scopes/0/channels/[0-1]/bwlimit |
Integer |
medium |
no |
scopes/0/segments/count |
Integer |
medium |
no |
scopes/0/channel |
Integer |
medium |
no |
scopes/0/single |
Integer |
medium |
no |
scopes/0/trighysteresis/absolute |
Float |
medium |
no |
scopes/0/cont |
Integer |
medium |
no |
scopes/0/trighysteresis/relative |
Float |
medium |
no |
scopes/0/trighysteresis/mode |
Integer |
medium |
no |
scopes/0/trigforce |
Integer |
medium |
no |
scopes/0/segments/counts/enable |
Integer |
medium |
no |
scopes/0/trigstate |
Integer |
medium |
no |
scopes/0/triggate/enable |
Integer |
medium |
no |
scopes/0/triggate/inputselect |
Integer |
medium |
no |
scopes/0/trigreference |
Float |
medium |
no |
scopes/0/trigdelay |
Float |
medium |
no |
scopes/0/trigholdofftriggerenable |
Integer |
medium |
no |
scopes/0/trigholdofftrigger |
Integer |
medium |
no |
scopes/0/channels/[0-1]/limitlower |
Float |
medium |
no |
scopes/0/channels/[0-1]/limitupper |
Float |
medium |
no |
sigins/[0-1]/ac |
Integer |
medium |
no |
sigins/[0-1]/imp50 |
Integer |
medium |
no |
sigins/[0-1]/bw |
Integer |
medium |
no |
sigins/[0-1]/on |
Integer |
medium |
no |
sigins/[0-1]/range |
Integer |
medium |
no |
sigins/[0-1]/diff |
Integer |
medium |
no |
sigins/[0-1]/autorange |
Integer |
medium |
no |
sigins/[0-1]/scaling |
Float |
medium |
no |
sigouts/[0-1]/on |
Integer |
medium |
no |
sigouts/[0-1]/range |
Float |
medium |
no |
sigouts/[0-1]/imp50 |
Integer |
medium |
no |
sigouts/[0-1]/autorange |
Integer |
medium |
no |
sigouts/[0-1]/offset |
Float |
medium |
no |
sigouts/[0-1]/enables/[0-1] |
Integer |
medium |
no |
sigouts/[0-1]/amplitudes/[0-1] |
Float |
medium |
no |
awgs/0/enable |
Integer |
medium |
no |
awgs/0/single |
Integer |
medium |
no |
awgs/0/time |
Integer |
medium |
no |
awgs/0/userregs/[0-15] |
Integer |
medium |
no |
awgs/0/triggers/[0-1]]/level |
Float |
medium |
no |
awgs/0/triggers/[0-1]/hysteresis/absolute |
Float |
medium |
no |
awgs/0/triggers/[0-1]/hysteresis/relative |
Float |
medium |
no |
awgs/0/triggers/[0-1]/hysteresis/mode |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/rising |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/falling |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/channel |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/force |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/state |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/gate/enable |
Integer |
medium |
no |
awgs/0/triggers/[0-1]/gate/inputselect |
Integer |
medium |
no |
awgs/0/auxtriggers/[0-1]/channel |
Integer |
medium |
no |
awgs/0/auxtriggers/[0-1]/rising |
Integer |
medium |
no |
awgs/0/auxtriggers/[0-1]/falling |
Integer |
medium |
no |
awgs/0/auxtriggers/[0-1]/state |
Integer |
medium |
no |
awgs/0/outputs/[0-1]/amplitude |
Float |
medium |
no |
awgs/0/outputs/[0-1]/mode |
Integer |
medium |
no |
auxouts/[0-3]/preoffset |
Double |
medium |
no |
auxouts/[0-3]/offset |
Float |
medium |
no |
auxouts/[0-3]/scale |
Float |
medium |
no |
auxouts/[0-3]/limitlower |
Float |
medium |
no |
auxouts/[0-3]/limitupper |
Float |
medium |
no |
auxouts/[0-3]/offset |
Integer |
medium |
no |
auxouts/[0-3]/outputselect |
Integer |
medium |
no |
auxouts/[0-3]/demodselect |
Integer |
medium |
no |
triggers/in/[0-3]/imp50 |
Integer |
medium |
no |
triggers/in/[0-3]/level |
Integer |
medium |
no |
triggers/in/[0-3]/dcc_fedge |
Integer |
medium |
no |
triggers/out/[0-3]/srcsel |
Integer |
medium |
no |
triggers/out/[0-3]/dir |
Integer |
medium |
no |
triggers/out/[0-3]/static_value |
Integer |
medium |
no |
triggers/out/[0-3]/hold |
Integer |
medium |
no |
triggers/out/[0-3]/delay |
Float |
medium |
no |
scopes/0/stream/enables/[0-1] |
Integer |
medium |
no |
scopes/0/stream/rate |
Integer |
medium |
no |
qas/0/integration/length |
Integer |
low |
yes |
oscs/0/freq |
Frequency |
low |
yes |
Expressions
Expressions may be used for making computations based on mathematical functions and operators. There are two kinds of expressions: those evaluated at compile time (the moment of clicking "Save" or "Save as…" in the user interface), and those evaluated at run time (after clicking "Run/Stop" or "Start"). Compile-time evaluated expressions only involve constants (const
) or compile-time variables (cvar
) and can be computed at compile time by the host computer. Such expressions can make use of standard mathematical functions and floating point arithmetic. Run-time evaluated expressions involve variables (var
) and are evaluated by the Sequencer on the instrument. Due to the limited computational capabilities of the Sequencer, these expressions may only operate on integer numbers and there are less operators available than at compile time.
The following table contains the list of mathematical functions supported at compile time.
Function | Description |
---|---|
const abs(const c) |
absolute value |
const acos(const c) |
inverse cosine |
const acosh(const c) |
hyperbolic inverse cosine |
const asin(const c) |
inverse sine |
const asinh(const c) |
hyperbolic inverse sine |
const atan(const c) |
inverse tangent |
const atanh(const c) |
hyperbolic inverse tangent |
const cos(const c) |
cosine |
const cosh(const c) |
hyperbolic cosine |
const exp(const c) |
exponential function |
const ln(const c) |
logarithm to base e (2.71828…) |
const log(const c) |
logarithm to the base 10 |
const log2(const c) |
logarithm to the base 2 |
const log10(const c) |
logarithm to the base 10 |
const sign(const c) |
sign function -1 if x<0; 1 if x>0 |
const sin(const c) |
sine |
const sinh(const c) |
hyperbolic sine |
const sqrt(const c) |
square root |
const tan(const c) |
tangent |
const tanh(const c) |
hyperbolic tangent |
const ceil(const c) |
smallest integer value not less than the argument |
const round(const c) |
round to nearest integer |
const floor(const c) |
largest integer value not greater than the argument |
const avg(const c1, const c2,…) |
mean value of all arguments |
const max(const c1, const c2,…) |
maximum of all arguments |
const min(const c1, const c2,…) |
minimum of all arguments |
const pow(const base, const exp) |
first argument raised to the power of second argument |
const sum(const c1, const c2,…) |
sum of all arguments |
The following table contains the list of predefined mathematical constants. These can be used for convenience in compile-time evaluated expressions.
Name | Value | Description |
---|---|---|
M_E |
2.71828182845904523536028747135266250 |
e |
M_LOG2E |
1.44269504088896340735992468100189214 |
log2(e) |
M_LOG10E |
0.434294481903251827651128918916605082 |
log10(e) |
M_LN2 |
0.693147180559945309417232121458176568 |
loge(2) |
M_LN10 |
2.30258509299404568401799145468436421 |
loge(10) |
M_PI |
3.14159265358979323846264338327950288 |
pi |
M_PI_2 |
1.57079632679489661923132169163975144 |
pi/2 |
M_PI_4 |
0.785398163397448309615660845819875721 |
pi/4 |
M_1_PI |
0.318309886183790671537767526745028724 |
1/pi |
M_2_PI |
0.636619772367581343075535053490057448 |
2/pi |
M_2_SQRTPI |
1.12837916709551257389615890312154517 |
2/sqrt(pi) |
M_SQRT2 |
1.41421356237309504880168872420969808 |
sqrt(2) |
M_SQRT1_2 |
0.707106781186547524400844362104849039 |
1/sqrt(2) |
Operator | Description | Priority |
---|---|---|
|
assignment |
-1 |
|
assignment by sum, difference, product, quotient, remainder, AND, OR, left shift, and right shift |
-1 |
|
logical OR |
1 |
|
logical AND |
2 |
|
bit-wise logical OR |
3 |
|
bit-wise logical AND |
4 |
|
not equal |
5 |
|
equal |
5 |
|
less or equal |
6 |
|
greater or equal |
6 |
|
greater than |
6 |
|
less than |
6 |
|
arithmetic left bit shift |
7 |
|
arithmetic right bit shift |
7 |
|
addition |
8 |
|
subtraction |
8 |
|
multiplication |
9 |
|
division |
9 |
|
bit-wise logical negation |
10 |
Operator | Description | Priority |
---|---|---|
|
assignment |
-1 |
|
assignment by sum, difference, product, quotient, remainder, AND, OR, left shift, and right shift |
-1 |
|
logical OR |
1 |
|
logical AND |
2 |
|
bit-wise logical OR |
3 |
|
bit-wise logical AND |
4 |
|
equal |
5 |
|
not equal |
5 |
|
less or equal |
6 |
|
greater or equal |
6 |
|
greater than |
6 |
|
less than |
6 |
|
left bit shift |
7 |
|
right bit shift |
7 |
|
addition |
8 |
|
subtraction |
8 |
|
bit-wise logical negation |
9 |
Control Structures
Functions may be declared using the var
keyword. Procedures may be declared using the void
keyword. Functions must return a value, which should be specified using the return
keyword. Procedures can not return values. Functions and procedures may be declared with an arbitrary number of arguments. The return
keyword may also be used without arguments to return from an arbitrary point within the function or procedure. Functions and procedures may contain variable and constant declarations. These declarations are local to the scope of the function or procedure.
var function_name(argument1, argument2, ...) { // Statements to be executed as part of the function. return constant-or-variable; } void procedure_name(argument1, argument2, ...) { // Statements to be executed as part of the procedure. // Optional return statement return; }
An if-then-else structure is used to create a conditional branching point in a sequencer program.
// If-then-else statement syntax if (expression) { // Statements to execute if 'expression' evaluates to 'true'. } else { // Statements to execute if 'expression' evaluates to 'false'. } // If-then-else statement short syntax (expression)?(statement if true):(statement if false)
// If-then-else statement example const REQUEST_BIT = 0x0001; const ACKNOWLEDGE_BIT = 0x0002; const IDLE_BIT = 0x8000; var dio = getDIO(); if (dio & REQUEST_BIT) { dio = dio | ACKNOWLEDGE_BIT; setDIO(dio); } else { dio = dio | IDLE_BIT; setDIO(dio); }
A switch-case structure serves to define a conditional branching point similarly to the if-then-else
statement, but is used to split the sequencer thread into more than two branches. Unlike the if-then-else
structure, the switch statement is synchronous, which means that the execution time is the same for all branches and determined by the execution time of the longest branch. If no default case is provided and no case matches the condition, all cases will be skipped. The case arguments need to be of type const
.
// Switch-case statement syntax switch (expression) { case const-expression: expression; ... default: expression; }
// Switch-case statement example switch (getDIO()) { case 0: playWave(gauss(1024,1.0,512,64)); case 1: playWave(gauss(1024,1.0,512,128)); case 2: playWave(drag(1024,1.0,512,64)); default: playWave(drag(1024,1.0,512,128)); }
The for loop is used to iterate through a code block several times. The initialization
statement is executed before the loop starts. The end-expression
is evaluated at the start of each iteration and determines when the loop should stop. The loop is executed as long as this expression is true. The iteration-expression
is executed at the end of each loop iteration.
Depending on how the for
loop is set up, it can be either evaluated at compile time or at run time. Run-time evaluation is typically used to play series of waveforms. Compile-time evaluation is typically used for advanced waveform generation, e.g. to generate a series of waveforms with varying amplitude. For a run-time evaluated for
loop, use the var
data type as a loop index. To ensure that a loop is evaluated at compile time, use the cvar
data type as a loop index. Furthermore, the compile-time for
loop should only contain waveform generation/editing operations and it can’t contain any variables of type var
. The following code example shows both versions of the loop.
// For loop syntax for (initialization; end-expression; iteration-expression) { // Statements to execute while end-expression evaluates to true }
// FOR loop example to assemble a train of pulses into // a single waveform (compile-time execution) cvar gain_factor; // CVAR: integer or float values allowed wave w_pulse_series; for (gain_factor = 0; gain_factor < 1.0; gain_factor = gain_factor + 0.1) { w_pulse_series = join(w_pulse_series, gain_factor*gauss(1008, 504, 100)); } // Playback of waveform defined using compile-time FOR loop playWave(w_pulse_series); // FOR loop example to vary waiting time between // waveform playbacks (run-time execution) var i; // VAR: integer values allowed for (i = 0; i < 1000; i = i + 100) { playWave(gauss(1008, 504, 100)); waitWave(); wait(i); }
The while loop is a simplified version of the for
loop. The end-expression
is evaluated at the start of each loop iteration. The contents of the loop are executed as long as this expression is true. Like the for
loop, this loop comes in a compile-time version (if the end-expression involves only cvar
and const
) and in a run-time version (if the end-expression involves also var
data types).
// While loop syntax while (end-expression) { // Statements to execute while end-expression evaluates to true }
// While loop example const STOP_BIT = 0x8000; var run = 1; var i = 0; var dio = 0; while (run) { dio = getDIO(); run = dio & STOP_BIT; dio = dio | (i & 0xff); setDIO(dio); i = i + 1; }
The repeat loop is a simplified version of the for
loop. It repeats the contents of the loop a fixed number of times. In contrast to the for
loop, the repetition number of the repeat
loop must be known at compile time, i.e., const-expression
can only depend on constants and not on variables. Unlike the for
and the while
loop, this loop comes only in a run-time version. Thus, no cvar
data types may be modified in the loop body.
// Repeat loop syntax repeat (constant-expression) { // Statements to execute }
// Repeat loop example repeat (100) { setDIO(0x1); wait(10); setDIO(0x0); wait(10); }
Functional Elements
Control/Tool | Option/Range | Description |
---|---|---|
Amplitude (FS) |
0.0 to 1.0 |
Amplitude in units of full scale of the given AWG Output. The full scale corresponds to the Range voltage setting of the Signal Outputs. |
Mode |
Select between plain mode, amplitude modulation, and advanced mode. |
|
Plain |
AWG Output goes directly to Signal Output. |
|
Modulation |
AWG Output is multiplied with a sinusoid carrier signal. On UHFLI instruments, AWG Output 1 (2) is multiplied with oscillator signal of demodulator 4 (8). On UHFQA instruments, AWG Output 1 (2) is multiplied with the in-phase (quadrature) signal of the internal oscillator represented in the In/Out tab. |
|
Advanced |
Output of AWG channel 1 (2) modulates demodulators 1-4 (5-8) with independent envelopes. Option not supported on UHFQA instruments. |
|
Start |
Runs the AWG. |
|
Sampling Rate |
220 kSa/s to 1.8 GSa/s |
AWG sampling rate. This value is used by default and can be overridden in the Sequence program. The numeric values are rounded for display purposes. The exact values are equal to the base sampling rate divided by 2^n, where n is an integer between 0 and 13. |
Round oscillator frequencies. |
![]() |
Round oscillator frequencies to nearest commensurable with 225 MHz. |
Status |
Display compiler errors and warnings. |
|
Compile Status |
grey/green/yellow/red |
Sequence program compilation status. Grey: No compilation started yet. Green: Compilation successful. Yellow: Compiler warnings (see status field). Red: Compilation failed (see status field). |
Upload Progress |
0% to 100% |
The percentage of the sequencer program already uploaded to the device. |
Upload Status |
grey/yellow/green |
Indicates the upload status of the compiled AWG sequence. Grey: Nothing has been uploaded. Yellow: Upload in progress. Green: Compiled sequence has been uploaded. |
Register selector |
Select the number of the user register value to be edited. |
|
Register |
0 to 2^32 |
Integer user register value. The sequencer has reading and writing access to the user register values during run time. |
Input File |
External source code file to be compiled. |
|
Example File |
Load pre-installed example sequence program. |
|
New |
![]() |
Create a new sequence program. |
Revert |
![]() |
Undo the changes made to the current program and go back to the contents of the original file. |
Save (Ctrl+S) |
![]() |
Compile and save the current program displayed in the Sequence Editor. Overwrites the original file. |
Save as… (Ctrl+Shift+S) |
![]() |
Compile and save the current program displayed in the Sequence Editor under a new name. |
Automatic upload |
ON / OFF |
If enabled, the sequence program is automatically uploaded to the device after clicking Save and if the compilation was successful. |
To Device |
![]() |
Sequence program will be compiled and, if the compilation was successful, uploaded to the device. |
Multi-Device |
ON / OFF |
Compile the program for use with multiple devices. If enabled, the program will be compiled for and uploaded to the devices currently synchronized in the Multi-Device Sync tab. |
Sync Status |
grey/green/yellow |
Sequence program synchronization status. Grey: No program loaded on device. Green: Program in sync with device. Yellow: Sequence program in editor differs from the one running on the device. |
Control/Tool | Option/Range | Description |
---|---|---|
Mem Usage (%) |
0 to 100 |
Amount of the used waveform data relative to the device cache memory. The cache memory provides space for 32 kSa of waveform data. Mem Usage > 100% means that waveforms must be loaded from the main memory (128 MSa per channel) during playback, which can lead to delays. |
Wave Selection |
Select wave for display in the waveform viewer. If greyed out, the corresponding wave is too long for display. |
|
Waveforms |
Lists all waveforms used by the current sequence program. |
Control/Tool | Option/Range | Description |
---|---|---|
Force |
![]() |
Enforce a trigger event. |
Signal |
![]() |
Selects the analog trigger source signal. Navigate through the tree view that appears and click on the required signal. |
Hysteresis Mode |
Selects the mode to define the hysteresis size. The relative mode will work best over the full input range as long as the analog input signal does not suffer from excessive noise. |
|
Hysteresis (V) |
Selects absolute hysteresis. |
|
Hysteresis (%) |
Selects a hysteresis relative to the adjusted full scale signal input range. |
|
Hysteresis (V) |
trigger signal range (positive values only) |
Defines the voltage the source signal must deviate from the trigger level before the trigger is rearmed again. Set to 0 to turn it off. The sign is defined by the Edge setting. |
Hysteresis (%) |
numeric percentage value (positive values only) |
Hysteresis relative to the adjusted full scale signal input range. A hysteresis value larger than 100% is allowed. |
Gating |
Trigger In 3 |
Select the signal source used for trigger gating if gating is enabled. |
Trigger In 4 |
||
Gating enable |
ON / OFF |
If enabled the trigger will be gated by the trigger gating input signal. |
Signal |
Selects the digital trigger source signal. |
|
DIO/Zsync Trigger state |
grey/green |
Indicates that triggers are generated from the DIO or ZSync interface to the AWG. |
Strobe Index |
16 to 31 |
Selects the index n of the DIO interface bit (notation DIO[n] in the Specification chapter of the User Manual) to be used as a STROBE signal input in connection with the waitDIOTrigger sequencer instruction. |
Strobe Slope |
Select the signal edge that activates the STROBE trigger in connection with the waitDIOTrigger sequencer instruction. |
|
None |
Off |
|
Rise |
Rising edge trigger |
|
Fall |
Falling edge trigger |
|
Both |
Rising or falling edge trigger |
|
Valid Index |
16 to 31 |
Selects the index n of the DIO interface bit (notation DIO[n] in the Specification chapter of the User Manual) to be used as a VALID signal input, i.e. a qualifier indicating that a valid codeword is available on the DIO interface. |
Valid Polarity |
Polarity of the VALID bit that indicates that a codeword is available on the DIO interface. |
|
None |
VALID bit is ignored. |
|
Low |
VALID bit must be logical low. |
|
High |
VALID bit must be logical high. |
|
Both |
VALID bit may be logical high or logical low. |
|
Trigger State |
grey/green |
State of the Trigger. Grey: No trigger detected. Green: Trigger detected. |
Slope |
Select the signal edge that should activate the trigger. The trigger will be level sensitive when the Level option is selected. |
|
Level |
Level sensitive trigger. |
|
Rise |
Rising edge trigger. |
|
Fall |
Falling edge trigger. |
|
Both |
Rising or falling edge trigger. |
|
Level (V) |
numeric value |
Defines the analog trigger level. |
Auxiliary Trigger State |
grey/green |
State of the Auxiliary Trigger. Grey: No trigger detected. Green: Trigger detected. |
Control/Tool | Option/Range | Description |
---|---|---|
Assembly |
Text display |
Displays the current sequence program in compiled form. Every line corresponds to one hardware instruction. |
AWG Core |
Display assembly information. |
|
Mem Usage (%) |
0 to 100 |
Size of the current sequence program relative to the device cache memory. The cache memory provides space for a maximum of 1024 instructions. |
Sequence Editor |
Display and edit the sequence program. |
|
Counter |
Current position in the list of sequence instructions during execution. |
|
Status |
Running, Idle, Waiting |
Displays the status of the sequencer on the instrument. Off: Ready, not running. Green: Running, not waiting for any trigger event. Yellow: Running, waiting for a trigger event. Red: Not ready (e.g., pending elf download, no elf downloaded) |
Rerun |
ON / OFF |
Reruns the Sequencer program continuously. This way of looping a program results in timing jitter. For a jitter free signal implement a loop directly in the sequence program. |
Status |
grey/green/red |
Displays the status of the command table of the selected AWG Core. Grey: no table description uploaded, Green: table description successfully uploaded, Red: Error occurred during uploading of the table description. |