Cse410 10 Pipelining A
Cse410 10 Pipelining A
IF ID EX MEM WB
Pipelining
1. Instruction Fetch
2. Instruction Decode
CSE 410, Spring 2005 3. Execute
Computer Systems 4. Memory
5. Write Back
http://www.cs.washington.edu/410
fully decoded
EX, MEM, and WB stages Example: add $s0, $s1, $s2
3. Execute • IF get instruction at PC from memory
» On a memory reference, add up base and offset op code source 1 source 2 dest shamt function
» On an arithmetic instruction, do the math 000000 10001 10010 10000 00000 100000
4. Memory Access
• ID determine what instruction is and read
» If load or store, access memory registers
» If branch, replace PC with destination address » 000000 with 100000 is the add instruction
» Otherwise do nothing » get contents of $s1 and $s2 (eg: $s1=7, $s2=12)
5. Write back • EX add 7 and 12 = 19
» Place the results in the appropriate register • MEM do nothing for this instruction
• WB store 19 in register $s0
increasing time
MIPS ISA: Born to Pipeline Memory accesses
• Instructions all one length • Efficient pipeline requires each stage to
» simplifies Instruction Fetch stage take about the same amount of time
• Regular format • CPU is much faster than memory hardware
» simplifies Instruction Decode • Cache is provided on chip
• Few memory operands, only registers » i-cache holds instructions
» only lw and sw instructions access memory » d-cache holds data
• Aligned memory operands » critical feature for successful RISC pipeline
» only one memory access per operand » more about caches next week