Docsity

Multicycle Implementation Overview - Lecture Slides | CS 35101, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Multicycle Implementation Overview - Lecture Slides | CS 35101 and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Computer Architecture^ CS 35101

Spring 2008

Week 11: 5.5, 5.7, 5.

Materials adapted from Kevin Schaffer and Mary Jane Irwin (www.cse.psu.edu/~mji)

[adapted from D. Patterson slides Advantages]Single Cycle Disadvantages &

Multicycle Implementation Overview

 Each instruction  Therefore, an instruction takes step takes 1 clock cycle more than 1 clock cycle to

complete

 Not every instruction takes the cycles to complete same number of clock

 Multicycle  faster clock rates implementations allow

 different instructions to take a different number of clock cycles

 functional units to be used more than once per instruction as long as they are used on different clock cycles, as a

result - only need one memory

  • only need one ALU/adder

The Multicycle Datapath – A High Level View

Address Read Data (Instr. or Data) PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR

MDR

A B^ ALUout

 Registers have to be added after every major functional unit to hold the output value until it is used

in a subsequent clock cycle

Clocking the Multicycle Datapath

Address Read Data (Instr. or Data) PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR

MDR

A B^ ALUout

System Clock

MemWrite RegWrite

clock cycle

The Complete Multicycle Data with Control

Address Read Data (Instr. or Data)

PC^ Memory

Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR MDR

A B^ ALUout Extend^ Sign left 2^ Shift (^) controlALU

left 2^ Shift

Control^ ALUOp MemWrite MemtoReg IRWrite IorD MemRead^ PCWrite PCWriteCond RegDst^ RegWrite^ ALUSrcA ALUSrcB

zero

PCSource

Instr[5-0]

Instr[25-0]^ PC[31-28]

Instr[15-0]

Instr[31-26]

32

28

 Reading from or writing to any of the internal registers, Register File, or the PC occurs (quickly) at the beginning

 (for read) or the end of a clock cycle (for write)Reading from the Register File takes ~50% of a clock cycle since it has additional control and access overhead (but reading can be done in parallel with decode)  Had to add functional unit input ports (e.g., Memory, ALU) because multiplexors in front of several of the they are now shared by different clock cycles and/or do multiple jobs

 All operations occurring in one clock cycle occur in parallel

 This limits us to one ALU operation, one Memory access, and one Register File access per clock cycle

Our Multicycle Approach, con’t

New Control Signals

 IRWrite to IR : If asserted the memory output is written

 PCSource ALU, ALUOut: Selects the new value for the PC from:, jump target address

 PCWrite : If asserted the PC is written

 PCWriteCond from the ALU is 1 then the PC is written: If asserted and the zero output

 Instruction Fetch

 Instruction Decode and Register Fetch

 R-type Instruction Execution, Memory Read/Write Address Computation, Branch Completion, or

Jump Completion

 Memory Read Access, Memory Write Completion or R-type Instruction Completion

 Memory Read Completion (Write Back)

INSTRUCTIONS TAKE FROM 3 - 5 CYCLES!

Five Instruction Steps

Datapath Activity During Instruction Fetch

Address Read Data (Instr. or Data)

PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR MDR

A B^ ALUout Extend^ Sign left 2^ Shift (^) controlALU

left 2^ Shift

Control^ ALUOp MemWrite MemtoReg IRWrite IorD MemRead^ PCWrite PCWriteCond RegDst^ RegWrite^ ALUSrcA ALUSrcB

zero

PCSource

Instr[5-0]

Instr[25-0]^ PC[31-28]

Instr[15-0]

Instr[31-26]

32

28

Fetch Control Signals Settings

Start^ Instr^ Fetch

Datapath Activity During Instruction Decode

Address Read Data (Instr. or Data)

PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR MDR

A B^ ALUout Extend^ Sign left 2^ Shift (^) controlALU

left 2^ Shift

Control^ ALUOp MemWrite MemtoReg IRWrite IorD MemRead^ PCWrite PCWriteCond RegDst^ RegWrite^ ALUSrcA ALUSrcB

zero

PCSource

Instr[5-0]

Instr[25-0]^ PC[31-28]

Instr[15-0]

Instr[31-26]

32

28

 ALU is performing one of four functions, based on instruction type

 Load/Store (  ALUOut ← lwA + andSignExt sw(IR[15:0])): Compute memory address

 R-type: Perform operation specified by instruction  ALUOut ← A op B

 Branch: Compare registers and set PC if equal  if (A == B) PC ← ALUOut

 Jump:Set PC to jump target address  PC ← {PC[31:28] || (IR[25:0] << 2)}

Step 3 (instruction dependent)

Datapath Activity During R-type Execute

Address Read Data (Instr. or Data)

PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR MDR

A B^ ALUout Extend^ Sign left 2^ Shift (^) controlALU

left 2^ Shift

Control^ ALUOp MemWrite MemtoReg IRWrite IorD MemRead^ PCWrite PCWriteCond RegDst^ RegWrite^ ALUSrcA ALUSrcB

zero

PCSource

Instr[5-0]

Instr[25-0]^ PC[31-28]

Instr[15-0]

Instr[31-26]

32

28

Datapath Activity During beq Execute

Address Read Data (Instr. or Data)

PC^ Memory Write Data

Read Read AddrAddr (^12) Write Addr

Register File Data 1^ Read Write Data Data 2^ Read^ ALU

IR MDR

A B^ ALUout Extend^ Sign left 2^ Shift (^) controlALU

left 2^ Shift

Control^ ALUOp MemWrite MemtoReg IRWrite IorD MemRead^ PCWrite PCWriteCond RegDst^ RegWrite^ ALUSrcA ALUSrcB

zero

PCSource

Instr[5-0]

Instr[25-0]^ PC[31-28]

Instr[15-0]

Instr[31-26]

32

28