The Light at the End of the Tunnel - PowerPoint PPT Presentation

About This Presentation
Title:

The Light at the End of the Tunnel

Description:

Title: PowerPoint Presentation Last modified by: Preferred Customer Created Date: 1/1/1601 12:00:00 AM Document presentation format: On-screen Show – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 5
Provided by: bing63
Category:
Tags: adder | end | full | light | tunnel

less

Transcript and Presenter's Notes

Title: The Light at the End of the Tunnel


1
The Light at the End of the Tunnel Doesnt Mean
You Died! Part 3 - Branch Hazards Easier!
3/24/04
  • This is a control hazard as opposed to data
    hazard we just examined
  • Also called a branch hazard
  • A successful conditional branch invalidates
    follow-on instructions
  • Rather than stalling for each branch to see it is
    successful or not, assume it is not successful
  • Branch prediction guess that the branch is NOT
    taken
  • If guess is correct, the we proceed full speed
  • If guess is wrong (branch taken), then the
    following instructions that are being fetched or
    decoded must be discarded.
  • The over head for successful branches take place
    only ½ of the time.
  • Discarding instructions
  • Done much the same as in the data hazard stall
    case
  • But must now change 3 instructions in the IF, ID,
    and EX stages when the branch reaches the MEM
    stage
  • In the case of data hazard stalls we let nops
    percolate from the EX stage by inserting zeros
    for controls in the ID/EX register.
  • In this case we would have to flush the 3
    following instruction dead in their tracks. In
    the next slide we see how to reduce this to one
    instruction.

2
The Final Data Path Tweak Reducing the Delay
of Successful Branches
  • Move branch execution up earlier in the pipeline
    - See fig 6.30, p. 470 for the way it was.
  • Fewer instructions to be flushed.
  • Move branch decision to ID stage (was in MEM
    stage)
  • Check equality of registers in ID stage by
    taking XOR of registers and then ANDing of
    results.
  • The information for the target address
    calculation is available in the IF/ID register
    (in ID stage) move the branch address adder
    from EX stage to ID stage.
  • Now on successful branch, there is only one
    instruction to be flushed, the one currently
    being fetched.
  • Instruction in IF stage is flushed by adding a
    new control line IF.Flush
  • Zeros out the the instruction field in the IF/ID
    register effectively making it a nop.

3
Example of Impact of Successful Branch on the
Pipeline
EX/MEMMemMEMWB ? stage ?
Fig. 6.50
Illustrates the conservative approach where 3
instructions must be flushed. In this case
decision for branch made in MEM stage.
4
Data path with the branch hazard feature
Fig. 6.51
Note the compare circuit ( ) above is the
selector of the PC MUX
Write a Comment
User Comments (0)
About PowerShow.com