Datapath
Executes an instruction in 1 clock cycle
Diagram - Abstract Datapath
5 Stage Instruction Cycle
Diagram - Simple Datapath
Stage 1: Instruction Fetch (IF)
These details are for the LEG V8 processor detailed in Design Paradigms for ISAs#Example processor LEGv8
Diagram
(see Sequential Circuits)
Steps
- Instruction is fetched from instruction memory
- The instruction address is incremented (
PC += 4
) and latched into the PC register at the end of clock cycle
Stage 2: Instruction Decode (ID)
Diagram
(see multiplexer)
Steps
Stage 3: Execute (EX)
Diagram
(see sign extend)
Info
- The ALU performs arithmetic operations
- Addition for
ADD
- Calculates memory address for
LDR/STR
- Sets zero status for
CBZ
- Addition for
ALU zero = Rt == 0
- The branch adder calculates the branch target address (
PC + (offsett << 2)
)
Stage 4: Memory (ME)
Diagram
Info
For loads (LDR
): assert read, output is on read data
For stores (STR
): assert write, input is from Rt
(from #Stage 2 Instruction Decode (ID))
Stage 5: Writeback (WB)
Diagram
Info
- A result is written back to a register
- Write
reg #
- Write
data
Datapath with Control
See Control
Figure