Branches and Pipelining

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/7

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

8 Terms

1
New cards

Pipelining

Overlapping instructions:

  • Fetch instruction

  • Decode instruction

  • Calculate operands

  • Fetch operands

  • Execute instruction

  • Write/complete result

Means one instruction is completed each clock cycle

<p>Overlapping instructions:</p><ul><li><p><span>Fetch instruction</span></p></li><li><p><span>Decode instruction</span></p></li><li><p><span>Calculate operands</span></p></li><li><p><span>Fetch operands</span></p></li><li><p><span>Execute instruction</span></p></li><li><p><span>Write/complete result</span></p></li></ul><p>Means one instruction is completed each clock cycle</p>
2
New cards

Branching

Branching can cause a pipeline stall - restart overlapping process

Wastes time

<p>Branching can cause a pipeline stall - restart overlapping process</p><p>Wastes time</p>
3
New cards

Dealing with branching

Delayed branching

Multiple streams

Prefetch Branch target

Loop buffer

Branch prediction

4
New cards

ARM Pipeline

Only fetch, decode, execute

Stalls have lower impact as shorter

5
New cards

Multiple Streams

Have two pipelines

Prefetch each branch into each pipeline

-ve: Leads to bus and register contention

-ve: multiple branches then need more pipelines

6
New cards

Prefetch Branch Target

Target of branch is prefetched in addition to instructions following branch

Keep target until branch is executed

<p>Target of branch is prefetched in addition to instructions following branch</p><p>Keep target until branch is executed</p>
7
New cards

Loop Buffer

Very fast memory stores last N instructions in sequence

Maintained by fetch stage

Check buffer before fetching from memory

Good for small loops or jumps

8
New cards

Branch Prediction

  • Static

    • Either assume branch never or always happen

    • Fetch instruction related to assumption

  • 'Active'

    • Predict by opcode - some more likely to result in jump than others

    • Uses taken/not taken switch

<ul><li><p><span>Static</span></p><ul><li><p><span>Either assume branch never or always happen</span></p></li><li><p><span>Fetch instruction related to assumption</span></p></li></ul></li><li><p><span>'Active'</span></p><ul><li><p><span>Predict by opcode - some more likely to result in jump than others</span></p></li><li><p><span>Uses taken/not taken switch</span></p></li></ul></li></ul><p></p>