Working in the lab · Chapter 6 of 14

Circuit builder & emulator

Draw the same file; scrub an ideal statevector.

~2 min read3 sectionssame text as the guide inside the lab
All chapters

Keys are written for macOS, the way the lab prints them — on Windows and Linux read as Ctrl, as Alt, as Shift, as Enter.Keys are shown for Windows / Linux to match your platform — on a Mac, Ctrl is and Alt is . Every binding: Keyboard shortcuts.

Every .qasm tab carries a Code | Circuit toggle in the tab strip. Both are projections of the same file: edit the picture and the text changes; close and reopen and the picture is re-derived from the QASM. Your choice of view sticks across files.

Building

  • Palette along the top, in teaching order: H X Y Z · S S† T T† √X · Rx Ry Rz P · CX CZ CP SW CCX · M (measure) ‖ (barrier). Hover a chip for what it does.
  • Place a gate: click a chip, then click a wire — or drag the chip onto the wire. For CX/CZ/CP/SW/CCX click control then target (the strip says what it is waiting for), or drag onto a wire and pick the other end.
  • Move / copy / retarget: drag a placed gate to another column or wire; drag a control or target dot to another wire.
  • Angles: rotation gates get an inline editor with chips pi, pi/2, pi/4, pi/8, -pi/2; any expression the parser reads works.
  • Right-click a gate for Edit angle…, Duplicate (or ⌥-drag), Delete, Insert column left / right, Delete this column; right-click an empty cell to insert or delete a column there.
  • + qubit / ✕ qubit add or remove the last wire (up to 24; the last wire must be empty to remove).
  • ↶ undo / ↷ redo⌘Z / ⇧⌘Z. Delete or Backspace removes the selected gate; arrow keys walk between gates; Escape cancels a drag, closes a menu, deselects.
  • Zoom / + from 50 % to 150 %.

An impossible drop shows why it bounced instead of silently doing nothing.

What the builder will not draw

Custom gate definitions, more than one quantum or classical register, and OpenQASM 3 keep you in the code view with the parser's own sentence and the line number. A picture that omits statements would be a lie with good typography.

The status strip counts what is drawn — gates, depth (barriers excluded), measured wires — and stops there. Nothing in the builder simulates anything…

…except the emulator

∿ emulate turns on an ideal statevector emulator: no noise, no shot sampling, up to 16 qubits in the browser (a bigger circuit gets an honest refusal that names the platform simulator it fits, with a button to the Run rail — the server simulators go to 22 qubits per the catalogue). Then:

  • ⏮ ◀ ▶ ▶| and a scrubber step column by column; col k/N in mono says where you are. Clicking an empty cell jumps to "after this column". The play button is hidden under reduce motion.
  • P(|1⟩) per qubit — one bar per wire.
  • Basis states — the top 8 of 2^n, qubit 0 rightmost.
  • On a measuring column the bars are readout probabilities; the state is not collapsed, and the panel says so.

Circuits the emulator cannot finish (an unsupported op mid-way) show how far it got and why.

Related: Run a circuit · For researchers · Keyboard shortcuts