CS4100计算机结构Pipelining课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《CS4100计算机结构Pipelining课件.ppt》由用户(三亚风情)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- CS4100 计算机 结构 Pipelining 课件
- 资源描述:
-
1、Pipelining-1OutlinevAn overview of pipeliningvA pipelined datapathvPipelined controlvData hazards and forwardingvData hazards and stallsvBranch hazardsvExceptionsvSuperscalar and dynamic pipeliningPipelining-2vLaundry example:Ann,Brian,Cathy,Dave each have one load ofclothes to wash,dry,and foldWash
2、er takes 30 minutesDryer takes 40 minutes“Folder”takes 20 minutesABCDPipelining Is Natural!Pipelining-3vSequential laundry takes 6 hours for 4 loadsvIf they learned pipelining,how long would it take?ABCD3040203040203040203040206 PM7891011MidnightTaskOrderTimeSequential LaundryPipelining-4vPipelined
3、laundry takes 3.5 hours for 4 loads ABCD6 PM7891011MidnightTaskOrderTime304040404020Pipelined Laundry:Start ASAPPipelining-5Pipelining LessonsvDoesnt help latency of single task,but throughput of entirevPipeline rate limited by slowest stagevMultiple tasks working at same time using different resour
4、cesvPotential speedup=Number pipe stagesvUnbalanced stage length;time to“fill”&“drain”the pipeline reduce speedupvStall for dependencesABCD6 PM789TaskOrderTime304040404020Pipelining-6Single cycle vs.PipelineClkCycle 1Cycle 2Cycle 3Cycle 4Cycle 5Cycle 6Cycle 7Cycle 8Cycle 9 Cycle 10LoadPipeline Imple
5、mentation:ClkSingle Cycle Implementation:LoadStoreWasteIfetchRegExecMemWrIfetchRegExecMemWrStoreIfetchRegExecMemWrR-typeCycle 1Cycle 2Pipelining-7Pipeline PerformanceSingle-cycle(Tc=800ps)Pipelined(Tc=200ps)Pipelining-8Instr.OrderTime(clock cycles)Inst 0Inst 1Inst 2Inst 4Inst 3ALUImRegDmRegALUImRegD
6、mRegALUImRegDmRegALUImRegDmRegALUImRegDmRegWhy Pipeline?Because the Resources Are There!Single-cycle DatapathPipelining-9OutlinevAn overview of pipeliningvA pipelined datapathvPipelined controlvData hazards and forwardingvData hazards and stallsvBranch hazardsvExceptionsvSuperscalar and dynamic pipe
7、liningPipelining-10Designing a Pipelined ProcessorvExamine the datapath and control diagramStarting with single cycle datapathSingle cycle control?vPartition datapath into stages:IF(instruction fetch),ID(instruction decode and register file read),EX(execution or address calculation),MEM(data memory
8、access),WB(write back)vAssociate resources with stagesvEnsure that flows do not conflict,or figure out how to resolvevAssert control in appropriate stagePipelining-11Multi-Execution StepsStep nameAction for R-type instructionsAction for memory-reference instructionsAction for branchesAction for jump
9、sInstruction fetchIR=MemoryPCPC=PC+4InstructionA=Reg IR25-21decode/register fetchB=Reg IR20-16ALUOut=PC+(sign-extend(IR15-0)2)Execution,addressALUOut=A op BALUOut=A+sign-extendif(A=B)thenPC=PC 31-28 IIcomputation,branch/(IR15-0)PC=ALUOut(IR25-02)jump completionMemory access or R-typeReg IR15-11=Load
10、:MDR=MemoryALUOutcompletionALUOutorStore:Memory ALUOut=BMemory read completionLoad:RegIR20-16=MDRBut,use single-cycle datapath.Pipelining-12Split Single-cycle DatapathWhat to add to split the datapath into stages?InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionMux01AddPC0WritedataMux1R
11、egistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddataAddressDatamemory1ALUresultMuxALUZeroIF:Instruction fetchID:Instruction decode/register file readEX:Execute/address calculationMEM:Memory accessWB:Write backFeedbackPathPipelining-13InstructionmemoryAdd
12、ress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXDatamemoryAddressPipeline registers(latches)Add Pipeline RegistersvUse registers between stag
13、es to carry data and controlPipelining-14vIF:Instruction FetchFetch the instruction from the Instruction MemoryvID:Instruction DecodeRegisters fetch and instruction decodevEX:Calculate the memory addressvMEM:Read the data from the Data MemoryvWB:Write the data back to the register fileCycle 1Cycle 2
14、Cycle 3Cycle 4Cycle 5IfetchReg/DecExecMemWrLoadConsider loadPipelining-15ClockCycle 1Cycle 2Cycle 3Cycle 4Cycle 5Cycle 6Cycle 7IfetchReg/DecExecMemWr1st lwIfetchReg/DecExecMemWr2nd lwIfetchReg/DecExecMemWr3rd lwPipelining loadv5 functional units in the pipeline datapath are:Instruction Memory for th
15、e Ifetch stageRegister Files Read ports(busA and busB)for the Reg/Dec stageALU for the Exec stageData Memory for the MEM stageRegister Files Write port(busW)for the WB stagePipelining-16vIR=memPC;PC=PC+4IF Stage of loadInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMu
16、x01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction fetchlwAddressDatamemoryInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersReaddata 1Re
17、addata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXMEM/WBInstruction decodelwAddressDatamemoryIR,PC+4Pipelining-17ID Stage of loadvA=RegIR25-21;B=RegIR20-16;InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0W
18、ritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction fetchlwAddressDatamemoryInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Re
19、adregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXMEM/WBInstruction decodelwAddressDatamemoryPipelining-18EX Stage of loadvALUout=A+sign-ext(IR15-0)InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersRea
20、ddata 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXMEM/WBExecutionlwAddressDatamemoryPipelining-19MEM State of loadvMDR=memALUoutInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersRead
21、data 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddataDatamemory1ALUresultMuxALUZeroID/EXMEM/WBMemorylwAddressInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216Si
22、gnextendWritedataReaddataDatamemory1ALUresultMuxALUZeroID/EXMEM/WBWrite backlwWriteregisterAddress97108/Patterson Figure 06.15Pipelining-20WB Stage of loadvRegIR20-16=MDRInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Read
23、register 1Readregister 216SignextendWriteregisterWritedataReaddataDatamemory1ALUresultMuxALUZeroID/EXMEM/WBMemorylwAddressInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendWritedataRea
24、ddataDatamemory1ALUresultMuxALUZeroID/EXMEM/WBWrite backlwWriteregisterAddress97108/Patterson Figure 06.15Who will supply this address?Pipelining-21Cycle 1Cycle 2Cycle 3Cycle 4IfetchReg/DecExecWrR-typeThe Four Stages of R-typevIF:fetch the instruction from the Instruction MemoryvID:registers fetch a
25、nd instruction decodevEX:ALU operates on the two register operandsvWB:write ALU output back to the register filePipelining-22vWe have a structural hazard:Two instructions try to write to the register file at the same time!Only one write portClockCycle 1Cycle 2Cycle 3Cycle 4Cycle 5Cycle 6Cycle 7Cycle
展开阅读全文