计算机组成与体系结构答案_第1页
计算机组成与体系结构答案_第2页
计算机组成与体系结构答案_第3页
计算机组成与体系结构答案_第4页
计算机组成与体系结构答案_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Page LastUpdated:October2003Page LastUpdated:October2003TheEssentialsofComputerOrganizationandArchitectureLindaNullandJuliaLoburJonesandBartlettPublishers,2003Chapter5InstructorfsManualChapterObjectivesChapter5.ACloserLookatInstructionSetArchitectures,providesacloserlookatinstructionsetarchitectures

2、,includinginstructionformats,instructiontypes,endianess.andaddressingmodesInstruclionlevelpipeliningisintroducedaswell.Real-worldISAs(includingIntel,MIPS,andJava)arediscussedtoreinforcetheconceptspresentedinthechapterThischaptershouIdbecoveredafterChapter4.LecturesshouIdfocusonthefollowingpoints:Ins

3、tructionformatsImportantissueshereincludeinstructionlengthlittleversusbigendian,registerusage(andtheuseofstacks),andexpandingopcodesAddressingAlthoughaddressingisaninstructiondesignissue,therearemanyaspectstoconsider,themostimportantofwhichisaddressingmodesInstruction-levelpipeliningThefetch-decode-

4、executecyclecanbeoverlappedresukinginfasterexecutiontimeResourceconflicts,conditionalbranching,anddatadependenciescanslowthisprocessdown.Real-worldexampiesofISAs.Intel.MIPS,andtheJavavirtualmachineareallpresentedtoreinforcetheconceptsofthechapterRequiredLectureTimeTheimportantconceptsinChapter5canty

5、picallybecoveredin3lecturehoursHowever,ifateacherwantsthestudentstohaveamasteryofalltopicsinChapter5.8lecturehoursaremorereasonableIflecturetimeislimited,wesuggestthatthefocusbeoninstructionformats(includingbigversuslittleendian,useofregisters,andinstructionlength)andaddressing(withconsiderableatten

6、tionpaidtothevariousmodes).LectureTipsItisimportanttomotivatethelittleversusbigendiandebateManystudentscomprehendtheconcept,butdon*tseethesignificanceThevarioussoftwareapplicationslistedinthischapterwillhelptheinstructormakethispointStudentsoftenhavedifficultyunderstandingstackmachinesItisimportantt

7、oemphasizethatnotALLinstructionsonstackmachinehavezerooperands,butrather,theinstructionsthatallowforoperandsarelimitedTheconceptofexpandingopcodesissometimesdifficuItforstudentsaswell.Wesuggestgoingoverasma11exampleindetailWhencoveringtheaddressingmodes,wesuggestthatinstructorsincludemanyexamples,as

8、thisisoneconceptthattendstobeeasiertounderstandthroughexamplesStudentsoftenconfuseinstruction1evelpipeliningwithothertypesofpipeliningItisimportanttostressthattherearemanytypesofpipelining,butinthischapteronlypipeliningthefetch-decode-executecycleisaddressedAlthoughthereal-lifeexamplescanbeleftforst

9、udentstoread,thesecasestudiesprovidetheinstructorwithameanstotietheconceptsfromthischaptertogether,aswellasamethodformotivatingstudyoftheconceptsfromthischapterAnswerstoExercisesAssumeyouhaveamachinethatuses32bitintegersandyouarestoringthehexvalue1234ataddress0.a.Showhowthisisstoredonabigendianmachi

10、neb.Showhowthisisstoredonalittleendianmachinec.IfyouwantedtoincreasethehexvaluetoI23456、whichbyteassignmentwouIdbemoreefficient,bigorlittleendian?ExplainyouranswerAns.aandbAddress00011011BigEndian00001234LittleEndian3-412()()()()c.Littleendianismoreefficientbecausetheadditionalinformationsimplyneeds

11、tobeappendedWithbigendian,the”12”and”34”wouldneedtoshifttomaintainthecorrectbyteordering.ShowhowthefollowingvalueswouIdbestoredbymachineswith32bilwords,usinglittleendianandthenbigendianformatAssumeeachvaluestartsataddress1016Drawadiagramofmemoryforeach,placingtheappropriatevaluesinthecorrect(andlabe

12、led)memorylocations456789A116bOOOOO58Ai6c14148888“Ans.a.Address10i61116121613“BigEndian4567S9AlLittleEndianAl1丿6745b.Address1“111612“13“BigEndian()()()()05SALittleEndian()5小)()()c.Address10“111612“13“BigEndian14148888LittleEndian888814143.Thefirsttwobytesofa2Mx16mainmemoryhavethefollowinghexvalues:B

