Docsity

Microprogramming in Processor Design, Slides of Computer Science

Partial preview of the text

Download Microprogramming in Processor Design and more Slides Computer Science in PDF only on Docsity!

CS 152: Computer Architecture

and Engineering

Lecture 10

Multicycle Controller Design

(Continued)

The Big Picture: Where are We Now?

 The Five Classic Components of a Computer

 Today’s Topics:

  • Microprogramed control
  • Administrivia
  • Microprogram it yourself
  • Exceptions

Control

Datapath

Memory

Processor Input

Output

Multicycle Datapath

PC

Next PC

Operand

Fetch Instruction

Fetch

nPC_sel

IR

Reg File^ Ext^ ALU

Reg. File

Mem Acces

s

DataMem

Result Store

MemRd MemWr^ RegDst^ RegWr

S
M

Equal MemToReg ExtOp^ ALUSrc^ ALUctr

A

B

E

State Diagram of Controller

IR <= MEM[PC]

R-type

A <= R[rs] B <= R[rt]

S <= A fun B

R[rd] <= S PC <= PC + 4

S <= A or ZX

R[rt] <= S PC <= PC + 4

ORi

S <= A + SX

R[rt] <= M PC <= PC + 4

M <= MEM[S]

LW

S <= A + SX

MEM[S] <= B PC <= PC + 4

BEQ PC <=

Next(PC)

SW

“instruction fetch”

“decode”

Execute

Memory

Write-back

Example: Jump-Counter

op-code

Map ROM

Counter

zero inc load

i

i+

i

None of above: Do nothing (for wait states)

Sequencer

Sequencer-based control unit

  • Called “microPC” or “μPC” vs. state register

Control Value Effect

00 Next μaddress = 0

01 Next μaddress = dispatch ROM

10 Next μaddress = μaddress + 1

Dispatch

ROM:

Opcode

microPC

μAddress

Select

Logic

Adder

Dispatch ROM

Mux

Opcode Dispatch State R-type 000000 0100 BEQ 000100 0011 ori 001101 0110 LW 100011 1000 SW 101011 1011

Microprogram

“Macro and micro - instruction” Interpretation

Main Memory

execution unit

control memory

CPU
ADD
SUB
AND
DATA

User program plus Data

this can change!

AND microsequence

e.g., Fetch Calc Operand Addr Fetch Operand(s) Calculate Save Answer(s)

one of these is mapped into one of these

Variations on Microprogramming

 “Horizontal” Microcode

  • Control field for each control point in the machine

 “Vertical” Microcode

  • Compact microinstruction format for each class of microoperation
    • Local decode to generate all control points (remember ALU?)

branch: μseq-op μadd

execute: ALU-op A,B,R

memory: mem-opS, D

μseq μaddr A-mux B-mux bus enables register enables

Horizontal Vertical

More Vertical Format

src (^) dst

D
E
C
D
E
C

other control fields next states^ inputs

MUX

Multiformat Microcode:

0 cond next address

1 dst src alu

D
E
C
D
E
C

Branch Jump

Register Xfer Operation

Hybrid Control

Not all critical control information is derived from control logic

E.g., Instruction Register (IR) contains useful control

information, such as register sources, destinations, opcodes, etc.

Register File

R S 1 D E C
R S 2 D E C
R
D
D
E
C

IR op rs1^ rs2 rd

to control

enable signals from control

Microprogramming a Multicycle Processor

1) Choose datapath and sequencer architecture

2) Assign states and sequence of each (multicycle)

instruction (i.e., define the controller FSM)

3) Choose microinstruction format (minimum bits to

describe all allowable functions of sequencer and

datapath)

4) Map instructions into microinstruction sequences

Sequencer

 Sequencer-based control unit

  • Called “microPC” or “μPC” vs. state register

Control Value Effect

00 Next μaddress = 0

01 Next μaddress = dispatch ROM

10 Next μaddress = μaddress + 1

Dispatch

ROM:

Opcode

microPC

μAddress

Select

Logic

Adder

Dispatch ROM

Mux

Opcode Dispatch State R-type 000000 0100 BEQ 000100 0011 ori 001101 0110 LW 100011 1000 SW 101011 1011

Microprogram

Finite State Machine (FSM) Spec

IR <= MEM[PC] PC <= PC + 4

R-type ALUout <= A fun B

R[rd] <= ALUout

ALUout <= A or ZX

R[rt] <= ALUout

ORi ALUout <= A + SX

R[rt] <= M

M <= MEM[ALUout]

LW

ALUout <= A + SX

MEM[ALUout] <= B

SW

“instruction fetch”

“decode”

Execute

Memory

Write-back

BEQ

If A = B then PC <= ALUout

ALUout <= PC +SX

Q: What can we do in state 0001?

Finite State Machine (FSM) Spec (improved)

IR <= MEM[PC] PC <= PC + 4

R-type ALUout <= A fun B

R[rd] <= ALUout

ALUout <= A or ZX

R[rt] <= ALUout

ORi ALUout <= A + SX

R[rt] <= M

M <= MEM[ALUout]

LW

ALUout <= A + SX

MEM[ALUout] <= B

SW

“instruction fetch”

“decode”

BEQ

If A = B then PC <= ALUout

ALUout <= PC +SX

Execute

Memory

Write-back