Docsity

Multiple Cycle Processor - Lecture Notes | ECE 154, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE154
Computer Architecture
Lecture 9
Multiple Cycle Processor I
October 26, 2006
Ryan Kastner
Electrical and Computer Engineering
University of California, Santa Barbara
Register-Register Timing: One complete cycle
32
Result
ALUctr
Clk
busW
RegWr
32
32
busA
32
busB
5 5 5
Rw Ra Rb
32 32-bit
Registers
Rs RtRd
ALU
Clk
PC
Rs, Rt, Rd,
Op, Func
Clk-to-Q
ALUctr
Instruction Memory Access Time
Old Value New Value
Delay through Control Logic
busA, B
Register File Access Time
Old Value New Value
busW
ALU Delay
Old Value New Value
Old Value New Value
New ValueOld Value
Register Write
Occurs Here
RegWr Old Value New Value
Putting it All Together: A Single Cycle Datapath
imm16
32
ALUctr
Clk
busW
RegWr
32
32
busA
32
busB
55 5
Rw Ra Rb
32 32-bit
Registers
Rs
Rt
Rt
Rd
RegDst
Extender
Mux
32
16
imm16
ALUSrc
ExtOp
Mux
MemtoReg
Clk
Data In
WrEn
32 Adr
Data
Memory
MemWr
ALU
Equal
Instruction<31:0>
0
1
0
1
0
1
<21:25>
<16:20>
<11:15>
<0:15>
Imm16RdRtRs
=
Adder Adder
PC
Clk
00
Mux
4
PCSrc
PC Ext
Adr
Inst
Memory
Review: Abstract View of the Critical Path
Ideal memory AND register file:
The CLK input is a factor ONLY during write operation
During read operation, behave as combinational logic:
Address valid => Output valid after “access time.”
Critical Path (Load Operation) =
PC’s Clk-to-Q +
Instruction Memory’s Access Time +
Register File’s Access Time +
ALU to Perform a 32-bit Add +
Data Memory Access Time +
Setup Time for Register File Write +
Clock Skew
Clk
5
Rw Ra Rb
32 32-bit
Registers
Rd
ALU
Clk
Data
In
Data
Address Ideal
Data
Memory
Instruction
Instruction
Address
Ideal
Instruction
Memory
Clk PC
5
Rs
5
Rt
16
Imm
32
32
32
32
A
B
Next Address
pf3
pf4
pf5

Partial preview of the text

Download Multiple Cycle Processor - Lecture Notes | ECE 154 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE

Computer Architecture

Lecture 9

Multiple Cycle Processor I

October 26, 2006

Ryan Kastner

Electrical and Computer Engineering

University of California, Santa Barbara

Register-Register Timing: One complete cycle

Result

ALUctr

Clk

busW

RegWr

busA

busB

Rw Ra Rb 32 32-bit Registers

Rd Rs Rt

ALU

Clk

PC

Rs, Rt, Rd, Op, Func

Clk-to-Q

ALUctr

Instruction Memory Access Time

Old Value New Value

Delay through Control Logic

busA, B

Register File Access Time Old Value New Value

busW

ALU Delay Old Value New Value

Old Value New Value

Old Value New Value

Register Write Occurs Here

RegWr Old Value New Value

Putting it All Together: A Single Cycle Datapath

imm

ALUctr

Clk

busW

RegWr

busA

busB

Rw Ra Rb 32 32-bit Registers

Rs

Rt

Rt

Rd

RegDst

Extender

Mux

imm

ExtOpALUSrc

Mux

MemtoReg

Clk

Data In

(^32) WrEnAdr

Data Memory

MemWr

ALU

Equal

Instruction<31:0>

Rs Rt Rd Imm

Adder

Adder

PC

Clk

Mux

PCSrc

PC Ext

Adr

Inst Memory

Review: Abstract View of the Critical Path

™Ideal memory AND register file:

™ The CLK input is a factor ONLY during write operation

™ During read operation, behave as combinational logic:

™ Address valid => Output valid after “access time.”

Critical Path (Load Operation) = PC’s Clk-to-Q + Instruction Memory’s Access Time + Register File’s Access Time + ALU to Perform a 32-bit Add + Data Memory Access Time + Setup Time for Register File Write + Clock Skew

Clk

Rw Ra Rb 32 32-bit Registers

Rd

ALU

Clk

Data In

Data Address Ideal Data Memory

Instruction

Instruction Address

Ideal Instruction Memory

Clk

PC

Rs 5

Rt 16

Imm

A

B

Next Address

Drawback of this Single Cycle Processor

™Long cycle time:

™Cycle time must be long enough for the load

instruction:

PC’s Clock -to-Q +

Instruction Memory Access Time +

Register File Access Time +

ALU Delay (address calculation) +

Data Memory Access Time +

Register File Setup Time +

Clock Skew

™Cycle time for load is much longer than needed

for all other instructions

What’s wrong with our CPI=1 processor?

™ Long Cycle Time

™ All instructions take as much time as the slowest

™ Real memory slower than idealized memory

