§ 5.7. Experiments¶
Four questions about the machines of this chapter, answered by running the same games on each:
- Is the bus-built machine the same machine as the fixed device system it replaced?
- What does a second bus cost, behind a pass-through bridge and behind a registered one?
- Which main memory should the machine have, and what does it cost?
- How fast may the machines be clocked, in realistic gate timing?
Method¶
Each run is one guest fixture (the program and its scripted button events)
on one machine, checked as in § 5.6; a run
that fails any check is not reported. The machine comparison runs the
bring-up program and the five short game versions; cycle comparisons use the
unit timing profile at a 1000-tick clock, and all parts are in their
compact forms, which run on delays proven on their gates. The machines run
their defaults: the pipelined bus and the array multiplier (the results
were rerun on them on 2026-11-13; the chapter-5 bus and multiplier gave 26–32 % more
cycles on SRAM, for example 4,760 instead of 3,641 for bring-up).
tools/system/run-experiments.py runs the campaign one job at a time; its
summaries are in site-docs/assets/system/results/ and the tables below are
generated from them (tools/system/results-tables.py).
| Machine | Description |
|---|---|
| One bus | games-machine: core, memory and devices on one bus |
| Two buses | games-machine-two-bus: memory and video on a system bus; the devices behind a pass-through bridge on a peripheral bus |
| Registered bridge | games-machine-registered-bridge: the same with a bridge that registers each request and answer |
The new machine equals the old one¶
This comparison was made with the zero-wait flip-flop main memory the machines had then (see Main memory for the change to SRAM).
The fixed RV32IMDeviceSystem was measured before it was retired, with the
game fixtures of that time (retired in turn on 2026-11-03; this table keeps
their measured results). The one-bus machine gave the same cycle counts and
the same frames, console text, reports and device reads:
| Game | Memory | Old machine cycles | New machine cycles | Same results | Events (old → new) |
|---|---|---|---|---|---|
| Bring-up | ff | 38,811 | 38,811 | yes | 15,181,178 → 11,000,184 |
| Pong | ff | 88,367 | 88,367 | yes | 33,391,339 → 24,655,432 |
| Snake | cached-ff | 260,970 | 260,970 | yes | 443,666,985 → 207,853,755 |
The machines differ in structure, not in time: the bus is the old router
and arbiter, rearranged by the description, and the devices' new register
front ends answer in the same cycles. The new machine needs fewer simulation
events; one likely reason (not measured separately) is that the front end
decodes an offset with one Decoder<n> instead of a 32-bit comparison per
register.
One bus or two¶
| Game | One bus | Two buses | Registered bridge | Two buses vs one | Registered vs one |
|---|---|---|---|---|---|
| Bring-up | 3,641 | 3,681 | 3,761 | +40 (+1.10%) | +120 (+3.30%) |
| 2048 | 32,350 | 32,382 | 32,446 | +32 (+0.10%) | +96 (+0.30%) |
| Sokoban | 42,224 | 42,262 | 42,338 | +38 (+0.09%) | +114 (+0.27%) |
| Snake | 29,357 | 29,396 | 29,474 | +39 (+0.13%) | +117 (+0.40%) |
| Pong | 13,453 | 13,490 | 13,564 | +37 (+0.28%) | +111 (+0.83%) |
| Tetris | 52,803 | 52,839 | 52,911 | +36 (+0.07%) | +108 (+0.20%) |
All three machines produce the same frames and console text for every program; their reports differ only in the timer samples, which count clock ticks (the table generator checks this and refuses to print otherwise).
The extra cycles are exactly the number of device accesses. Pong's short version, for example, makes 22 device reads, writes 10 console bytes, presents 3 frames and pops 2 button events: 37 accesses, 37 extra cycles with two buses, 111 (3 × 37) with the registered bridge. Instructions and memory stay on the system bus and do not pay at all.
| One device access | One bus | Two buses | Registered bridge |
|---|---|---|---|
| Routers crossed | 1 | 2 | 2 |
| Bridge register stages | — | 0 | 2 (request, answer) |
| Extra cycles vs one bus | 0 | 1 (second router) | 3 (second router + 2 stages) |
Why a pass-through bridge still costs a cycle: every bus's router holds a request for one clock edge before offering it (§ 5.2.1). A device access now crosses two routers, so it pays that edge twice; the bridge itself adds nothing. The registered bridge adds an edge in each direction on top.
Why build two buses then? In a real machine the slow devices, with their long wires and narrow ports, would otherwise lengthen the clock period of the fast path to memory. Here the devices are flip-flop logic on the same clock as everything else, so the second bus shows only its cost; the clock shows that it does not lengthen the critical path either.
Main memory¶
The machines' main memory is the on-chip clocked SRAM macro
(§ 3.3), 256 KiB, with as many wait states
as its proven access time needs at the clock. Until November 2026 it was a
zero-wait flip-flop memory, which a real chip of this size would not have:
256 KiB of flip-flops is far larger and slower to reach than an SRAM array.
The comparison below decided the change. It runs the bring-up program and
the six short games (each on its own machine, Snake with LEDs on the LED
machine) in the embedded profile on each memory the machine accepts
(memory=sram|ff|dram, with or without the default caches), on the
pipelined bus, at 4.5 ns except FF without caches at 5.5 ns (below);
cycles and their ratio to SRAM:
| Program | sram |
ff |
dram |
cached-sram |
cached-ff |
cached-dram |
|---|---|---|---|---|---|---|
| Bring-up | 3,641 | 1,654 (0.45×) | 12,208 (3.35×) | 6,688 (1.84×) | 4,606 (1.27×) | 14,223 (3.91×) |
| 2048 | 32,350 | 15,121 (0.47×) | 113,921 (3.52×) | 48,288 (1.49×) | 37,474 (1.16×) | 91,698 (2.83×) |
| Sokoban | 42,224 | 19,489 (0.46×) | 154,674 (3.66×) | 70,046 (1.66×) | 51,160 (1.21×) | 138,476 (3.28×) |
| Snake | 29,357 | 13,684 (0.47×) | 108,931 (3.71×) | 47,854 (1.63×) | 35,353 (1.20×) | 93,442 (3.18×) |
| Pong | 13,453 | 6,026 (0.45×) | 51,198 (3.81×) | 21,679 (1.61×) | 16,049 (1.19×) | 43,697 (3.25×) |
| Tetris | 52,803 | 24,252 (0.46×) | 190,909 (3.62×) | 86,703 (1.64×) | 63,931 (1.21×) | 171,621 (3.25×) |
| Snake with LEDs | 27,185 | 12,672 (0.47×) | 100,761 (3.71×) | 43,372 (1.60×) | 32,410 (1.19×) | 83,796 (3.08×) |
Every memory gives the same frames, console text and instruction counts; the reports differ only in their timer samples.
- SRAM answers one cycle after it takes a request: its access, about 3.3 ns from the clock edge for 64 Ki words (an estimate from tables proven at 64 and 128 words), fits one 4.5 ns cycle. A real single-cycle on-chip SRAM of this size is at least as fast: NXP's i.MX RT1050 reads 512 KB of tightly coupled SRAM in one 1.67 ns cycle.
- FF answers in the cycle it takes a request: less than half SRAM's cycles (0.45–0.47×), about two cycles per instruction against SRAM's 4.1–4.4. It does not keep the 4.5 ns clock on the pipelined bus: the word it answers arrives late in the cycle, and the core's overlapped fetch chooses its next address from it, so the fetch router's address input changes up to 4.0 ns after the edge and needs 1.4 ns before the next. Every FF run at 4.5 ns (and up to 5.4 ns) recorded setup violations, so these runs use 5.5 ns, at which none did. FF has no clock-dependent wait states, so its cycle counts do not depend on the period (the same at 5.5, 6 and 9 ns). The analyzer gives this configuration no certificate (Clock).
- DRAM (the profile's SDRAM rows and refresh) costs 3.4–3.8 times SRAM's cycles.
- The default caches (four sets of 16-byte lines per port) are too small for these programs: they slow SRAM down by 49–84 % and FF by a factor of 2.5–2.8, and with DRAM they save 10–20 % of the games' cycles but cost 17 % more in the short bring-up program.
Why a wait state still costs so much: on the pipelined bus the core offers its next fetch in the cycle it takes an answer, so on FF memory fetches follow each other almost every cycle. The bus router holds one request at a time, though: SRAM's answer comes a cycle after the request, and the next request waits for it, so every access pays SRAM's wait instead of overlapping another. A two-deep router would hide it; it is not built. On the chapter-5 bus (one request at a time all the way) a fetch on FF already took three cycles, and SRAM cost 1.28–1.32 times FF's cycles; now it costs 2.1–2.2 times.
Clock¶
The safe-clock analyzer certifies each machine: the shortest period at which every register meets its setup time, with the machine's inputs changing one tick after a falling edge.
| Machine | Memory | Unit profile (ticks) | Embedded profile | Embedded clock | Limiting path (embedded) |
|---|---|---|---|---|---|
games-machine |
sram | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine |
cached-sram | 156 | 4,254 ps | 235 MHz | MEMORY.INSTRUCTION_CACHE.CONTROLLER.FRONTEND.PENDING input D |
games-machine |
ff | not certified | not certified | a state-dependent combinational cycle (see below) | |
games-machine |
cached-ff | not certified | not certified | a state-dependent combinational cycle (see below) | |
games-machine |
dram | 84 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine |
cached-dram | 84 | 4,254 ps | 235 MHz | MEMORY.INSTRUCTION_CACHE.CONTROLLER.FRONTEND.PENDING input D |
games-machine |
sram-128x96 | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine-two-bus |
sram | not certified | not certified | a state-dependent combinational cycle (see below) | |
games-machine-registered-bridge |
sram | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine-leds |
sram | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine |
sram-chapter5-bus | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
games-machine |
ff-chapter5-bus | 92 | 4,464 ps | 224 MHz | CORE input IMEM_RSP_READ_DATA |
games-machine |
cached-ff-chapter5-bus | 84 | 4,254 ps | 235 MHz | MEMORY.INSTRUCTION_CACHE.CONTROLLER.FRONTEND.PENDING input D |
games-machine-two-bus |
sram-chapter5-bus | 160 | 4,254 ps | 235 MHz | MEMORY.ARBITER.I_RESPONSE.HELD_DATA input WE |
The machines run the pipelined bus of § 6.3.2
(their default since 2026-11-13); the rows marked "chapter5-bus" are the
same machines with bus=single and the iterative multiplier, for
comparison. SRAM and DRAM are set up for the clock the games run at
(4.5 ns; 1000 ticks in unit), as the runs use them. With SRAM the
limiting path is the memory arbiter's held answer (embedded) or the RAM's
write-mask input (unit), on either bus; adding a registered bridge does
not lengthen it. The games of § 5.6 run at 4.5 ns, within every
listed certificate; 4,254 ps rounded down to 4.25 ns would be too short.
Two designs of the pipelined bus kept this clock. The core's overlapped fetch offers its next address chosen by the registered "request in flight" bit rather than by the late "answer taken" decision, and it guesses that address from the prediction made at fetch, not from the execute stage's redirect. With the late select the machine certified at 5,278 ps, and with the redirect at 4,842 ps.
Not certified. The analyzer cannot certify three configurations of the
pipelined bus: FF memory (with or without caches) and the two-bus machine.
It finds a combinational dependency cycle that never closes in a real
state: the pipelined arbiter offers its next request in the cycle the
current one completes, while a zero-wait FF memory answers in the cycle it
is asked (or, in the two-bus machine, two pipelined routers meet without a
register between them). Ruling it out needs the states of two parts
together (the arbiter is busy exactly when the memory has its request),
which the analysis does not track. They have no certificate; their
chapter-5-bus forms do. In simulation, cached FF ran every game at 4.5 ns
with no setup violation, and the two-bus machine at the unit clock; FF
without caches did not keep 4.5 ns (it needs 5.5 ns, see
Main memory), so behind that false cycle it also has a long
true path.
The table's numbers are simulated timing contracts under the stated binary input boundary, including setup and hold constraints. They are not measured clock rates of fabricated hardware, nor a certificate for every memory size, prediction setting or checked-link configuration.
Reproducing a selected run¶
The existing runner accepts one fixture and machine at a time. For example, with the built native tool:
CIRCUITSIM_TIMING_PROFILE=embedded build-milestone/system_experiment \
--guest bringup --machine games-machine-two-bus \
--memory sram --fidelity compact --period 4500
This runs a new simulation and prints a checked result JSON. The campaign
script tools/system/run-experiments.py runs selected games/machines
serially; tools/system/results-tables.py validates the saved summaries and
regenerates the published result rows. Reformatting a table is not a new run.
Limits¶
- The devices are as fast as the memory and no bus has more than two masters on one target, so slow devices and heavy arbitration are not measured.
- Cycle counts depend on the fixtures' short scripts (three actions per game); they compare machines, they do not rate the games.
- Host times are for one development machine, with other work running.
- A long game is recorded natively; the page's simulator continues it from a frame's save for a window of cycles, not the whole session.
- There is no independent randomized legal-traffic bus reference campaign or automatic protocol proof from the port checker's three flags. The memory comparison covers the default caches only, not a cache-size sweep.
- The SRAM's analog intervals in
embeddedare estimates awaiting calibration; one wait state at 4.5 ns holds for any access below about 4.1 ns. - The display's 4 KiB pixel memory is still a flip-flop memory.
These limits are additional to the selected guest models and clock certificates reported above.
Source: experiment runner, serial campaign, table generator, machine clock checks.