Instruction Pipelining Flashcards

Week 2.4 (24 cards)

1
Q

what are the basic ideas of instruction pipelining

A
  1. split instructions into independent stages
  2. execute stages concurrently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the limiting factors of instruction pipeling

A
  1. execution time longer than fetch time
  2. branches may invalidate fetched operations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are the 6 steps of a realistic pipeline

A
  1. FI = fetch instruction
  2. DI = decode instruction
  3. CO = calculate operations
  4. FO = fetch operands
  5. EI = execute instructions
  6. WO = write operands
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

draw a timing diagram for a simple programme using a realistic pipeline

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the realistic assumptions that break down the ‘realistic pipeline’

A
  • not all instructions require all 6 pipeline stages
  • not all stages can be performed in parallel
  • not all stages have equal duration
  • interrupts may invalidate the pipeline
  • branching may invalidate the pipeline
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are 3 things that can affect pipeline performance

A
  1. cycle time
  2. total pipeline time
  3. speedup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the formula of the cycle time

A

T = max ti + d = Tm + d
where:
- ti = time delay of ith pipeline stage
- k = number of pipeline stages
- d = delay of a latch
- Tm = maximum stage delay

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

total pipeline time formula

A

Tk, n = (k + n - 1).t
where:
- Tk,n = execution time of n instructions in k-stage pipeline
- t = cycle time
- k = number of pipeline stages
- n = number of instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

speedup formula

A

Sk = T1,n/Tk,n
= n.k.t/(k + n - 1).t
= n.k/(k + n - 1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is the limit of speedup

A

lim Sk = lim (n.k/k + n - 1) = k

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are pipeline hazards

A

the pipeline must stall because conditions do not permit continued execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are the 3 main pipeline hazards

A
  1. resource
  2. data
  3. control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is a resource hazards

A

2 instructions in the same pipeline need the same resources
- instruction 1 must source operands, so instruction 3 cannot be fetched when there is only one memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is a data hazard

A

2 instructions in the pipepline access the same memory location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what are the 3 data hazards

A
  1. RAW - read after write
  2. WAR - write after read
  3. WAW - write after write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is a read after write data hazard

A

read takes place before preceding write is complete

17
Q

what is a write after read data hazard

A

write operation completes before read has taken place

18
Q

what is a write after write data hazard

A

2 writes happen in the wrong order

19
Q

what is a control hazard

A

wrong branch is taken in the pipeline

20
Q

what is the most serious data hazard

A

control - pipeline must be completely flushed

21
Q

what are some solutions to control hazards

A
  • multiple pipelines for branches
  • prefetch branch target
  • instruction buffer (loop buffer)
  • branch prediction - static or dynamic
  • reordering of branches
22
Q

what are some static approaches of branch prediction

A
  • ‘always taken’
  • ‘never taken’
  • predict by opcode
23
Q

what are some dynamic approaches of branch prediction

A
  • ‘taken/not taken’ switch
  • branch-history table