™ Duplicate Resources

PC Inst Memory mux ALU Data Mem mux

PC Inst Memory Reg File mux ALU mux

PC Inst Memory (^) mux ALU Data Mem

PC Inst Memory cmp mux

Reg File

Reg File

Reg File

Arithmetic & Logical

Load

Store

Branch

Critical Path

setup

setup

Reducing Cycle Time

™ Cut combinational dependency graph and insert register / latch

™ Do same work in two fast cycles, rather than one slow one

™ May be able to short-circuit path and remove some components for some

instructions!

storage element

Acyclic Combinational Logic

storage element

storage element

Acyclic Combinational Logic (A)

storage element

storage element

Acyclic Combinational Logic (B)

Limits on Cycle Time (new view of datapath)

™ Next address logic

™ PC <= branch? PC + offset : PC + 4

™ Instruction Fetch

™ InstructionReg <= Mem[PC]

™ Register Access

™ A <= R[rs]

™ ALU operation

™ R <= A + B

PC

Next PC

Operand Fetch

Exec Reg.File MemAccess

DataMem

Instruction

Fetch

Result Store

ALUctr

RegDst ExtOpALUSrc nPC_sel MemRdMemWr RegWrMemWr

Control

Step 4: R-rtype (add, sub,.. .)

™ Logical Register Transfer

™ Physical Register Transfers

inst Logical Register Transfers ADDU R[rd] <= R[rs] + R[rt]; PC <= PC + 4

inst Physical Register Transfers IR <= MEM[pc] ADDU A<= R[rs]; B <= R[rt] S <= A + B R[rd] <= S; PC <= PC + 4

Exec Reg.File

Mem Access

DataMem

S

M

RegFile PC Next PC

IR

Inst. Mem

Time

A

B

E

Step 4: Logical immed

™ Logical Register Transfer

™ Physical Register Transfers

inst Logical Register Transfers ORI R[rt] <= R[rs] | ZExt(Im16); PC <= PC + 4

inst Physical Register Transfers IR <= MEM[pc] ORI A<= R[rs]; B <= R[rt] S <= A | ZExt(Im16) R[rt] <= S; PC <= PC + 4

Exec

Reg.File

MemAccess

DataMem

S

M

RegFile PC Next PC

IR

Inst. Mem

Time

A

B

E

Step 4 : Load

™ Logical Register Transfer

™ Physical Register Transfers

inst Logical Register Transfers LW R[rt] <= MEM[R[rs] + SExt(Im16)]; PC <= PC + 4

inst Physical Register Transfers IR <= MEM[pc] LW A<= R[rs]; B <= R[rt] S <= A + SExt(Im16) M <= MEM[S] R[rd] <= M; PC <= PC + 4

Exec

Reg.File

MemAccess

DataMem

S

M

RegFile PC Next PC

IR

Inst. Mem

A

B

E

Time

Step 4 : Store

™ Logical Register Transfer

™ Physical Register Transfers

inst Logical Register Transfers SW MEM[R[rs] + SExt(Im16)] <= R[rt]; PC <= PC + 4

inst Physical Register Transfers IR <= MEM[pc] SW A<= R[rs]; B <= R[rt] S <= A + SExt(Im16); MEM[S] <= B PC <= PC + 4

Exec Reg.File

Mem Access

DataMem

S

M

RegFile PC Next PC

IR

Inst. Mem

A

B

E

Time

Step 4 : Branch

™ Logical Register Transfer

™ Physical Register Transfers

inst Logical Register Transfers BEQ if R[rs] == R[rt] then PC <= PC + 4+{SExt(Im16), 2’b00} else PC <= PC + 4

Exec Reg.File

Mem Access

DataMem

S

M

RegFile PC Next PC

IR

Inst. Mem

inst Physical Register Transfers IR <= MEM[pc] BEQ E<= (R[rs] = R[rt]) if (!E) PC <= PC + 4; else PC <=PC+4+{SExt(Im16),2’b0}

A

B

E

Time

Our Control Model

™ State specifies control points for Register Transfer

™ Transfer occurs upon exiting state (same clock edge)

Control State

Next State Logic

Output Logic

inputs (conditions)

outputs (control points)

State X

Register Transfer Control Points

Depends on Input

Step 4 ⇒ Control Spec for multicycle proc

IR <= MEM[PC]

R-type

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

S <= A fun B

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

S <= A | 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,Equal)

SW

“instruction fetch”

“decode / operand fetch”

Execute

Memory

Write-back

“Finite State Diagram”

Step 5 ⇒ (datapath + state diagram ⇒ control)

™ Translate RTs into control points

™ Assign states

™ Then go build the controller

Conclusion

™ Disadvantages of the Single Cycle Processor

™ Long cycle time

™ Cycle time is too long for all instructions except the Load

™ Multiple Cycle Processor:

™ Divide the instructions into smaller steps

™ Execute each step (instead of the entire instruction) in one cycle

™ Partition datapath into equal size chunks to minimize cycle

time

™ ~10 levels of logic between latches

™ Follow same 5-step method for designing “real” processor