Part D · Lesson 4
When a design breaks a rule
A design is only useful if the simulator can tell you when it describes a machine that cannot work. This lesson goes through every rule the checker applies, the message each one gives, and the one warning: a readout that returns after its acquisition window has opened.
This lesson assumes lessons D1 to D3. All verdicts on this page come
from check() in riscq/design.mjs, through POST /api/riscq/design/check.
1Errors and warnings
check(design) returns { errors, warnings }. An error means the document does not
describe a machine the simulator can build: machine() refuses it with "The hardware design breaks
n rules" followed by the list, and no program runs. The editor marks the parts concerned in red and disables
Run on this hardware. A warning describes a consequence you should see, but the machine is built and
runs.
The check works in two phases. First it checks every part, channel and wire on its own. Only if that phase finds nothing does it look for paths: whether each calibrated pulse can actually reach the part it acts on. A design with a broken wire therefore does not also get a list of every path that wire would have completed.
2Rules on parts, channels and wires
In this section: the first phase, with the exact message of each rule.
| Rule | Message (X, Y stand for ids) |
|---|---|
| The document's kind and version | A hardware design is { kind: "riscq-design", version: 1, … }. |
| Part ids are unique | Part id X is used twice. |
| Part types come from the list | Part X has the unknown type T. Allowed: control-board, core, dac, adc, stage, qubit, resonator. |
| Every part has a position | Part X needs centerMm: [x, y, z]. |
| One board | A design has exactly one control-board. |
| 1 to 64 cores | A board carries 1 to 64 cores. |
| Converter numbers | Every dac has its own index from 0 to 63. (The same for adc.) |
| Channel ids are unique | Channel id X is used twice. |
| A channel belongs to a core | Channel X names Y, which is not a core. |
| Channel kinds | Channel X has the unknown kind K. |
| Pulse channels use a DAC, demod channels an ADC | Channel X of kind pulse needs a dac as its converter. |
| 1 to 16 channels per core | Core X has N channels. A core has 1 to 16. |
| Channel names unique on a core | Core X has two channels of one name. |
| Wires join parts | Wire X joins A and B, and one of them is not a part. |
| Wire media come from the list | Wire X has the unknown medium M. Allowed: coax, planar, fiber, beam. |
| A route has points | Wire X needs routeMm with at least two points [x, y, z]. |
| A route ends at its parts | Wire X must start at A and end at B: its route ends are more than 0.5 mm from them. |
The last rule is why a route is not decoration: the length that sets the delay is the length of a path that really joins the two parts, within 0.5 mm at each end.
Break the ring
Tick one or more edits, then press Check. Each edit is applied to a fresh copy of the ring from
GET /api/riscq/design?template=ring, and the copy is sent to the check route.
You shift the first point of drive0's route by 5 mm along x and leave everything else. What does the
check say?
- Wire drive0 must start at dac0 and end at qubit0: its route ends are more than 0.5 mm from them.
- Nothing: only the length changed, so only the delay changes.
- Qubit 0: no wire leads from dac0 to qubit0.
- Wire drive0 has the unknown medium coax.
How many dio channels can you add to core q0 of the ring before the check reports an
error?
dio channel needs no converter, so nothing else is checked
about it.3Rules on paths
The second phase follows the wires (pathDelay, in their direction only, through stages). For each qubit
it requires:
- that it names a
qubitpart and aresonatorpart ("Qubit i names a qubit part and a resonator part."), - that its
gate,roanddemodchannels exist ("Qubit i names no gate channel.") and have the right kinds ("Qubit i drives and reads out through pulse channels and acquires through a demod channel."), - a wired path from the gate channel's DAC to the qubit, from the readout channel's DAC to the resonator, and from the resonator back to the acquisition channel's ADC ("Qubit i: no wire leads from dac0 to qubit0.").
For each coupling, every pulse must name a pulse channel and a qubit, and its DAC must reach that qubit ("Coupling pulse on
q0.cz0: no wire leads to qubit0."). A decoder, if given, must be a core ("The decoder is one of the cores.").
Delete the wire drive0 from the ring. How many errors does the check report?
You give drive0 the medium string and also delete the wire tone0. Which
errors does the check report?
- Both: the unknown medium, and that no wire leads from dac8 to resonator0.
- Only the unknown medium.
- Only the missing path.
- None, since every remaining wire is valid.
tone0 appears. The editor's Rules tab works the same way, one phase at a time.check(). A channel has one carrier. If two calibrated pulses with
different frequencies name the same channel, for example a coupling pulse moved onto q0.gate, the check
finds nothing, but building the machine fails with "Channel q0.gate is given two carrier frequencies. A channel has
one carrier." The check route then answers with that message and HTTP status 400 instead of a verdict. Try it with
the last edit in the widget above.4The late-readout warning
What if the readout tone comes back after the window has opened?
A readout fires its tone, then opens the acquisition window demodDelayNs later. That delay comes from the
calibration, and it assumes cables of a certain length. In a design the tone needs the delay of its wire to reach the
resonator, and the response needs the delay of the return wire to reach the ADC. The check compares the two:
The message says how much of the window holds no signal, for example: "Qubit 3: the acquisition window opens 335.23 ns after the readout tone starts, but the tone needs … ns to reach the resonator and return. The first … ns of the window hold no signal."
Each qubit has its own calibrated delay, from 335.23 ns to 750 ns, and in the ring its tone and return wires together take about 10 ns. Moving the chip farther along x lengthens both wires by the same amount.
As you move the chip farther along x, which qubit's readout is warned about first? Give its index.
How far, in metres, can you move the chip along x before the first warning appears? Compute it from the wire delays the check reports, then confirm it with the widget above.
What to remember
- Errors stop a design from running; warnings describe consequences. Both come from
check(). - The check first validates parts, channels and wires, then, only if they are sound, every path a pulse needs.
- A route must start and end within 0.5 mm of its parts; a core takes 1 to 16 channels; a pulse channel needs a DAC.
- One missing wire breaks every pulse that used it, including coupling pulses.
- A readout whose tone and return take longer than its calibrated delay is warned about. The model does not shift the window.