CSSE232 Computer Architecture I Pipelining Summary of - - PowerPoint PPT Presentation

csse232 computer architecture i
SMART_READER_LITE
LIVE PREVIEW

CSSE232 Computer Architecture I Pipelining Summary of - - PowerPoint PPT Presentation

CSSE232 Computer Architecture I Pipelining Summary of Instruc;on Execu;on sae $t0, $t1($t2) sll $at, $t1, 2 add $at, $at, $t2 sw $t0,


slide-1
SLIDE 1

CSSE232 ¡ Computer ¡Architecture ¡I ¡

Pipelining ¡

slide-2
SLIDE 2

Summary ¡of ¡Instruc;on ¡Execu;on ¡

  • sae ¡$t0, ¡$t1($t2) ¡
  • sll ¡$at, ¡$t1, ¡2 ¡
  • add ¡$at, ¡$at, ¡$t2 ¡
  • sw ¡$t0, ¡0($at) ¡

Step name Action for R-type instructions Action for memory-reference instructions Action for branches Action for jumps Instruction fetch IR = Memory[PC] PC = PC + 4 Instruction A = Reg [IR[25-21]] decode/register fetch B = Reg [IR[20-16]] ALUOut = PC + (sign-extend (IR[15-0]) << 2) Execution, address ALUOut = A op B ALUOut = A + sign-extend if (A ==B) then PC = PC [31-28] II computation, branch/ (IR[15-0]) PC = ALUOut (IR[25-0]<<2) jump completion Memory access or R-type Reg [IR[15-11]] = Load: MDR = Memory[ALUOut] completion ALUOut

  • r

Store: Memory [ALUOut] = B Memory read completion Load: Reg[IR[20-16]] = MDR

slide-3
SLIDE 3

Outline ¡

  • Review ¡of ¡mul;cycle ¡datapath ¡and ¡control ¡
  • Pipelining ¡
  • Pipeline ¡control ¡
slide-4
SLIDE 4

Differences ¡between ¡single-­‑cycle, ¡mul;-­‑cycle, ¡ and ¡pipelining ¡

  • Components ¡

– Memory, ¡adders, ¡extra ¡registers ¡

  • Control ¡ ¡

– Fixed ¡vs ¡Finite ¡state ¡

  • Performance ¡

– Cycles ¡

slide-5
SLIDE 5

Ac;vity ¡

  • You ¡have ¡a ¡date ¡at ¡9:45pm. ¡Its ¡6:00pm ¡and ¡

you’ve ¡just ¡realized ¡that ¡you ¡have ¡no ¡clean ¡

  • clothes. ¡You ¡have ¡4 ¡loads ¡of ¡laundry. ¡The ¡laundry ¡

process ¡includes ¡4 ¡steps: ¡

– Wash ¡ – Dry ¡ – Fold ¡ – Put ¡away ¡ ¡ Assume ¡each ¡step ¡takes ¡30 ¡mins. ¡Describe ¡a ¡process ¡for ¡ comple;ng ¡the ¡laundry ¡by ¡9:45pm. ¡

slide-6
SLIDE 6

Pipelining ¡Analogy ¡

  • Pipelined ¡laundry: ¡overlapping ¡

execu;on ¡

– Parallelism ¡improves ¡performance ¡

n Four ¡loads: ¡

n Sequen;al: ¡8 ¡hrs ¡ n Pipeline: ¡3.5 ¡hrs ¡ n Speedup ¡

= ¡8/3.5 ¡= ¡2.3 ¡

slide-7
SLIDE 7

Mul;cycle ¡Approach ¡ ¡ ¡

  • Note ¡par;culari;es ¡of ¡

¡ ¡ ¡ ¡mul;cycle ¡vs. ¡single-­‑ ¡ ¡ ¡ ¡ ¡diagrams ¡ ¡

– single ¡memory ¡for ¡data ¡ ¡ ¡ ¡ ¡and ¡instruc;ons ¡ – single ¡ALU, ¡no ¡extra ¡adders ¡ – extra ¡registers ¡to ¡ ¡ ¡ ¡ ¡ ¡hold ¡data ¡between ¡ ¡ ¡ ¡ ¡ ¡clock ¡cycles ¡ ¡

PC Instruction memory Read address Instruction 16 32 Add ALU result M u x Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Shift left 2 4 M u x ALU operation 3 RegWrite MemRead MemWrite PCSrc ALUSrc MemtoReg ALU result Zero ALU Data memory Address Write data Read data M u x Sign extend Add PC Memory Address Instruction

  • r data

Data Instruction register Registers Register # Data Register # Register # ALU Memory data register A B ALUOut

Single-cycle datapath Multicycle datapath (high-level view)

slide-8
SLIDE 8

Summary ¡of ¡Instruc;on ¡Execu;on ¡

