Lec13 - Pipeline: Branch Prediction Fall, 2008 These slides...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Pipeline: Branch Prediction Fall, 2008 These slides are adapted from notes by Dr. David Patterson (UCB)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Announcements Midterm Exam is on 10/26/2009 in class. Midterm Review is on 10/19/2009 Monday.
Background image of page 2
3 Static Branch Prediction For every branch encountered during execution predict whether the branch will be taken or not taken . Predicting branch not taken not taken : 1. Speculatively fetch and execute instructions following the branch 2. If prediction incorrect flush pipeline of speculated instructions Convert these instructions to NOPs by clearing pipeline registers These have not updated memory or registers at time of flush Predicting branch Predicting branch taken taken : : 1. Speculatively fetch and execute instructions at the branch target address 2. Useful only if target address known earlier than branch outcome May require stall cycles till target address known Flush pipeline if prediction is incorrect Must ensure that flushed instructions do not update memory/registers
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Control Hazard - Stall beq writes PC here new PC used here 02468 1 0 12 IF ID EX MEM WB 16 dd $r4,$r5,$r6 eq $r0,$r1,tgt IF ID EX MEM WB IF ID EX MEM WB w $s4,200($t5) 18 BUBBLE BUBBLE BUBBLE BUBBLE BUBBLE TALL Why the penalty is only 1 cycle?
Background image of page 4
5 Control Hazard - Correct Prediction Fetch assuming branch taken 02468 1 0 12 IF ID EX MEM WB 16 dd $r4,$r5,$r6 eq $r0,$r1,tgt IF ID EX MEM WB IF ID EX MEM WB tgt: w $s4,200($t5) 18
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Control Hazard - Incorrect Prediction “Squashed” instruction 02468 1 0 12 IF ID EX MEM WB 16 add $r4,$r5,$r6 beq $r0,$r1,tgt IF ID EX MEM WB IF ID EX MEM WB 18 BUBBLE BUBBLE BUBBLE BUBBLE tgt: sw $s4,200($t5) (incorrect - STALL) IF or $r8,$r8,$r9
Background image of page 6
7 1-Bit Branch Prediction Branch History Table (BHT): Lower bits of PC address index table of 1-bit values Says whether or not branch taken last time No address check (saves HW, but may not be right branch) If prediction is wrong, invert prediction bit a 31 a 30 …a 11 …a 2 a
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2009 for the course CS 20929 taught by Professor Taoxie during the Spring '09 term at San Diego State.

Page1 / 26

Lec13 - Pipeline: Branch Prediction Fall, 2008 These slides...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online