OPENQASM 3 and OpenPulse¶
OPENQASM 3 is one of the source languages accepted, offering low-level pulse control over the QPU through OpenPulse instructions. For comprehensive documentation on OPENQASM 3 and OpenPulse, please refer to the official QASM3 specification here.
Supported Features¶
Not all features of OPENQASM 3 and OpenPulse are currently supported. The table below outlines the supported and unsupported features:
Units: ns, us, ms, s, dt |
✅ |
Constants: π, ɛ, τ |
✅ |
Standard Libraries |
|
qelib1.inc |
✅ |
stdgates.inc |
✅ |
Qubit Gates / Operations |
|
reset |
❌ |
measure |
✅ |
u |
✅ |
cx |
✅ |
ecr |
✅ |
barrier |
✅ |
Classical Instructions |
|
if_else |
❌ |
for |
❌ |
while |
❌ |
break |
❌ |
continue |
❌ |
function |
❌ |
Types |
|
angle |
❌ 1 |
array |
❌ 1 |
bit |
✅ |
complex |
❌ 1 |
duration |
❌ |
float |
❌ 1 |
frame |
✅ |
int |
❌ 1 |
port |
✅ |
qubit |
✅ |
physical_index |
✅ |
stretch |
❌ |
waveform |
✅ |
Waveforms |
|
constant |
✅ |
gaussian |
✅ |
sech |
✅ |
gaussian_square |
✅ |
drag |
✅ |
sine |
✅ |
arbitrary |
✅ |
mix |
❌ |
sum |
❌ |
scale |
✅ |
phase_shift |
✅ |
Keywords |
|
cal |
✅ |
constant |
❌ |
def |
❌ |
defcal |
✅ |
defcalgrammar |
✅ |
extern |
✅ |
gate_def |
✅ |
include |
✅ |
OpenPulse Instructions |
|
delay |
✅ |
play |
✅ |
capture_v0 |
❌ |
capture_v1 |
✅ |
capture_v2 |
✅ |
capture_v3 |
✅ |
capture_v4 |
❌ |
OpenPulse Functions |
|
durationof |
❌ |
get_phase |
✅ |
set_phase |
✅ |
shift_phase |
✅ |
get_frequency |
✅ |
set_frequency |
❌ 2 |
shift_frequency |
❌ 2 |
newframe |
✅ |
Variable declaration with these types is not supported, but these types can be used as literals.
The frequency of a frame cannot be set dynamically throughout the program. However, it can be used to set the frequency for a frame, which remains constant for the entirety of the program.
Using OpenPulse¶
Reference frames enable pulse-level control of the QPU. Each qubit, or pair of coupled qubits, has associated reference frames that can be accessed using extern declarations. The standard reference frames are named as follows:
`q1_drive`: Used for driving the qubit to perform a rotation in its X-Y plane.
`r1_measure`: Used to read out the qubit state.
`r1_acquire`: Used to acquire the measurement signal, typically alongside the measure frame with capture instructions.
`q1_q2_cross_resonance`: Used to perform an entangling gate between two coupled qubits.
Example: Using Extern Frames¶
The following example demonstrates how extern frames can define custom operations for an sx gate and a measure operation:
OPENQASM 3;
defcalgrammar "openpulse";
cal {
extern frame q1_drive;
extern frame r1_measure;
extern frame r1_acquire;
}
defcal sx $1 {
waveform wf_drive = gaussian(1e-4, 160ns, 50ns);
play(q1_drive, wf_drive);
}
defcal measure $1 {
barrier r1_measure, r1_acquire;
waveform wf_measure = constant(1us, 1e-3);
play(r1_measure, wf_measure);
return capture_v2(r1_acquire, 1us);
}
bit[1] c;
sx $1;
measure $1 -> c[0];
Refer to the official QASM3 documentation for more details on using OpenPulse instructions.