Target
QASM2
QASM2(
qelib1: bool = True,
allow_parallel: bool = False,
allow_global: bool = False,
custom_gate: bool = True,
unroll_ifs: bool = True,
allow_noise: bool = True,
)
QASM2 target for Bloqade kernels.
QASM2 target that accepts a Bloqade kernel and produces an AST that you can then obtain a string for printing or saving as a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_parallel
|
bool
|
Allow parallel gate in the resulting QASM2 AST. Defaults to |
False
|
allow_global
|
bool
|
Allow global gate in the resulting QASM2 AST. Defaults to |
False
|
qelib1
|
bool
|
Include the |
True
|
custom_gate
|
bool
|
Include the custom gate definitions in the resulting QASM2 AST. Defaults to |
True
|
unroll_ifs
|
bool
|
Unrolls if statements with multiple qasm2 statements in the body in order to produce valid qasm2 output, which only allows a single
operation in an if body. Defaults to |
True
|
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/emit/target.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
emit
emit(entry: Method) -> ast.MainProgram
Emit a QASM2 AST from the Bloqade kernel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
Method
|
The Bloqade kernel to convert to the QASM2 AST |
required |
Returns:
Type | Description |
---|---|
MainProgram
|
ast.MainProgram: A QASM2 AST object |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/emit/target.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
emit_str
emit_str(entry: Method) -> str
Emit a QASM2 AST from the Bloqade kernel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
Method
|
The Bloqade kernel to convert to the QASM2 AST |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A string with the QASM2 representation of the kernel |
Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/emit/target.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|