资源预览内容
第1页 / 共46页
第2页 / 共46页
第3页 / 共46页
第4页 / 共46页
第5页 / 共46页
第6页 / 共46页
第7页 / 共46页
第8页 / 共46页
第9页 / 共46页
第10页 / 共46页
亲,该文档总共46页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
ComputerSystemandApplication Chapter6 InstructionSystemofCPU ConceptsofInstructionSystem Instructionsystem machineinstructionsetInterfacebetweenhardwareandsoftwareDetermineCPU sstructureandfunctionDeterminestructureandfunctionofprogramminglanguageThesamepartviewedbyarchitectandprogrammerAlargepartofCPUdesigntaskisimplementinginstructionsetDifferentCPUarchitecture differentinstructionsetRISCvsCISCContentsofdesigninginstructionsetInstructionformatdesignInstructionfunctiondesignDatatypesupportAddressingmodedesign ComponentsofAnInstruction InstructionsetThecollectionofdifferentinstructionsthattheprocessorcanexecuteTens hundredsofinstructionsAninstructionincludesOpcodesAddressingmodeflagAddresses sourceoperandsandresultoperandsMainmemoryorvirtualmemoryRegisterI OdevicesSourceoperandmaybeimmediateoperandAddressofnextinstruction explicitorimplicitMachineinstructionispresentedasasequenceof0 1codesManyformatsexistininstructionset 4 OpcodeOptimizationDesign FrequentlyusedopcoderepresentationsFixed lengthopcodeHuffmanencodingExtendedHuffmanencodingFixed lengthopcodeOnebytelengthSimplehardware buttotalopcodeistoolongUsedinRISCCPUHuffmanencodingVariableopcodelengthShortestaverageopcodelengthExtendedHuffmanencodingCombiningfixed lengthandHuffmanencoding 5 HuffmanEncoding PrincipleFrequentlyeventsarerepresentedbyshortcodeAveragecodelengthisshortestTheorybasisisentropycodingEntropyShortestaverageencodinglengthpi usageprobabilityofanopcodeinprogram amountofinformationoftheopcodeRedundantamountofinformationH averagecodelengthofanencodingmode 6 ExampleforHuffmanEncoding SupposeaCPUhas7opcodesandoccurringprobabilityinprogramisshownasthetable Problems Iffixed lengthopcodeisused howmanybitsaretheopcode Howmanybitsaretheshortestaverageopcode entropy Howmuchisredundantamountofinformationforfixed lengthopcode 7 Solutions 7opcodes soinfixed lengthmode 3bitsareneededEntropyRedundantamountofinformationforfixed lengthopcode35 isredundantinformation 8 OpcodeEncodingMethodBasedonHuffman EncodingusingHuffmantree alsocalledminimumprobabilitymergingStep1 constructHuffmantreeStep2 encodingbranchesHuffmantreeconstructingprocedureinaboveexampleArrangetheprobabilitiesof7opcodeshigh downMergingprobablenodesinbinarytreefromrighttoleftEncodeeachbranchusing0or1Leftbranchis0andrightbranchis10 1sequencefromtheroottoaleafnodeistheencodingoftheopcodeSeenextslide 9 HuffmanTree 10 AverageCodeLengthofHuffmanEncoding Averagecodelengthpi usageprobabilityofithopcodeinprogramli lengthofithopcodeAccordingtovaluesofthefig Averagecodelength Amountofredundantinformation Huffmanencodingapproachesoptimizedentropy 11 ProsandConsofHuffmanEncoding ProsShortaveragecodelengthLittleredundantinformationConsOpcodeirregularityNoeasyforinstructiondecodingandcompilingNotesHuffmanencodingisnotuniqueTotalcodelengthandaveragecodelengthareunique 12 ExtendedHuffmanEncoding Huffmanencodingonthewholecombineswithlocalfixed lengthencodingTrade offbetweenHuffmanandfixed lengthSimplifydecoderandcompilerMultipleencodingmethods 13 AddressCodeDesign Totaladdresslengthdependsonthenumberofaddresses typesandaddressingmodesTypicaladdressesininstructions3 2 1 0Toomanyaddressesmayexist butseldomusedAddressesselectionrulesMaketheprogramshortestMaketheprogramfastestShorteningaddresslengthtoavoidtoolonginstructionIndirectaddressingRegisterindirectaddressingIndexaddressing 14 InstructionFormatDesign Itisaverycomplicatedproblem limitedbyInstructionfunctionandlengthFieldsandbitsofeachfieldAddressingmodesLengthofmainmemoryunitManyinstructionformatsexistinainstructionsetTrade offbetweenopcodelengthandaddressingabilityisneededVariableopcodeMultipleopcodes 15 X86InstructionFormat Thex86isequippedwithavarietyofinstructionformatsTheinstructionformatisveryflexibleTypicalCISCinstructions 16 DataTypes DatatypedesignisanimportantcontentforinstructionsetInfluencingthestructureandfunctionofCPUDeterminingthedatatypesofHLLTypicaldatatypesAddressesNumbersCharactersLogicaldataSpecialdatatypesListsStrings 17 Numbers NumbersincomputerarelimitedanddiscreteTypicalnumbersBinaryintegerorbinaryfixedpointBinaryfloatingpointDecimalBinaryinteger itsvalueinTwosComplementRepresentationisWhere overflowwilloccurifavalueexceedsthisscope 18 Numbers BinaryfloatingpointnumbersAnyfloat pointnumbercannormalizedasor0 1 1 andbase2neednottobestoredExponentinbiasedrepresentationOriginalvalue 2k 1 1 RemovingsignofexponentIEEE754standardisnormallyused 19 Numbers PackeddecimalEachdecimaldigitisrepresentedbya4 bitcodeBCD BinaryCodedDecimal Standardsignvaluesare1100forpositiveand1101fornegativeateithertheleftorrightendExample 369 1100001101101001 369 1101001101101001MostofCPUssupportpackeddecimalAvoidingconvertingoverheadinfrequentI Oapplications 20 Characters CharacterorstringisnormallyrepresentedinASCIIcodeAnothercharacterrepresentationisEBCDICExtendedbinarycodeddecimalinterchangecode 0 1 codesof8bitsrepresentacharacterUsedinpastIBMlargecomputerWe dbetterrememberASCIIcodesofseveralspecialcharacters 0 48 A 65 enter 13 space 32Convertinglowercas
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号