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:
| Quantity | Calibration | In the run |
|---|---|---|
| Readout tone frequency | 6,555,406,453 Hz | code 53,702 |
| Readout tone duration | 500 ns | 250 batches |
| Delay from tone to acquisition window | 398.57 ns | 200 batches |
| Acquisition window | 656.67 ns | 329 batches |
| Demodulation phase | −54.256 rad | code 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.
2The window and the decoder
In this section: what the model does when the acquisition window opens and closes.
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:
- 17 batches after the window opens, at batch 755, a
clearframe marks the result register of q0 invalid. The new window has started, so the old result no longer applies. - 17 batches after the window closes, at batch 1,084, a
resultframe writes the new result to q0's inbox:valid, the bitres, and the two integralsrealandimag.
How many batches pass between the close of the acquisition window and the result frame?
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?
- A simulation of the qubit's state after the Hadamard.
- A random number with probability one half.
- The outcome you give the run, applied by the readout oracle.
- The phase of the demodulation carrier.
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:
| Step | Batch | Frame | Meaning |
|---|---|---|---|
| 394 | 787 | q0:165 wait | The load of res stalls: the result is not valid |
| 404 | 1,084 | e190 result | The decoder's result reaches q0's inbox |
| 405 | 1,085 | q0:165.resume | The 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.
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?
.resume appended. Its state
holds register: res and value: 1.For how many batches is core q0 stalled in that load?
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?
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
- A readout is two fired channels: a tone on a DAC and a demodulation window on an ADC.
- The result reaches the core's sink 9 + 8 = 17 batches after the window closes; the report latency is an assumed worst case.
- The bit is an input to the model; its
realintegral only carries the sign RISC-Q's decoder uses. - A load of
resstalls until the result is valid. The firmware waits 48 batches after the window opens so that it never reads the previous result. - The bit is stored in the core's RAM and in the host window at
0x40000000.