Background · Chapter 3

The RISC-Q architecture

RISC-Q gives each qubit a small RISC-V processor that never touches a sample. It writes registers, and the hardware next to the converters turns those writes into pulses on exactly the scheduled clock cycle. This chapter describes every part of that design as the simulator models it: cores, the address map, posted writes, channels and pulse tables, timed queues, sinks, the board hub and the host window.

This chapter assumes the vocabulary of chapter 2: batches, DACs and ADCs, carriers, envelopes and demodulation. RISC-Q is an open-source design from the Wu Quantum Application System Group (github.com/Wu-Quantum-Application-System-Group/RISC-Q). Its QEC system paper is J. Liu, Y. Lee, Y. Xu, G. Huang and X. Wu, "A Scalable Open-Source QEC System with Sub-Microsecond Decoding-Feedback Latency", arXiv:2603.16203 (2026). Where this chapter names a document such as PutHub.md, it is a file of the RISC-Q repository that the model follows.

1One processor per qubit

If a control processor does not produce samples, what does it do?

In this section: the shape of a RISC-Q system and the path of one register write.

RISC-Q's README describes "a RISC-V–controlled SoC for superconducting-qubit control, written in SpinalHDL and targeting the AMD/Xilinx ZCU216 RFSoC board", with one RV32I core per qubit. Each core runs its own program from its own RAM. Next to the converters sit channels: a pulse generator for a DAC, an acquisition unit for an ADC, or a bank of digital lines. A core and its channels are joined by a pipelined link. Above all cores sits the board hub, through which cores share bits, meet at barriers and send each other words.

board hub groups · barriers · mailboxes · 1 msg/batch host windowresults, write only core q0 (RV32I) own RAM, sinkssw → put window core q1 (RV32I) own RAM, sinkssw → put window linkdepth L gatepulse table, queues roreadout tone demodacquisition DAC (16 samples/batch) ADC (4/batch) report → sink … one core per qubit,8 on the x6y3 ring
A RISC-Q system as the model sees it. A core's store into its put window becomes a posted write that crosses the link to one channel (solid arrows). Channels feed the converters. Reports from acquisition channels come back to core-local sinks, and messages to the hub and results to the host travel as writes too (dashed arrows). The channel list is the one each transmon core has on the ring, without its CZ channels. Schematic drawing; the workspace's control view draws the same parts at the model's schematic floorplan positions.

One pulse, in four events, shows the whole idea. In the feed-forward run of lesson A1 with the measured bit set to 1, the conditioned x on qubit 2 is caused by one store on core q2 at batch 1,157. The write reaches the channel q2.gate at batch 1,160 and is fired there. The pulse window opens at batch 1,239, and 6 batches later, at batch 1,245, the pulse is at the DAC port, from where the coax takes it to the qubit. Everything in between is what this chapter explains: why the write arrives three batches after the store, why it waits 79 batches before the window opens, and why the opening does not depend on when the write arrived.

2Cores

Each core executes RV32I, the 32-bit base integer instruction set of RISC-V, with the multiply-only Zmmul extension (QControl/RiscQ/Rv32.lean, after RISC-Q docs/riscv/RISCV.md: single issue, in order). The model has no CSRs, interrupts, compressed or atomic instructions; an unsupported word decodes to illegal and stops the core with a fault frame. RAM starts at 0x80000000. The x6y3 build gives each core 8,192 words; the ion and atom builds of the simulator give 16,384.

The model's core timing is a cost model, not a pipeline simulation: one batch per instruction, five more after a taken branch or jump (an assumed upper bound from the stages in RISCV.md) and one more for a load or store (LsuPlugin.md). This matters for how fast firmware runs, for example a decoder, but not for when pulses land, as long as each write is issued early enough. That is the subject of chapter 4.

3The address map

How does a store instruction reach a pulse generator?

In this section: every register a core can read or write, with the RISC-Q source of each.

