qblox_scheduler.backends.qblox.register_manager#
Utility class for dynamically allocating registers for Qblox sequencers.
Classes#
Utility class that keeps track of all the registers that are still available. |
Functions#
|
Verifies whether the passed name is a valid register name. |
Module Contents#
- class RegisterManager[source]#
Utility class that keeps track of all the registers that are still available.
- _variable_mapping: dict[qblox_scheduler.operations.variables.Variable, str][source]#
- allocate_register() str[source]#
Allocates a register to be used within the q1asm program.
- Returns:
: A register that can be used.
- Raises:
IndexError – When the RegisterManager runs out of registers to allocate.
- allocate_register_for_variable(variable: qblox_scheduler.operations.variables.Variable) str[source]#
Allocate one or two registers for a variable.
- Parameters:
variable – The variable to which the register(s) are linked.
- Returns:
str The allocated register(s).
- free_register_of_variable(variable: qblox_scheduler.operations.variables.Variable) None[source]#
Mark the register associated with the variable ready for re-use.
- Parameters:
variable – The variable that is no longer needed.
- free_register(register: str) None[source]#
Frees up a register to be reused.
- Parameters:
register – The register to free up.
- Raises:
ValueError – The value provided is not a valid register.
RuntimeError – Attempting to free a register that is already free.
- property available_registers: list[str][source]#
Getter for the available registers.
- Returns:
: A copy of the list containing all the available registers.
- get_register_of_variable(variable: qblox_scheduler.operations.variables.Variable) str[source]#
Get the register(s) associated with the variable.
- Parameters:
variable – The variable.
- Returns:
str The registers.
- _verify_valid_register(register_name: str) None[source]#
Verifies whether the passed name is a valid register name.
Raises on any of the conditions:
register_namedoes not start with “R” orregister_namedoes not have an integer nextthe integer is higher than the number of registers in the sequence processor
the integer is negative valued
- Parameters:
register_name – The register to verify.
- Raises:
ValueError – Invalid register name passed.