书签 分享 收藏 举报 版权申诉 / 141
上传文档赚钱

类型CS4100计算机结构Pipelining课件.ppt

  • 上传人(卖家):三亚风情
  • 文档编号:3377021
  • 上传时间:2022-08-25
  • 格式:PPT
  • 页数:141
  • 大小:6.29MB
  • 【下载声明】
    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

    26、 8Cycle 9IfetchReg/DecExecWrR-typeIfetchReg/DecExecWrR-typeIfetchReg/DecExecMemWrLoadIfetchReg/DecExecWrR-typeIfetchReg/DecExecWrR-typeOps!We have a problem!Pipelining R-type and loadPipelining-23Important ObservationIfetchReg/DecExecMemWrLoad12345IfetchReg/DecExecWrR-type1234vEach functional unit c

    27、an only be used once per instructionvEach functional unit must be used at the same stage for all instructions:Load uses Register Files write port during its 5th stageR-type uses Register Files write port during its 4th stageSeveral ways to solve:forwarding,adding pipeline bubble,making instructions

    28、same lengthPipelining-24ClockCycle 1Cycle 2Cycle 3Cycle 4Cycle 5Cycle 6Cycle 7Cycle 8Cycle 9IfetchReg/DecMemWrR-typeIfetchReg/DecMemWrR-typeIfetchReg/DecExecMemWrLoadIfetchReg/DecMemWrR-typeIfetchReg/DecMemWrR-typeIfetchReg/DecExecWrR-typeMemExecExecExecExec12345Solution:Delay R-types WritevDelay R-

    29、types register write by one cycle:R-type also use Reg Files write port at Stage 5MEM is a NOP stage:nothing is being done.R-type also has 5 stagesPipelining-25Cycle 1Cycle 2Cycle 3Cycle 4IfetchReg/DecExecMemStoreWrThe Four Stages of storevIF:fetch the instruction from the Instruction MemoryvID:regis

    30、ters fetch and instruction decodevEX:calculate the memory addressvMEM:write the data into the Data MemoryAdd an extra stage:vWB:NOPPipelining-26vIF:fetch the instruction from the Instruction MemoryvID:registers fetch and instruction decodevEX:compares the two register operandselect correct branch ta

    31、rget addresslatch into PCAdd two extra stages:vMEM:NOPvWB:NOPCycle 1Cycle 2Cycle 3Cycle 4IfetchReg/DecExecMemBeqWrThe Three Stages of beqPipelining-27Pipelined DatapathInstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0AddressWritedataMux1RegistersReaddata 1Rea

    32、ddata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddataDatamemory1ALUresultMuxALUZeroID/EXPipelining-28Graphically Representing PipelinesvCan help with answering questions like:How many cycles to execute this code?What is the ALU doing during cycle 4?Help understand datapathsIM

    33、RegDMRegIMRegDMRegCC 1CC 2CC 3CC 4CC 5CC 6Time(in clock cycles)lw$10,20($1)Programexecutionorder(in instructions)sub$11,$2,$3ALUALUPipelining-29Example 1:Cycle 1InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readreg

    34、ister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction decodelw$10,20($1)Instruction fetchsub$11,$2,$3InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readreg

    35、ister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction fetchlw$10,20($1)AddressDatamemoryAddressDatamemoryClock 1Clock 2Pipelining-30Example 1:Cycle 2InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddat

    36、a 1Readdata 2Readregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction decodelw$10,20($1)Instruction fetchsub$11,$2,$3InstructionmemoryAddress4320AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2R

    37、eadregister 1Readregister 216SignextendWriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXInstruction fetchlw$10,20($1)AddressDatamemoryAddressDatamemoryClock 1Clock 2Pipelining-31InstructionmemoryAddress40AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReadda

    38、ta 1Readdata 2Readregister 1Readregister 23216SignextendWriteregisterWritedataMemorylw$10,20($1)Readdata1ALUresultMuxALUZeroID/EXExecutionsub$11,$2,$3InstructionmemoryAddress40AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readre

    39、gister 2WriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXExecutionlw$10,20($1)Instruction decodesub$11,$2,$33216SignextendAddressDatamemoryDatamemoryAddressClock 3Clock 4Example 1:Cycle 3Pipelining-32InstructionmemoryAddress40AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0Writed

    40、ataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 23216SignextendWriteregisterWritedataMemorylw$10,20($1)Readdata1ALUresultMuxALUZeroID/EXExecutionsub$11,$2,$3InstructionmemoryAddress40AddAddresultShiftleft 2InstructionIF/IDEX/MEMMEM/WBMux01AddPC0WritedataMux1RegistersReaddata 1Readdata

    41、 2Readregister 1Readregister 2WriteregisterWritedataReaddata1ALUresultMuxALUZeroID/EXExecutionlw$10,20($1)Instruction decodesub$11,$2,$33216SignextendAddressDatamemoryDatamemoryAddressClock 3Clock 4Example 1:Cycle 4Pipelining-33InstructionmemoryAddress4320AddAddresult1ALUresultZeroShiftleft 2Instruc

    42、tionIF/IDEX/MEMID/EXMEM/WBWrite backMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendMuxALUReaddataWriteregisterWritedatalw$10,20($1)InstructionmemoryAddress4320AddAddresult1ALUresultZeroShiftleft 2InstructionIF/IDEX/MEMID/EXMEM/WBWrite backMux01AddPC0Writ

    43、edataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendMuxALUReaddataWriteregisterWritedatasub$11,$2,$3Memorysub$11,$2,$3AddressDatamemoryAddressDatamemoryClock 6Clock 5Example 1:Cycle 5Pipelining-34InstructionmemoryAddress4320AddAddresult1ALUresultZeroShiftleft 2InstructionIF

    44、/IDEX/MEMID/EXMEM/WBWrite backMux01AddPC0WritedataMux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendMuxALUReaddataWriteregisterWritedatalw$10,20($1)InstructionmemoryAddress4320AddAddresult1ALUresultZeroShiftleft 2InstructionIF/IDEX/MEMID/EXMEM/WBWrite backMux01AddPC0WritedataM

    45、ux1RegistersReaddata 1Readdata 2Readregister 1Readregister 216SignextendMuxALUReaddataWriteregisterWritedatasub$11,$2,$3Memorysub$11,$2,$3AddressDatamemoryAddressDatamemoryClock 6Clock 5Example 1:Cycle 6Pipelining-35OutlinevAn overview of pipeliningvA pipelined datapathvPipelined controlvData hazard

    46、s and forwardingvData hazards and stallsvBranch hazardsvExceptionsvSuperscalar and dynamic pipeliningPipelining-36Pipeline Control:Control SignalsPCInstructionmemoryAddressInstructionInstruction20 16MemtoRegALUOpBranchRegDstALUSrc41632Instruction15 000RegistersWriteregisterWritedataReaddata 1Readdat

    47、a 2Readregister 1Readregister 2SignextendMux1WritedataReaddataMux1ALUcontrolRegWriteMemReadInstruction15 116IF/IDID/EXEX/MEMMEM/WBMemWriteAddressDatamemoryPCSrcZeroAddAddresultShiftleft 2ALUresultALUZeroAdd01Mux01MuxPipelining-37Execution/Address Calculationstage control linesMemory access stagecont

    48、rol linesWrite-back stagecontrol linesRegDstALUOp1ALUOp0ALUSrcBranchMemReadMemWriteRegwriteMem toReg110000010000101011X0010010XX0101000XFig.4.22Group Signals According to StagesvCan use control signals of single-cycle CPU Pipelining-38vPass control signals along just like the dataMain control genera

    49、tes control signals during ID Data Stationary ControlControlEXMWBMWBWBIF/IDID/EXEX/MEMMEM/WBInstructionFig.4.50Pipelining-39IF/ID RegisterID/Ex RegisterEx/MEM RegisterMEM/WB RegisterIDEXMEMExtOpALUOpRegDstALUSrcBranchMemWrMemtoRegRegWrMainControlExtOpALUOpRegDstALUSrcMemtoRegRegWrMemtoRegRegWrMemtoR

    50、egRegWrBranchMemWrBranchMemWWBData Stationary Control(cont.)vSignals for EX(ExtOp,ALUSrc,.)are used 1 cycle latervSignals for MEM(MemWr,Branch)are used 2 cycles latervSignals for WB(MemtoReg,MemWr)are used 3 cycles laterPipelining-40WB Stage of loadvRegIR20-16=MDRInstructionmemoryAddress4320AddAddre

    展开阅读全文
    提示  163文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:CS4100计算机结构Pipelining课件.ppt
    链接地址:https://www.163wenku.com/p-3377021.html

    Copyright@ 2017-2037 Www.163WenKu.Com  网站版权所有  |  资源地图   
    IPC备案号:蜀ICP备2021032737号  | 川公网安备 51099002000191号


    侵权投诉QQ:3464097650  资料上传QQ:3464097650
       


    【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。

    163文库