13、yte0isFEByte1is01Ifthesebytesholda16-bitiwoscomplementinteger,whatisitsactualdecimalvalueif:a.memoryisbigendian?b.memoryislittleendian?Ans.FE01I6=11111110000000012=-51110OIFEm=00000001111111102=51Oio4.Whatkindsofproblemsdoyouthinkendiannesscancauseifyouwishedtotransferdatafromabigendianmachinetoalit

14、tleendianmachine?Explain.Ans.Ifthemachinesreceivingthedatausesdifferentendian-nessthanthemachinesendingthedata.thevaluescanbemisinterpretedForexample,thevaluefromProblem3,sentasthevalue511onabigendianmachinewouIdbereadasthevalue510onalittleendianmachine5.ThePopulationStudiesInstitutemonitorsthepopul

15、ationoftheUnitedStatesIn2000,thisinstitutewroteaprogramtocreatefilesofthenumbersrepresentingthevariousstates,aswellasthetotalpopulationoftheU.S.Thisprogram,whichrunsonaMotorolaprocessor,projectsthepopulationbasedonvariousrules,suchastheaveragenumberofbirthsanddeathsperyearTheInstituterunstheprograma

16、ndthenshipstheoutputfilestostateagenciessothedatavaluescanbeusedasinputintovariousapplicationsHowever,onePennsylvaniaagency,runningallIntelmachines,encountereddifficulties.asindicatedbythefollowingproblemWhenthe32bitunsignedinteger1D2F37E816(representingtheoverallU.S.populationpredicationfor2003)isu

17、sedasinput,andtheagencysprogramsimplyoutputsthisinputvalue,theU.S.populationforecastfor2003isfartoolargeCanyouhelpthisPennsylvaniaagencybyexplainingwhatmightbegoingwrong?Ans.Hint:TheyarerunondifferentprocessorsIntelandMotorolausedifferentendian-nessIftheprogramontheIntelmachinedoesnotadjustforthis,t

18、hentheintegerisinterpretedincorrectly.6.TherearereasonsformachinedesignerstowantallinstructionstobethesamelengthWhyisthisnotagoodideaonastackmachine?Ans.TheonlyinstructionsonastackmachinethatneedtoaddressmemoryarepushandpopSoanoperandfieldisrequired,whichimpliestheinstructionfieldmustbedividedintoan

19、opcodeandanoperandHowever,theotherinstructionsneednotaccessmemoryandcanthusconsistofonlytheopcodeTomakethemallthesamelength,theseinstructionswouIdneedtobe”artificiallylengthened.7.Acomputerhas32-bitinstructionsand12-bitaddressesSupposethereare2502-addressinstructionsHowmany1-addressinstructionscanbe

20、formulated?ExplainyouranswerAns.Thereare2502addressinstructionsThereareonlyatotalof2562-addressinstructionsallowedifwehave32-bitinstructions(twoaddressestakeup24bits,leavingonly8bitsfortheopcode).Lookingatthe8bitopcode,assumebitpatterns00000000(0)through11111001(249)areusedforthe250two-addressinstru

