




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
UsingWinMIPS64SimulatorASimpleTutorialThisexerciseintroducesWinMIPS64,aWindowsbasedsimulatorofapipelinedimplementationoftheMIPS6464-bitprocessor.1.StartingandconfiguringWinMIPS64StartWinMIPS64fromthetaskbar.Awindow(denotedthemainwindow)appearswithsevenchildwindowsandastatuslineatthebottom.ThesevenwindowsarePipeline,Code,Data,Registers,Statistics,CyclesandTerminal.PipelinewindowThiswindowshowsaschematicrepresentationofthefivepipelinestagesoftheMIPS64processorandtheunitsforfloatingpointoperations(addition/subtraction,multiplicationanddivision).Itshowswhichinstructionisineachstageofthepipeline.CodewindowThiswindowshowsathreecolumnrepresentationofthecodememory,showingfromlefttoright1)abyteaddress,2)ahexnumbergivingthe32-bitmachinecoderepresentationoftheinstruction,and3)theassemblylanguagestatement.Double-left-clickingonaninstructionsetsorclearsbreak-points.DatawindowThiswindowshowsthecontentsofdatamemory,byteaddressable,butdisplayedin64-bitchunks,asappropriatefora64-bitprocessor.Toeditanintegervaluedouble-left-click.Todisplayandeditasafloating-pointnumber,double-right-click.RegisterwindowThiswindowshowsthevaluesstoredintheregisters.Iftheregisterisdisplayedingrey,thenitisintheprocessofbeingwrittentobyaninstruction.Ifdisplayedusingacolour,thecolourindicatesthestageinthepipelinefromwhichthisvalueisavailableforforwarding.Thiswindowallowsyoutointeractivelychangethecontentsofthose64-bitintegerandfloating-pointregistersthatarenotintheprocessofbeingwrittento,orbeingforwarded.Todothis,double-left-clickontheregisteryouwanttochangeandapop-upwindowwillaskyoufornewcontent.PressOKtoconfirmthechange.ClockCyclediagramThiswindowgivesarepresentationofthetimingbehaviourofthepipeline.Itrecordsthehistoryofinstructionsastheyenterandemergefromthepipeline.Aninstructionthatcausesastallishighlightedinblue:instructionsheldupasaresultofastallaregrayed.StatisticsThiswindowprovidesstatisticsonthenumberofsimulationcycles,instructions,theaverageCyclesPerInstruction(CPI),thetypesofstalls,andnumbersofconditionalbranchesandLoad/Store-instructions.TerminalThiswindowmimicsadumbterminalI/Odevicewithsomelimitedgraphicscapability.StatusLineThestatuslineatthebottomnormallydisplays"Ready",butwillduringprogramsimulationprovideusefulinformationonthecurrentstatusofthesimulation.Tomakesurethesimulationisreset,clickontheFilemenuandclickResetMIPS64.WinMIPS64canbeconfiguredinmanyways.Youcanchangethestructureandtimerequirementsofthefloating-pointpipeline,andthecode/datamemorysize.TovieworchangestandardsettingsclickConfigure/Architecture(readthisas:clickConfiguretoopenthemenu,thenclickingonArchitecture)andyouwillseethefollowingsettings:Youcanchangethesettingsbyclickingintheappropriatefieldandeditingthegivennumbers.AnychangestotheFloating-pointlatencieswillbereflectedinthePipelinewindow.TheCodeAddressBusreferstotheactualnumberofwiresintheaddressbus.Soavalueof10meansthat210=1024bytesofcodememorywillbedisplayedintheCodewindow.Whenyouarefinished,clickOKtoreturntothemainwindow.ThreemoreoptionsintheConfigurationmenucanbeselected:Multi-Step,EnableForwarding,EnableBranchTargetBufferandEnableDelaySlot.OftheseEnableForwardingshouldbeenabled,thatis,asmallhookshouldbeshownbesideit.Ifthisisnotthecase,clickontheoption.Youcanchangethesizeand/orpositionofchildwindowsorbringuponlyonewindowusingthemaximiseoptionforthatwindow.2.Loadingatestprogram.Useastandardtexteditortocreatethisfilesum.s,whichisaMIPS64programthatcalculatesthesumoftwointegersAandBfrommemory,andstorestheresultintothememoryonlocationC..dataA:.word10B:.word8C:.word0.textmain:ldr4,A(r0)ldr5,B(r0)daddr3,r4,r5sdr3,C(r0)haltAsmallcommandlineutilityasm.exeisprovidedtotestaprogramforsyntacticalcorrectness.TocheckthisprogramtypeH:>asmsum.sInordertobeabletostartthesimulation,theprogrammustbeloadedintothemainmemory.Toaccomplishthis,selectFile/Open.Alistofassemblerprogramsincurrentdirectoryappearsinawindow,includingsum.s.ToloadthisfileintoWinMIPS64,dothefollowing:Clickonsum.sClicktheOpenbuttonTheprogramisnowloadedintothememoryandthesimulationisreadytobegin.YoucanviewthecontentofcodememoryusingtheCodewindow,andobservetheprogramdataintheDataWindow.3.Simulation3.1Cycle-by-cycleSimulationAtanystageyoucanpressF10torestartthesimulationfromthebeginning.AtthestartyouwillnotethatthefirstlineintheCodewindowwiththeaddress0000iscolouredyellow.TheIFstageinthePipelinewindowisalsocolouredinyellowandcontainstheassemblermnemonicofthefirstinstructionintheprogram.NowinspecttheCodewindowandobservethefirstinstructionldr4,A(r0).LookintheDatawindowtofindtheprogramvariableA.Clock1:PressingExecute/SingleCycle(orsimplypressingF7)advancesthesimulationforonetimesteporoneclocktick;intheCodeWindow,thecolourofthefirstinstructionischangedtoblueandthesecondinstructioniscolouredinyellow.Thesecoloursindicatethepipelinestagetheinstructionisin(yellowforIF,blueforID,redforEX,greenforMEM,andpurpleforWB).IfyoulookintheIFstageinthePipelinewindow,youcanseethatthesecondinstructionldr5,B(r0)isintheIFstageandthefirstinstructionldr4,A(r0)hasadvancedtothesecondstage,ID.Clock2:PressingF7againwillre-arrangethecoloursintheCodewindow,introducingredforthethirdpipelinestageEX.Instructiondaddr3,r4,r5entersthepipeline.Notethatthecolourofaninstructionindicatesthestageinthepipelinethatitwillcompleteonthenextclocktick.Clock3:PressingF7againwillre-arrangethecoloursintheCodewindow,introducinggreenforthefourthpipelinestageMEM.Instructionsdr3,C(r0)entersthepipeline.ObservetheClockCycleDiagramwhichshowsahistoryofwhichinstructionwasineachstagebeforeeachclocktick.Clock4:PressF7again.Eachstageinthepipelineisnowactivewithaninstruction.Thevaluethatwillendupinr4hasbeenreadfrommemory,buthasnotyetbeenwrittenbacktor4.HoweveritisavailableforforwardingfromtheMEMstage.Henceobservethatr4isdisplayedasgreen(thecolourforMEM)intheRegisterswindow.Canyouexplainthevalueofr4?Notethatthelastinstructionhalthasalreadyenteredthepipeline.Clock5:PressF7again.Somethinginterestinghappens.Thevaluedestinedforr5becomesavailableforforwarding.Howeverthevalueforr5wasnotavailableintimeforthedaddr3,r4,r5instructiontoexecuteinEX.SoitremainsinEX,stalled.Thestatuslinereads"RAWstallinEX(R5)",indicatingwherethestalloccurred,andwhichregister'sunavailabilitywasresponsibleforit.ThepictureintheClockCycleDiagramandthePipelinewindowclearlyshowsthatthedaddinstructionisstalledinEX,andthattheinstructionsbehinditinthepipelinearealsounabletoprogress.IntheClockCycleDiagram,thedaddinstructionishighlightedinblue,andtheinstructionsbehindareshowningray.Clock6:PressF7.Thedaddr3,r4,r5instructionexecutesanditsoutput,destinedforr3,becomesavailableforforwarding.Thisvalueis12hex,whichisthesumof10+8=18indecimal.Thisisouranswer.Clock7:PressF7.ThehaltinstructionenteringIFhashadtheeffectof"freezing"thepipeline,sononewinstructionsareacceptedintoit.Clock8:PressF7.ExamineDatamemory,andobservethatthevariableCnowhasthevalue12hex.Thesdr3,C(r0)instructionwroteittomemoryintheMEMstageofthepipeline,usingtheforwardedvalueforr3.Clock9:PressF7.Clock10:PressF7.TheprogramisfinishedLookattheStatisticswindowandnotethattherehasbeenoneRAWstall.10clockcycleswereneededtoexecute5instructions,soCPI=2.Thisisartificiallyhighduetotheone-offstart-upcostinclockcyclesneededtoinitiallyfillthepipeline.Thestatisticswindowisextremelyusefulforcomparingtheeffectsofchangesintheconfiguration.Letusexaminetheeffectofforwardingintheexample.Untilnow,wehaveusedthisfeature;whatwouldtheexecutiontimehavebeenwithoutforwarding?Toaccomplishthis,clickonConfigure.Todisableforwarding,clickonEnableForwarding(thehookmustvanish).
Repeatthecycle-by-cycleprogramexecution,re-examinetheStatisticswindowandcomparetheresults.NotethattherearemorestallsasinstructionsareheldupinIDwaitingforaregister,andhencewaitingforanearlierinstructiontocompleteWB.Theadvantagesofforwardingshouldbeobvious.3.2OtherexecutionmodesClickonFile/ResetMIPS64.IfyouclickonFile/FullReset,youwilldeletethedatamemory,soyouwillhavetorepeattheprocedureforprogramloading.ClickingonFile/ReloadorF10isahandywaytorestartasimulation.Youcanrunsimulationforaspecifiednumberofcycles.UseExecute/Multicycle...forthis.ThenumberofcyclessteppedthroughcanbechangedviaConfigure/Multi-step.Youcanrunthewholeprogrambyasinglekey-press-pressF4.AlternativelyclickonExecute/Runto.Also,youcansetbreakpoints.PressF10.Tosetabreak-point,double-left-clickontheinstruction,forexampleondaddr3,r4,r5.NowpressF4.TheprogramwillhaltwhenthisinstructionentersIF.Toclearthebreak-point,double-left-clickonthesameinstructionagain.3.3TerminalOutputThesimulatorsupportsasimpleI/Odevice,whichworkslikeasimpledumbterminalscreen,withsomegraphicalcapability.Theoutputofaprogramcanappearonthisscreen.Tooutputtheresultofthepreviousprogram,modifyitlikethis.dataA: .word10B: .word8C: .word0CR: .word320x10000DR: .word320x10008.textmain:ldr4,A(r0)ldr5,B(r0)daddr3,r4,r5sdr3,C(r0)lwur1,CR(r0);ControlRegisterlwur2,DR(r0);DataRegisterdaddir10,r0,1sdr3,(r2);r3output..sdr10,(r1);..toscreenhaltAfterthisprogramisexecutedyoucanseetheresultoftheadditionprintedindecimalontheTerminalwindow.ForamorecompleteexampleoftheI/Ocapabilities,seethetestio.sandhail.sexampleprograms.TheInstructionsetThefollowingassemblerdirectivesaresupported.data-startofdatasegment.text-startofcodesegment.code-startofcodesegment(sameas.text).org<n>-startaddress.space<n>-leavenemptybytes.asciiz<s>-enterszeroterminatedasciistring.ascii<s>-enterasciistring.align<n>-alignton-byteboundary.word<n1>,<n2>..-entersword(s)ofdata(64-bits).byte<n1>,<n2>..-enterbytes.word32<n1>,<n2>..-enters32bitnumber(s).word16<n1>,<n2>..-enters16bitnumber(s).double<n1>,<n2>..-entersfloating-pointnumber(s)where<n>denotesanumberlike24,<s>denotesastringlike"fred",and<n1>,<n2>..denotesnumbersseparatedbycommas.Theintegerregisterscanbereferredtoasr0-r31,orR0-R31,or$0-$31orusingstandardMIPSpseudo-names,like$zeroforr0,$t0forr8etc.Notethatthesizeofanimmediateislimitedto16-bits.Themaximumsizeofanimmediateregistershiftis5bits(soashiftbygreaterthan31bitsisillegal).Floatingpointregisterscanbereferredtoasf0-f31,orF0-F31Thefollowinginstructionsaresupported.Noteregisanintegerregister,fregisafloating-point(FP)register,andimmisanimmediatevalue.lbreg,imm(reg)-loadbytelbureg,imm(reg)-loadbyteunsignedsbreg,imm(reg)-storebytelhreg,imm(reg)-load16-bithalf-wordlhureg,imm(reg)-load16-bithalfwordunsignedshreg,imm(reg)-store16-bithalf-wordlwreg,imm(reg)-load32-bitwordlwureg,imm(reg)-load32-bitwordunsignedswreg,imm(reg)-store32-bitwordldreg,imm(reg)-load64-bitdouble-wordsdreg,imm(reg)-store64-bitdouble-wordl.dfreg,imm(reg)-load64-bitfloating-points.dfreg,imm(reg)-store64-bitfloating-pointhalt-stopstheprogramdaddireg,reg,imm-addimmediatedadduireg,reg,imm-addimmediateunsignedandireg,reg,imm-logicalandimmediateorireg,reg,imm-logicalorimmediatexorireg,reg,imm-exclusiveorimmediateluireg,imm-loadupperhalfofregisterimmediatesltireg,reg,imm-setiflessthanimmediatesltiureg,reg,imm-setiflessthanimmediateunsignedbeqreg,reg,imm-branchifpairofregistersareequalbnereg,reg,imm-branchifpairofregistersarenotequalbeqzreg,imm-branchifregisterisequaltozerobnezreg,imm-branchifregisterisnotequaltozerojimm-jumptoaddressjrreg-jumptoaddressinregisterjalimm-jumpandlinktoaddress(callsubroutine)jalrreg-jumpandlinktoaddressinregisterdsllreg,reg,imm-shiftleftlogicaldsrlreg,reg,imm-shiftrightlogicaldsrareg,reg,imm-shiftrightarithmeticdsllvreg,reg,reg-shiftleftlogicalbyvariableamountdsrlvreg,reg,reg-shiftrightlogicalbyvariableamountdsravreg,reg,reg-shiftrightarithmeticbyvariableamountmovzreg,reg,reg-moveifregisterequalszeromovnreg,reg,reg-moveifregisternotequaltozeronop-nooperationandreg,reg,reg-logicalandorreg,reg,reg-logicalorxorreg,reg,reg-logicalxorsltreg,reg,reg-setiflessthansltureg,reg,reg-setiflessthanunsigneddaddreg,reg,reg-addintegersdaddureg,reg,reg-addintegersunsigneddsubreg,reg,reg-subtractintegersdsubureg,reg,reg-subtractintegersunsigneddmulreg,reg,reg-signedintegermultiplicationdmulureg,reg,reg-unsignedintegermultiplicationddivreg,reg,reg-signedintegerdivisionddivureg,reg,reg-unsignedintegerdivisionadd.dfreg,freg,freg-addfloating-pointsub.dfreg,freg,freg-subtractfloating-pointmul.dfreg,freg,freg-multiplyfloating-pointdiv.dfreg,freg,freg-dividefloating-pointmov.dfreg,freg-movefloating-pointcvt.d.lfreg,freg-convert64-bitintegertoadoubleFPformatfreg,freg-convertdoubleFPtoa64-bitintegerformatfreg,freg-setFPflagiflessthanfreg,freg-setFPflagiflessthanorequaltoc.eq.dfreg,freg-setFPflagifequaltobc1fimm-branchtoaddressifFPflagisFALSEbc1timm-branchtoaddressifFPflagisTRUEmtc1reg,freg-movedatafromintegerregistertoFPregistermfc1reg,freg-movedatafromFPregistertointegerregisterMemoryMappedI/OareaAddressesofCONTROLandDATAregistersCONTROL:.word320x10000DATA:.word320x10008SetCONTROL=1,SetDATAtoUnsignedIntegertobeoutputSetCONTROL=2,SetDATAtoSignedIntegertobeoutputSetCONTROL=3,SetDATAtoFloatingPointtobeoutputSetCONTROL=4,SetDATAtoaddressofstringtobeoutputSetCONTROL=5,SetDATA+5toxcoordinate,DATA+4toycoordinate,andDATAtoRGBcolourtobeoutputSetCONTROL=6,ClearstheterminalscreenSetCONTROL=7,ClearsthegraphicsscreenSetCONTROL=8,readtheDATA(eitheranintegerorafloating-point)fromthekeyboardSetCONTROL=9,readonebytefromDATA,nocharacterecho.NotesonthePipelineSimulationThepipelinesimulationattemptstomimicasfaraspossiblethatdescribedinAppendixAofComputerArchitecture:AQuantitativeApproach.Howeverinafe
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 衛(wèi)生管理考試的評(píng)估標(biāo)準(zhǔn)試題及答案探討
- 激光技術(shù)工程師的考前沖刺試題及答案
- 藥物發(fā)酵工藝研究試題及答案
- 模特職業(yè)測(cè)試題及答案
- 藥物使用風(fēng)險(xiǎn)評(píng)估知識(shí)試題及答案
- 電氣檢測(cè)面試題及答案
- 成果分享衛(wèi)生管理證書(shū)考試試題及答案
- 系統(tǒng)架構(gòu)與數(shù)據(jù)架構(gòu)的關(guān)系探討試題及答案
- 激光測(cè)量技術(shù)的研究進(jìn)展試題及答案
- 激光設(shè)備性能指標(biāo)試題及答案
- 入團(tuán)志愿書(shū)表格(空白)
- 秘密花園讀書(shū)交流會(huì)(課堂PPT)
- 安裝工程開(kāi)工報(bào)告表格
- 浙江省公安民警心理測(cè)驗(yàn)考試題目(含答案)
- 森林防火安全責(zé)任書(shū)(施工隊(duì)用)
- Duncans 新復(fù)極差檢驗(yàn)SSR值表
- 自卸車(chē)液壓系統(tǒng)安裝手冊(cè)
- 商務(wù)部商業(yè)保理企業(yè)管理辦法
- 機(jī)械加工工藝過(guò)程卡片及工序卡(共3頁(yè))
- 初中英語(yǔ)語(yǔ)法-介詞、連詞.ppt
- 【精選】配電室安全管理制度精選
評(píng)論
0/150
提交評(píng)論