Appendix-C-m2-ziavras

Mem alu if idrf ex r8r1r9 xor r10r1r11 r10 adapted

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: azards Read After Write (RAW) InstrJ tries to read operand before InstrI writes it I: add r1,r2,r3 add r1 J: sub r4,r1,r3 • Caused by a “Data Dependence” or “Flow by Dependence or Dependence” (in compiler nomenclature). This hazard results from an actual need for communication communication Adapted from D. Culler. Copyright 2001 UCB. Changes and new slides included S. Ziavras Three Generic Data Hazards Write After Read (WAR) InstrJ writes operand before InstrI reads it it I: sub r4,r1,r3 J: add r1 J: add r1,r2,r3 K: mul r6,r1,r7 • Called an “anti-dependence” by compiler writers. This results from reuse of the name “r1” • Can’t happen in MIPS 5-stage pipeline because: happen in MIPS pipeline because: – All instructions take 5 stages, and – Reads are always in stage 2, and are always in stage 2, and – Writes are always in stage 5 Adapted from D. Culler. Copyright 2001 UCB. Changes and new slides included S. Ziavras Three Generic Data Hazards Write After Write (WAW) InstrJ writes operand before InstrI writes it. operand before it. I: sub r1,r4,r3 J: add r1 J: add r1,r2,r3 K: mul r6,r1,r7 • Called an “output dependence” by compiler writers. This also results from the reuse of name “r1” also results from the reuse of name • Can’t happen in MIPS 5-stage pipeline because: – All instructions take 5 stages & instructions take stages – Writes are always in stage 5 • Will see WAR and WAW later, in more complicated pipes Adapted from D. Culler. Copyright 2001 UCB. Changes and new slides included S. Ziavras Forwarding to Avoid Data Hazard or Reg DMem Ifetch Reg DMem Ifetch Reg DMem Ifetch Reg ALU and r6,r1,r7 Ifetch DMem ALU sub r4,r1,r3 Reg ALU O r d e r add r1,r2,r3 Ifetch ALU I n s t r. ALU Time (clock cycles) r8,r1,r9 r8 xor r10,r1,r11 Adapted from D. Culler. Copyright 2001 UCB. Changes and new slides included Reg Reg Reg Reg DMem Reg S. Ziavras HW Change for Forwarding NextPC mux x Adapted from D. Culler. Copyright 2001 UCB....
View Full Document

Ask a homework question - tutors are online