21、ctionsThenthereare6bitpatternsleftforoneaddressinstructionsHowever,eachoneofthesecanusetheremaining12bitsgainedfromhavingonlyoneoperand,sowehave6*2ConvertthefollowingexpressionsfrominfixtoreversePolish(postfix)notation.“X*Y+W*Z+V*UbW*X+W*(U*V+Z)c(W(X+Y(U六V)/(U*(X+Y)Ans.XY*WZ*VU*+00000000111110011111

22、101011111010 xxxxxxxxxxxxxxxxxxxxxxxx000000000000111111111111xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx000000000000111111111111xxxxxxxxxxxxxxxxxxxxxxxx2502-addressinstructions212,I6*21*1-addressinstructions2】2WX*WUVWXYUV*9ConvertthefollowingexpressionsfromreversePolishnotationtoinfixnotationa.

23、WXYZ+*b.uVWXYZ+*+*+CXYZ+Vw_*z+Ans.W*(X+Y-Z)U+(V*(W+(X*(Y+Z)X+(Y+Z)*(V-W)+Z)10.a.Writethefollowingexpressioninpostfix(ReversePolish)notation.Remembertherulesofprecedenceforarithmeticoperators!A_B+C*(D*E_F)_G+H*KbWriteaprogramtoevaluatetheabovearithmeticstatementusingastackorganizedcomputerwithzero-ad

24、dressinstructions(soonlypopandpushcanaccessmemory).Ans.nAB-CDE*F-*+GHK*+/b.Theprogramwouldbe:PushAPushBSubtractPushCPushDPushEMultPushFSubtractMultAddPushGPushHPushKMultAddDivPopX11a.Inacomputerinstructionformat,theinstructionlengthis11bitsandthesizeofanaddressfieldis4bitsIsitpossibletohave:2-addres

25、sinstructions451-addressinstructions320addressinstructionsusingtheformat?Justifyyouranswer.b.Assumethatacomputerarchitecthasalreadydesigned6addressand24zeroaddressinstructionsusingtheinstructionformataboveWhatistheinaximumnumberofone-addressinstructionsthatcanbeaddedtotheinstructionset?Ans.a.YesThe2

26、-addressinstructionscouIdberepresentedOOOxxxxxxxxthrough1OOxxxxxxxx(using000through100foropcodes).The1-addressinstructionscouIduse1010000through1011111(16).1100000through1101111(16),and1110000through1111100(13more,foratotalof45).The0-addressinstructionscouIduseHill100000through11111101111(16),and111

27、11110000through111I1111111(16).Sowehave:000 xxxx100 xxxx101000010111111100000110111111100001111100XXXXIxxxxJxxxxxxxxxxxx16xxxxXXXXxxxx52-addressinstructions16451-addressinstructionsPage #LastUpdated:October20031616a320-addressinslmclions11111100000i11111101111J11111110000i11111111111Jb.Assumethetwad

28、dressinstructionsusebitpatterns000 xxxxxxxxthrough101xxxxxxxxAssumealsothatthezero-addressinstructionsareoftheformat11111101000through11111101111(8111111110000through11111110111(8).and111111iToOOthrough111I1111111(8)(Theseconstitutethelast16binarynumberspossiblewith11bits).Thenallinstructionsbeginni

29、ngwith110(1100000 xxxxthrough1101111xxxx)couIdbeoneaddressinstructions(16).Inaddition,1110000 xxxxthrough1111101xxxx_couIdbeoneaddressinstructions,givingus14more.foratotalof301-addressinstructions12.Whatisthedifferencebetweenusingdirectandindirectaddressing?GiveanexampleAns.Directaddressingprovidest

30、heactualmemoryaddressoftheoperandintheinstruction,whereasindirectaddressingprovides,aspartoftheinstruction,apointertoamemorylocation.Forexample.theinstructionLoadXinterpretedusingdirectaddressingwouIdgotomemorylocationXandloadthevaluefoundthereUsingindirectaddressing,memorylocationXwouIdbeusedasthee

31、ffectiveaddressofwhatshouIdactuallybeloadedSoifavalueof200werefoundatlocationX.thevaluelocatedataddress200wouIdbeloaded.Page LastUpdated:October2003I3SupposewehavetheinstructionLoad1000.GivenmemoryandregisterR1containthevaluesbelow:Memory10001100120013001400R1200Page #LastUpdated:October2003Page #La

32、stUpdated:October2003Ans.AssumingR1isimpliedintheindexedaddressingmode,determinetheactualvalueloadedintotheaccumulatorandfillinthetablebelow:SupposewehavetheinstructionLoadvaluesbelow:500.GivenmemoryandregisterR1containtheModeValueLoadedintoACImmediateDirectIndirectIndexedModeValueImmediate1000Direc

33、t1400Indirect1300Indexed1000Page #LastUpdated:October2003Page LastUpdated:October2003R1200100400500600700AssumingR1isimpliedintheindexedaddressingmode,determinetheactualvalueloadedintotheaccumulatorandfillinthetablebelow:ModeValueLoadedintoACImmediateDirectIndirectIndexedAns.Page #LastUpdated:Octobe

34、r2003Page #LastUpdated:October2003ModeValueImmediate500Direct100Indirect600Indexed800Anonpipelinedsystemtakes200nstoprocessataskThesametaskcanbeprocessedina5-segmentpipelinewithaclockcycleof40nsDeterminethespeedupratioofthepipelinefor200tasksWhatisthemaximumspeedupthatcouIdbeachievedwiththepipelineu

35、nitoverthenonpipelinedunit?Ans.SpeedUp=(200nsx200)/(5+200-1)(40ns)=40000/8160=4.91MaxSpeedUp=5Anonpipelinedsystemtakes100nstoprocessataskThesametaskcanbeprocessedina5-segmentpipelinewithaclockcycleof20nsDeterminethespeedupratioofthepipelinefor100tasksWhatisthetheoreticalspeedupthatcouIdbeachievedwit

36、hthepipelinesystemoveranonpipelinedsystem?Ans.SpeedUp=(100nsx100)/(5+100-1)(20ns)=10000/2080=4.8MaxSpeedUp=5Writecodetoimplementtheexpression:A=(B+C)*(D+E)on3,2飞1and0-addressmachinesInaccordancewithprogramminglanguagepractice,computingtheexpressionshouIdnotchangethevaluesofitsoperandsAns.AddRLBCAddR

37、2.DEMullA.R1.R23-addressmachineLoadRl,BAddRl,CLoadR2.EAddR2.EMultR2.RStoreA.R22-addressmachineLoadBAddCStoreTempLoadDAddEMultTempStoreA1-addressmachinePage #LastUpdated:October2003Page #LastUpdated:October200318.Adigitalcomputerhasamemoryunitwith24bitsperwordTheinstructionsetconsistsof150differentop

38、erationsAllinstructionshaveanoperationcodepart(opcode)andanPage LastUpdated:October2003addresspart(allowingforonlyoneaddress)Eachinstructionisstoredinonewordofmemorya.Howmanybitsareneededfortheopcode?bHowmanybitsareleftfortheaddresspartoftheinstruction?c.Whatisthemaximumallowablesizeformemory?dWhati

39、sthelargestunsignedbinarynumberthatcanbeaccommodatedinonewordofmemory?Ans.a.150instructionsimplies28(27willonlygiveusI28instructions),or8bitsfortheopcode.b24-8=16c2,or32Md24ISor2Pickanarchitecture(otherthanthosecoveredinthischapter).Doresearchtofindouthowyourarchitectureapproachestheconceptsintroduc

40、edinthischapter,aswasdoneforIntel.MIPS,andJavaAns.Noanswergiven-119Thememoryunitofacomputerhas256Kwordsof32bitseachThecomputerhasaninstructionformatwith4fields:anopcodefield;amodefieldtospecify1of7addressinginodes;aregisteraddressfieldtospecifyoneof60registers:andamemoryaddressfieldAssumeaninstructi

41、onis32bitslongAnswerthefollowing:Howlargemustthemodefieldbe?Howlargemusttheregisterfieldbe?Howlargemusttheaddressfieldbe?dHowlargeistheopcodefield?Ans.Weneedtoidentify1of7items,sotheremustbe3bits(23=8)60registersimplies6bits(26=64)c256K=28210=2%or18bitsd32-(3+6+18)=5bits20.Supposeaninstructiontakesf

42、ourcyclestoexecuteinanonpipelinedCPU:onecycletofetchtheinstruction,onecycletodecodetheinstruction,onecycletoperforintheALUoperation,andonecycletostoretheresuItInaCPUwitha4-stagepipeline,thatinstructionstilltakesfourcyclestoexecute、sohowcanwesaythepipelinespeedsuptheexecutionoftheprogram?Ans.Foronein

43、struction,thereisnospeedupThespeedupcomeswiththeparallelexecutionofmultipleinstructionsWhilethefirstinstructionisdecoding,thesecondcanbefetched;whilethefirstinstructionisperformingtheALUinstruction.thesecondcanbedecoding,andthethirdcanbefetched,etcSampieExamQuestions1Supposewehavetheinstructionlda80

44、0.Givenmemoryasfollows:Memory100011001200800900a.immediateb.directc.indirectWhatwouldbeloadedintotheACiftheaddressingmodefortheoperandis:Ans.a.800b900c1000Writethefollowingexpressioninpostfix(reversePolishnotation).RemembertherulesofprecedenceforarithmeticoperatorsX=A-B+C*(D*E-F)/(G+H*K)Ans.AB-CDE*F

45、-*+GHK*+/Anonpipelinedsystemtakes300nstoprocessataskThesametaskcanbeprocessedina5-segmentpipelinewithaclockcycleof60nsDeterminethespeedupratioofthepipelinefor100tasksWhatisthemaximumspeedupthatcouIdbeachievedwiththepipelineunitoverthenonpipelinedunit?Ans.SpeedUp=(300nsx100)/(5+100-1)(60ns)=30000/6240=4.8MaxSpeedUp=5b.32-7=25.c225,or32G.Showhow

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论