CS251 - Computer Organization and Design - Spring 2008

Lecture 19 - Execution Control


Practical Details

  1. Assignment 5
  2. Mid-term

Instruction Execution Components

Put It All Together

Instruction fetch

  1. PC
  2. Instruction memory
  3. Adder: no longer goes straight to PC, but is output (branch)

Control: none

R-type instruction

  1. Registers
  2. ALU

Control signals:

  1. Clock
  2. Regwrite
  3. ALU operation select (3)

I-type instructions

Load/store

  1. Registers
  2. Sign extender
  3. ALU: combines read1 and sign-extended immediate
  4. Data memory: needs a MUX on output

Control signals

  1. Regwrite
  2. ALUctl (3)
  3. MemRead
  4. MemWrite
  5. MemToReg

Conditional branch

  1. Registers
  2. ALU:
  3. Sign extender:
  4. Shifter
  5. Adder: MUX needed on output

Control signals

  1. ALUctl
  2. PCSrc
  3. ALUSrc

Control Logic

Highest six bits of instruction is opcode

Control logic needs to accept opcode (26:31) and function (0:5)

Split into two stages

  1. From opcode only generate all control signals except ALUctl, plus ALUop
  2. From ALUop plus function generate ALUctl

Signals to generate

Signal 0 1
RegDst rt rd
RegWrite n/a write register
ALUSrc register instruction
Branch no branch branch
MemRead n/a read memory
MemWrite n/a write memory
MemToReg write register from ALU write register from memory
ALUOp0 not branch branch
ALUOp1 not R-type R-type

Opcodes

Opcode Instruction Assert
100011 lw ALUSrc, MemToReg, RegWrite, MemRead
101011 sw ALUSrc, MemWrite
000100 beq Branch, ALUOp0
000000 R-format RegDst, RegWrite, ALUOp1

ALUCtl

Operation ALUOp Funct action ALUCtl
beq 01 XXXXXX subtract 110
add 10 100000 add 010
sub 10 100010 subtract 110
and 10 100100 AND 000
or 10 100101 OR 001
slt 10 101010 set on less than 111

Timing

Suppose

Then for R-type instructions

But for loads

And for conditional branches

Climax

The CPU plus memory is just a finite state machine, albeit a complex one.


Return to: