Pipelining in Computer Architecture: Understanding Stages, Components, and Hazards, Slides of Assembly Language Programming

An in-depth exploration of pipelining in computer architecture. It covers the concept of pipelining, its benefits, and the challenges it presents. Recaps, lessons, and explanations of the five stages of r-type and store instructions, as well as the three stages of beq. The document also discusses datapath and data stationary control, and the issues that arise in pipelined design. It concludes with a summary of pipelining and its impact on performance.

Typology: Slides

2011/2012

Uploaded on 07/26/2012

parinita
parinita 🇮🇳

4.8

(6)

67 documents

1 / 37

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 6.2 - Pipelining2 1
Recap: Sequential Laundry
Sequential laundry takes 6 hours for 4 loads
If they learned pipelining, how long would laundry take?
A
B
C
D
30 40 20 30 40 20 30 40 20 30 40 20
6 PM 789
10 11 Midnight
T
a
s
k
O
r
d
e
r
Time
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Pipelining in Computer Architecture: Understanding Stages, Components, and Hazards and more Slides Assembly Language Programming in PDF only on Docsity!

Chapter 6.2 - Pipelining

Recap: Sequential Laundry

-^ Sequential laundry takes 6 hours for 4 loads •^ If they learned pipelining, how long would laundry take?

A B C D

6 PM

Midnight

T a s k O r d e r

Time

docsity.com

Chapter 6.2 - Pipelining

Recap: Pipelining Lessons

-^ Pipelining doesn’t helplatency of single task, it helpsthroughput of entire workload •^ Pipeline rate limited byslowest pipeline stage •^ Multiple tasks operatingsimultaneously usingdifferent resources •^ Potential speedup = Numberpipe stages •^ Unbalanced lengths of pipestages reduces speedup •^ Time to “fill” pipeline andtime to “drain” it reducesspeedup •^ Stall for Dependences

6 PM A B C D

T a s k O r d e r

Time

docsity.com

Chapter 6.2 - Pipelining

Pipelining the Load Instruction

-^ The five independent functional units in the pipeline datapathare: - Instruction Memory for the Ifetch stage– Register File’s Read ports (bus A and busB) for the Reg/Decstage– ALU for the Exec stage– Data Memory for the Mem stage– Register File’s Write port (bus W) for the Wr stage Clock

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Cycle 5

Cycle 6

Cycle 7

Ifetch

Reg/Dec

Exec

Mem

Wr

1st lw

Ifetch

Reg/Dec

Exec

Mem

Wr

2nd lw

Ifetch

Reg/Dec

Exec

Mem

Wr

3rd lw

docsity.com

Chapter 6.2 - Pipelining

The Four Stages of R-type

-^ Ifetch: Instruction Fetch - Fetch the instruction from the Instruction Memory -^ Reg/Dec: Registers Fetch and Instruction Decode •^ Exec: - ALU operates on the two register operands– Update PC -^ Wr: Write the ALU output back to the register file

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Ifetch

Reg/Dec

Exec

Wr

R-type

docsity.com

Chapter 6.2 - Pipelining

The Four Stages of Store

-^ Ifetch: Instruction Fetch - Fetch the instruction from the Instruction Memory -^ Reg/Dec: Registers Fetch and Instruction Decode •^ Exec: Calculate the memory address •^ Mem: Write the data into the Data Memory

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Ifetch

Reg/Dec

Exec

Mem

Store

Wr

docsity.com

Chapter 6.2 - Pipelining

The Three Stages of Beq

-^ Ifetch: Instruction Fetch - Fetch the instruction from the Instruction Memory -^ Reg/Dec: - Registers Fetch and Instruction Decode -^ Exec: - compares the two register operand,– select correct branch target address– latch into PC

Cycle 1

Cycle 2

Cycle 3

Cycle 4

Ifetch

Reg/Dec

Exec

Mem

Beq^

Wr

docsity.com

Chapter 6.2 - Pipelining

Let’s Try it Out

lw^

r1, r2(35)

addI

r2, r2, 3

sub

r3, r4, r

beq

r6, r7, 100

ori^

r8, r9, 17

add

r10, r11, r

and

r13, r14, 15

these addresses are octal

docsity.com

Chapter 6.2 - Pipelining

Start: Fetch 10

Exec

Reg.File

MemAcces

s Data

Mem

A B

S

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl M

rs^ rt

im

10

lw^

r1, r2(35) 14

addI

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

IF

PC

Next PC

n^

n^

n^

n

docsity.com

Chapter 6.2 - Pipelining

Fetch 20, Decode 14, Exec 10

Exec

Reg.File

MemAcces

s Data

Mem

r2 B

S

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl M

2 rt

10

lw^

r1, r2(35) 14

addI^

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

lw r

addI r2, r2, 3

EX ID IF

PC

Next PC

n^

n

docsity.com

Chapter 6.2 - Pipelining

Fetch 24, Decode 20, Exec 14, Mem 10

Exec

Reg.File

MemAcces

s Data

Mem

r2 B

r2+

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl M

10

lw^

r1, r2(35) 14

addI^

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

lw r

sub r3, r4, r

addI r2, r2, 3

M EX ID IF

PC

Next PC

n

docsity.com

Chapter 6.2 - Pipelining

Fetch 100, Dcd 30, Ex 24, Mem 20, WB 14

Exec

Reg.File

MemAcces

s Data

Mem

r6 r

r2+

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl

r1=M[r2+35]

9 xx

10

lw^

r1, r2(35) 14

addI^

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

beq

addI r

sub r3 r4-r

100

ori r8, r9 17

WBM EX^ ID IF

PC

Next PC

docsity.com

Chapter 6.2 - Pipelining

Fetch 104, Dcd 100, Ex 30, Mem 24, WB 20

Exec

Reg.File

MemAcces

s Data

Mem

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl^10

lw^

r1, r2(35) 14

addI^

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

WBM EX ID

PC

Next PC

___

Fill it in yourself!

docsity.com

Chapter 6.2 - Pipelining

Fetch 114, Dcd 110, Ex 104, Mem 100, WB 30

Exec

Reg.File

MemAcces

s Data

Mem

RegFile Inst. MemIR

D

Decode

MemCtrl

WBCtrl^10

lw^

r1, r2(35) 14

addI^

r2, r2, 3 20

sub^

r3, r4, r 24

beq^

r6, r7, 100 30

ori^

r8, r9, 17 34

add^

r10, r11, r 100 and

r13, r14, 15

WB^ M

PC

Next PC

___

Fill it in yourself!

?^

docsity.com

Chapter 6.2 - Pipelining

Data Hazards Handling

-^ Avoid

some “by design”:

  • eliminate WAR by always fetching operands early (decode) in pipe– eliminate WAW by doing all WBs in order (last stage, static). -^ Detect

and

resolve

remaining ones

  • stall the pipeline,– or, forward (if possible).^ IF^

DCD

EX

Mem WB

IF^

DCD

OF^

Ex^

Mem

RAW Data Hazard

WAW Data Hazard

IF^

DCD

OF

Ex

RS^

WAR Data Hazard

IF^

DCD

EX

Mem

WB

IF^

DCD

EX

Mem WB

docsity.com