Blog/Series/Computer Architecture From First Principles

Computer Architecture From First Principles

Building up computer architecture from bits and gates to pipelines, caches, out-of-order execution, and accelerators — connecting every layer back to the code you write.

15 parts

Lesson 1: Foundations of Computer Architecture

1
August 18, 202630 min read

Computer Architecture, Bits, and Number Representation

Lesson 1 of the Computer Architecture From First Principles series, expanded into a full worked-example treatment of the software/ISA/microarchitecture stack, the state-transformation model of a CPU, and how bits become unsigned integers, hex, and two's complement signed integers.

Computer ArchitectureDigital LogicSystemsLearning
Read More →
2
August 18, 202631 min read

From Logic Gates to a 32-bit ALU

A ground-up derivation of the 32-bit ALU — from NOT/AND/OR/XOR truth tables through half and full adders, propagation delay, two's-complement subtraction, and multiplexer-based operation select, ending in a hand-traced 4-bit ALU.

Computer ArchitectureDigital LogicSystemsLearning
Read More →
3
August 18, 202620 min read

Sequential Logic, the Clock, and Why GHz Lies to You

Lesson 1, Part 3: how feedback turns a circuit into memory, why a CPU needs a clock at all, and the difference between a 3 GHz clock and 3 billion instructions per second — with the setup/hold time and critical-path math that actually sets a chip's maximum frequency.

Computer ArchitectureDigital LogicSystemsLearning
Read More →
4
August 18, 202621 min read

Registers, the Register File, and the Program Counter

How individual flip-flops become named, addressable storage: N-bit registers, the multi-port register file that lets one instruction read two operands and write a third in a single cycle, and the Program Counter as the special register that drives instruction sequencing.

Computer ArchitectureDigital LogicSystemsLearning
Read More →
5
August 18, 202619 min read

Instruction Memory, Decode, and the Control Unit

Lesson 1, Part 5: how a fixed-width instruction becomes bits in memory, how a decoder splits those bits into fields for free, and how a control unit turns an opcode into the RegWrite, ALUSrc, MemRead, MemWrite, and Branch signals that drive the datapath — plus hardwired versus microcoded control.

Computer ArchitectureDigital LogicCPU DesignLearning
Read More →
6
August 18, 202619 min read

The Fetch-Decode-Execute Cycle: Tracing ADD, LOAD, STORE, and BEQ

Every piece built so far — PC, register file, ALU, control unit — finally moves together. This post traces ADD, LOAD, STORE, and BEQ cycle by cycle, wire by wire, and shows why the same ALU that adds two numbers is also the circuit computing every memory address and evaluating every branch.

Computer ArchitectureCPU DesignSystemsLearning
Read More →
7
August 18, 202623 min read

Why Pipelining Exists: Latency, Throughput, Hazards, and Out-of-Order Execution

A deep dive into why CPUs pipeline instructions, the data/control/structural hazards that pipelining creates, how forwarding and stalling fix them (and why load-use hazards can't be fully forwarded away), and how out-of-order execution — reservation stations, register renaming, and the reorder buffer — extracts instruction-level parallelism while still looking sequential from the outside.

Computer ArchitecturePipeliningCPU DesignLearning
Read More →
10
August 18, 202626 min read

Parallelism, the Modern CPU, and the Big-Picture Mental Model

The closing chapter of Lesson 1: SIMD and Amdahl's Law worked from first principles, a full seven-question teardown of a 2-bit branch predictor, and the unified mental model tying number representation all the way to transistors — before Lesson 2 begins building a real CPU.

Computer ArchitectureParallelismSystemsLearning
Read More →

Lesson 2: Designing a Single-Cycle CPU

3
August 18, 202625 min read

The Control Unit: Generating Every Control Signal from the Opcode

Deriving the complete control-signal truth table for a MIPS-style single-cycle CPU from first principles, and the two-level ALUOp/funct decoding scheme that lets a 2-bit main control signal and a small secondary decoder together select the correct ALU operation.

Computer ArchitectureCPU DesignDigital LogicLearning
Read More →
4
August 18, 202621 min read

Cycle-by-Cycle Trace: Running a Real Program on Our CPU

The Lesson 2 payoff: we hand-trace all seven instructions of a real program through the single-cycle datapath, one clock cycle at a time — every control signal, every register read, every ALU operation, every memory access, verified against hand-computed arithmetic.

Computer ArchitectureCPU DesignWorked ExampleLearning
Read More →
5
August 18, 202610 min read

Why Single-Cycle Design Doesn't Scale — The Bridge to Pipelining

The closing chapter of Lesson 2: applying the critical-path clocking math from Lesson 1 to the actual CPU we built, showing exactly how much clock period gets wasted on every non-LOAD instruction — and why that's the whole reason multi-cycle and pipelined designs exist.

Computer ArchitectureCPU DesignPipeliningLearning
Read More →