Feedback Trigger Handling#
Every Qblox Cluster shares a trigger network through the backplane that is described here. The trigger network uses 4 lines on the backplane to transmit the triggers. These lines map to 15 trigger addresses. Once a trigger is sent from any source, all sequencers will receive it simultaneously 212 ns later. Only one trigger may be sent over the backplane at once. After 252 ns, the network is ready for another trigger.
All Q1 sequencer can be configured to send a trigger to the backplane due to different events. These events are different for the different types of sequencers and are described in the specific sequencer pages (control, readout and timetag).
Additionally, every Q1 sequencer can receive triggers from the backplane in order to run instructions conditioned on the state of the triggers. A sequencer can either wait for a trigger on a particular address, or execute real-time instructions conditionally based on a condition. Both of these methods are described below.
wait_trigger#
The wait_trigger <trigger_address> instruction stops the RT core until a trigger arrives to the sequencer at the specified address.
Warning
This means that the time required to execute a wait_trigger instruction is not deterministic.
Example: wait_trigger
Here is a program that plays a 1 us square pulse, then waits for a trigger on address 5. Once the sequencer receives the trigger, it then plays a short 100 ns square pulse. This program works on either a control or readout sequencer.
set_awg_offs 32767, 32767 # Play 1 us square pulse.
upd_param 1000
set_awg_offs 0, 0
upd_param 4
wait_trigger 5 # Wait for a trigger from any source on trigger address 5.
set_awg_offs 32767, 32767 # Play 100 ns square pulse.
upd_param 100
set_awg_offs 0, 0
upd_param 4
stop
set_cond#
Every sequencer has a trigger handling module which counts the number of triggers arriving at each trigger address and computes the boolean result of a condition that is configurable using the set_cond instruction.
The set_cond instruction is a Q1 core instruction that changes how real-time instructions are executed. The set_cond instruction takes 4 arguments: enable, mask, operator and else_time. A boolean condition is calculated before the RT core executes every real-time instruction. If the condition is true, the instruction is executed. If the condition is false, the RT core simply waits for else_time ns before moving on to the next real-time instruction in the queue.
Here is a description of the arguments to the set_cond instruction:
The enable argument can be either 1 or 0 and either enables or disables conditional execution.
The mask argument sets the 15 bit mask as described below.
The operator argument sets the operator to one of 6 as described below.
The else_time argument sets how long the RT core will wait after skipping execution of the real-time instruction if the condition is false.
The block diagram below followed by an explanation of how the boolean condition is determined.
Address Counters The trigger handling module consists of 15 counters that count the number of triggers that arrive at each of the 15 trigger addresses. These counters can be activated and deactivated using the
latch_eninstruction. The counters can be reset to zero using thelatch_rstinstruction.Thresholds A threshold value can be set for each of the trigger address counters using
Sequencer.trigger1_count_threshold()parameter. Each counter is individually compared (>=) with its associated threshold. TheSequencer.trigger1_threshold_invert()parameter can be used to invert this comparison to (<). The results of these static comparisons create a thresholds vector of boolean values with a true/false indication for each trigger address.Mask and operator A 15 bit mask (specified as either a decimal number:
72or a hexadecimal number:0x48) can be set using the second argument of theset_condinstruction. The 15 bit boolean thresholds vector and the 15 bit mask are combined using one of 6 different operations described in the table below to give one boolean value.
Argument |
Select |
Operator |
Comment |
|---|---|---|---|
0 |
AND mask |
OR |
Return true if any of the selected counters crossed their thresholds |
1 |
AND mask |
NOR |
Return true if none of the selected counters crossed their threshold |
2 |
OR NOT(mask) |
AND |
Return true if all of the selected counters crossed their threshold |
3 |
OR NOT(mask) |
NAND |
Return true if any of the selected counters did not cross their threshold |
4 |
AND mask |
XOR |
Return true if an odd number of selected counters crossed their threshold |
5 |
AND mask |
XNOR |
Return true if an even number of selected counters crossed their threshold |
Example: set_cond
Here is a program that plays a 1 us square pulse, then plays a 100 ns pulse only if a trigger is received on trigger address 1 and 5. If the trigger is not received, it waits for 2 us and continues with the program. This program works on either a control or readout sequencer.
# Play 1 us square pulse
set_awg_offs 32767, 32767
upd_param 1000
set_awg_offs 0, 0
upd_param 4
# Configure set_cond
# Set the condition with these arguments:
# enable: Enable conditional execution
# mask: Set the mask to 000000000010001 (triggers 1 and 5)
# operator: Set the operator to thresholds vector OR NOT(mask)
# else_time: If condition is false, wait 1000 ns for every real-time instruction
set_cond 1, 0x0011, 2, 1000
# Play 100 ns square pulse
set_awg_offs 32767, 32767 # Classical instruction: Always executed by Q1 core.
upd_param 100 # Real-time instruction: Evaluate condition. Execute if condition is true. Else wait 1 us.
set_awg_offs 0, 0 # Classical instruction: Always executed by Q1 core.
upd_param 4 # Real-time instruction: Evaluate condition. Execute if condition is true. Else wait 1 us.
stop