Skip to main content
QiskitBackend translates a b01t IRProgram into a Qiskit QuantumCircuit. Use it as the final step after building and (optionally) lowering your b01t program. The backend requires qiskit to be installed separately — b01t does not depend on it by default.

QiskitBackend

QiskitBackend has no constructor arguments. Create one instance and reuse it across multiple programs.

QiskitBackend.emit

Compiles an IRProgram into a Qiskit QuantumCircuit. Each QReg in the program becomes a QuantumRegister with the same name and size. Measurement ops add a corresponding ClassicalRegister automatically.
ir
IRProgram
required
The compiled IR program to emit. Obtain this from .build() on a @parametric or @adaptive function, or from lower_exact_program() on an ExactProgram.
Returns: a qiskit.QuantumCircuit with the same register layout and gate sequence as the input IR. Raises:
  • DSLValidationError — if qiskit is not installed, or if the IR contains an IfOp (classical feed-forward is not supported in the current release).
  • DSLValidationError — if the IR contains a gate name not supported by the backend.

Supported gates

The backend supports all gates in the b01t exact and parametric gate sets: x, h, z, s, sdg, t, tdg, rx, ry, rz, cx, cz, swap, cry, crz, ccx, ccz, mcx, mcz, measure, measure_all. IfOp (from if_then) is not lowered and raises DSLValidationError.

Full example: @coherent to QuantumCircuit

Example: @parametric to QuantumCircuit

Example: @adaptive with measurement

Unsupported gate error

If you pass an IR that contains an unrecognised gate name, the backend raises DSLValidationError: