CPU, ISA & Computer Architecture - Expanded Project Guides
Generated from:
CPU_ISA_ARCHITECTURE_PROJECTS.md
Overview
This directory contains 16 comprehensive project guides designed to take you from zero understanding of CPU architecture to designing and implementing your own processors. Each project builds on the previous, creating a complete learning path from binary representation to building a RISC-V System-on-Chip on an FPGA.
By completing these projects, you will:
- Understand how CPUs execute instructions at the gate level
- Build working emulators for real historical processors
- Write programs in assembly language with no abstractions
- Design your own instruction set architecture
- Implement a complete CPU in hardware (FPGA)
- Master performance concepts: pipelining, caching, branch prediction
Project Index
| # | Project | Difficulty | Time | Key Focus |
|---|---|---|---|---|
| 1 | Binary & Hex Visualization Tool | Beginner | Weekend | Number systems, Two’s complement, Endianness |
| 2 | Logic Gate Simulator | Beginner | 1 week | Boolean algebra, Combinational logic, ALU basics |
| 3 | Stack Machine Virtual Machine | Intermediate | 1 week | Fetch-decode-execute, Bytecode interpretation |
| 4 | CHIP-8 Emulator | Intermediate | 1-2 weeks | Real ISA emulation, Registers, Timers, Graphics |
| 5 | Simple RISC CPU Emulator | Advanced | 2-3 weeks | ISA design, Assembler implementation, RISC philosophy |
| 6 | 6502 CPU Emulator | Advanced | 3-4 weeks | Complex addressing modes, Cycle accuracy, Real hardware |
| 7 | Memory Visualizer & Debugger | Advanced | 2-3 weeks | Virtual memory, Process layout, ptrace/debugging |
| 8 | x86-64 Disassembler | Expert | 3-4 weeks | CISC encoding, ModR/M, Variable-length instructions |
| 9 | Assembly Programming | Advanced | 2-4 weeks | Raw syscalls, Calling conventions, No-libc programming |
| 10 | Game Boy Emulator | Expert | 1-2 months | Complete system emulation, PPU, Memory banking |
| 11 | Bare-Metal Programming | Expert | 2-4 weeks | No OS, GPIO, UART, Direct hardware access |
| 12 | RISC-V CPU on FPGA | Master | 2-3 months | HDL, Real hardware, Digital design |
| 13 | CPU Pipeline Simulator | Advanced | 2-3 weeks | Hazards, Forwarding, Stalls, CPI analysis |
| 14 | Cache Simulator | Advanced | 2 weeks | Memory hierarchy, Associativity, Replacement policies |
| 15 | Branch Predictor Simulator | Advanced | 1-2 weeks | Dynamic prediction, Gshare, Tournament predictors |
| 16 | RISC-V System-on-Chip (Capstone) | Master | 3-4 months | Full SoC with peripherals, Bootloader, Kernel |
Core Concepts Mastery Map
┌─────────────────────────────────────┐
│ CPU ARCHITECTURE MASTERY │
└─────────────────────────────────────┘
│
┌────────────────────────────┼────────────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Foundations │ │ Execution │ │ Performance │
│ (P01-P02) │ │ (P03-P12) │ │ (P13-P15) │
├─────────────────┤ ├─────────────────┤ ├─────────────────┤
│ • Binary/Hex │ │ • Fetch-Decode │ │ • Pipelining │
│ • Logic Gates │ │ • Registers │ │ • Caching │
│ • Boolean Alg. │ │ • Memory Access │ │ • Prediction │
│ • Adders │ │ • Interrupts │ │ • CPI/IPC │
└─────────────────┘ │ • I/O │ └─────────────────┘
└─────────────────┘
│
▼
┌─────────────────┐
│ Capstone │
│ (P16) │
├─────────────────┤
│ • Full SoC │
│ • Peripherals │
│ • Bootloader │
│ • Your own CPU! │
└─────────────────┘
Learning Paths
Path A: The Emulator Track (Focus on Software)
Goal: Deeply understand CPUs by emulating them in software
P01 → P02 → P03 → P04 → P05 → P06 → P10
│ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼
Bits Gates Stack CHIP-8 RISC 6502 GameBoy
Time: 2-3 months Best for: Software developers wanting deep CPU understanding
Path B: The Hardware Track (Focus on Digital Design)
Goal: Build real CPUs in hardware
P01 → P02 → P03 → P04 → P05 → P12 → P16
│ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼
Bits Gates Stack CHIP-8 RISC FPGA SoC
Time: 4-6 months Best for: Hardware engineers, those interested in chip design
Path C: The Systems Track (Focus on Low-Level Programming)
Goal: Master assembly and bare-metal programming
P01 → P02 → P03 → P09 → P07 → P08 → P11
│ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼
Bits Gates Stack ASM Memory Disasm Bare-Metal
Time: 2-3 months Best for: OS developers, security researchers, embedded engineers
Path D: The Performance Track (Focus on Optimization)
Goal: Understand why code runs fast or slow
P01 → P03 → P04 → P13 → P14 → P15
│ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼
Bits Stack CHIP-8 Pipe Cache Branch
Time: 6-8 weeks Best for: Performance engineers, compiler writers
Path E: Complete Mastery (All Projects)
Goal: Comprehensive CPU architecture understanding
Phase 1 (Foundations): P01 → P02
Phase 2 (First CPUs): P03 → P04 → P05 → P06
Phase 3 (Low-Level): P07 → P08 → P09
Phase 4 (Performance): P13 → P14 → P15
Phase 5 (Hardware): P11 → P12
Phase 6 (Capstone): P10 → P16
Time: 6-9 months Best for: Those seeking expert-level understanding
Prerequisites
Essential (Before Starting)
- Basic programming in C (variables, loops, functions, pointers)
- Understanding of decimal numbers
- Comfort with command-line tools
- Willingness to struggle and debug
Helpful (But Not Required)
- Prior exposure to any assembly language
- Basic electronics knowledge (for hardware projects)
- Experience with systems programming
- Knowledge of how compilers work
Self-Assessment Questions
Before starting, you should be able to answer:
- What is a pointer and how does pointer arithmetic work in C?
- What’s the difference between stack and heap memory?
- How do you read/write files in C?
- What is a linked list and how would you implement one?
If you struggle with these, consider completing a C programming tutorial first.
Required Tools
For All Projects
- C Compiler: GCC or Clang
- Build System: Make
- Debugger: GDB or LLDB
- Text Editor: vim, emacs, VS Code, or similar
For Specific Projects
| Projects | Additional Tools | |———-|——————| | P04, P06, P10 | SDL2 (graphics library) | | P07 | Linux (for ptrace) or macOS | | P08-P09 | NASM or GNU Assembler | | P11 | Raspberry Pi + ARM toolchain | | P12, P16 | FPGA board + Yosys/Vivado |
Essential Books
| Book | Author | Used In Projects |
|---|---|---|
| Code: The Hidden Language | Charles Petzold | P01, P02 |
| Computer Systems: A Programmer’s Perspective | Bryant & O’Hallaron | P03, P07, P08, P09, P14 |
| Computer Organization and Design (RISC-V Ed.) | Patterson & Hennessy | P05, P06, P12, P13, P16 |
| Digital Design and Computer Architecture | Harris & Harris | P02, P12, P16 |
| The Linux Programming Interface | Michael Kerrisk | P07, P09 |
| Crafting Interpreters | Robert Nystrom | P03 |
Project Dependencies
P01 ─────┐
├──► P03 ──► P04 ──► P05 ──► P06 ──► P10
P02 ─────┘ │ │
│ ├──► P08
▼ │
P07 ├──► P11 ──► P12 ──► P16
│ │
▼ ▼
P09 ◄────── P09
P13, P14, P15 can be done after P04
Success Metrics
After completing all projects, you should be able to:
- Read machine code and understand what it does
- Explain CPU operation from voltage levels to high-level abstractions
- Debug at any level (C, assembly, binary, hardware)
- Design an ISA with informed trade-offs
- Predict performance of code based on cache/branch behavior
- Build a CPU in either software (emulator) or hardware (FPGA)
- Write bare-metal code without any OS or libraries
- Answer any interview question about computer architecture
Getting Started
- Read this README completely to understand the overall structure
- Choose a learning path based on your goals
- Start with P01 (even if you think you know binary - you’ll learn something)
- Build each project completely before moving to the next
- Take notes on what you learn - this reinforces understanding
- Compare your implementations to reference implementations when available
- Ask questions when stuck (but struggle first - that’s where learning happens)
Begin with P01: Binary & Hex Visualization Tool