A core talks to the rest of the system only through loads and stores to fixed addresses. The table is from docs/riscq-controller.md; the constants are in riscq/soc.mjs (MAP), after RISC-Q's software/riscq/map.py.

Register (core address)BehaviorRISC-Q source
time 0xBFF8Batch time. The core's copy lags the converter edge by the linkControlMemMaps.scala
timeCmp 0x4000, waitTimeCmp 0x4008A read of waitTimeCmp stalls the core until time + 3 ≥ timeCmpControlMemMaps.scala
done 0x4010Sticky completion flagControlMemMaps.scala
Sinks from 0x4200, 0x20 apartReadout result (res stalls until settled, real, imag) or an input-edge queue (pop, time, seq, count)EventLink.scala
board 0x4300, release 0x4320, mailboxes 0x4340Shared group words, barrier release time, unicast wordsPutHub.scala
Put window from 0x10000, 0x10000 per nodeNodes 0–15 are the core's channels. Higher nodes reach the hubmap.py
Channel: fire +0, freq +4, dcOffset +8, phaseOffset +0xC, entry i at (i+1)·16, startTime +0x410016-bit fields sit in bits 31:16 of the written wordPulseParamBuffer.scala
Host window from 0x40000000Write only. Results for the hostHostWindow.md

The put window is divided into nodes of 0x10000 bytes. Node k starts at 0x10000 + k · 0x10000. Nodes 0–15 are the core's own channels in the order its build lists them. Nodes 16–19 are the four shared group words of the hub, nodes 20–35 the sixteen barriers, and from node 36 on the mailboxes of other cores (GROUP_NODE0, BARRIER_NODE0, INBOX_NODE0 in riscq/soc.mjs). So a store to 0x10000 fires channel 0, and a store to 0x150000 arrives at barrier 0.

On the ring, each core's channels are listed gate, cz0, cz1, ro, demod (where the qubit has two CZ partners). At which address does core q0 write to fire its cz1 channel? Answer in hexadecimal.

cz1 is channel 2, node 2: 0x10000 + 2 · 0x10000 = 0x30000. Its fire register is at offset 0, its startTime at 0x34100.

4Posted writes and the link

A store into the put window is a posted write: the core sends it and goes on without waiting for an answer. The PutBridge forwards it as one beat after a one-cycle acknowledgment, and the PutLink carries it through L register stages, the link depth. A write therefore reaches its channel 1 + L batches after the store (PutBridge.md, PutLink.md). The x6y3 build has link_pipe = 2, which is why the store at batch 1,157 above reaches q2.gate at batch 1,160. The ion and atom builds of the simulator use a depth of 4.

Posted writes are what make the link cheap to pipeline. Because nothing waits for an answer, adding a register stage to meet the FPGA's timing costs one batch of latency and no throughput. The cost is that the core does not know when a write arrives, which the timed queues of section 6 make irrelevant. The link also carries traffic back: reports from channels to the core's sinks, and messages to and from the hub.

5Channels and pulse tables

What does a channel hold, and what does a fire do?

In this section: the three channel kinds, the register layout, firing, and the start-time register that advances by itself.

A channel is one of three kinds (riscq/soc.mjs, socSpec): pulse, which drives a DAC; demod, which opens acquisition windows on an ADC; and dio, which drives and watches sixteen digital lines. Each holds a register file (Buffer in Timing.lean): a start time, a carrier code, a DC offset, a phase offset and a pulse table of slots entries, each with a phase, an amplitude, an envelope address and a duration. The firmware fills the table once, at the start of the program; a calibrated pulse is then just an index.

To play an entry, the firmware writes the start time to startTime and then the entry's index to fire. A fire captures the current start time and the entry, hands both to the timed queues, and then advances startTime by the entry's duration. Three theorems in Timing.lean pin this behavior down:

