




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
ComputerOrganization&ArchitectureChapter10
InstructionSets:CharacteristicsandFunctions10.1MachineinstructioncharacteristicsWhatisTheInstructionSetArchitectures?Theattributesofasystemasseenbytheprogrammer,i.e.,theconceptualstructureandfunctionalbehavior,asdistinctfromtheorganizationofthedataflowsandcontrols,thelogicdesign,andthephysicalimplementation.
-Amdahl,BlaawandBrooks,1964...theportionofthemachinevisibletotheprogrammerorcompilerwriter.
-HennesseyandPatterson,1990SoftwareHardwareISAInstructionSetThecollectionofinstructionsthatCPUcanexecuteTheinstructionsetdeterminatesthefunctionofCPUMachineCode,BinaryForconvenience,usuallyrepresentedbyassemblycodesElementsofanInstructionOperationcode(Opcode)DothisSourceOperandreferenceTothisResultOperandreferencePuttheanswerhereNextInstructionReferenceWhenyouhavedonethat,dothis...BranchinstructionPC
InstructionCycleStateDiagramWherearealltheOperands?Cache
or
mainmemoryorvirtualmemoryCPUregistersIfonlyoneregisterexists,referencetoitmaybeimplicitFormanyregisters,eachisassignedauniquenumberI/OdeviceTheinstructionmustspecifytheI/Omodule&deviceoranothermemoryaddressfortheoperationInstructionRepresentation
Inmachinecode,eachinstructionhasauniquebitsequenceTheinstructionisdividedintofieldssuchasthefollowingformat:Itisdifficultforboththeprogrammerandreaderstodealwithbinarycodeofmachineinstructions,thus,asymbolicrepresentationisusede.g.ADD,SUB,MPY,DIV
LOAD,STOR,etc.OperandscanalsoberepresentedinthiswayADDA,BInstructionTypesDataprocessingDatastorage(mainmemory)Datamovement(I/O)Programflowcontrol:testandbranchAnydata-processingtaskmaybeexpressedbyaboveinstructionsAnyprogramwritteninhigh-levellanguagemaybetranslatedintoaboveinstructionsNumberofAddresses3addressesOpcodeOperand1,Operand2,Result(Operand1)OP(Operand2)→Resulta=b+c;Maybeaforth-nextinstruction(usuallyimplicit)NotcommonNeedsverylongwordstoholdeverything2addressesOpcodeOperand1,Operand2(Operand1)OP(Operand2)→Operand1Oneaddressdoublesasoperandandresulta=a+bReduceslengthofinstructionSometimes,requiressomeextrawork:usingMOVinstructionTemporarystoragetoholdsomeresults1addressOpcodeOperand1OP(Operand1)→Operand1or(Operand1)OP(OperandX)→Operand1ImplicitsecondaddressUsuallyaregister(accumulator,AC)Commononearlymachines
E.g:ACACOPA0(zero)addressesOpcodeAlladdressesimplicitornoaddressUsesastack0addressesinstructionswouldreferencetoptwounitsofstackE.g.TTOP(T-1)NOPHowManyAddresses?MoreaddressesMorecomplex(powerful?)instructionsMoreregistersInter-registeroperationsarequickerFewerinstructionsperprogramFeweraddressesLesscomplex(powerful?)instructionsMoreinstructionsperprogramFasterfetch/executionofinstructions,buttheprogramislonger,morecomplicatedandslowerModerncomputersadopttwo-orthree-addressinstructionsInstructionSetDesignDecisionsOperationrepertoireHowmanyops?Whatcantheydo?Howcomplexarethey?DatatypesAddresses,Numbers,Characters,LogicalDataInstructionformatsLengthofopcodefieldNumberofaddresses
RegistersNumberofCPUregistersavailableWhichoperationscanbeperformedonwhichregisters?Addressingmodes(later…)RISCvCISC10.2TypesofOperandsAddressesUnsignedintegerNumbersInteger/floatingpoint/decimalUsingdecimalcanavoidconversionManymachinessupportpackeddecimal4bitsbinarycodeadecimaldigit246=001001000110CharactersASCII,EBCDIC,etc.LogicalDataBitsorflagsBoolean10.3PentiumandPowerPCdatatypePentiumDataTypes8bit(Byte)16bit(word)32bit(doubleword)generaldatatypes64bit(quadword)Addressingisby8bitunitA32bitdoublewordisreadataddressesdivisibleby4(32bitdatabus)Little-endian:theleastsignifcandisstoredinthelowestaddressSpecificDataTypesGeneral-arbitrarybinarycontentsInteger-signedbinaryvalue,complementrepresentationOrdinal-unsignedintegerUnpackedBCD-OnedigitperbytePackedBCD-2BCDdigitsperbyteNearPointer-32bitoffsetwithinsegmentBitfieldByteStringFloatingPointPentiumDataTypesPowerPCDataTypes8(byte),16(halfword),32(word)and64(doubleword)lengthdatatypesSomeinstructionsneedoperandalignedon32bitboundaryCanbebig-orlittle-endianFixedpointprocessorrecognises:Unsignedbyte,unsignedhalfword,signedhalfword,unsignedword,signedword,unsigneddoubleword,bytestring(<128bytes)FloatingpointIEEE754Singleordoubleprecision10.4TypesofOperationsDataTransferArithmeticLogicalConversionI/OSystemControlTransferofControlDataTransferDatatransferinstructionsarethemostfundamentaltypeofmachineinstructionSpecifySourceDestination:registers,memory,topofstackAmountofdataModeofaddressingDatatransferinstructionsMoveStoreLoadExchange:swapcontentsofsourceanddestinationClear:all0Set:all1Push/popArithmeticAdd,Subtract,Multiply,DivideSignedIntegerFloatingpointMayincludeIncrement(a++)Decrement(a--)Negate(-a)absoluteLogicalBitwiseoperations/BooleanoperationsAND,OR,NOT,Exclusive-ORTest,compareSetcontrolVariables:setcontrolsforprotectingpurpose,interrupthandling,timercontrol,etc.ShiftRotateshiftLogicalShiftArithmeticShiftCyclicShiftConversionTranslateSomevaluesinmemoryareconvertedbytablequeryASCIIEBCDICConvertBaseconversionE.g.BinarytoDecimalInput/OutputInput/readOutput/writeStartI/OTestI/OMaybespecificinstructionsMaybedoneusingdatamovementinstructions(memorymapped)Maybedonebyaseparatecontroller(DMA)SystemsControlPrivilegedinstructionsCPUneedstobeinspecificstateUpdatecontrolregisterForoperatingsystemsuseScheduleaprocessUpdatePCBTransferofControlBranch/jumpJumpconditionalJumptosubroutineReturnexecuteSkipSkipconditionalHaltWait(hold)NooperationProcedureCallInstructionAprocedureisaself-containedcomputerprogramthatisincorporatedintoalargerprogramCodereuseTaskdecomposingProcedureCallInstructionisajumpinstructionAcallinstructionAreturninstructionNestedProcedureReturnAddressForcorrectlyexecutingmainprogram’ssequence,thereturnaddressmustbeprotectedThreemainmethods:RegisterStartofprocedureTopofstackStack&ReturnAddressStack&ParameterspassingWithaprocedurecall,inadditiontoprovidingareturnaddress,passingorreturnedparametersisalsoneededHowtopassparameters?RegistersMemorystackStackFrame:asetofparametersincludingreturnaddress10.5PentiumIIOperationTypesPp.356~357–table10.8NoneedtorememberCall/ReturnInstructionsPIIprovides4instructionstosupportprocedurecall/returnCALL:pushPCintostack,PC=startaddressoftheprocedure(jump)ENTER:createastackframeLEAVE:clearastackframeRETURN:endofprocedureMemoryManagementInstructionsDealwithmemorysegmentationsPrivilegedinstructionsusedbyOSE.g.loadasegmenttablecheckoralteraprivilegeofasegmentConditionCodesBitsinspecialregistersSetbycertainoperationsandusedinconditionaljumpinstructionsPIICCsC:carryP:parity–1meansevenA:auxiliarycarry—carryofhalfbytesinALZ:0S:signO:overflowThesecodescanbecombinedtoformaconditionMMXTechniquesMMX—MultiMedia
eXtensionAsetofhighlyoptimizedinstructionsformultimediaapplications57SIMDinstructions,64-bitdatafieldPerformthesameoperationonmultipledataelementsatonceinasingleclockcycleForproperapplications,theseparalleloperationscanyieldaspeedupof2~8timesMMXRegisters864-bitregistersMMXDataTypes64-bitdatafield,3types:SIMDExecutionModelSIMDallowsthesameoperationtobecarriedoutonmultipledataelementsinparallel.TheMMXtechnologysupportsparalleloperationsonbyte,word,anddoubleworddataelementswhencontainedinMMXregisters.Wraparound&SaturationArithmeticWraparoundArithmeticWithordinaryunsignedarithmetic,whenanoperationoverflows,theextrabitistruncatedthatis,thecarryoroverflowbitisignoredandonlytheleastsignificantbitsoftheresultarereturnedtothedestinationcontroltherangeofoperandstopreventout-of-rangeresultsSaturationArithmeticIfadditionresultsoverfloworsubtractionresultsunderflow,theresultissettothelargestorsmallestvaluerepresentable0or255DataRangeLimitsforSaturationMMXInstructionsTheMMXinstructionsetconsistsof57instructions,groupedintothefollowingcategories:DatatransferArithmeticComparisonConversionUnpackingLogicalShiftEmptyMMXstateinstruction(EMMS)ExampleFade-outandfade-ininvideoapplicationAlgorithm:Result-pixel=Apixel
fade+Bpixel
(1-fade)=(Apixel-Bpixel)fade+Bpixel
MMXCodespxormm7,mm7;zerooutmm7movqmm3,fad_val;loadfadevaluereplicated4timesmovdmm0,imageA;load4redpixelcomponentsfromimageAmovdmm1,imageB;load4redpixelcomponentsfromimageBpunpcklbwmm0,mm7;unpack4pixelsto16bitspunpckblwmm1,mm7;unpack4pixelsto16bitspsubwmm0,mm1;subtractimageBfromimageApmulhwmm0,mm3;multiplythesubtractresultbyfadevaluespadddwmm0,mm1;addresulttoimageBpackuswbmm0,mm7;pack16-bitresultsbacktobytesSpecification8-bitpixelcomponentsareconvertedto16-bitelementstoaccommodatetheMMX16-bitmultiplycapabilityIfimages’resolutionis640*480,andthedissolveusesall255possiblefadevaluesthen,totalnumberofinstructionsinMMXis535million,withoutMMX,is1.4billionNotesAssemblelanguageisneeded50cyclestimeisneededfromMMXtofloatingpointinstructionsDoyourbesttoavoidshuffleusageofMMXandFPinstructionsSSESSE—StreamSIMDExtensionsMMX28new128-bitXMMregistersSSEregistersUsedforPentiumIIIprocessorfamilyEnhancetheperformanceofIA-32processorsforadvanced2-Dand3-Dgraphics,motionvideo,imageprocessing,speechrecognition,audiosynthesis,telephony,andvideoconferencingSSEInstructionsTheSSEinstructionsaredividedintofourfunctionalgroupsPackedandscalarsingle-precisionfloating-pointinstructions.64-bitSIMDintegerin
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- DB31/T 867-2014崇明水仙生产技术规程
- DB31/T 789-2014黄金珠宝饰品零售店经营服务规范
- DB31/T 762-2013食品零售商店服务规范
- DB31/T 668.12-2013节能技术改造及合同能源管理项目节能量审核与计算方法第12部分:配电变压器
- DB31/T 1356.1-2022公共数据资源目录第1部分:编制指南
- DB31/T 1219-2020节能技术评审方法和程序
- DB31/T 1101-2018液化石油气钢瓶延长使用期安全评定方法
- DB31/T 1046-2017家政服务从业人员基本要求
- DB31/T 1027-2017室内装饰装修材料挥发性有机化合物散发率测试系统技术要求
- DB31/ 590-2012变形铝及铝合金铸造锭、铸轧卷单位产品能源消耗限额
- 2024年版-生产作业指导书SOP模板
- 历年考研英语一真题及答案
- 宠物殡葬师理论知识考试题库50题
- 飞花令“水”的诗句100首含“水”字的诗句大全
- 门诊常见眼科病
- 保育师中级培训课件资源
- 心力衰竭病人的护理课件
- 教学机房规划方案
- 肿瘤患者全程管理
- 可行性研究报告编制服务投标方案
- 大学生如何处理学习与娱乐的平衡
评论
0/150
提交评论