Introduction to
Processor Architecture
A Simple Computer
The foundation of modern computing: CPU connected to memory via address and data buses, orchestrating the fetch-decode-execute cycle.
MicroArchitecture
Architecture defines what the processor does. Microarchitecture defines how it’s built — the specific arrangement of hardware to implement it.
Architecture vs Microarchitecture
A computer architecture is defined by its instruction set and architectural state. For example, the MIPS architecture’s state comprises:
The microarchitecture is the hardware implementation — registers, ALUs, FSMs, multiplexers, and memory — arranged to execute that architecture. One architecture can have many microarchitectures with different trade-offs.
Two Key Parts
Building a Single-Cycle CPU
We incrementally build the datapath — starting with pure instruction fetch, then adding branching, register operations, memory access, and finally branching control.
Fetch Instructions
- ✦ PC supplies address to instruction memory
- ✦ Memory outputs instruction to datapath
- ✦ Adder increments PC by 1 each cycle
- ✦ Limitation: no branching, no data access
Register Access + ALU
Machine Instruction Format
Memory Access — LOAD/STORE
Building a simple computer –memory access
.
Branching — BEQZ
- ✦ ALU checks if R1 is zero → zero flag
- ✦ Decoder signals: branch = 1
- ✦ AND gate:
branch AND zero - ✦ If true → MUX selects jump adder output
- ✦ Jump adder:
PC + offset (+10) - ✦ If false → normal PC+1 path
Three Processor Designs
From single-cycle through multicycle to pipelined — each design trades complexity for performance in different ways.
| Feature | Single-Cycle | Multicycle | Pipelined |
|---|---|---|---|
| Clock Period | Fixed — slowest instruction | Shorter — per step | Shortest — 1 stage |
| Adders Needed | 3 (ALU + 2 PC logic) | 1 (reused) | 2 (reused) |
| Memory | Separate instr + data | Shared single memory | Separate (optimised) |
| Control | Combinational logic | FSM | FSM + hazard unit |
| Throughput | 1 instr / long cycle | Variable steps | ~1 instr / short cycle |
| Complexity | Low | Medium | High |
| Hazards | None | None | Data + Control hazards |
Clock Cycle Timing Comparison
⚡ Performance Equation
Multicycle Processor
Break instructions into smaller, reusable steps. Simple instructions finish early; complex ones take longer. One memory, one adder — shared across cycles.
3 Weaknesses of Single-Cycle
- ⚠ Clock must accommodate the slowest instruction every cycle
- ⚠ Requires 3 adders — 1 in ALU, 2 in PC logic — all idle most of the time
- ⚠ Needs separate instruction and data memories — expensive duplication
Multicycle Advantages
- ✅ Shorter clock period = only 1 step’s worth
- ✅ ALU reused across multiple steps in one instruction
- ✅ Single shared memory — instruction fetched in step 1, data in later steps
- ✅ Simple instructions complete faster than complex ones
Instruction Execution Steps (FSM States)
Fetch
IF
Decode
ID
Execute
EX
Mem R/W
MEM
WriteBack
WB
FSM Control — State Transitions
Pipelined Processor
Divide instruction execution into 5 stages. While one instruction is in stage 2, another enters stage 1. Ideal throughput: 1 instruction per clock cycle.
5-Stage Pipeline
Instruction
Fetch
Decode &
Reg Fetch
Execute
ALU
Memory
Read/Write
Write
Back
Instructions in Flight
⚠ Pipeline Hazards
Data Hazard
An instruction tries to read a register that a preceding instruction hasn’t finished writing to yet.
Control Hazard
When a branch instruction is in the pipeline, we don’t yet know which instruction to fetch next — but we have to fetch something.
Key Concepts
Instruction Set Reference
| Instruction | Syntax | Operation | Type |
|---|---|---|---|
| ADD | ADD rd, rs1, rs2 |
rd = rs1 + rs2 | ALU |
| SUB | SUB rd, rs1, rs2 |
rd = rs1 − rs2 | ALU |
| LOAD | LOAD rd, [rs2] |
rd = MEM[rs2] | MEM |
| STORE | STORE rs1, [rs2] |
MEM[rs2] = rs1 | MEM |
| BEQZ | BEQZ rs, offset |
if(rs==0) PC=PC+offset | BRANCH |
| JUMP | JUMP target |
PC = target (unconditional) | JUMP |
Component Glossary
(5-stage)
(MIPS / RISC-V)
(IDEAL THROUGHPUT)