Repository navigation
Phase 7: datapath, hazard lab and programs views - #1
Merged
Merged
Conversation
Python reference model (decode/encode/disasm, ISS with RVFI-lite retire records, CLI), TinyCPU memory-map linker script and riscv-tests environment, sw Makefile, five asm example programs with pinned output and instret, GNU objdump cross-check, generated web/src/lib/isa.ts, and CI steps. The ISS passes all 40 rv32ui-p-* tests.
RTL building blocks (alu, imm_gen, branch_unit, lsu, decoder, regfile, csr_counters, mmio, mem_comb), core_single and tiny_cpu_top with an RVFI-lite retire bus and memory loader. Per-block cocotb suites, a lockstep test against the golden ISS over all riscv-tests and programs plus fault cases, lint script, cocotb runner, CI wiring and docs/ARCHITECTURE.md.
core_pipe (IF/ID/EX/MEM/WB with taken-branch flush, precise faults and halt), mem_sync with write-first read, CORE="PIPE" in tiny_cpu_top and a uniform per-stage debug bus on both cores. Adds the Prog mini-assembler and dynamic RAW-hazard checker, hazard-free program set, a shared lockstep library and a pipeline lockstep suite with an exact cycle-count check.
wasm/harness.cpp owns both Verilated models of tiny_cpu_top (SINGLE and PIPE, distinct prefixes) behind one TinyCpuSim. build.sh builds the module and enforces a 400 KB gzipped budget (77 KB today). test.mjs checks every golden fixture on both cores, forwarding on and off, against the Python ISS: console, registers, data memory, retire-stream digest and pipeline-model cycle counts. Adds a hazard-dense fixture, the only one where the forwarding pin is observable. docs/STATE_SCHEMA.md defines the JavaScript contract.
Adds the /app page: an RV32I assembler (two passes, byte-identical to GNU as/ld on 26 sources), a disassembler, typed CycleState mirror, runner and run model, and React views for the source, pipeline, cycle controls, registers, data memory, console and statistics. Five presets run on the WASM core in tests. Vitest unit and integration tests and Playwright smoke tests; CI runs both.
Adds the remaining app views behind level tabs on /app: - L1 datapath: SVG of the single-cycle datapath with the wires the retired instruction uses highlighted and labelled with real operand and result values. - L3 hazard lab: eight programs, one per hazard kind, each run on the pipeline with forwarding on and off and on the single-cycle core. - L4 programs: every preset compared across cores, with CPI, PASS/FAIL, and a data-memory access heatmap. - Light/dark theme toggle that restores the saved choice. Tests: 67 Vitest (phase7.test.ts checks datapath values, hazard behaviour and comparison results against the WASM core) and 9 Playwright smoke tests, including phone-width layout with no horizontal scroll. Docs: CONTEXT.md gains the Phase 6 and Phase 7 status and gotchas.
The .gitignore exception for web/public/tiny_cpu.wasm had a trailing comment, which git reads as part of the pattern, so the file was ignored and never committed. The Web CI unit tests load tiny_cpu.mjs, which needs the .wasm beside it, and failed on a clean checkout. The rule is now a plain line, and the binary is committed next to the matching tiny_cpu.mjs.
The Golden ISS step runs with REQUIRE_RISCV_TESTS=1, so the GNU fixture freshness test fails if riscv-none-elf-gcc is not on PATH. The toolchain was only added to PATH inside the build step, so the golden step could not see it. A step now appends the toolchain's bin directory to GITHUB_PATH, as the Verilator step does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 7 adds the remaining views to the
/apppage, behind level tabs:The datapath reads operand values from a single-cycle run of the same program, since a pipeline run does not expose per-instruction operands. Both cores compute the same architecture, so the values match.
Verification
pnpm test: 67 Vitest tests.phase7.test.tsruns the datapath values, hazard behaviour and comparison results against the WASM core.pnpm test:e2e: 9 Playwright tests against the production build, including phone-width layout with no horizontal scroll.pnpm lint,pnpm typecheck,pnpm build: clean.Notes
CONTEXT.mdgains the Phase 6 and Phase 7 status and gotchas;docs/ARCHITECTURE.mdhas a views section.