200 likes | 315 Views
CDA 3101 Fall 2013 Introduction to Computer Organization. Pipelined Datapath Execution and Control 18 October 2013. Pipelining. Overlapped execution of instructions Instruction level parallelism (concurrency)
E N D
CDA 3101 Fall 2013Introduction to Computer Organization Pipelined Datapath Execution and Control 18 October 2013
Pipelining • Overlapped execution of instructions • Instruction level parallelism (concurrency) • Physical pipeline: Automobile assembly line • Response time for any instruction is the same • Instruction throughput increases • Speedup = k x number of steps (stages) • Theory: k is a large constant • Reality: Pipelining introduces overhead
Pipelined Datapath MEM/WB Mux IF/ID ID/EX EX/MEM Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
MIPS Pipeline • MIPS subset • Memory access: lw and sw • Arithmetic and logic: and, sub, and, or, slt • Branch: beq • Steps (pipeline segments) • IF: fetch instruction from memory • ID: decode instruction and read registers • EX: execute the operation or calculate address • MEM: access an operand in data memory • WB: write the result into a register
Execution of lw (1/5) Instruction Fetch MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Execution of lw (2/5) Instruction Decode MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Execution of lw (3/5) Execution MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Execution of lw (4/5) Memory MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Execution of lw (5/5) Write Back MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Datapath Resources Used for lw MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Instr. Mem Data Mem PC Sign extend
Multiple-clock-cycle Diagram Bypass
Single-cycle Diagram (Cycle 1) IF: lw $10, 20($1) MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Single-cycle Diagram (Cycle 2) IF: sub $11, $2, $3 ID: lw $10, 20($1) MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Single-cycle Diagram (Cycle 3) ID: sub $11, $2, $3 EX: lw $10, 20($1) MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Single-cycle Diagram (Cycle 4) EX: sub MEM: lw MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Single-cycle Diagram (Cycle 5) MEM: sub WB: lw MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Single-cycle Diagram (Cycle 6) WB: sub MEM/WB IF/ID ID/EX EX/MEM Mux Add Shift left 2 4 Add Mux ALU Regs Mux Instr. Mem Data Mem PC Sign extend
Conclusions • Caution: Pipelining is not as simple as it might appear • Different resources used per cycle per instruction • More complex than multicycle DP • Multiple representations • Pipeline contents representation • Single-cycle datapath: convenient • Single- and Multi-cycle diagrams • Instructor’s choice Next Lecture: Pipeline control and hazards