Step name Action for R-type instructions Action for memory-reference instructions Action for branches Action for jumps Instruction fetch IR = Memory[PC] PC = PC + 4 Instruction A = Reg [IR[25-21]] decode/register fetch B = Reg [IR[20-16]] ALUOut = PC + (sign-extend (IR[15-0]) << 2) Execution, address ALUOut = A op B ALUOut = A + sign-extend if (A ==B) then PC = PC [31-28] II computation, branch/ (IR[15-0]) PC = ALUOut (IR[25-0]<<2) jump completion Memory access or R-type Reg [IR[15-11]] = Load: MDR = Memory[ALUOut] completion ALUOut

  • r

Store: Memory [ALUOut] = B Memory read completion Load: Reg[IR[20-16]] = MDR

slide-9
SLIDE 9

MIPS ¡Pipeline ¡

  • Five ¡stages, ¡one ¡step ¡per ¡stage ¡
  • 1. IF: ¡Instruc;on ¡fetch ¡from ¡memory ¡
  • 2. ID: ¡Instruc;on ¡decode ¡& ¡register ¡read ¡
  • 3. EX: ¡Execute ¡opera;on ¡or ¡calculate ¡address ¡
  • 4. MEM: ¡Access ¡memory ¡operand ¡
  • 5. WB: ¡Write ¡result ¡back ¡to ¡register ¡
slide-10
SLIDE 10

Single ¡cycle ¡+ ¡stages ¡

  • IF, ¡ID, ¡EX, ¡MEM, ¡WB ¡

PC Instruction memory Read address Instruction 16 32 Add ALU result M u x Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Shift left 2 4 M u x ALU operation 3 RegWrite MemRead MemWrite PCSrc ALUSrc MemtoReg ALU result Zero ALU Data memory Address Write data Read data M u x Sign extend Add

slide-11
SLIDE 11

Summary ¡of ¡Instruc;on ¡Execu;on ¡

Step name Action for R-type instructions Action for memory-reference instructions Action for branches Action for jumps Instruction fetch IR = Memory[PC] PC = PC + 4 Instruction A = Reg [IR[25-21]] decode/register fetch B = Reg [IR[20-16]] ALUOut = PC + (sign-extend (IR[15-0]) << 2) Execution, address ALUOut = A op B ALUOut = A + sign-extend if (A ==B) then PC = PC [31-28] II computation, branch/ (IR[15-0]) PC = ALUOut (IR[25-0]<<2) jump completion Memory access or R-type Reg [IR[15-11]] = Load: MDR = Memory[ALUOut] completion ALUOut

  • r

Store: Memory [ALUOut] = B Memory read completion Load: Reg[IR[20-16]] = MDR

1: IF 2: ID 3: EX 4: MEM 5: WB Step

slide-12
SLIDE 12

Single ¡cycle ¡+ ¡stages ¡

  • Where ¡should ¡the ¡stages ¡go? ¡

PC Instruction memory Read address Instruction 16 32 Add ALU result M u x Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Shift left 2 4 M u x ALU operation 3 RegWrite MemRead MemWrite PCSrc ALUSrc MemtoReg ALU result Zero ALU Data memory Address Write data Read data M u x Sign extend Add

slide-13
SLIDE 13

MIPS ¡Pipelined ¡Datapath ¡

slide-14
SLIDE 14

Pipeline ¡registers ¡

  • Need ¡registers ¡between ¡stages ¡

– To ¡hold ¡informa;on ¡produced ¡in ¡previous ¡cycle ¡

slide-15
SLIDE 15

IF ¡for ¡Load, ¡Store, ¡… ¡

slide-16
SLIDE 16

ID ¡for ¡Load, ¡Store, ¡… ¡

slide-17
SLIDE 17

EX ¡for ¡Load ¡

slide-18
SLIDE 18

MEM ¡for ¡Load ¡

slide-19
SLIDE 19

WB ¡for ¡Load ¡

Wrong ¡ register ¡ number ¡

slide-20
SLIDE 20

Corrected ¡Datapath ¡for ¡Load ¡

The ¡first ¡of ¡many ¡adjustments ¡needed ¡

slide-21
SLIDE 21

EX ¡for ¡Store ¡

slide-22
SLIDE 22

MEM ¡for ¡Store ¡

slide-23
SLIDE 23

WB ¡for ¡Store ¡

slide-24
SLIDE 24

Mul;-­‑Cycle ¡Pipeline ¡Diagram ¡

  • Form ¡showing ¡resource ¡usage ¡
slide-25
SLIDE 25

Mul;-­‑Cycle ¡Pipeline ¡Diagram ¡

  • Tradi;onal ¡form ¡
slide-26
SLIDE 26

Single-­‑Cycle ¡Pipeline ¡Diagram ¡

  • State ¡of ¡pipeline ¡in ¡a ¡given ¡cycle ¡
slide-27
SLIDE 27

Pipelined ¡Control ¡(Simplified) ¡

slide-28
SLIDE 28

Pipelined ¡Control ¡

  • Control ¡signals ¡derived ¡from ¡instruc;on ¡

– As ¡in ¡single-­‑cycle ¡implementa;on ¡

slide-29
SLIDE 29

Pipelined ¡Control ¡

slide-30
SLIDE 30

Outline ¡

  • Review ¡of ¡mul;cycle ¡datapath ¡and ¡control ¡
  • Pipelining ¡
  • Pipeline ¡control ¡