Files
imple b008b37d49 Add phase-by-phase tutorial notes
Add a Tutorial tree that mirrors the roadmap from Phase 0 through Linux bring-up.
Each phase and subphase gets a short learning note with consistent sections for
context, goals, new concepts, mental model, learning tasks, pitfalls, tooling,
testing, and references.

The tutorial material is intentionally explanatory rather than implementation
code. It gives a systems-oriented learner enough FPGA, SystemVerilog, RISC-V,
firmware, and Linux bring-up context to approach each roadmap phase without
turning the notes into copy-paste RTL.
2026-04-28 12:11:23 +02:00

50 lines
1.6 KiB
Markdown

# Phase 4 - First CPU
## Context
This phase connects fetch, decode, arithmetic, register-file, and writeback into a minimal
non-pipelined CPU. It executes straight-line arithmetic programs from instruction BRAM.
## Goals
- Build the first integrated datapath.
- Learn how BRAM latency shapes control flow.
- Verify architectural state changes instruction by instruction.
## New Concepts
- BRAM: block RAM, dedicated on-chip FPGA memory with synchronous access.
- PC: program counter, the address of the current or next instruction.
- Writeback: stage where a result is committed to the register file.
- CPI: cycles per instruction.
## How To Think About It
This is not a performance exercise. It is an integration exercise. The goal is to make
one instruction at a time retire correctly while respecting real memory latency.
## Learning Tasks
- Draw the fetch/execute FSM.
- Decide exactly when PC advances.
- Trace a short program and record expected register state after each instruction.
## Pitfalls
- Treating BRAM like a combinational array.
- Updating PC while a multi-cycle M operation is still in progress.
- Writing back results for instructions that should not write a register.
## Tooling And Testing
- Start with very small programs and known final register values.
- Use simulation waveforms before ILA.
- Add a visible "halt" or terminal condition for test programs.
## References
- AMD/Xilinx block memory documentation: https://docs.xilinx.com/
- RISC-V unprivileged ISA: https://riscv.org/technical/specifications/
- Digital design FSM overview: https://www.chipverify.com/verilog/verilog-fsm