Input Circuit
Introduction
Quantum circuits can be written in a number of ways, for example, using a number of different languages, programs, and libraries. This section describes the format that TopQAD accepts for input quantum circuits. This format helps TopQAD to compile to the Pauli product rotations ISA. Recall that quantum programs can be compiled for different instruction sets and their corresponding gate set, as explained in the Quantum Architecture Basics section.
TopQAD currently accepts input circuits in the CNOT+ gate set.
Input File Conditions
The following input circuit conditions must be met:
- The file must be less than or equal to 10 MB in size.
- The file name and description may contain only letters, numbers, spaces, underscores, and hyphens. Other characters are not permitted.
- The file format must adhere to the requirements stated below.
Input File Format Requirements
The following requirements must be met for an input circuit file to be compatible with TopQAD:
- The input file must be a valid OpenQASM 2.0 file.
- TopQAD supports purely quantum circuits; the classically-controlled if statement (
if) is not supported. - Currently, TopQAD supports the gates listed in the table below. These gates are defined in the standard OpenQASM header
qelib1.inc. Custom gates (including opaque gates) are not supported. 4.qelib1.incis assumed to be imported, but the import statement may still be present in input files. No other include statements can be present. - Measurements are expected at the end of the circuit. Mid-circuit measurements are not supported. If no measurement is present on a qubit, a Z-basis measurement on that qubit will be appended to the circuit in the optimization phase.
- A
cregof the same size as the total number of qubits is assumed to be present.cregdeclarations are ignored. - Quantum register declarations (
qreg name[size];) must appear before any gate invocations. All qubits are mapped to a linear address space in latter portions of the pipeline; all qregs will be appended to this space in declaration order. - Neither
resetnorbarrierstatements are supported. - At present, classical arguments to a gate must be in one of the following formats (where
nandmare integers,fis a float, no whitespace is allowed):n * pipi * nn * pi / mpi * n / m-n * pi-pi * n-n * pi / m-pi * n / mpi / n-pi / nff * pipi * f
A complete listing of supported gates is provided below.
| Gate | Description |
|---|---|
rz | rotates a qubit around the -axis by a given angle |
ry | rotates a qubit around the -axis by a given angle |
rx | rotates a qubit around the -axis by a given angle |
u1 | equivalent to rz, up to a global phase |
u2 | equivalent to u3(pi/2, theta, phi) |
u3 | a single-qubit unitary parameterized by three arbitrary angles |
h | the Hadamard gate |
x | the Pauli- gate |
y | the Pauli- gate |
z | the Pauli- gate |
s | the phase gate |
sdg | the inverse of the phase gate |
t | the gate, a rotation |
tdg | the inverse of the gate |
cx | the controlled-NOT (CNOT) gate |