TheoremStatement
fire_captures_startA fire schedules its entry at the buffer's current start time.
fire_fire_contiguousA second fire is scheduled exactly one duration after the first, with no time arithmetic in the control program.
explicit_start_winsWriting startTime after a fire discards the automatic advance.
fire_preserves_tableA fire changes no table entry, so a slot can be fired repeatedly.
decode_layoutstartTime at 0x4100 and the fields of entry i at (i+1)·16 decode to the intended registers, provided the table ends below 0x4100.

fire_fire_contiguous is what makes pulse trains cheap: firing the same channel twice plays two pulses back to back without the firmware computing the second start time. The firmware this simulator generates writes the start time before every fire anyway, because its pulses are rarely contiguous.

6Timed queues and leads

How can parameters that take different times to process all take effect on the same batch?

In this section: why each parameter of a pulse has its own pipeline latency, and how the queues hide it.

A pulse generator is a pipeline. The amplitude goes through a multiplier, the phase through a rotation, the envelope address through a memory read, the duration only through a gate. Each takes a different number of cycles from the moment the generator receives it to the moment it affects the output. If all four were applied at the start time, the pulse would begin with the right duration but the wrong amplitude for a few dozen samples.

RISC-Q solves this with one timed queue per parameter. A fired entry is pushed into every queue 2 batches after its beat (PulseParamBuffer.md). Each queue releases its value at startTime − lead, where lead is that parameter's own pipeline latency, so every parameter reaches the output on the start time. The model derives the leads from the block latencies of PulseGenerator.md:

ParameterPathLead (batches)
Amplitudecarrier amplitude 27 + complex multiply 6 + gate 134
Phasecarrier phase 28 + 6 + 135
Carrier frequencycarrier frequency 29 + 6 + 136
Lane phasors (16 lanes)regeneration 16 + CORDIC 19 + 2, then phasor 8 + 6 + 152
Envelope addressenvelope reader 4 + 6 + 111
Durationgate 1 + 12

Theorem default_leads in Timing.lean proves that these formulas give exactly 34, 35, 36, 52, 11 and 2 for the default datapath; phase_is_slowest_fired_lead proves that phase is the slowest parameter of a fired pulse.

A queue cannot release an entry the instant it is pushed. The model follows RISC-Q's TimedQueue.scala (RegHead implementation): an entry can pop no sooner than 3 batches after its push (FIFO write, head register, registered compare), and consecutive pops of one queue are at least 2 batches apart. Each queue holds the build's queue depth plus one entry: 33 on the x6y3 build (depth 32), 5 on the default depth of 4. After the generator, the samples cross an adder tree that combines the channels sharing one DAC, plus 2 stages, to reach the DAC port (dac_pipe in map.py): 6 batches on the ring, where several channels of one core share each DAC. That is the gap between the window opening at 1,239 and the pulse at the port at 1,245.

The result. As long as a write reaches its channel early enough, the pulse opens exactly on its start time, whatever the link latency, the core's speed or the order of other writes. Chapter 4 states this as three theorems and shows what "early enough" means in batches.

7Sinks: results coming back

Information flows back to a core through sinks, core-local registers starting at 0x4200, one per reporting channel in channel order (sinkAddress in riscq/soc.mjs). There are two kinds (EventLink.md):

A report takes 3 + 2 + L + 1 batches to reach its sink: up to three puts, a merge, the link and the sink. This is an assumed worst case of the stages EventLink.md describes, listed as such in docs/riscq-controller.md. On the ring the measured result is in the measuring core 34 ns after the window closes; lesson E1 takes that interval apart.

8The board hub

How do cores that each drive one qubit coordinate a two-qubit gate or a feed-forward?

In this section: groups, barriers, mailboxes, and the one-message-per-batch arbiter that every core shares.

The hub (PutHub.md) offers three services, all reached by posted writes to put-window nodes above 15:

The hub is a shared resource with a fixed throughput. Every message waits in a queue of depth 8 per core, and a round-robin arbiter passes one message per batch for the whole board. A message into a full queue is dropped and reported as a fault. A barrier arrival directly behind another for the same barrier waits one more batch. At link depth 4, a published bit reaches every core's board 23 batches after the store, as RISC-Q documents, plus any wait at the arbiter.

