netqasm.lang.ir
- class netqasm.lang.ir.GenericInstr(value)
Bases:
EnumAn enumeration.
- QALLOC = 1
- INIT = 2
- INIT_ALL = 3
- ARRAY = 4
- SET = 5
- STORE = 6
- LOAD = 7
- UNDEF = 8
- LEA = 9
- JMP = 10
- BEZ = 11
- BNZ = 12
- BEQ = 13
- BNE = 14
- BLT = 15
- BGE = 16
- ADD = 17
- SUB = 18
- ADDM = 19
- SUBM = 20
- MUL = 21
- DIV = 22
- REM = 23
- X = 24
- Y = 25
- Z = 26
- H = 27
- S = 28
- K = 29
- T = 30
- ROT_X = 31
- ROT_Y = 32
- ROT_Z = 33
- CNOT = 34
- CPHASE = 35
- ROT_X_ALL = 36
- ROT_Y_ALL = 37
- ROT_Z_ALL = 38
- BICHROMATIC = 39
- MEAS = 40
- MEAS_BASIS = 41
- MEAS_BASIS_YZY = 42
- MEAS_BASIS_ZXZ = 43
- MEAS_ALL = 44
- CREATE_EPR = 45
- RECV_EPR = 46
- WAIT_ALL = 47
- WAIT_ANY = 48
- WAIT_SINGLE = 49
- QFREE = 50
- RET_REG = 51
- RET_ARR = 52
- CROT_X = 53
- CROT_Y = 54
- CROT_Z = 55
- MOV = 56
- BREAKPOINT = 57
- SWP = 58
- class netqasm.lang.ir.BreakpointAction(value)
Bases:
EnumAn enumeration.
- NOP = 0
- DUMP_LOCAL_STATE = 1
- DUMP_GLOBAL_STATE = 2
- netqasm.lang.ir.instruction_to_string(instr)
- netqasm.lang.ir.flip_branch_instr(instr)
- Parameters:
instr (
GenericInstr)- Return type:
- 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 (
Optional[List[int]])lineno (
Optional[HostLine])
-
instruction:
GenericInstr
-
args:
List[int] = None
- property debug_str
- class netqasm.lang.ir.BranchLabel(name, lineno=None)
Bases:
object- Parameters:
name (
str)lineno (
Optional[HostLine])
-
name:
str
- property debug_str
- class netqasm.lang.ir.ProtoSubroutine(commands=None, arguments=None, netqasm_version=(0, 10), app_id=None)
Bases:
objectA ProtoSubroutine 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.
ProtoSubroutines can optionally have arguments, which are yet-to-be-defined variables that are used in one or more of the commands in the ProtoSubroutine. So, a ProtoSubroutine can be seen as a function which takes certain parameters (arguments). Concrete values for arguments can be given by instantiating (using the instantiate method).
ProtoSubroutine`s are currently only used by the sdk and the text parser (netqasm.parser.text). In both cases they are converted into `Subroutine objects before given to other package components.
- Parameters:
commands (
Optional[List[Union[ICmd,BranchLabel]]])arguments (
Optional[List[str]])netqasm_version (
Tuple[int,int])app_id (
Optional[int])
- property netqasm_version: Tuple[int, int]
- property app_id: int | None
- property commands: List[ICmd | BranchLabel]
- property arguments: List[str]
- instantiate(app_id, arguments)
- Parameters:
app_id (
int)arguments (
Dict[str,int])
- Return type:
None