版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、1Pipelined Implementation2Outline Instruction Stalling Data Forwarding Handle Control Hazard Suggested Reading 4.5 3Data Dependencies: 2 Nops123456789FDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M WFDE M W10WR%eax f3DvalA fR%edx = 10valB fR%eax = 0WR%eax f3WR%eax f3DvalA
2、 fR%edx = 10valB fR%eax = 0DvalA fR%edx = 10valB fR%eax = 0Cycle 6Error# demo-h2.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax0 x00c:nop0 x00d:nop0 x00e:addl %edx,%eax0 x010:halt4Data Dependencies: 2 Nops# demo-h2.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax0 x00c:nop0 x00d:nop bubble0 x00e:addl %e
3、dx,%eax0 x010:halt123456789FDE M WFDE M WFDE M WFE M WD DE M WFDE M W10FFDE M W11 If instruction follows too closely after one that writes register, slow it down Hold instruction in decode Dynamically inject nop into execute stagedstMdstE5EMWFDPCPCALUData MemorySelect PCrBSelect AALUAALUBMem.control
4、AddrreadALU funFetchDecodeExecuteMemoryWrite backdata outdata inM_valAW_valMW_valEM_valAW_valMd_rvalAf_PCPredict PCvalEvalMdstEdstMBchvalEvalAdstEdstMicode ifunvalCvalAvalBdstEsrcBvalCvalPicode ifun rApredPCCCe_BchM_BchwritedstMsrcARegister FileAB MEsrcAsrcBd_srcA d_srcBInstructionInstruction Memory
5、incrementicodeicode6Stall Condition Source Registers srcA and srcB of current instruction in decode stage Destination Registers dstE and dstM fields Instructions in execute, memory, and write-back stages Condition srcA=dstE or srcA=dstM srcB=dstE or srcB=dstM Special Case Dont stall for register ID
6、8 Indicates absence of register operand7Data Dependencies: 2 Nops# demo-h2.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax0 x00c:nop0 x00d:nop bubble0 x00e:addl %edx,%eax0 x010:halt123456789FDE M WFDE M WFDE M WFE M WD DE M WFDE M W10FFDE M W11Cycle 6WDW_dstE = %eaxW_valE = 3srcA = %edxsrcB = %eax8Sta
7、lling X3123456789FDE M WFDE M WFE M WDE M WDDE M WFDE M W10FFDFE M W11Cycle 4WW_dstE = %eaxDsrcA = %edxsrcB = %eaxMM_dstE = %eaxDsrcA = %edxsrcB = %eaxEE_dstE = %eaxDsrcA = %edxsrcB = %eaxCycle 5Cycle 6# demo-h0.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax bubble bubble bubble0 x00c:addl %edx,%eax0
8、 x0e:halt9What Happens When Stalling? Stalling instruction held back in decode stage Following instruction stays in fetch stage Bubbles injected into execute stage Like dynamically generated nops Move through later stages0 x000: irmovl $10,%edx0 x006: irmovl $3,%eax0 x00c: addl %edx,%eaxCycle 40 x00
9、e: halt0 x000: irmovl $10,%edx0 x006: irmovl $3,%eax0 x00c: addl %edx,%eax# demo-h0.ys0 x00e: halt0 x000: irmovl $10,%edx0 x006: irmovl $3,%eax bubble0 x00c: addl %edx,%eaxCycle 50 x00e: halt0 x006: irmovl $3,%eax bubble0 x00c: addl %edx,%eax bubbleCycle 60 x00e: halt bubble bubble0 x00c: addl %edx,
10、%eax bubbleCycle 70 x00e: halt bubble bubbleCycle 80 x00c: addl %edx,%eax0 x00e: haltWrite BackMemoryExecuteDecodeFetch10Implementing StallingEMWFDrBsrcAsrcBicodevalEvalMdstE dstMBchicodevalEvalAdstE dstMicode ifunvalCvalAvalBdstE dstM srcA srcBvalCvalPicode ifunrApredPCd_ srcBd_ srcAD_ icodeE_ dstE
11、E_ dstMPipecontrollogicD_stallE_bubbleM_ dstEM_ dstMW_ dstEW_ dstMF_stall11Implementing Stalling Pipeline Control Combinational logic detects stall condition Sets mode signals for how pipeline registers should update12Initial Version of Pipeline Controlbool F_stall = d_srcA = E_dstE | d_srcA = M_dst
12、M | d_srcA = M_dstE | d_srcA = W_dstM |d_srcA = W_dstE ;bool D_stall = d_srcA = E_dstE | d_srcA = M_dstM | d_srcA = M_dstE | d_srcA = W_dstM |d_srcA = W_dstE ;bool E_bubble =d_srcA = E_dstE | d_srcA = M_dstM | d_srcA = M_dstE | d_srcA = W_dstM |d_srcA = W_dstE ;13Pipeline Register ModesRisingclockRi
13、singclock_Output = xx xOutput = xInput = ystall = 1bubble= 0 x xStall14Pipeline Register ModesnopRisingclockRisingclock_Output = nopx xOutput = xInput = ystall = 0bubble= 1Bubble15Pipeline Register ModesRisingclockRisingclock_Output = yy yOutput = xInput = ystall = 0bubble= 0 x xNormal16Data Forward
14、ing Observation Value generated in execute or memory stage Trick Pass value directly from generating instruction to decode stage Needs to be available at end of decode stage17Data Forwarding Example1 2 3 4 5 6 7 8 9F D E M WF D E M WF D E M WF D E M WF D E M WF D E M WF D E M WF D E M WF D E M WF D
15、E M WF D E M WF D E M W10Cycle 6WR%eax f3DvalAfR%edx = 10valBfW_ valE= 3W_ dstE= %eaxW_valE = 3srcA= %edxsrcB= %eax# demo-h2.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax0 x00c:nop0 x00d:nop0 x00e:addl %edx,%eax0 x010:haltirmovl in write-back stageDestination value in W pipeline registerForward as v
16、alB for decode stage18CCALUData memoryWrite backd_srcBd_srcARegister fileA BMEvalA,valBaluA, aluBBche_valEAddr, Datam_valMW_valE,W_valM,W_dstE, W_dstMEMWDForwardW_valE,W_valM19Bypass Paths Decode Stage Forwarding logic selects valA and valB Normally from register file Forwarding: get valA or valB fr
17、om later pipeline stage Forwarding Sources Execute: valE Memory: valE, valM Write back: valE, valM20Data Forwarding Example #2# demo-h0.ys0 x000:irmovl $10,%edx0 x006:irmovl $3,%eax0 x00c:addl %edx,%eax0 x0e:haltRegister %edxGenerated by ALU during previous cycleForward from memory stage as valARegi
18、ster %eaxValue just generated by ALUForward from execute stage as valB12345678FD E MWFD E MWFD E M WFD E M WCycle 4MDvalAfM_valE= 10valBfe_valE= 3M_dstE= %edxM_valE = 10srcA= %edxsrcB= %eaxEE_dstE= %eaxe_valE f0 + 3 = 321Implementing Forwarding Add additional feedback paths from E, M, and W pipeline
19、 registers into decode stage Create logic blocks to select from multiple sources for valA and valB in decode stage22RegisterfileRegisterfileALUALUDatamemoryDatamemorydstE dstMALUBAddrsrcA srcBALUfun.data outdata inAB MEM_ valEW_valEW_valMW_ valEvalEvalAdstE dstMvalAvalBdstE dstM srcA srcBd_ srcBd_ s
20、rcASel+FwdAFwdBvalEvalMdstE dstMm_ valMW_valMe_ valE23Implementing Forwarding# What should be the A value?int new_E_valA = # Use incremented PCD_icode in ICALL, IJXX : D_valP; # Forward valE from execute d_srcA = E_dstE : e_valE; # Forward valM from memoryd_srcA = M_dstM : m_valM; # Forward valE fro
21、m memory d_srcA = M_dstE : M_valE; # Forward valM from write back d_srcA = W_dstM : W_valM; # Forward valE from write backd_srcA = W_dstE : W_valE; # Use value read from register file 1 : d_rvalA;24Limitation of Forwarding#demo-luh.ys0 x000: irmovl $128, %edx0 x006: irmovl $3, %ecx0 x00c: rmmovl %ec
22、x, 0(%edx)0 x012: irmovl $10, %ebx0 x018: mrmovl 0(%edx), %eax # Load %eax0 x10e: addl %ebx, %eax #Use %eax0 x020: haltLoad-use dependencyValue needed by end of decode stage in cycle 7Value read from memory in memory stage of cycle 8ErrorMM_dstM= %eaxm_valMfM128 = 3Cycle 7Cycle 8DvalAfM_valE= 10valB
23、fR%eax = 0DvalAfM_valE= 10valBfR%eax = 0MM_dstE= %ebxM_valE= 10123456789FDEMWFDEMWFDEM WFDEM WFDEM WFDEM WFDEM W10FDEM W1125#demo-luh.ys0 x000: irmovl $128, %edx0 x006: irmovl $3, %ecx0 x00c: rmmovl %ecx, 0(%edx)0 x012: irmovl $10, %ebx0 x018: mrmovl 0(%edx), %eax # Load %eax bubble0 x10e: addl %ebx
24、, %eax #Use %eax0 x020: haltStall using instruction for one cycleCan then pick up loaded value by forwarding from memory stageMM_dstM = %eaxm_valM f M128 = 3MM_dstM = %eaxm_valM f M128 = 3Cycle 8DvalA f W_valE = 10valB f m_valM = 3DvalA f W_valE = 10valB f m_valM = 3WW_dstE = %ebxW_valE = 10WW_dstE = %ebxW_valE = 10123456789FDEMWFDEMWFDEMWFDEMWFDEM WFDEM WFDEM WFDEM WFDEM WFDEM WFDEM WEM W10DDEM W11FDEM WFF12Avoiding Load/Use Hazard26DRegisterfileRegisterfileCCCCALUALUrBdstE dstMALUAALUBsrcA srcBALUfun.DecodeExecuteAB MEW_valMW_ valEEicode ifunvalCvalAvalBdstE dstM srcA srcBvalCval
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 蘭州資源環(huán)境職業(yè)技術(shù)大學(xué)《液壓流體力學(xué)》2023-2024學(xué)年第一學(xué)期期末試卷
- 濟(jì)寧職業(yè)技術(shù)學(xué)院《傳播效果監(jiān)測》2023-2024學(xué)年第一學(xué)期期末試卷
- 湖南幼兒師范高等??茖W(xué)校《結(jié)構(gòu)耐久性理論》2023-2024學(xué)年第一學(xué)期期末試卷
- 湖南工業(yè)大學(xué)科技學(xué)院《嬰幼兒藝術(shù)發(fā)展與教育》2023-2024學(xué)年第一學(xué)期期末試卷
- 衡陽科技職業(yè)學(xué)院《地理信息系統(tǒng)A》2023-2024學(xué)年第一學(xué)期期末試卷
- 湖南交通職業(yè)技術(shù)學(xué)院《生物醫(yī)藥文獻(xiàn)檢索和專業(yè)英語》2023-2024學(xué)年第一學(xué)期期末試卷
- 浙江師范大學(xué)《發(fā)酵工程制造技術(shù)及應(yīng)用》2023-2024學(xué)年第一學(xué)期期末試卷
- 鄭州體育職業(yè)學(xué)院《工業(yè)設(shè)計(jì)專業(yè)導(dǎo)論》2023-2024學(xué)年第一學(xué)期期末試卷
- 浙江工貿(mào)職業(yè)技術(shù)學(xué)院《短視頻策劃與運(yùn)營》2023-2024學(xué)年第一學(xué)期期末試卷
- 食品中重金屬殘留的控制手段
- 2024-2025學(xué)年成都高新區(qū)七上數(shù)學(xué)期末考試試卷【含答案】
- 定額〔2025〕1號文-關(guān)于發(fā)布2018版電力建設(shè)工程概預(yù)算定額2024年度價(jià)格水平調(diào)整的通知
- 2025年浙江杭州市西湖區(qū)專職社區(qū)招聘85人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- 《數(shù)學(xué)廣角-優(yōu)化》說課稿-2024-2025學(xué)年四年級上冊數(shù)學(xué)人教版
- “懂你”(原題+解題+范文+話題+技巧+閱讀類素材)-2025年中考語文一輪復(fù)習(xí)之寫作
- 2025年景觀照明項(xiàng)目可行性分析報(bào)告
- 2025年江蘇南京地鐵集團(tuán)招聘筆試參考題庫含答案解析
- 2025年度愛讀書學(xué)長參與的讀書項(xiàng)目投資合同
- 電力系統(tǒng)分析答案(吳俊勇)(已修訂)
- 化學(xué)-河北省金太陽質(zhì)檢聯(lián)盟2024-2025學(xué)年高三上學(xué)期12月第三次聯(lián)考試題和答案
- 期末復(fù)習(xí)試題(試題)-2024-2025學(xué)年四年級上冊數(shù)學(xué) 北師大版
評論
0/150
提交評論