BehaviorValueBasis
Publish to every core's board23 batches at link depth 4, plus the wait at the arbiterPutHub.md; conformance test
Hub throughput1 message per batch, whole boardPutHub.md
Queue per core8 messagesPutHub.md
8 cores publish on the same batchreach every board after 23 to 30 batches, in core orderriscq/limits.mjs, publishBurst, run for this chapter
8 cores arrive at one barrier on the same batchcounted 2 batches apart; all hold the common time 37 batches after the arrivalriscq/limits.mjs, barrierFanIn, run for this chapter
Arbiter fairnessgrants only a core with a message waiting, and grants one in every batch in which any core has oneproved: nextSource_waiting, nextSource_isSome in Soc.lean

The hub arbiter follows the statements of PutHub.md, not an RTL trace, and the model starts the arbiter's round at core 0, an assumption. One bit per message and one message per batch means the hub carries at most 500 bits per microsecond at 500 MHz. Lessons B4 and E4 measure what that limit means for feed-forward and for error-correction traffic.

Run the feed-forward program with the measured bit set to 1. How many messages does the hub pass in the whole run?

The run's summary counts every message the arbiter granted (summary.hub.served): the three active cores (q0, q1, q2) arrive at barrier 0 before the first segment and at barrier 1 before the conditioned gate, and q0 publishes the measured bit once. Open the control view in the workspace and step through the hub's frames to see each one.

A core writes a message to the hub while its queue of 8 is full. What does the model do?

  1. The store stalls the core until there is room.
  2. The message is dropped and the run reports a fault.
  3. The oldest message in the queue is overwritten.
  4. The hub passes two messages in that batch.
The write is posted, so the core never waits for it. A message into a full queue is dropped and reported as a fault (docs/riscq-controller.md). The limit sweeps show that eight cores publishing without pause overflow their queues.

9The host window

Results leave the controller through the host window at 0x40000000 (HostWindow.md). It is write only: a core stores a word there and the host reads it later. The firmware this simulator generates writes every measured or decoded bit to the host window at the same offset as its slot in the core's bit table (storeBit in riscq/firmware.mjs), and the compiled Helios decoder writes each output line there. A run's summary lists every host write with its batch, core and value.

10How close the model is to RISC-Q

Three firmware binaries from the RISC-Q repository run unmodified in the model and reproduce what RISC-Q's own RTL simulations assert (tests/riscq-firmware.test.mjs): pulse_sched.elf opens one gate pulse on DAC 8 exactly at its start time for six batches; xcore.elf gives two cores the same barrier time, delivers the word 0x77 to core 1's mailbox and opens core 1's pulse at that time plus 1,024; host_window.elf writes its ramp, byte lanes and sentinel and raises done. Three latencies are assumed rather than documented: the core's time lag, the report path and the branch and bus penalties. Chapter 6 separates what is proved, tested and assumed.

Live run of the feed-forward program with the measured bit set to 1, showing host, hub, cores, links, inboxes, channels and converters at their schematic floorplan positions. Press Play or step through the trace.

What to remember

  1. Each qubit has an RV32I core with its own RAM. Cores write registers; channels next to the converters make the samples.
  2. A store into the put window is a posted write. It reaches its channel 1 + L batches later, without the core waiting.
  3. A channel holds a pulse table. Writing startTime and then an index to fire schedules that entry.
  4. Timed queues release each parameter early by its own lead (34, 35, 36, 52, 11, 2 batches), so all land on the start time.
  5. Results come back to core-local sinks: a result register that stalls until settled, or an event queue of depth 8.
  6. The board hub gives shared bits, barriers and mailboxes, one message per batch for the whole board, eight queued per core.
  7. Results for the host go to the write-only host window at 0x40000000.