1 / 24

Instruction Times (Critical Paths)

Instruction Times (Critical Paths). What is the clock cycle time assuming negligible delays for muxes , control unit, sign extend, PC access, shift left 2, wires, setup and hold times except: Instruction and Data Memory (200 ps ) ALU and adders (200 ps )

cadee
Download Presentation

Instruction Times (Critical Paths)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Instruction Times (Critical Paths) • What is the clock cycle time assuming negligible delays for muxes, control unit, sign extend, PC access, shift left 2, wires, setup and hold times except: • Instruction and Data Memory (200 ps) • ALU and adders (200 ps) • Register File access (reads or writes) (100 ps)

  2. Simplified MIPS Pipelined Datapath

  3. Instruction Critical Paths • What is the clock cycle time assuming negligible delays for muxes, control unit, sign extend, PC access, shift left 2, wires, setup and hold times except: • Instruction and Data Memory (200 ps) • ALU and adders (200 ps) • Register File access (reads or writes) (100 ps)

  4. Stages • Five stages, one step per stage • IF: Instruction fetch from memory • ID: Instruction decode & register read • EX: Execute operation or calculate address • MEM: Access memory operand • WB: Write result back to register

  5. Hazards • Situations that prevent starting the next instruction in the next cycle • Structure hazards • Data hazard • Control hazard

  6. Structure Hazards • Instruction cannot execute in proper clock cycle because hardware cannot support the combination of instructions that are set to execute in the clock cycle • In MIPS pipeline with a single memory • Load/store requires data access • Instruction fetch would have to stall for that cycle • Would cause a pipeline “bubble” • Hence, pipelined datapaths require separate instruction/data memories • Or separate instruction/data caches

  7. Data Hazards • Instruction cannot execute in proper clock cycle because data that is needed is not yet available add $s0, $t0, $t1sub $t2, $s0, $t3

  8. Simplified MIPS Pipelined Datapath

  9. Forwarding (aka Bypassing) • Use result when it is computed • Don’t wait for it to be stored in a register • Requires extra connections in the datapath

  10. Load-Use Data Hazard • Can’t always avoid stalls by forwarding • If value not computed when needed • Can’t forward backward in time!

  11. Code Scheduling to Avoid Stalls • Reorder code to avoid use of load result in the next instruction: C code A = B + E, C= B + F lw $t1, 0($t0) lw $t2, 4($t0) add $t3, $t1, $t2 sw $t3, 12($t0) lw $t4, 8($t0) add $t5, $t1, $t4 sw $t5, 16($t0) lw $t1, 0($t0) lw $t2, 4($t0) lw $t4, 8($t0) add $t3, $t1, $t2 sw $t3, 12($t0) add $t5, $t1, $t4 sw $t5, 16($t0) stall stall

  12. Control Hazards • Instruction cannot execute in proper clock cycle because the instruction that was fetched is not the one that is needed • Branch determines flow of control • Fetching next instruction depends on branch outcome • Pipeline can’t always fetch correct instruction • In MIPS pipeline • Need to compare registers and compute target early in the pipeline • Add hardware to do it in ID stage

  13. Stall on Branch • Wait until branch outcome determined before fetching next instruction

  14. Branch Instruction Data/Control Flow 0 Add Add 1 4 Shift left 2 PCSrc ALUOp Branch MemRead Instr[31-26] Control Unit MemtoReg MemWrite ALUSrc RegWrite RegDst ovf Instr[25-21] Read Addr 1 Instruction Memory Read Data 1 Address Instr[20-16] Register File zero Read Addr 2 Data Memory Read Address PC Instr[31-0] 0 Read Data 1 ALU Write Addr Read Data 2 0 1 Write Data 0 Instr[15 -11] Write Data 1 Instr[15-0] Sign Extend ALU control 16 32 Instr[5-0]

  15. Branch Prediction • Correct branch prediction is very important and can produce substantial performance improvements. • static prediction • dynamic prediction • To take full advantage of branch prediction, we can have the instructions not only fetched but also begin execution. This is known as speculative execution

  16. MIPS with Predict Not Taken Prediction correct Prediction incorrect

  17. Branches • Branch instructions can dramatically affect pipeline performance. Control operations are very frequent in current programs. • 20% - 35% of the instructions executed are branches (conditional and unconditional). • 65% of the branches actually take the branch. • Conditional branches are much more frequent than unconditional (more than two times). More than 50% of conditional branches are taken.

  18. Static Branch Prediction • Static prediction techniques do not take into consideration execution history. • Predict never taken (Motorola 68020): assumes that the branch is not taken. • Predict always taken: assumes that the branch is taken.

  19. Dynamic Branch Prediction • Improve the accuracy of prediction by recording the history of conditional branches. • One-bit prediction scheme • is used in order to record if the last execution resulted in a branch taken or not. The system predicts the same behavior as for the last time. • Two-bit prediction scheme • with a two-bit scheme predictions can be made depending on the last two instances of execution.

  20. One-Bit Prediction Scheme

  21. Two-Bit Prediction Scheme

  22. Branch History Table • History info. can be used not only to predict the outcome of a conditional branch but also to avoid recalculation of the target address. Together with bits used for prediction, the target address can be stored for later use in a branch history table. • Using D. B. P with history tables up to 90% of predictions can be correct. • Pentium,PowerPC620 use speculative execution with D.B.P based on a branch history table.

  23. Branch History Table

More Related