Professional Documents
Culture Documents
DLX-Phases of Instruction Cycle
DLX-Phases of Instruction Cycle
X) Memory reference ALUOutput A + IMM R-R ALU Instruction ALUOutput A func B R-Imm ALU Instruction ALUOutput A op Imm Branch ALUOutput NPC + Imm Cond (A op 0) Write-Back cycle (WB) R-R ALU Instruction Regs[IR16..20] ALUOutput R-Imm ALU Instruction Regs[IR11..15] ALUOutput Load Instruction Regs[IR11..15] LMD Instruction Decode/Register Fetch Cycle (ID) A Regs[IR6..10] B Regs[IR11..15] IMM ((IR16)16 ## IR16..31) Memory access / branch completion cycle (MEM) Memory reference (load) LMD Mem[ALUOutput] or (store) Mem[ALUOutput] B Branch If (cond) PC ALUOutput else PC NPC
Pipeline Latches
Structural Hazards
Inserting Bubbles/Stall
Three types of Data Hazards RAW (Read-After-Write) Instruction J tries to read a Source before I writes it WAW (Write-After-Write) (only is WRITE needs more than 1 pipe stages) J tries to write an operand before it is written by I LW R1, 0(R2) ADD R1,R2,R3 IF ID EX Mem1 Mem2 WB IF ID EX WB
WAR (Write-After-Read) J tries to write a destination before it is read by I SW 0(R2),R2 IF ID EX Mem1 Mem2 WB ADD R2,R3,R4 IF ID EX WB RAR (Read-AfterRead) ---- ??????
Compiler Scheduling a=b+c d=ef LW Rb , b LW Rc , c ADD Ra, Rb, Rc SW a , Ra LW LW SUB SW Re , e Rf , f Rd, Re, Rf d , Rd LW Rb , b LW Rc , c Stall ADD Ra, Rb, Rc SW a , Ra LW LW Stall SUB SW Re , e Rf , f Rd, Re, Rf d , Rd LW Rb , b LW Rc , c LW Re , e ADD Ra, Rb, Rc LW Rf , f SW a , Ra SUB Rd, Re, Rf SW d , Rd
Control Hazards
Reducing Stalls by moving logic of Zero Test and Branch Target Calculation
Predict-Taken