基本操作-Step3,执行阶段 根据译码的结果,有四种情况 Memory reference ALUOutput <--A+(ir166##Ir1631---------effective address SMD <--B data to be written if it is a store-- smd(store mem data)=MDR Register-Register ALU instruction ALUOutput <--A op B Register -Immediate ALU instruction ALUOutput <--A op((ir6)6##ir1631)) Branch/Jump ALUOutput <--NPC +(ir166##Ir16-31 cond <--A op 0---for conditional branches As value is the condition base for BENz) 在简单的Load- Store机器中,不存在即需要计算存储器地址,指令地址 又要进行ALU运算的指令,因此可以将计算有效地址与执行合二为一 在一个流水段中进行。 中国科学技术大学 chapter3. 12
中国科学技术大学 chapter3.12 基本操作-Step 3, 执行阶段 根据译码的结果,有四种情况 • Memory Reference – ALUOutput <-- A + (IR16) 16 ## IR16..31--------- effective address – SMD <-- B ---------- data to be written if it is a STORE -- SMD (store mem data) = MDR • Register - Register ALU instruction – ALUOutput <-- A op B • Register - Immediate ALU instruction – ALUOutput <-- A op ((IR16) 16 ## IR16..31)) • Branch/Jump – ALUOutput <-- NPC + (IR16) 16 ## IR16..31 – cond <-- A op 0 --- for conditional branches A’s value is the condition base (= for BEQZ) – 在简单的 Load-Store机器中,不存在即需要计算存储器地址,指令地址 ,又要进行ALU运算的指令,因此可以将计算有效地址与执行合二为一 ,在一个流水段中进行
Step 4& Step5 Step 4 MEm- memory accessbranch completion memory reference LMD <---Mem[ALUOutput]-------if its a load; LMD (load memory data MDR或 Mem[ALUOutput <--SMD branch if(cond) then PC <--ALUOutput else PC <--NPC for Jumps the condition is always true Step 5 Wb- write back Reg -Reg alu Regs[r,6-20<--ALUOutput Reg-Immed ALU Regs[]<--ALUOutput Load Regs[.]<--LMD 中国科学技术大学 chapter3. 13
中国科学技术大学 chapter3.13 Step 4 & Step5 Step 4 MEM - memory access/branch completion • memory reference – LMD <--- Mem[ALUOutput] ------- if it’s a load; LMD (load memory data) = MDR 或 – Mem[ALUOutput] <-- SMD • branch – if (cond) then PC <-- ALUOutput else PC <-- NPC – for Jumps the condition is always true Step 5 WB - write back • Reg - Reg ALU – Regs[IR16..20] <-- ALUOutput • Reg - Immed ALU – Regs[IR11..15] <-- ALUOutput • Load – Regs[IR11..15] <-- LMD
这种结构是否可行 模型是正确的,但没有优化 ·还有其他选择 指令和数据存储器是否可以分开 采用一个长周期还是5个短周期实现 中国科学技术大学 chapter3. 14
中国科学技术大学 chapter3.14 这种结构是否可行 • 模型是正确的,但没有优化 • 还有其他选择 – 指令和数据存储器是否可以分开 – 采用一个长周期还是5个短周期实现
单周期和多周期控制 eaton 6 8 10 12 14 16 18 order Tin (in instuctions) M,可 2092Ro w $2, 20) Inergen 8 rc tothRoAU 8 Prosen 包eao 10 12 trudon w乳, 100*m retraction fotch R以N N孰2间2ns Irctrvaton foch R以N acess% lw $3, 300$0) 2n Tach 2 2 ·多周期控制可实现指令重叠执行 中国科学技术大学 chapter3. 15
中国科学技术大学 chapter3.15 单周期和多周期控制 • 多周期控制可实现指令重叠执行
DLX(MIPS的基本流水线 Instruction Clock Number Number 6 8 9 IF 2DF MEM NB i+1 3DF EX MEM NB 1+2 D EX MEM NB +3 IF ID EX MEM WB i F EX MEM AB ·假设流水线周期为每步所花费的时间 中国科学技术大学 chapter3.16
中国科学技术大学 chapter3.16 DLX(MIPS)的基本流水线 • 假设流水线周期为每步所花费的时间