chapter one introduction to pipelined processors

51
Chapter One Introduction to Pipelined Processors

Upload: venus-maxwell

Post on 30-Dec-2015

20 views

Category:

Documents


1 download

DESCRIPTION

Chapter One Introduction to Pipelined Processors. Non-linear pipeline. In floating point adder , stage (2) and (4) needs a shift register. We can use the same shift register and then there will be only 3 stages. Then we should have a feedback from third stage to second stage . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter One  Introduction to Pipelined Processors

Chapter One Introduction to Pipelined

Processors

Page 2: Chapter One  Introduction to Pipelined Processors

Non-linear pipeline• In floating point adder, stage (2) and (4)

needs a shift register. • We can use the same shift register and then

there will be only 3 stages.• Then we should have a feedback from third

stage to second stage. • Further the same pipeline can be used to

perform fixed point addition.• A pipeline with feed-forward and/or

feedback connections is called non-linear

Page 3: Chapter One  Introduction to Pipelined Processors

Example: 3-stage nonlinear pipeline

Page 4: Chapter One  Introduction to Pipelined Processors

3 stage non-linear pipeline

• It has 3 stages Sa, Sb and Sc and latches.• Multiplexers(cross circles) can take more than

one input and pass one of the inputs to output

• Output of stages has been tapped and used for feedback and feed-forward.

SaSa SbSb ScScInput Output B

Output A

Page 5: Chapter One  Introduction to Pipelined Processors

3 stage non-linear pipeline

• The above pipeline can perform a variety of functions.

• Each functional evaluation can be represented by a particular sequence of usage of stages.

• Some examples are:1. Sa, Sb, Sc2. Sa, Sb, Sc, Sb, Sc, Sa3. Sa, Sc, Sb, Sa, Sb, Sc

Page 6: Chapter One  Introduction to Pipelined Processors

Reservation Table

• Each functional evaluation can be represented using a diagram called Reservation Table(RT).

• It is the space-time diagram of a pipeline corresponding to one functional evaluation.

• X axis – time units • Y axis – stages

Page 7: Chapter One  Introduction to Pipelined Processors

Reservation Table

• For first sequence Sa, Sb, Sc, Sb, Sc, Sa called function A , we have

  0 1 2 3 4 5

Sa A A

Sb A A

Sc A A

Page 8: Chapter One  Introduction to Pipelined Processors

Reservation Table

• For second sequence Sa, Sc, Sb, Sa, Sb, Sc called function B, we have

0 1 2 3 4 5

Sa B B

Sb B B

Sc B B

Page 9: Chapter One  Introduction to Pipelined Processors

3 stage non-linear pipelineOutput A

Output BSaSa SbSb ScSc

Input

Reservation TableTime

Stage

  0 1 2 3 4 5

Sa

Sb

Sc

Page 10: Chapter One  Introduction to Pipelined Processors

Function A

Page 11: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A

Sb

Sc

Page 12: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A

Sb A

Sc

Page 13: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A

Sb A

Sc A

Page 14: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A

Sb A A

Sc A

Page 15: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A

Sb A A

Sc A A

Page 16: Chapter One  Introduction to Pipelined Processors

3 stage pipeline : Sa, Sb, Sc, Sb, Sc, Sa

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa A A

Sb A A

Sc A A

Page 17: Chapter One  Introduction to Pipelined Processors

Function B

Page 18: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

  0 1 2 3 4 5

Sa B

Sb

Sc

Page 19: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa B

Sb

Sc B

Page 20: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa B

Sb B

Sc B

Page 21: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa B B

Sb B

Sc B

Page 22: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa B B

Sb B B

Sc B

Page 23: Chapter One  Introduction to Pipelined Processors

3 stage pipeline: Sa, Sc, Sb, Sa, Sb, Sc

SaSa SbSb ScScInput Output B

Output A

Reservation TableTime

Stage

0 1 2 3 4 5

Sa B B

Sb B B

Sc B B

Page 24: Chapter One  Introduction to Pipelined Processors

Reservation Table• After starting a function, the stages need to be

reserved in corresponding time units.• Each function supported by multifunction

pipeline is represented by different RTs• Time taken for function evaluation in units of

clock period is compute time.(For A & B, it is 6)

Page 25: Chapter One  Introduction to Pipelined Processors

Reservation Table• Marking in same row => usage of stage more

than once• Marking in same column => more than one

stage at a time

Page 26: Chapter One  Introduction to Pipelined Processors

Multifunction pipelines• Hardware of multifunction pipeline should be

