計(jì)算機(jī)組成與結(jié)構(gòu):chapter10 Instruction Sets Characteristics and Functions_第1頁
計(jì)算機(jī)組成與結(jié)構(gòu):chapter10 Instruction Sets Characteristics and Functions_第2頁
計(jì)算機(jī)組成與結(jié)構(gòu):chapter10 Instruction Sets Characteristics and Functions_第3頁
計(jì)算機(jī)組成與結(jié)構(gòu):chapter10 Instruction Sets Characteristics and Functions_第4頁
計(jì)算機(jī)組成與結(jié)構(gòu):chapter10 Instruction Sets Characteristics and Functions_第5頁
已閱讀5頁,還剩56頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論