Part B · Lesson 3

Measurement results come back

Pulses go out; a measurement has to come back. On the transmon ring a measurement is a tone, a window on an ADC, a decoder pipeline and a register on the core that holds one bit. This lesson follows qubit 0's measurement from the tone to the load instruction that waits for the result.

You should know channels and the pulse table (B1) and the lead (B2). The background chapter on measurement, feedback and decoding explains readout physics further.

1A measurement is two windows

What does c = measure q[0]; become on the controller?

A transmon is read through a resonator coupled to it. A microwave tone near the resonator's frequency is sent in, and the signal that comes back has an amplitude and phase that depend on the qubit's state. Integrating the returning signal against a reference tone gives one complex number, and a threshold on it gives one bit (Krantz et al., "A quantum engineer's guide to superconducting qubits", Applied Physics Reviews 6, 021318 (2019), arXiv:1904.06560, Section V). Experimentalists call the whole procedure readout.

On the controller this needs two channels of core q0. The ro channel plays the tone on DAC 8, a line all eight qubits share. The demod channel opens an acquisition window on ADC 12, where it multiplies the incoming samples by its own carrier and integrates: demodulation. Both are ordinary channels with a pulse table of one entry, fired like any drive pulse. The calibration of qubit 0 states:

QuantityCalibrationIn the run
Readout tone frequency6,555,406,453 Hzcode 53,702
Readout tone duration500 ns250 batches
Delay from tone to acquisition window398.57 ns200 batches
Acquisition window656.67 ns329 batches
Demodulation phase−54.256 radcode 23,913

Two details differ from a drive pulse. The demodulation carrier advances per ADC sample, and a batch holds 4 ADC samples instead of 16 DAC samples, so its frequency code is four times the tone's, kept to 16 bits: 18,200 (_demod_code in RISC-Q's units.py). And its amplitude is the full scale 19,896. The hardware instruction h19 covers both windows: the tone opens at batch 538 and the acquisition window at 738, 200 batches later.

How many batches does the acquisition window of h19 last? Find the demodulation window's pulse frame with Next pulse and read its dur.

656.67 ns / 2 ns = 328.3, rounded up to 329 batches (lesson A2). The window closes at 738 + 329 = 1,067.

2The window and the decoder

In this section: what the model does when the acquisition window opens and closes.

Step 390: the demodulation window of qubit 0 opens on ADC 12 at batch 738. The readout tone, opened at batch 538, is still playing.

The pulse frame of a demodulation window looks like that of a drive pulse, with kind set to demod and the converter adc12. Its atConverter equals opens: there is no DAC pipeline on the way in. The window feeds RISC-Q's readout decoder, which integrates the window and decides the bit. The model charges it

decoder = 9 batches (complex multiply 6 + 1 + log₂ 4, ReadoutDecoder.md)

and then a report to the core-local sink:

report = 3 + 2 + link depth + 1 = 8 batches on the ring

The report latency is an assumption: the worst case of the stages in RISC-Q's EventLink.md (up to three puts, a merge, the link, the sink). The model applies the two latencies twice:

How many batches pass between the close of the acquisition window and the result frame?

9 for the decoder and 8 for the report at link depth 2: 1,067 + 17 = 1,084, which is 34 ns. The system-call measurements of docs/riscq-controller.md quote it as "result at the measuring core 34 ns after the window closes".

3Where the bit comes from

RISC-Q's decoder sets the bit from the sign of the real part of the integral (ReadoutDecoder.md). The model keeps that rule but does not produce the integral: no quantum state is simulated, and the returning signal is not computed. The measured bit is an input you choose. In the workspace it is the outcome in the address (outcome=c=1); in the detailed debugger, the "Measurement outcome" box. The lowering (readoutOracle in riscq/platforms/superconducting.mjs) turns it into a result record with res equal to your bit and real set to −20,000 for 1 and +20,000 for 0. Those magnitudes are illustrative; only their sign agrees with the rule.

In this simulator, what determines whether qubit 0's measurement gives 0 or 1?

  1. A simulation of the qubit's state after the Hadamard.
  2. A random number with probability one half.
  3. The outcome you give the run, applied by the readout oracle.
  4. The phase of the demodulation carrier.
The controller model is classical. The outcome is an input, so you can run both branches of a feed-forward program and compare their timing. Exercise B3.6 does that.

4A load that waits

In this section: how the firmware reads the result without polling, and why it must not read too early.

The sink of q0's demodulation channel sits at 0x4200 in the core's address space: res at +0, real at +4, imag at +8 (EventLink.scala). A load from res stalls the core while the result is not valid, and returns the bit the moment it is. The firmware therefore reads the result with one instruction, lw x11, 512(x9): register x9 holds 0x4000, plus 512 is 0x4200.

Timing still matters, in one direction. The result register keeps the previous window's result until the new window has opened and been cleared (RISC-Q's riscq.h, read_res). A read issued too early would return the old bit without stalling. The firmware waits READOUT_LEAD = 48 batches after the window opens before it reads (riscq/soc.mjs, from map.py). On the ring that is batch 786, safely after the clear at 755. From then until the window has closed plus 40 batches (READ_SETTLE), the core is held by the read, so the compiler moves any timed write that would fall in that span to before it.

The trace shows the read in two frames:

StepBatchFrameMeaning
394787q0:165 waitThe load of res stalls: the result is not valid
4041,084e190 resultThe decoder's result reaches q0's inbox
4051,085q0:165.resumeThe load returns res = 1 into x11

A resume frame is named after the wait it ends, and its parents are that wait and the event that woke it. In the Machine state tab, q0 shows "stalled on res" for every step in between.

Step 405: core q0 resumes with res = 1. Its causes are the wait and the result frame.

What is the frame ID of the step at which q0's load of the readout result returns?

The resume frame carries the ID of the wait it ends with .resume appended. Its state holds register: res and value: 1.

For how many batches is core q0 stalled in that load?

From the wait at 787 to the resume at 1,085: 298 batches, 596 ns. Most of it is the acquisition window itself. A stalled core issues nothing, which is why the compiler moves timed writes out of the hold.

5Keeping and reporting the bit

With the bit in x11, the firmware (storeBit in riscq/firmware.mjs) stores it twice: in a bit table in the core's own RAM, where later code of the same core can test it, and in the host window at 0x40000000, which is how results reach the computer that runs the experiment. The host window is write only (RISC-Q's HostWindow.md). The RAM store leaves no frame in the default trace; the host store is frame q0:168 at batch 1,089, and the run's summary.host lists it with its value.

Here the bit also conditions a pulse on another core, so q0 then publishes it to the board hub: the subject of lesson B4. If the measurement and the conditioned gate were on the same core, a branch on the loaded bit would be enough.

Run the feed-forward program with the outcome c = 0 instead. How many pulse and demodulation windows open in that run?

Seven instead of eight. The core q2 still waits at the barrier and reads the bit, but its firmware branches over the fire of the x (beq on the stored bit), so no window opens. The run takes as long as before: segment 1 has a fixed span.

What to remember

  1. A readout is two fired channels: a tone on a DAC and a demodulation window on an ADC.
  2. The result reaches the core's sink 9 + 8 = 17 batches after the window closes; the report latency is an assumed worst case.
  3. The bit is an input to the model; its real integral only carries the sign RISC-Q's decoder uses.
  4. A load of res stalls until the result is valid. The firmware waits 48 batches after the window opens so that it never reads the previous result.
  5. The bit is stored in the core's RAM and in the host window at 0x40000000.