netqasm.lang.ir

class netqasm.lang.ir.GenericInstr(value)

Bases: enum.Enum

An enumeration.

QALLOC = 1
INIT = 2
ARRAY = 3
SET = 4
STORE = 5
LOAD = 6
UNDEF = 7
LEA = 8
JMP = 9
BEZ = 10
BNZ = 11
BEQ = 12
BNE = 13
BLT = 14
BGE = 15
ADD = 16
SUB = 17
ADDM = 18
SUBM = 19
X = 20
Y = 21
Z = 22
H = 23
S = 24
K = 25
T = 26
ROT_X = 27
ROT_Y = 28
ROT_Z = 29
CNOT = 30
CPHASE = 31
MEAS = 32
CREATE_EPR = 33
RECV_EPR = 34
WAIT_ALL = 35
WAIT_ANY = 36
WAIT_SINGLE = 37
QFREE = 38
RET_REG = 39
RET_ARR = 40
CROT_X = 41
CROT_Y = 42
CROT_Z = 43
MOV = 44
BREAKPOINT = 45
class netqasm.lang.ir.BreakpointAction(value)

Bases: enum.Enum

An enumeration.

NOP = 0
DUMP_LOCAL_STATE = 1
DUMP_GLOBAL_STATE = 2
class netqasm.lang.ir.BreakpointRole(value)

Bases: enum.Enum

An enumeration.

CREATE = 0
RECEIVE = 1
netqasm.lang.ir.instruction_to_string(instr)
netqasm.lang.ir.flip_branch_instr(instr)
Parameters

instr (GenericInstr) –

Return type

GenericInstr

netqasm.lang.ir.string_to_instruction(instr_str)
class netqasm.lang.ir.ICmd(instruction, args=None, operands=None, lineno=None)

Bases: object

Parameters
  • instruction (GenericInstr) –

  • args (List[int]) –

  • operands (List[T_OperandUnion]) –

  • lineno (Optional[HostLine]) –

instruction: GenericInstr
args: List[int] = None
operands: List[T_OperandUnion] = None
lineno: Optional[HostLine] = None
property debug_str
class netqasm.lang.ir.BranchLabel(name, lineno=None)

Bases: object

Parameters
  • name (str) –

  • lineno (Optional[HostLine]) –

name: str
lineno: Optional[HostLine] = None
property debug_str
class netqasm.lang.ir.PreSubroutine(netqasm_version, app_id, commands)

Bases: object

A PreSubroutine object represents a preliminary subroutine that consists of general ‘commands’ that might not yet be valid NetQASM instructions. These commands can include labels, or instructions with immediates that still need to be converted to registers.

Subroutine objects before given to other package components.

Parameters
  • netqasm_version (tuple) –

  • app_id (int) –

  • commands (List[Union[ICmd, BranchLabel]]) –

netqasm_version: tuple
app_id: int
commands: List[Union[netqasm.lang.ir.ICmd, netqasm.lang.ir.BranchLabel]]