reconfigurable.• Multifunction pipeline can be static or

dynamic

Page 27: Chapter One  Introduction to Pipelined Processors

Multifunction pipelines• Static: – Initially configured for one functional evaluation. – For another function, pipeline need to be drained

and reconfigured.– You cannot have two inputs of different function

at the same time

Page 28: Chapter One  Introduction to Pipelined Processors

Multifunction pipelines

• Dynamic:– Can do different functional evaluation at a time.– It is difficult to control as we need to be sure that

there is no conflict in usage of stages.

Page 29: Chapter One  Introduction to Pipelined Processors

Principle of Designing Pipeline Processors

(Design Problems of Pipeline Processors)

Page 30: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• The instructions in computer programs can be classified into 4 types:– Arithmetic/Load Operations (60%) – Store Type Instructions (15%)– Branch Type Instructions (5%)– Conditional Branch Type (Yes – 12% and No – 8%)

Page 31: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• Arithmetic/Load Operations (60%) : – These operations require one or two operand

fetches. – The execution of different operations requires a

different number of pipeline cycles

Page 32: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• Store Type Instructions (15%) :– It requires a memory access to store the data.

• Branch Type Instructions (5%) :– It corresponds to an unconditional jump.

Page 33: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• Conditional Branch Type (Yes – 12% and No – 8%) : – Yes path requires the calculation of the new

address – No path proceeds to next sequential instruction.

Page 34: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• Arithmetic-load and store instructions do not alter the execution order of the program.

• Branch instructions and Interrupts cause some damaging effects on the performance of pipeline computers.

Page 35: Chapter One  Introduction to Pipelined Processors

Handling Example – Interrupt System of Cray1

Page 36: Chapter One  Introduction to Pipelined Processors

Cray-1 System• The interrupt system is built around an

exchange package. • When an interrupt occurs, the Cray-1 saves 8

scalar registers, 8 address registers, program counter and monitor flags.

• These are packed into 16 words and swapped with a block whose address is specified by a hardware exchange address register

Page 37: Chapter One  Introduction to Pipelined Processors

Instruction Prefetch and Branch Handling

• In general, the higher the percentage of branch type instructions in a program, the slower a program will run on a pipeline processor.

Page 38: Chapter One  Introduction to Pipelined Processors

Effect of Branching on Pipeline Performance

• Consider a linear pipeline of 5 stages

Fetch Instruction Decode Fetch

OperandsExecute

Store Results

Page 39: Chapter One  Introduction to Pipelined Processors

Overlapped Execution of Instruction without branching

I1

I2I3

I4

I5I6

I7I8

Page 40: Chapter One  Introduction to Pipelined Processors

I5 is a branch instruction

I1

I2

I3I4

I5

I6I7

I8

Page 41: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching on an n-segment instruction pipeline

Page 42: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• Consider an instruction cycle with n pipeline clock periods.

• Let – p – probability of conditional branch (20%)– q – probability that a branch is successful (60% of

20%) (12/20=0.6)

Page 43: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• Suppose there are m instructions • Then no. of instructions of successful branches

= mxpxq (mx0.2x0.6)• Delay of (n-1)/n is required for each successful

branch to flush pipeline.

Page 44: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• Thus, the total instruction cycle required for m instructions =

n

nmpqmn

n

)1(1

1

Page 45: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• As m becomes large , the average no. of instructions per instruction cycle is given as

= ?

nnmpq

nmn

mLtm )1(1

Page 46: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• As m becomes large , the average no. of instructions per instruction cycle is given as

nnmpq

nmn

mLtm )1(1

)1(1

npq

n

Page 47: Chapter One  Introduction to Pipelined Processors

Estimation of the effect of branching

• When p =0, the above measure reduces to n, which is ideal.

• In reality, it is always less than n.

Page 48: Chapter One  Introduction to Pipelined Processors

Solution = ?

Page 49: Chapter One  Introduction to Pipelined Processors

Multiple Prefetch Buffers• Three types of buffers can be used to match

the instruction fetch rate to pipeline consumption rate

1.Sequential Buffers: for in-sequence pipelining2.Target Buffers: instructions from a branch

target (for out-of-sequence pipelining)

Page 50: Chapter One  Introduction to Pipelined Processors

Multiple Prefetch Buffers• A conditional branch cause both sequential

and target to fill and based on condition one is selected and other is discarded

Page 51: Chapter One  Introduction to Pipelined Processors

Multiple Prefetch Buffers

3. Loop Buffers– Holds sequential instructions within a loop