2.2

Single-Cycle Datapath

Visualize the complete MIPS single-cycle processor datapath. Watch data flow through PC, Instruction Memory, Register File, ALU, and Data Memory as each instruction executes in five phases: Fetch, Decode, Execute, Memory, and Write Back.

Presets:
1.0x
MIPS Single-Cycle Datapath
IF
ID
EX
MEM
WB
PC0InstrMemControlRegFileSignExtMUXALUDataMemMUXMUXAdd+4BranchAddMUXANDReady
Instruction Memory
Register File
Data Memory
No memory locations used
Control Signals
Execute an instruction to see control signals
Execution Metrics
PC
0
Current Phase
--
Instruction
--
ALU Result
--
Completed
0/0
Execution Log
Press Play or Step to begin execution
IFFetch

Read the instruction from Instruction Memory using the PC value. PC+4 is computed for next instruction.

IDDecode

Control unit generates signals from the opcode. Register file reads source registers rs and rt. Sign-extend produces 32-bit immediate.

EXExecute

ALU performs the operation. For R-type: arithmetic on register values. For I-type: add base + offset. For BEQ: subtract to check equality.

MEMMemory

Data Memory is accessed. LW reads a word from the computed address. SW writes a word to memory. R-type instructions pass through.

WBWrite Back

Results are written back to the Register File. R-type writes ALU result. LW writes memory data. SW and BEQ do not write.

Key Components
Program Counter (PC)

A register holding the memory address of the current instruction. Updated every cycle to PC+4 or branch target.

Instruction Memory

Read-only memory storing the program. Addressed by PC, outputs the 32-bit instruction word.

Register File

32 general-purpose 32-bit registers. Has two read ports (rs, rt) and one write port. Reads are combinational; writes occur on clock edge.

ALU

Arithmetic Logic Unit performs ADD, SUB, AND, OR, SLT. Outputs the result and a Zero flag for branch decisions.

Data Memory

Stores data values. Addressed by ALU result. MemRead enables load, MemWrite enables store operations.

Control Unit

Decodes the opcode field [31:26] and generates all control signals that orchestrate the datapath multiplexers and enables.

Control Signal Truth Table
InstructionRegDstALUSrcMemToRegRegWriteMemReadMemWriteBranchALUOp
R-type100100010
LW011110000
SWX1X001000
BEQX0X000101
Key Insights
  • *In a single-cycle design, every instruction completes in one clock cycle. The clock period must be long enough for the slowest instruction (typically LW).
  • *The critical path for LW goes through: PC, Instruction Memory, Register File, ALU, Data Memory, and back to Register File write.
  • *MUXes are controlled by single-bit signals that select between two data sources (e.g., RegDst selects between rt and rd for the write register).
  • *The single-cycle design is simple but inefficient: resources like the ALU sit idle during memory access. Pipelining solves this by overlapping instruction execution.