quantify_scheduler.backends.zhinst.seqc_il_generator
Module Contents
Classes
The sequencer enum type. |
|
The Intermediate Sequencer Language Generator. |
Functions
|
Add a wait instruction to the SeqcILGenerator with the specified delay. |
|
Adds a playWave instruction to the |
|
Adds a startQA instruction to the |
|
Adds an executeTableEntry instruction to |
|
Adds a setTrigger instruction to the seqc |
|
Declares waveforms and links them to filenames of .csv files. |
|
Adds wave variables in form of a |
Attributes
- SEQC_INSTR_CLOCKS: Dict[quantify_scheduler.backends.types.zhinst.DeviceType, Dict[SeqcInstructions, int]][source]
- class SeqcILGenerator[source]
Bases:
object
The Intermediate Sequencer Language Generator.
This class acts a an assembler for the seqc programs which can be executed on the ZI AWG(s).
Creates a new instance of SeqcILGenerator.
- _declare_local(type_def: str, name: str) None [source]
Creates a new local variable.
- Parameters
type_def – The variable type definition.
name – The variable name.
- Raises
ValueError – Duplicate local variable error.
- _assign_local(name: str, value: str) None [source]
Assign a value to a local variable.
- Parameters
name – The variable name.
value – The new variable value.
- Raises
ValueError – Undefined reference error.
- _emit(operation: str) None [source]
Emits a new operation to the program.
- Parameters
operation – The operation to append.
- _end_scope() None [source]
Dedent the scope level.
- Raises
ValueError – Scope level error.
- declare_var(name: str, value: Optional[Union[str, int]] = None) None [source]
Creates a new variable of type var with a name and optionally its value.
- Parameters
name – The variable name.
value (Optional[str]) – The variable value. (optional)
- declare_wave(name: str, value: Optional[str] = None) None [source]
Creates a new variable of type wave with a name and optionally its value.
- Parameters
name – The variable name.
value – The variable value. (optional)
- assign_get_user_reg(name: str, index: int) None [source]
Assign the getUserReg function to a variable by name with a specific index.
- Parameters
name – The variable name.
index – The register index.
- assign_placeholder(name: str, size: int) None [source]
Assign a placeholder to a variable by name with a specific size.
- Parameters
name – The variable name.
size – The size of the placeholder.
- assign_var(name: str, value: Union[str, int, List[Any]]) None [source]
Assign a value to a variable by name.
This method requires the variable to be declared before allowing a new value to be assigned to it.
Translates to:
` wave w0; wave w0 = "dev1234_awg0_0"; # <-- `
- Parameters
name – The variable name.
value – The new value.
- emit_blankline() None [source]
Emits a blank line to the program.
This is typically used to create a visual separation for readability.
- emit_assign_wave_index(*args: str, index: int) None [source]
Emit assignWaveIndex to the program which assigns a wave variable to an index in the waveform table (just like a pointer).
- Parameters
index – The waveform table index.
- emit_execute_table_entry(index: int, comment: str = '') None [source]
Emit executeTableEntry to the program. Executes a command table waveform.
::note executeTableEntry is not blocking so if you want to await the wave use waitWave directly after it.
- Parameters
index – The wave index to execute.
- emit_play_wave(*names: str, comment: str = '') None [source]
Emit playWave to the program.
- Parameters
names – The wave names to be played. This should refer to the wave variable name as defined in the seqc, or the wave index in the commandtable to be played.
comment – The inline comment to be emitted in the seqc.
Examples
An example for the use of the playWave instruction from the LabOne Programming Manual.
Ensure that the “wave_file” variable (the name argument) corresponds to a filename that was declared using the declareWave
//Definition inline with playWave playWave("wave_file"); //Assign first to a wave data type, then use wave w = "wave_file"; playWave(w)
- emit_start_qa(comment: str = '') None [source]
Starts the Quantum Analysis Result and Input units by setting and clearing appropriate AWG trigger output signals. The choice of whether to start one or the other or both units can be controlled using the command argument. An bitmask may be used to select explicitly which of the ten possible qubit results should be read. If no qubit results are enabled, then the Quantum Analysis Result unit will not be triggered. An optional value may be used to set the normal trigger outputs of the AWG together with starting the Quantum Analysis Result and input units. If the value is not used, then the trigger signals will be cleared.
Parameter
monitor: Enable for QA monitor, default: false
result_address: Set address associated with result, default: 0x0
trigger: Trigger value, default: 0x0
weighted_integrator_mask: Integration unit enable mask, default: QA_INT_ALL
- emit_wait(cycles: int, comment: str = '') None [source]
Emits a wait instruction to the sequencer program.
- Parameters
cycles – The number of cycles to wait.
- emit_set_trigger(index: Union[int, str], comment: str = '') None [source]
Emit setTrigger to the program.
- Parameters
index – The number or string of a trigger to set.
- emit_wait_dig_trigger(index: int = 0, comment: str = '', device_type: Optional[quantify_scheduler.backends.types.zhinst.DeviceType] = None) None [source]
Emit waitDigTrigger to the program.
- Parameters
index – The trigger to wait on, by default 0
- emit_start_qa_monitor() None [source]
Starts the Quantum Analysis Monitor unit by setting and clearing appropriate AWG trigger output signals.
- emit_start_qa_result(bitmask: Optional[str] = None, trigger: Optional[str] = None) None [source]
Starts the Quantum Analysis Result unit by setting and clearing appropriate AWG trigger output signals.
// Start Quantum Analysis Result unit for // channel=1 on trigger=AWG_INTEGRATION_TRIGGER startQAResult(0b0000000001, AWG_INTEGRATION_TRIGGER); // Reset and clear triggers startQAResult();
- Parameters
bitmask – The bitmake to select explicitly which of the ten possible qubit results should be read, by default “”
trigger – The trigger to start the Quantum Analysis Result unit. If no trigger is specified it will clear the triggers, by default “”
- emit_begin_while(predicate: str = 'true') None [source]
Emit while loop to the program.
- Parameters
predicate – The while condition, by default “true”
- add_wait(seqc_gen: SeqcILGenerator, delay: int, device_type: quantify_scheduler.backends.types.zhinst.DeviceType, comment: str = '') int [source]
Add a wait instruction to the SeqcILGenerator with the specified delay.
- Parameters
seqc_gen –
delay – The delay in clocks.
device_type –
comment – An optional comment to the instruction, by default “”
- Returns
The number of clocks waited.
- Return type
- Raises
- add_play_wave(seqc_gen: SeqcILGenerator, *variable: str, device_type: quantify_scheduler.backends.types.zhinst.DeviceType, comment: str = '') int [source]
Adds a playWave instruction to the seqc program.
- Parameters
seqc_gen –
variable –
device_type –
comment –
- Returns
Elapsed number of clock cycles.
- Return type
- add_start_qa(seqc_gen: SeqcILGenerator, device_type: quantify_scheduler.backends.types.zhinst.DeviceType, comment: str = '') int [source]
Adds a startQA instruction to the seqc program. See
emit_start_qa()
for more details.- Parameters
seqc_gen –
device_type –
comment –
- Returns
Elapsed number of clock cycles.
- Return type
- add_execute_table_entry(seqc_gen: SeqcILGenerator, index: int, device_type: quantify_scheduler.backends.types.zhinst.DeviceType, comment: str = '') int [source]
Adds an executeTableEntry instruction to seqc program.
- Parameters
seqc_gen –
index –
device_type –
comment –
- Returns
Elapsed number of clock cycles.
- Return type
- Raises
AttributeError – Raised when the DeviceType not equals HDAWG.
- add_set_trigger(seqc_gen: SeqcILGenerator, value: Union[List[str], int, str], device_type: quantify_scheduler.backends.types.zhinst.DeviceType, comment: str = '') int [source]
Adds a setTrigger instruction to the seqc program.
- Parameters
seqc_gen –
value –
device_type –
comment –
- Returns
Elapsed number of clock cycles.
- Return type