HOME

TheInfoList



OR:

Open Quantum Assembly Language (OpenQASM; pronounced ''open kazm'') is a programming language designed for describing quantum circuits and algorithms for execution on quantum computers. It is designed to be an
intermediate representation An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
that can be used by higher-level compilers to communicate with quantum hardware, and allows for the description of a wide range of quantum operations, as well as classical feed-forward flow control based on measurement outcomes. The language includes a mechanism for describing explicit timing of instructions, and allows for the attachment of low-level definitions to gates for tasks such as calibration. OpenQASM is not intended for general-purpose classical computation, and hardware implementations of the language may not support the full range of data manipulation described in the specification. Compilers for OpenQASM are expected to support a wide range of classical operations for compile-time constants, but the support for these operations on runtime values may vary between implementations. The language was first described in a paper published in July 2017, and a reference source code implementation was released as part of IBM's Quantum Information Software Kit (
Qiskit Qiskit is an open-source Software development kit, software development kit (SDK) for working with Quantum Computer, quantum computers at the level of circuits, pulses, and algorithms. It provides tools for creating and manipulating Quantum circu ...
) for use with their
IBM Quantum Experience The IBM Quantum Composer and the IBM Quantum Lab (previously known collectively as the IBM Quantum Experience) form an online platform allowing public and premium access to cloud-based quantum computing services provided by IBM Quantum. This inclu ...
cloud quantum computing platform. The language has similar qualities to traditional
hardware description language In computer engineering, a hardware description language (HDL) is a specialized computer language used to describe the structure and behavior of electronic circuits, and most commonly, digital logic circuits. A hardware description language e ...
s such as
Verilog Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is also ...
. OpenQASM defines its version at the head of a source file as a number, as in the declaration: OPENQASM 3; The level of OpenQASM's original published implementations is OpenQASM 2.0. Version 3.0 of the specification is the current one and can be viewed at th
OpenQASM
repository on ''GitHub''.


Examples

The following is an example of OpenQASM source code from the official library. The program adds two four-bit numbers. /* * quantum ripple-carry adder * Cuccaro et al, quant-ph/0410184 */ OPENQASM 3; include "stdgates.inc"; gate majority a, b, c gate unmaj a, b, c qubit cin; qubit a; qubit b; qubit cout; bit ans; uint a_in = 1; // a = 0001 uint b_in = 15; // b = 1111 // initialize qubits reset cin; reset a; reset b; reset cout; // set input states for i in : 3 // add a to b, storing result in b majority cin b a for i in : 2 cx a cout for i in : -1: 0 unmaj cin b a measure b :3-> ans :3 measure cout -> ans


References


External links


OpenQASM
on ''GitHub'' {{quantum computing Programming languages Quantum computing Quantum programming