1 / 16

Pipelined Control (Simplified)

Pipelined Control (Simplified). Control Refresher. Here are the control signals that were previously identified:. Control Signals Grouped by Stages. pass to EX stage. pass to MEM stage. pass to WB stage. Control Signal Forwarding. Control signals derived from instruction opcode, as before:.

yorick
Télécharger la présentation

Pipelined Control (Simplified)

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. Pipelined Control (Simplified)

  2. Control Refresher • Here are the control signals that were previously identified:

  3. Control Signals Grouped by Stages pass to EX stage pass to MEM stage pass to WB stage

  4. Control Signal Forwarding • Control signals derived from instruction opcode, as before:

  5. Pipelined Control Overview

  6. Data Hazards in ALU Instructions • Consider this sequence: sub $2, $1,$3and $12,$2,$5or $13,$6,$2add $14,$2,$2sw $15,100($2) • We can resolve hazards with forwarding, but how do we detect when to forward?

  7. Dependencies & Forwarding

  8. Fwd fromEX/MEMpipeline reg Fwd fromMEM/WBpipeline reg Detecting the Need to Forward • Pass register numbers along pipeline • e.g., ID/EX.RegisterRs = register number for Rs sitting in ID/EX pipeline register • ALU operand register numbers in EX stage are given by • ID/EX.RegisterRs, ID/EX.RegisterRt • Data hazards when 1a. EX/MEM.RegisterRd = ID/EX.RegisterRs 1b. EX/MEM.RegisterRd = ID/EX.RegisterRt 2a. MEM/WB.RegisterRd = ID/EX.RegisterRs 2b. MEM/WB.RegisterRd = ID/EX.RegisterRt

  9. Detecting the Need to Forward • But only if forwarding instruction will write to a register! • EX/MEM.RegWrite, MEM/WB.RegWrite • And only if Rd for that instruction is not $zero • EX/MEM.RegisterRd ≠ 0,MEM/WB.RegisterRd ≠ 0

  10. ALU Operand Selection Value from register fetch in ID stage Value from WB stage Value from ALU execution

  11. Forwarding Paths Select source for $rs Select source for $rt register #s from current instruction $rd # from MEM stage Must select correct operand sources $rd # from EX stage

  12. Conditions for EX Hazard • If ( EX/MEM.RegWrite and • EX/MEM.RegisterRd ≠ 0 and • EX/MEM.RegisterRd = ID/EX.RegisterRs )then • ForwardA = 10 • If ( EX/MEM.RegWrite and • EX/MEM.RegisterRd ≠ 0 and EX/MEM.RegisterRd = ID/EX.RegisterRt ) • thenForwardB = 10 QTP: could BOTH occur with respect to the same instruction?

  13. Conditions for MEM Hazard • If ( MEM/WB.RegWrite and • MEM/WB.RegisterRd ≠ 0 and MEM/WB.RegisterRd = ID/EX.RegisterRs ) • thenForwardA = 01 • If ( MEM/WB.RegWrite and • MEM/WB.RegisterRd ≠ 0 and MEM/WB.RegisterRd = ID/EX.RegisterRt ) • thenForwardB = 01 QTP: could BOTH an EX hazard and a MEM hazard occur with respect to the same instruction?

  14. Double Data Hazard • Consider the sequence: add $1,$1,$2add $1,$1,$3add $1,$1,$4 • Both hazards occur… which value do we want to forward? • Revise MEM hazard condition: • Only forward if EX hazard condition is not true

  15. Revised Conditions for MEM Hazard • If ( MEM/WB.RegWrite and • MEM/WB.RegisterRd ≠ 0 and not ( EX/MEM.RegWrite and • EX/MEM.RegisterRd ≠ 0 and EX/MEM.RegisterRd = ID/EX.RegisterRs )and MEM/WB.RegisterRd = ID/EX.RegisterRs ) • thenForwardA = 01 • If ( MEM/WB.RegWrite and • MEM/WB.RegisterRd ≠ 0 and not ( EX/MEM.RegWrite and • EX/MEM.RegisterRd ≠ 0 and EX/MEM.RegisterRd = ID/EX.RegisterRt ) and MEM/WB.RegisterRd = ID/EX.RegisterRt ) • thenForwardB = 01

  16. Datapath with Forwarding

More Related