qblox_scheduler.backends.qblox.register_manager#

Utility class for dynamically allocating registers for Qblox sequencers.

Classes#

RegisterManager

Utility class that keeps track of all the registers that are still available.

Functions#

_verify_valid_register(→ None)

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.

_available_registers: list[str][source]#
_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:

  1. register_name does not start with “R” or

  2. register_name does not have an integer next

  3. the integer is higher than the number of registers in the sequence processor

  4. the integer is negative valued

Parameters:

register_name – The register to verify.

Raises:

ValueError – Invalid register name passed.