Table of Contents
Fetching ...

Open Quantum Assembly Language

Andrew W. Cross, Lev S. Bishop, John A. Smolin, Jay M. Gambetta

TL;DR

OpenQASM 2.0 defines a hardware-centered quantum assembly language and IR for the Quantum Experience, enabling low-depth, near-term experiments with a universal gate basis built from CNOT and SU(2) operations. It provides a simple, macro-like gate subroutine mechanism, a quantum-classical interface (measurement, reset, and feedback), and a structured workflow (offline compilation, online circuit generation, execution, and post-processing). The paper presents a comprehensive set of representative circuits—teleportation, QFT, inverse QFT with measurement, ripple-carry adders, RB, QPT, and QEC—to demonstrate practical OpenQASM usage and hierarchical gate design. By anchoring hardware primitives in a standard header and supporting opaque gates and parameter expressions, the approach aims to remain adaptable to evolving quantum hardware while preserving portability and human readability. The work facilitates accessible experimentation on IBM’s quantum hardware and serves as a reference for subsequent language and compiler development in quantum computing.

Abstract

This document describes a quantum assembly language (QASM) called OpenQASM that is used to implement experiments with low depth quantum circuits. OpenQASM represents universal physical circuits over the CNOT plus SU(2) basis with straight-line code that includes measurement, reset, fast feedback, and gate subroutines. The simple text language can be written by hand or by higher level tools and may be executed on the IBM Q Experience.

Open Quantum Assembly Language

TL;DR

OpenQASM 2.0 defines a hardware-centered quantum assembly language and IR for the Quantum Experience, enabling low-depth, near-term experiments with a universal gate basis built from CNOT and SU(2) operations. It provides a simple, macro-like gate subroutine mechanism, a quantum-classical interface (measurement, reset, and feedback), and a structured workflow (offline compilation, online circuit generation, execution, and post-processing). The paper presents a comprehensive set of representative circuits—teleportation, QFT, inverse QFT with measurement, ripple-carry adders, RB, QPT, and QEC—to demonstrate practical OpenQASM usage and hierarchical gate design. By anchoring hardware primitives in a standard header and supporting opaque gates and parameter expressions, the approach aims to remain adaptable to evolving quantum hardware while preserving portability and human readability. The work facilitates accessible experimentation on IBM’s quantum hardware and serves as a reference for subsequent language and compiler development in quantum computing.

Abstract

This document describes a quantum assembly language (QASM) called OpenQASM that is used to implement experiments with low depth quantum circuits. OpenQASM represents universal physical circuits over the CNOT plus SU(2) basis with straight-line code that includes measurement, reset, fast feedback, and gate subroutines. The simple text language can be written by hand or by higher level tools and may be executed on the IBM Q Experience.

Paper Structure

This paper contains 13 sections, 5 equations, 14 figures, 1 table.

Figures (14)

  • Figure 1: Block diagrams of processes (blue) and abstractions (red) to transform and execute a quantum algorithm. The emphasized quantum circuit abstraction is the main focus of this document. The API and Resource Manager (green) represents the gateway to backend processes for circuit execution. Dashed vertical lines separate offline, online, and real-time processes.
  • Figure 2: The built-in two-qubit entangling gate is the controlled-NOT gate. If a and b are qubits, the statement CX a,b; applies a controlled-NOT (CNOT) gate that flips the target qubit b iff the control qubit a is one. If a and b are quantum registers, the statement applies CNOT gates between corresponding qubits of each register. There is a similar meaning when a is a qubit and b is a quantum register and vice versa.
  • Figure 3: The single-qubit unitary gates are built in. These gates are parameterized by three real parameters $\theta$, $\phi$, and $\lambda$. If the argument q is a quantum register, the statement applies size(q) gates in parallel to the qubits of the register.
  • Figure 4: New gates are defined as unitary subroutines. The gates are applied using the statement name(params) qargs; just like the built-in gates. The parentheses are optional if there are no parameters. The gate $\mathrm{cu1}(\theta)$ corresponds to the unitary matrix $\mathrm{diag}(1,1,1,e^{i\theta})$ up to a global phase.
  • Figure 5: The measure statement projectively measures a qubit or each qubit of a quantum register. The measurement projects onto the $Z$-basis and leaves qubits available for further operations. The top row of circuits depicts single-qubit measurement using the statement measure q[0] -> c[0]; while the bottom depicts measurement of an entire register using the statement measure q -> c;. The center circuit of the top row depicts measurement as the final operation on q[0].
  • ...and 9 more figures