register_manager#

Utility class for dynamically allocating registers for Qblox sequencers.

Module Contents#

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.

class RegisterManager[source]#

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

_available_registers: Set[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.

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: Set[str][source]#

Getter for the available registers.

Returns:

A set containing all the available 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.