Quiz 2

Processor Design — Datapath, Control Unit, Instruction Execution

484 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Processor Design — Datapath, Control Unit, Instruction Execution ## 🎯 Learning Objectives - Identify components of a CPU datapath - Design a simple control unit - Trace instruction execution through datapath stages - Explain the fetch-decode-execute cycle * * * ## 1. Basic CPU Architecture *(Diagram)* ### 1.1 Dat...

Processor Design — Datapath, Control Unit, Instruction Execution

🎯 Learning Objectives

  • Identify components of a CPU datapath
  • Design a simple control unit
  • Trace instruction execution through datapath stages
  • Explain the fetch-decode-execute cycle

1. Basic CPU Architecture

(Diagram)

1.1 Datapath Components

ComponentFunction
Program Counter (PC)Address of current instruction
Instruction MemoryStores program (could be ROM)
Register FileGeneral-purpose registers (e.g., 32 × 32-bit)
ALUPerforms arithmetic/logic operations
Data MemoryRAM for data storage

2. Instruction Execution Cycle

2.1 Fetch-Decode-Execute

(Diagram)

2.2 R-Type Instructions (e.g., ADD Rd, Rs, Rt)

StageAction
IFIR ← M[PC]; PC ← PC + 4
IDRead Rs, Rt from register file
EXALUout ← Rs op Rt
MEM(no memory access)
WBRd ← ALUout

2.3 I-Type Instructions (e.g., LW Rt, offset(Rs))

StageAction
IFIR ← M[PC]; PC ← PC + 4
IDRead Rs from register file; sign-extend offset
EXALUout ← Rs + offset
MEMData ← M[ALUout]
WBRt ← Data

3. Control Unit

3.1 Control Signals

SignalEffectR-FormatLWSWBranch
RegDstWrite register: rd(1)/rt(0)10XX
ALUSrcALU input: register(0)/immediate(1)0110
MemtoRegWrite data: ALU(0)/Memory(1)01XX
MemReadRead data memory0100
MemWriteWrite data memory0010
RegWriteWrite register file1100
BranchBranch instruction0001

4. 📝 Practice Questions

Q1: What is the role of the Program Counter?
Answer: The PC holds the address of the next instruction to execute. It's incremented by 4 (for 32-bit instructions) during the fetch stage. For branches and jumps, it's updated with the target address. Q2: How does the control unit generate signals from the instruction opcode?
Answer: The opcode bits of the instruction are input to combinational logic (or a decoder) that sets each control signal to 0 or 1 based on the instruction type. For example, if opcode = 0 (R-type), RegDst=1, ALUSrc=0, RegWrite=1. Q3: Why is the register file a critical component in CPU design?
Answer: The register file provides fast access to operands (typically 32 registers, each 32-bit). It needs two read ports and one write port to support instructions like ADD which read two source registers and write one destination register in a single cycle. Q4: What is the difference between a single-cycle and multi-cycle processor?
Answer: Single-cycle executes each instruction in one clock cycle (cycle time = longest instruction = LW). Multi-cycle uses multiple shorter cycles per instruction, running different stages each cycle — better average performance but more complex control. Q5: How does the ALU know which operation to perform?
Answer: For R-type instructions, the funct field (bits 5:0) selects the ALU operation. The ALU control logic decodes the funct field (in combination with ALUOp from the main control unit) to generate ALU control signals (e.g., 0010 for ADD, 0110 for SUB).

5. 🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.