您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 02-chapter2
Chapter2TheMicroprocessoranditsArchitectureFetchinstructionsInterpretinstructionsFetchdataProcessdataWritedataWhatmustCPUdo?StructureCentralProcessingUnitMainMemoryI/OSystemInterconnectionCPUReviewWhatisinsideCPU?ALU,registers,controlunit,internalbusesAND:if0then0,all1comes1有0则0,全1出1AND(与)OR(或)BeforestartingAsseriesswitchesOR:if1then1,all0comes0有1则1,全0得0AsparallelswitchesAND(与)OR(或)NOT(非)NOT:if0then1,if1then0见0出1,见1出0ExclusiveOR/XOR(异或门)ABCDE00010011111011111100XOR:Samethen0,differentcomes1相同则0,不同则1ABCDEABERegister(寄存器)可以临时存放数码的逻辑部件,一般在CPU中。HalfAdder(半加器)Ahalfaddercangetthesumandthecarrybitbyaddingtwobinaryvaluesbutdoesnottakeaccountofthecarrybitwhichisbroughtforthbyformerstep.二进制位A+B,得到一个和S,以及一个进位输出CO。但不能够把前一步的进位加到本次运算中。HowtoaddABABSCOABSCOFullAdder(全加器)ABCISCO0000001010100101100100110011011010111111HowtoaddABSCOCIABCISCO8-digitadderHowtoaddCOCI8-bitsum反码:输入求反。不分情况地对输入求反。Howtosubtract补码:反码+11、0表示正数的符号位,1表示负数的符号位;2、正数的原码、反码、补码相同;3、负数的反码是原码除符号位外,逐位取反;4、负数的补码是反码加1;5、计算机中,数是用补码表示的;[X1]原=[X2]反=[X3]补=11000001X1=?X2=?X3=?原码、反码、补码需要既能做加法又能做减法的机器,求反电路应该只有做减法时才取反。若“取反”信号为1,则输出取反。HowtosubtractSUB是加/减法转换开关。做加法时为0,做减法时为1。做减法时,B输入在送入加法器之前先求反;设置加法器的进位输入端(CI)为1,使由加法器得到的结果加1,乃求补也。HowtoaddandsubtractAndMultiplication…Division…Progression…CPUWhatisinsideaCPU?ThediagramsUser-visibleRegistersTheyaretheregisterswhichmaybereferencedbymeansofamachinelanguage.General-purposeProgramStatusTest&ControlSegmentAddressGeneral-purposeInstructionpointerAccumulatorDataCountBaseProgramStatusStackPointerBasePointerDestinationIndexSourceIndexRealmodeProtectedmodeFlagsS:状态标志位,指明程序运行时的微处理器的实时状态.C:控制位,由程序设计者设置,以控制进行某种操作.X:系统标志.(无符号数看)(有符号数看)ThedevelopmentofflagsTheFlagsC–holdsacarryoraborrowP–theparityflag(littleusetoday)A–auxiliaryflagusedwithDAAandDASZ–zeroS–signO–overflowD–direction(usedwithstringinstructions)I–interrupt(interrupton/off)T–traceflag(traceon/off)Thestack(堆栈)Thestackisaspacewhichisutilizedtotemporarilystoreaddressanddataitems.Eachitemisaword.Whatentersfirstcomesoutlast.Whatenterslastcomesoutfirst.SScontainsthebeginningaddressofstack.SPcontainsthesize,hencepointstotheitemwhichpasttheendofthestack,anddecreases2afteraPUSHcommandisexecuted,increases2afteraPOPcommandisexecuted.Instructions:PUSH,POP;PUSHA,POPA;PUSHF,POPFPUSHAX,PUSHCX,POPBXRealModeMemoryAddressingRealmodememoryisthefirst1Mofthememorysystem.Allrealmodeaddressesareacombinationofasegmentaddressplusanoffsetaddress.Thesegmentaddress(16-bits)isoftenappendedwitha0Hor0000Btoforma20-bitaddress.(ormultipliedby10H)Theeffectiveaddressisthis20-bitsegmentaddressplusa16-bitoffsetaddress.工作模式实地址模式:向前兼容。存储空间:220=1M字节。没有分页功能。通过段寄存器左移4位加上有效地址形成物理地址。保留的地址空间:中断向量区:00000000H~000003FFH。系统初始化区:FFFFFFF0H~FFFFFFFFH。例:CS:1000H,IP:1234H实地址模式下物理地址:11234H5D26HAHAL5BE0H5D10H05BEH05D1HAddressingofinstructionsanddataCS:05BEDS:05D1MOVAL,DS:[0016](5D26H:4AH)05D1HX16+16H=5D26HSegmentRegisterThesegmentregistersare:CS(code),DS(data),ES(extra),SS(stack),FS,andGS.Segmentregistersaddressasectionofmemoryinaprogram.Asegmentiseither64Kinlength(realmode)orupto4Ginlength(protectedmode).Allcode(programs)resideinthecodesegment.ProtectedModeTheWindowsoperatingsystemdomain.4Gofmemorywith2Gforthesystemand2GfortheapplicationProtectedmodestillusessegmentandoffsetaddresses,buttheoffsetaddressis32-bitsProtectionisprovidedbyrestrictingaccessthroughprioritylevelsandaccessrightsAddressingCapacityMemory4GB:00000000H~FFFFFFFFHI/O64KB:00000000H~0000FFFFHTwoindependentphysicalspaceslogicallydefersfromeachotherbythepinM/IODescriptorsdescribememoryAdescriptorisselectedbythenumberplacedinthesegmentregister.Thedescriptordescribesthebaseaddress(startingaddress)andlimit(offsettotheendingaddress)ofasegment.Thedescriptoralsodefinestheprivilegelevelandaccessrightstoamemorysegment.80486外部引脚数据线类(D0~D31):双向、三态。地址线类(A2~A3,A4~A31,):A2~A31具有三态特性,确定一个4字节的存储单位。BE0~BE3用来确定4个字节中的哪一个。控制线类:1.数据校验位组(DP0~DP3,PCHK):当数据写入存储时,由DP0~DP3自动地对每个字节加入偶校验位。2.数据线宽度控制组(BS16,BS8):设置数据线宽度。3.时钟(CLK):提供基本的定时和内部的工作频率。BE0,BE1,BE2,BE3控制线类:4.总线周期定义组(W/R,D/C,M/IO,LOCK,PLOCK):微处理器与存储器或I/O之间交换一个数据的时间为总线周期。全是单向输出引脚。前三项的组合决定当前的总线周期所完成的操作。后二项为锁定信号。5.总线控制组(ADS,RDY):“地址状态”单向输出表示启动了一个总线周期;“准备好”单向输入表示数据线上存在有效信息。6.总线仲裁信号组(HOLD,HOLDA,BOFF,BREQ):决定总线的控制权。基本时序总线周期一般至少两个时钟周期。如读或写都要两个时钟。称为2-2周期。如果增加等待时间,则相应增加等待状态数。读读写T1T1T1T2T2T2CLKADSBE0~BE3A2~A31M/IO,D/CW/RRDYD0~D31PCHK2-2总线周期T1期间ADS有效,地址线及总线周期定义组均生效。T2期间,若有效数据在数据线上出现,RDY送出。处理器在T2结束前测得RDY。下一个T1期间,处理器完成读/写操作,在结束前输出PCHK信号。周期开始,第一周期激活,后续无效Ready已生效表示校验,外部用读写T1T1T1T2T2T2CLKADSBE0~BE3A2~A31M/IO,D/CW/RRDYD0~D313-3总线周期在输入/输出速度跟不上总线操作速度时,RDY信号不会发出。处理器自动插入等待状态,直到RDY有效。InstructionCycleStartFetchnextinstructionExecuteinstructionCheckandProcessinterruptPauseDisableinterruptFetchcycleExecutecycleInterruptcycleFetchIndirectExecuteInterruptDataFlow(Read)PCIRMBRMARAddressBusDataBusControlBusMemoryControlUnitMAR:存储器地址寄存器MBR:存储器缓冲寄存器PC:程序计数器IR:指令寄存器PC持有下一条指令的地址。地址传送到地址总线。控制器请求一次存储器读。读出的指令放到数据总线上传送到MBR。MBR中的内容传送到IR。PC增1,准备取下一条指令。DataFlow(中断周期)PC的当前内容必须被保持,以便中断之后CPU恢复原来的工作继续进行。PC的内容传送到MBR。保存PC的存储器位置由控制
本文标题:02-chapter2
链接地址:https://www.777doc.com/doc-3048787 .html