1、6Ll9/9/6007附录10:英文原文MemorySubsystemOrganizationandInterfacingInthissectionweexaminetheconstructionandfunctionsofthememorysubsystemofacomputer.Wereviewthedifferenttypesofphysicalmemoryandtheinternalorganizationoftheirchips.Wediscusstheconstructionofthememorysubsystem,aswellasmultibytewordorganization
2、sandadvancedmemoryorganizations.1 TypesofMemoryTherearetwotypesofmemorychips;readonlymemory(ROM)andrandomaccessmemory(RAM).ReadOnlyMemory(ROM)chipsaredesignedforapplicationsinwhichdataisonlyread.(Thisdatacanincludeprograminstructions.)Thesechipsareprogrammedwithdatabyanexternalprogrammingunitbeforet
3、heyareaddedtothecomputersystem.Oncethisisdone,thedatausuallydoesnotchange.AROMchipalwaysretainsitsdata,evenwhenpowertothechipisturnedoff.Asanexample,anembeddedcontrollerforamicrowaveovenmightcontinuouslyrunoneprogramthatdoesnotchange.ThatprogramwouldbestoredinaROM.RandomAccessMemory(RAM),alsocalledr
4、ead/writememory,canbeusedtostoredatathatchange.ThisisthetypeofmemoryreferredtoasXMBofmemoryinadsforPCs.UnlikeROM,RAMchipslosetheirdataoncepowerisshutoff.Manycomputersystem,includingpersonalcomputers,includebothROMandRAM.2 InternalChipOrganizationTheinternalorganizationsofROMandRAMchipsaresimilar.Toi
5、llustratethesimplestorganization,alinearorganization,consideran8x2ROMchip.Forsimplicity,programmingcomponentsarenotshownoThischiphasthreeaddressinputsandtwodataoutputs,and16bitsofinternalstoragearrangedaseight2-bitlocations.Thethreeaddressbitsaredecodedtoselectoneoftheeightlocations,butonlyifthechip
6、enableisactive.IfCE=O,thedecoderiddisabledandnolocationisselected.Thetri-statebuffersforthatlocationscellsareenabled,allowingdatatopasstotheoutputbuffers.IfbothCEandOEsetto1,thesebuffersareenabledandthedataisoutputfromthechip;otherwisetheoutputsaretri-stated.Asthenumberofthelocationsincreases,thesiz
7、eoftheaddressdecoderneededinalinearorganizationbecomesprohibitivelylarge.Toremedythisproblem,thememorychipcanbedesignedusingmultipledimensionsofdecoding.Inlargememorychips,thissavingscanbesignificant.Considera4096xlchip.Thelinearorganizationwillrequirea12to4096decoder,thesizeofwhichisproportionaltot
8、henumberofoutputs.(Thesizeofannto2ndecoderidthussaidtobeO(2n).)Ifthechipisorganizedasa64x64twodimensionalarrayinstead,itwillhavetwo6to64decoders:onetoselectoneofthe64rowsandtheothertoselectoneofthe64cellswithintherow.Thesizeofthedecodersisproportionalto2x64,orO(2x2l72)=O(2l72+1).Forthischip,thetwode
9、coderstogetherareabout3percentofthesizeoftheonelargedecoder.3 MemorySubsystemConfigurationItisveryeasytosetupamemorysystemthatconsistsofasinglechip.Wesimpleyconnecttheaddress,data,andcontrolsignalsfromtheirsystembusesandthejobisdone.However,mostmemorysystemsrequiremorethanonechip.Followingaresomemet
10、hodsforcombiningmemorychipstoformamemorysubsystem.Twoormorechipscanbecombinedtocreatememorywithmorebitsperlocation.Thisisdonebyconnectingthecorrespondingaddressandcontrolsignalsofthechips,andconnectingtheirdatapinstodifferentbitsofthedatabus.Forexample,two8x2chipscanbecombinedtocreatean8x4memory,ass
11、howninFigure2-4.Bothchipsreceivethesamethreeaddressinputsfromthebus,aswellasthesamechipenableandoutputenablesignals.(Fornowitisonlyimportanttoknowthatthesignalsarethesameforbothchips;weshowthelogictogeneratethesesignalsshortly.)Thedatapinsofthefirstchipareconnectedtobits3and2ofthedatabus,andthoseoft
12、heotherchipareconnectedtobits1and0.D3D2D3D2Figure4An8x4memorysubsystemconstructedfromtwo8x2ROMChipsWhentheCPUreadsdata,itplacestheaddressontheaddressbus.BothchipsreadinaddressbitsA2,Al,andAoandperfonntheirinternaldecoding.IftheCEandOEsignalsareactivated,thechipsoutputtheirdataontothefombitsofthedata
13、bus.Sincetheaddressandenablesignalsarethesameforbothchips,eitherbothchipsorneitherchipisactiveatanygiventime.Thecomputerneverhasonlyoneofthetwoactive.Forthisreason,theyactjustasasingle8x4chip,atleastasfarastheCPUisconcerned.Insteadofcreatingwiderwords,chipscanbecombinedtocreatemorewords.Thesametwo8x
14、2chipscouldinsteadbeconfiguredasa16x2memorysubsystem.ThisisillustratedinFigure2-5(八).Theupperchipisconfiguredas,memorylocationsOto7(0000toOIII)andthelowerchipaslocations8to15(100Oto11II).TheupperchipalwayshasA3=OandthelowerchiphasA3=I.Thisdifferenceisusedtoselectoneofthetwochips.WhenA3=0,theupperchi
15、pisenabledandthelowerchipisdisabled;whenA3=1,theoppositeoccurs.(Asshowninthefigure9otherconditionsmustalsooccurorneitherchipwillbeselected.)Theoutputenablescanbeconnected,sinceonlythechipthatisenabledwilloutputdata.Sincebothchipscorrespondtothesamedatabits,bothareconnectedtoDIandDoofthedatabus.Thisc
16、onfigurationuseshigh-orderinterleaving.Allmemorylocationswithinachiparecontiguouswithinsystemmemory.However,thisdoesnothavetobethecase.ConsidertheconfigurationshowninFigure2-5(b),whichuseslow-orderinterleaving.TheupperchipisenabledwhenAO=OorbyaddressesXXXO,inthiscase0,2,4,6,8,10,12,and14.Thelowerchi
17、pisenabledwhen.A0=l,whichistrueforaddresses1,3,5,7,9,11,13and15.BothlookthesametotheCPU,butlow-orderinterleavingcanoffersomespeedadvantagesforpipelinedmemoryaccess,andforCPUsthatcanreaddatafrommorethanonememorylocationsimultaneously.DlDO(八)high-orderinterleaving(b)low-orderinterleavingFigure5A16x2me
18、morysubsystemconstructedfromtwo8x2ROMChipsThenextstepinthesedesignsistodeveloptheCEorOEinputlogic.Ofthese,theoutputenableismorestraightforward.TheCPUgenerallyoutputsacontrolsignalcalledRDorRD,orsomethingsimilar,whichitsetsactivewhenitwantstoreaddatafrommemory.ThissignalissufficienttodriveOE;thelogic
19、todriveCEensuresthatonlythecorrectchipoutputdata.Thechipenablesignalmakesuseoftheunusedaddressbits.Toillustrate,assumethatthe8x4memoryofFigure2-4isusedinasystemwith6-bitaddressbus.Furthermore,assumethischipcorrespondstolocations0to7(000000to000111).AddressbitsA2,Al,andAOselectalocationwithinthememor
20、ychips;bitsA5,A4,andA3mustbe000forthechipstobeactive.4 MultibyteDataOrganizationManydataformatusemorethanone8-bitbytetorepresentavalue,whetheritisaninteger,floatingpointnumber,orcharacterstring.MostCPUsassignaddressesto8-bitmemorylocations,sothesevaluesmustbestoredinmorethanonelocation.Itisnecessary
21、foreveryCPUtodefinetheorderitexpectsforthedataintheselocations.Thesearetwocommonlyusedorganizationsformultibytedata:bigendianandlittleendian.Inbigendainformat,themostsignificantbyteofavalueisstoredinlocationX,thefollowingbyteinlocationX+l,andsoon.Forexample,thehexadecimalvalue01020304H(Hforhexadecim
22、al)wouldbestored,startinginlocation100H,asshowninTableKa).Inlittleendian,theorderisreversed.TheleastsignificantbyteisstoredinlocationX,thenextbyteinlocationX+l,andsoon.Thesamevalue,inlittleendianformat,isshowninTable1(八).MemoryAddressData(inhex)10004101031020210301(八)bigendianformatsMemoryAddressDat
23、a(inhex)10001101021020310304(b)littleendianformatsThesameorganizationscanbeusedforbitswithinabyte.Inbigendianorganization,bit0istherightmostbitofabyte:theleftmostbitisbit7.Inlittleendianorganization,theleftmostbitisbit0andbit7istherightmostbit.Table1Dataorganizationinbigandlittleendianformats.Whiche
24、ndianorganizationisusedforbytesandwordsdoesnotimpacttheperformanceoftheCPUandcomputersystem.AslongastheCPUisdesignedtohandleaspecificformat,neverisbetterthantheother.Themainproblemcomesintransferringdatabetweencomputerswithdifferentendianorganizations.Forexample,ifacomputerwithinlittleendianorganiza
25、tionstransferthevalue01020304Htoacomputerwithbigendianorganizationwithoutconvertingthedata,thebigendiancomputerwillreadthevalueas0403020IHThereareprogramswhichcanconvertdatafilesfromoneformattotheother,andsomemicroprocessorshavespecialinstructionstoperformtheconversion.Oneotherissueofconcernformulti
26、bytewordsisalignment.Modernmicroprocessorscanreadinmorethanonebyteofdataatatime.Forexample,theMotorola68040microprocessorcanreadinfourbytessimultaneously.Howeverthefourbytesmustbeinconsecutivelocationsthathavethesameaddressexpectforthetwoleastsignificantbits.ThisCPUcouldreadlocations100,IOL102,and10
27、3simultaneously,butnotlocationsIOL102,103,and104.Thiscasewouldrequiretworeadoperations,oneforlocations100(notneeded),IOL102,and103,andtheotherfor104,105(notneeded),106(notneeded),and107(notneeded).Alignmentsimplymeansstoringmultibytevaluesinlocationssuchthattheybeginatalocationthatalsobeginsamultiby
28、tereadblock.Inthisexample,thismeansbeginningmultibytevaluesatmemorylocationsthathaveaddressesevenlydivisiblebyfour,thusguaranteeingthatafour-bytevaluecanbeaccessedbyasingleoperation.SomeCPUs,particularlyRISCCPUs,requirealldatatobealigned.OtherCPUsdonot;theycanusuallyaligndatainternally.Ingeneral,non
29、alignedCPUshavemorecompactprograms,becausenolocationsareleftunusedbyalignment.However,alignedCPUscanhavebetterperformancebecausetheymayneedfewermemoryreadoperationstofetchdataandinstructions.5 BeyondtheBasicsThememorysubsystemdescribeinthischapterissufficientforsmall,embeddedcomputers.Personalcomput
30、ersandmainframes,however,requiremorecomplexhierarchicalconfigurations.Thesecomputersincludesmall,high-speedcache;theprocessorcanaccessdatainthecachemorequicklythanitcanaccessthesamedatainphysicalmemory.Manymicroprocessorsincludesomecachememoryrightontheprocessorchip.Acomputerthatincludescachememorym
31、ustalsohaveacachecontrollertomovedatabetweenthecacheandphysicalmemory.Attheotherextreme,modemcomputersincludevirtualmemory.Thismechanismusesaharddiskasapartofthecomputer,smemory,expendingthememoryspaceofthecomputerwhileminimizingcost,sinceabyteofharddiskcostslessthanabyteofRam.Aswiththecachevirtualm
32、emoryneedsacontrollertomovedatabetweenphysicalmemoryandtheharddisk.附录11:英文译文存储器子系统的组成与接口本节我们将讨论计算机中存储器子系统的结构和功能,我们将会回顾不同类型的物理存储器及其芯片的内部组成,讨论存储器子系统的结构,以及多字节的组织和高级存储器的组成。1存储器的种类存储器芯片有两种类型:只读存储器(ROM)和随机存取存储器(RAM)。只读存储器芯片是为数据(此数据可包括程序的指令)只读的应用而设计的。这些芯片在加入系统之前,就已经被某个外部编成器装好数据了。这个工作一旦完成,其数据通常不再改变。ROM芯片总是保
33、存有数据,甚至在芯片断电以后。例如,一个微波炉的嵌入式控制器可以连续运行一个不变的数据。这就是我们在个人电脑广告上经常看到的XMB的内存所指的那种类型。不像RoM,RAM芯片一旦掉电,数据就会消失。许多计算机系统,包括个人电脑,都同时拥有RoM和RAM。2芯片的内部组成ROM和RAM芯片的内部组成是相似的。为了说明一个简单的组成一一线性组成,我们来考虑一个8x2的RoM芯片。为了简化,编程器件没有画出来。这个芯片有三个地址输入端和两个数据输出端,以及16位的内部存储元件,它排成8个单元,每个单元2位。三个地址位经过译码,可以选择8个中的一个,但只有芯片的使能要有效才行。如果CE=O,译码器被禁
34、止,则不选择任何单元。该单元上的三态缓冲器是有效的,允许数据输出到缓冲器中。如果CE=I且OE=I,则这些缓冲器有效,数据从芯片中输出;否则,输出是高阻态。随着单元数量的增加,线性组成中地址译码器的规模变得相当大。为了补救这一问题,存储器芯片可以设计成使用多维译码方式。在大型存储器芯片中,这种节省显得至关重要。考虑一个4096x1芯片其线性组成将需要一个12-4096译码器,译码器大小与输出的数量成正比(假定一个n2译码器的大小是0(2)。如果芯片排列成64x64的二维数组,它将有两个6-64译码器:一个用来选择64行中的一行,另一个用来在选定行中选择64个单元中的一个单元,该译码器的大小正比
35、于2x64,或写成0(222)=o(才/2+i)。对于这个芯片,两个译码器总的大小约是那个大译码器大小的3%.3存储器子系统配置构造包含一个简单芯片的存储器系统是非常容易的,我们只需要简单地从系统总线上连接地址信号线、数据信号线和控制信号线就完成了。然而。大多数的存储器系统需要多个芯片,下面是通过存储器芯片组合来形成存储器子系统的一些方法。两个或多个芯片可以组合起来构造一个每单元有多位的存储器。这可以通过连接芯片相应的地址信号线和控制信号线,井将它们的数据引脚连到数据总线的不同位上来完成。例如,2个8X2芯片可以组合产生一个8X4存储器,如图4所示。两个芯片从总线上接收相同的三位地址输入,还有
36、共同的芯片使能信号和输出使能信号(目前.我们只要了解两个芯片使用的是同一信号就可以了,稍后我们将说明产生这些信号的逻辑)。第一个芯片的数据引脚连到数据总线的第3位和第2位,第二个芯片的数据引脚则连接在第1位和第O位。当CPU读取数据时,它将地址放在地址总线上。两个芯片读取地址位A2、A1、AO,并执行内部译码操作。如果CE和OE信号是有效的,两个芯片则输出数据到数据总线的四位上。因为两个芯片的地址和使能信号是相同的,因此在任一时刻两个芯片要么同时有效,要么同时无效。正因如此,它们的行为就像一个单一的8x4芯片,至少就CPU而言是这样的。除了构造更宽的字以外,芯片组合还可以构造出更多的字。两样的
37、两个8x2芯片能够组成一个16x2存储子系统。如图5(八)所示。上面的芯片构成存储器的0到7(0000到Oln)单元,下面的芯片作为单元8至U15(1000到1111).上面的芯片总是设置A3R,而下面的芯片A3=L通过这一区别来选择芯片,当A3R时,上面的芯片有效,而下面的芯片无效;当A3=l时,情况刚好相反。(如图所示,另一种情况必定会发生,否则没有芯片被选中)输出使能端需要连接起来,因为只有芯片有效才可以输出数据。由于两个芯片对应相同的数据位,因此都可以连接到数据总线的Dl和Do位上。这种配置使用的是高位交叉技术。同一芯片的所有存储单元在系统内存中是连续的。然而,不一定非得如此。考虑如图
38、5(b)所示的情况,它用的是低位交叉技术。上面的芯片当AO=O或者当地址位为XXXO时有效,此时,地址为0、2、4、6、8、10、12和14;下面的芯片当AO=I时有效,地址为1、3、5、7、9、11、13和15。对CPU而言,两者是相同的。但低位交叉能为流水线存储器访问提供速度上的优势,对于能够同时从多于一个存储器单元中读取数据的CPU来说,低位交叉也存在速度上的优势。设计的下一步是指制定CE和OE的输入逻辑。输出使能更直接一些,CPU通常输出一个控制信号,称作RD或RD或别的什么,当它想要从主存读取数据时就将其设为有效,用此信号驱动OE就足够了,而驱动CE的逻辑务必确保只有正确的芯片方可输
39、出数据。芯片使能信号可利用未使用的地址位。为了说明这一点,假设图2-4中的8x4存储器被用到一个6位地址总线的系统中,而且,进一步假设这个芯片对应的单元为O到7(00OOO到00OllDo则地址位A2、Al和AO可以用于选中存储芯片中的某个单元,而A5、A4和A3在芯片有效时一定要是OO0。4多字节数据组成许多数据格式使用多个字节(一个字节8位)来表示一个数据,而不管此数值是整型数、浮点数还是字符串。由于大多数CPU给8位的存储器单元分配地址,因此这些值必须存储在多个单元中,每个CPU必须定义数据在这些单元中的顺序。有两种常用的多字节数据排列顺序:高位优先和低位优先。依照高位优先格式,一个数值
40、的最高字节存储在单元X中,次高字节存储在单元X+1中,依次类推。例如,十六进制数01020304H(H表示十六进制)从单元100h开始存储,则存储结果如表1(八)所示。依照低位优先格式,顺序正好相反。最低字节存储在单元X中,次字节存储在单元X+I中,依次类推。上例中的同一值,以低位优先格式存储,如表11b)所示。同样的组织方式可用于一个字节中的不同位上。在高位优先结构中,位0代表字节中最右边的位,最左边的位是第7位。在低位优先结构中,最左边的位是0,最右边的位是7。对于字节和字而言,无论使用哪一种排列组织方式都不会影响CPU和计算机系统的性能。只要设计CPU处理一种特定的格式,就不存在谁比谁强
41、的问题,主要的问题在于具有不同排列组织方式的CPU之间传输数据的问题例如,如果一个低位优先结构的计算机传的01020304H的数据给一个高位优先结构的计算机,而没有转换数据,那么该高位优先结构计算机读出的值为04030201Ho有程序可以将两种数据文件进行格式转换,并且某些处理器有特殊的指令可以执行这种转换。多字节的另一个值得关注的问题是对齐问题。现代微处理器在某一时刻可以读出多个字节。例如,摩托罗拉68040微处理器能同时读入4个字节的数据,然而,这4个字节必须在连续的单元中,它们的地址除了最低两位不同之外,其余的位均相同。该CPlJ可以同时读单元100、IOK102和103,但不能同时读单
42、元101、102、103和104,后者需要两个读操作,一个操作读100(不需要的)、101、102和103,另一个读104、105(不需要的)、106(不需要的)和107(不需要的)。对齐简单地说就是存储多字节值的起始单元刚好是某个多字节读取模块的开始单元。在这个例子中意味着多字节值开始存储的单元的地址要能被4整除,这样就保证该4字节值可在单一的一个读操作中存取到。一些CPU,特别是精简指令系统CPU,需要所有的数据都对齐。其他的CPU不要求这样,它们通常能够在内部将数据对齐。一般来说,不要求对齐的CPU具有更紧凑的程序,因为没有单元因为要对齐而闲置不用。然而,对齐的CPU具有更好的性能,因为
43、他们读取指令和数据是需要更少的存储器读操作。5基本功能的拓展本章描述的存储器子系统对于较小的、嵌入式计算机而言是足够的。然而,个人电脑和大型主机需要更加复杂的层次结构。这些计算机包含体积小的、高速的缓冲存储器。计算机将数据从物理存储器中装载到高速缓冲中:处理器在高速缓冲中访问数据比在物理存储器中快得多。许多微处理器就在处理器芯片中含有一些高速缓冲存储器。含有高速缓冲存储器的计算机同时也要有一个高速缓冲控制器,用来在高速缓冲和物理存储器问传输数据。在另一端,现代计算机还具有一个虚拟存储器。这种机制用硬盘充当计算机存储器的一部分,扩大了计算机的存储空间,而且降低了价格,因为一个硬盘字节的价格比一个
44、RAM字节要便宜的多。同高速缓冲一样,虚拟存储器也需要一个控制器以便在物理存储器和虚拟存储器之间传输数据。在做毕业论文的几个月里,我得到了指导老师以及其他老师和同学们的帮助。在此我向他们表示真诚地感谢!首先要感谢的是我的指导老师一一张根柱副教授。感谢他对我的悉心指导和极大帮助;对老师在学业上给予的指导、培养和关怀致以崇高的敬意和由衷的感谢。感谢他那严谨的治学态度、精湛的专业技术知识、高度的事业心和实事求是的工作作风;他对工作认真负责、一丝不苟,对学生严于教导、无微不至。从开始做毕业设计以来,张老师时常对我们的毕业论文进行指导。从最初的搜集材料、原理分析到最后的攥写,每个阶段每个过程张老师都会耐心的为我讲解,指出我的不足之处及提出解决问题的思路及方法。再次要感谢的是所有传授我知识的老师和那些与我朝夕相处的同学们。感谢其他老师和同学,他们为我的毕业论文也提供了建议和指导,向我提供论文相关资料,并经常关心我论文的进度。在我做论文的过程中,当我遇到问题时,他们都主动地给予我帮助。时光荏苒,五年的大学生活即将结束。在这最后的日子里,我怀着一颗感恩的心,以最真诚的态度向以上那些帮助过我的老师和同学们表示衷心地感谢!谢谢你们!此致!敬礼!