Overview
OpenPulse extends OpenQASM3 beyond the gate model by introducing constructs for ports, frames, and waveforms that describe the actual control signals sent to quantum hardware. This allows programmers to implement custom calibrated gates, adjust frequencies and phases dynamically, and align timing at the hardware level. With OpenPulse, quantum programs can bridge the gap between high-level circuits and the physical pulses that drive qubit operations.PyQASM 🤝 OpenPulse
PyQASM now understands and validates OpenPulse constructs embedded inOpenQASM3
programs. This includes parsing cal
blocks and defcal
definitions and validating pulse-level statements.
While most existing tools focus on gate-level OpenQASM
, few provide strong support for pulse-level semantics and most of them lack comprehensive semantic analysis — such as validating scope rules, deterministic durations in defcal, and hardware-level constraints
PyQASM aims to fill this gap by:
-
Providing a unified parser and validator for both
OpenQASM3
andOpenPulse
. - Enforcing semantic correctness of pulse operations, not just syntax.
-
Allowing users to configure
backend-specific
rules (duration tracking, frame limits, etc.). - Building towards a complete analysis and compilation toolkit for pulse-level programs, bridging high-level circuits with low-level control.
Core Constructs
The OpenPulse grammar—activated bydefcal grammar "openpulse";
— adds these core constructs to OpenQASM3.
-
Ports (
port
): Abstract I/O channels representing hardware control lines.- Real hardware often restricts the number of active frames per physical port. pyqasm introduces a
frame_limit_per_port
option that users can set when loading a program.
- Real hardware often restricts the number of active frames per physical port. pyqasm introduces a
-
Frames (
frame
): Stateful carriers with port, timing, frequency, and phase.- Users can configure whether frames are allowed in
defcal
blocks via theframe_in_defcal
option when loading a program.
- pyqasm also supports the full set of frame manipulators defined in the OpenPulse grammar
set_frequency()
/shift_frequency()
/shift_phase()
/get_frequency()
/get_phase()
.
- Users can configure whether frames are allowed in
-
Waveforms (
waveform
): Envelopes modulating signals on ports.- pyqasm supports all
waveform
types defined in the OpenPulse specification —gaussian
,sech
,gaussian_square
,drag
,constant
,sine
,mix
,sum
,phase_shift
,scale
. - validates all declarations conform to the OpenPulse grammar, including parameter correctness and waveform compatibility.
- pyqasm supports all
-
Capture (
capture
): Measurement/capture operations.- pyqasm also supports the
capture
operations defined in the OpenPulse grammar —capture_v1()
,capture_v2()
,capture_v3()
,capture_v4()
.
- pyqasm also supports the
-
Operations within
cal
/defcal
:-
play() — apply a waveform via a frame.
- By default,
play
is intended for use insidedefcal
blocks. pyqasm introduces a configurable option,play_in_cal_block
, which allows users to enable or restrict the use ofplay
instructions insidecal
blocks as well.
- By default,
-
delay() — Advance the
time-cursor
of a frame by a givenduration
. -
barrier() —
synchronize
the time-cursor of multiple frames to the same point in time.
-
play() — apply a waveform via a frame.
Capabilities
-
Duration Tracking
- Each frame carries an internal time-cursor that advances as operations (
play
,delay
,capture
) are applied. - pyqasm performs semantic tracking of
durations
, ensuring that timing across frames remains consistent throughout the program. - This enables correct validation of
defcal
blocks, which must have deterministic total durations across all execution paths.
- Each frame carries an internal time-cursor that advances as operations (
-
PyQASM Supports Frames-Collisions validation in
defcal
blocks. -
PyQASM also unrolls
cal
blocks, which is useful for debugging and visualization. Since,defcal
are acted as functions, we are not unrolling them.
- Currently, pyqasm does not support
extern
declarations in OpenPulse blocks.
For more details, please refer to the OpenPulse
specification.