Pirouz Bazargan SabetDecember 2003 RISC vs. CISC concept An implementation of Mips Implementation Concept of pipeline Pipeline’s problems
Pirouz Bazargan SabetDecember 2003 Problem with branches Beq The instruction that follows a branch is always fetched from the memroy Implementation
Pirouz Bazargan SabetDecember 2003 Implementation IFC IR M IFC M IR IR (BEQ) M delayed slot instruction
Pirouz Bazargan SabetDecember 2003 Implementation Solutions : Avoid the execution of the delayed slot instruction Hardware control Let the instruction be executed Difficulties in assembly language in contradiction with the RISC concept
Pirouz Bazargan SabetDecember 2003 Implementation The delayed slot instruction is always executed The compiler has to be tuned to the processor and put an instruction after each branch smart compiler branch useful instruction basic compiler branch nop
Pirouz Bazargan SabetDecember 2003 Implementation The later the next instruction address is calculated greater number of delayed slots hard to fill branch 75% used 5% used 0% used
Pirouz Bazargan SabetDecember 2003 Implementation The problem of data dependency
Pirouz Bazargan SabetDecember 2003 time i i+1 IDEMW IDEMW Add r3, r2, r1 Add r4, r3, r5 Implementation
Pirouz Bazargan SabetDecember 2003 Implementation Solutions : Try to resolve the problem inside the hardware Hardware control Let the compiler avoid the problem Difficulties inside the compiler
Pirouz Bazargan SabetDecember 2003 Add r3, r2, r1 Add r4, r3, r5 Implementation Add r4, r3, r5 time add r3 IDEMW IDEMW IDEMW IDEMW IDEMW add r4
Pirouz Bazargan SabetDecember 2003 Implementation Let the compiler avoid the problem Add r3, r2, r1 Add r4, r3, r5 nop Low performance nop
Pirouz Bazargan SabetDecember 2003 Implementation Try to resolve the problem inside the hardware i+1 ID time i IDEMW Add r3, r2, r1 Add r4, r3, r5 D EMW DD
Pirouz Bazargan SabetDecember 2003 E Implementation Are 3 wait cycles really necessary ? Add r3, r2, r1 Add r4, r3, r5 Data usage time i IDEMW MW i+1 ID E E
Pirouz Bazargan SabetDecember 2003 Implementation Are 3 wait cycles really necessary ? time i IDEMW Add r3, r2, r1 Add r4, r3, r5 Data availability
Pirouz Bazargan SabetDecember 2003 Implementation Putting all together time IDEMW Add r3, r2, r1 Add r4, r3, r5 IDEMW
Pirouz Bazargan SabetDecember 2003 Implementation Putting all together M +4 IFC DEC EXE MEM WBK IR S T + M Add r4, r3, r5 Add r3, r2, r1 IR + +4
Pirouz Bazargan SabetDecember 2003 Implementation All the data dependencies cannot be resolved time IDEMW Lw r3, 0(r1) Add r4, r3, r5 E MW i+1 ID E i
Pirouz Bazargan SabetDecember 2003 Implementation How many data dependencies time IDEMW i i+1 i+2 i+3 i+4 IDEMW IDEMW IDEMW IDEMW
Pirouz Bazargan SabetDecember 2003 Is there any limitation to deep pipelines ? NO !2 limitations deep pipeline great number of delayed slots complex hardware control due to data dependencies Implementation