Repository navigation
Raven v1.29.0 — many cores, one truth
🐦⬛ Raven v1.29.0: many cores, one truth
🧭 TL;DR. Each core can now get its own L1 cache, and you pick how those caches stay in step: 🌫️ none, 🟦 MSI, 🟩 MESI or 🟧 MOESI. Every line state, bus request and invalidation shows up live. Underneath that, Raven became a multi-architecture engine 🧬 with four pipeline models 🚦, an RV32F that follows IEEE 754 🧮, and the official riscv-tests suite passing 71/71 in every execution mode ✅.
🧠 Cache coherence, from first principles
Until now every hart shared one L1, so each line had exactly one copy and there was nothing to keep coherent. Now there is a choice:
coherence= |
Each core has | What you learn | |
|---|---|---|---|
| 🏠 | shared (default) |
the one shared L1 | the baseline, unchanged |
| 🌫️ | none |
a private L1, no protocol | 👻 a core keeps reading its own stale copy |
| 🟦 | msi |
private L1 + snooping bus | Modified / Shared / Invalid |
| 🟩 | mesi |
private L1 + snooping bus | ✨ Exclusive: the first write to an unshared line costs no bus request |
| 🟧 | moesi |
private L1 + snooping bus | 🤝 Owned: dirty lines are shared, and the owner sends them cache to cache |
🚌 The bus model:
- Requests are
BusRd,BusRdX,BusUpgrandBusWr. - Write-through stores go on the bus, and AMOs read the line for ownership.
- An I-cache miss also snoops the D-caches, so code another core wrote is fetched current.
- Snoops and cache-to-cache transfers cost cycles you can set:
coherence.snoop_latencyandcoherence.c2c_latency.
🔬 Watch it happen
- Settings → MULTI-CORE CACHES: protocol, snoop latency and cache-to-cache latency.
- Cache → view: the selected core's L1. The dirty bit is replaced by the line state, colour-coded: 🟪
M· 🟧O· 🟩E· 🟦S· ⬜I. - Cache → coherence (new subtab): each core's bus traffic, the state of every recent line in every core, and a log of transitions:
#instr core request line transitions
23 c1 BusRd 0x00008000 c1 I→S, c0 M→S written back first
17 c0 BusRdX 0x00008010 c0 I→M, c1 E→I
12 c1 BusRd 0x00008010 c1 I→E
⌨️ Or from the shell
raven run prog.s --cores 2 --coherence mesi --format csvJSON, rstats and CSV now include each core's L1 and its bus counters:
- requests sent;
- invalidations received;
- flushes;
- cache-to-cache transfers;
- coherence misses;
- bus cycles.
🧪 Two experiments are included
🚩 harts/coherence_flag_handoff.s: core 0 raises a flag and core 1 waits for it.
| 🏠 shared | 🌫️ none | 🟦 MSI | 🟩 MESI | 🟧 MOESI | |
|---|---|---|---|---|---|
| result | ✅ 42 | ♾️ never ends | ✅ 42 | ✅ 42 | ✅ 42 |
| cycles | 772 | — | 1376 | 1376 | 1000 |
| bus cycles | — | — | 292 | 292 | 124 |
🏓 harts/coherence_false_sharing.s: two cores each bump their own counter 200 times.
| MESI | cycles | bus requests | invalidations |
|---|---|---|---|
| 😵 counters on the same line | 50 444 | 607 | 400 |
| 😌 counters 16 bytes apart | 6 558 | 8 | 0 |
Neither core ever reads the other's counter, yet the line ping-pongs between the two caches on every write. That is false sharing. 📖 The full guide, with transition tables for all three protocols, is at docs/en/coherence.md · 🇧🇷 docs/pt-BR/coherence.md
🧬 One engine, four machines
Raven's backends are now trait-driven. Switch architectures with a on the Settings screen, or with --arch on the CLI:
--arch |
What it is | |
|---|---|---|
| 🐉 | riscv32 |
RV32IMAF: VM/TLB, JIT, multicore, floating point |
| 🧱 | x86_64 |
an Intel-syntax integer/system core with its own split cache and pipeline view |
| 🍼 | sap |
the classic 8-bit Simple-As-Possible teaching CPU |
| 🧸 | toy16 |
a tiny 16-bit ISA, deliberately unlike RISC-V |
- 🗂️ The Run, Cache and Virtual Memory tabs are shared by every architecture, and each backend only shows what it actually models.
- 📦 The simulator now lives in its own crate,
raven-engine.Falconruns a program headless for graders and tests:
let r = raven_engine::Falcon::new()
.asm(".text\n li a0, 42\n li a7, 93\n ecall\n")
.run()?;
assert_eq!(r.exit_code, Some(42));🚦 Four pipeline models
mode= in the [pipeline] section selects one of four models: Serialized, Parallel UFs, Scoreboard and Tomasulo + ROB.
- 🕸️ The out-of-order workbench is back, with hover and dependency wires.
- 🗺️ The datapath is now a graph that each architecture declares.
- 🩹 Before this release, a config asking for Scoreboard or Tomasulo silently ran the in-order datapath. It now builds the engine it asks for.
🧮 RV32F, by the book
- 🚩 IEEE exception flags are raised.
- ⚙️
fflags,frmandfcsrwork. - 🧊 NaN results are canonical.
- 🎯
fmin/fmax,fcvt.wu.sandfclass.sfollow the spec. - 🧵 The fused ops round once. A new exact-integer FPU is shared by the sequential and pipelined modes. (#80)
- 🎚️ Rounding modes
rne/rtz/rdn/rup/rmm/dynare honoured by every rounding instruction, written as an optional last operand. A reserved mode raises an illegal-instruction trap. (#87)
🛠️ Pipeline correctness
- 🧾 Zicsr instructions really run in the pipeline. (#81)
- 🔁 A result written to
f0is forwarded, and the out-of-order models see writes tof0. (#82, #86) - 🚚
flw/fswgo through the memory unit in every mode. (#83) - 🛫
mret,sretandsfence.vmarun, and fetch resumes atmepc/sepc. (#84) - 🧽
fence.imakes stored code visible: dirty D-cache lines are written back before the I-cache is dropped. (#85)
✅ riscv-tests: 71 / 71, everywhere
The tests are built with the suite's official env/p, which needed HTIF tohost 📮 and a real mhartid 🪪. (#88)
| suite | seq | Serialized | Parallel UFs | Scoreboard | Tomasulo + ROB |
|---|---|---|---|---|---|
rv32ui |
✅ 42 | ✅ 42 | ✅ 42 | ✅ 42 | ✅ 42 |
rv32um |
✅ 8 | ✅ 8 | ✅ 8 | ✅ 8 | ✅ 8 |
rv32ua |
✅ 10 | ✅ 10 | ✅ 10 | ✅ 10 | ✅ 10 |
rv32uf |
✅ 11 | ✅ 11 | ✅ 11 | ✅ 11 | ✅ 11 |
🤖 CI now runs cargo test on 🐧 Linux, 🪟 Windows and 🍎 macOS. An ELF fixture is committed, so a clean checkout passes. (#89)
📂 Real files for guest programs
openat, read, write, lseek, fstat, unlinkat, mkdirat… now work on real host files inside a chroot-like sandbox 🏖️. .. never escapes it. Linux ABI coverage is broader, and a valid Linux syscall never halts the run.
🎬 Polish
- 🌅 A cinematic boot splash with a breathing PRESS ANY KEY.
- 🖱️ Draggable scrollbars on register lists, TLB entries and cache snapshots.
- 🧹 Fixes for screen inconsistencies across tabs.
- 🗃️ One
.rcfg([sim]/[cache]/[pipeline]) and one.rstatsfile, and examples renamed from.fasto.s.
🐞 Issues closed
#80 RV32F flags/fcsr/NaN · #81 Zicsr in the pipeline · #82 f0 forwarding · #83 flw/fsw in Parallel UFs · #84 mret/sret/sfence.vma · #85 fence.i · #86 f0 in the OoO timing model · #87 rounding modes · #88 official env/p · #89 clean-checkout cargo test
⚠️ Upgrade notes
- 🏠 Nothing changes unless you ask for it.
coherencedefaults toshared, and configs without the new keys load exactly as before. - 📝
raven export-confignow writescoherence=,coherence.snoop_latency=andcoherence.c2c_latency=in[cache]. - 🔌 For
raven-engineusers:CacheLineViewgained astatefield, so addstate: Nonewhere you build one. The newCacheHierarchymethods (core_count,core_cache,core_set,core_amat,coherence) all have defaults. - 🐢 The JIT runs whole blocks per turn, so for studying how cores interleave, keep the interpreter (
--jit none, the default).
📦 Downloads
| Platform | File |
|---|---|
| 🪟 Windows x86-64 | raven-x86_64-pc-windows-msvc.zip |
| 🐧 Linux x86-64 (glibc) | raven-x86_64-unknown-linux-gnu.tar.gz |
| 🐧 Linux x86-64 (static, musl) | raven-x86_64-unknown-linux-musl.tar.gz |
| 🍎 macOS Intel | raven-x86_64-apple-darwin.tar.gz |
| 🍏 macOS Apple Silicon | raven-aarch64-apple-darwin.tar.gz |
🔐 Checksums are in SHA256SUMS.txt.
Full changelog: v1.28.0...v1.29.0