【文档说明】课计算机组成原理课件第3章.ppt,共(62)页,738.578 KB,由小橙橙上传
转载请保留链接:https://www.ichengzhen.cn/view-77578.html
以下为本文档部分文字说明:
课计算机组成原理课件第3章MainContent•CharacteristicsofMemorySystem•TypesofMemory•TheMemoryHierarchy•CacheMemory•VirtualMemoryCharacteristicsofMemorySystemsL
ocationCPUInternalExternalCapacityWordByteInternalUsuallygovernedbydatabuswidthExternalUsuallyablockwhic
hismuchlargerthanawordUnitofTransferAccessMethods(1)SequentialStartatthebeginningandreadthroughinorderAccesstimedependsonlocationofdataa
ndpreviouslocatione.g.tapeDirectIndividualblockshaveuniqueaddressAccessisbyjumpingtovicinityplussequentialsearchAccesstimedependsonlocation
andpreviouslocatione.g.diskCharacteristicsofMemorySystemsRandomIndividualaddressesidentifylocationsexactlyAccesstimeisin
dependentoflocationorpreviousaccesse.g.RAMAssociativeDataislocatedbyacomparisonwithcontentsofaportion
ofthestoreAccesstimeisindependentoflocationorpreviousaccesse.g.cacheAccessMethods(2)CharacteristicsofMemorySystemsPerforman
ceAccesstimeTimebetweenpresentingtheaddressandgettingthevaliddataMemoryCycletimeTimemayberequiredfortheme
moryto“recover”beforenextaccessCycletimeisaccess+recoveryTransferRateRateatwhichdatacanbemovedCharacteristicso
fMemorySystemsPhysicalTypesSemiconductorRAMMagneticDisk&TapeOpticalCD&DVDOthersHologramCharacteristicsofMemorySyst
emsTheBottomLineHowmuch?(Capacity)Greatercapacity,smallercostperbitGreatercapacity,sloweraccesstimeHowfast?(Accesstime)Fasteraccesstime,greater
costperbitHowexpensive?(Cost)MemoryHierarchyRegistersInCPUInternalorMainmemoryMayincludeoneormorelevelsofcache“RA
M”ExternalmemoryBackingstoreHierarchyListRegistersL1CacheL2CacheMainmemoryDiskOpticalTapeMemoryHierarchy-DiagramHierarchyListCacheSmall
amountoffastmemorySitsbetweennormalmainmemoryandCPUMaybelocatedonCPUchipormoduleContentaddressablememor
yWhatmakescache“special”?Cacheisnotaccessedbyaddress;itisaccessedbycontent.Forthisreason,cacheissometimescalledcontentaddressab
lememoryorCAM.TerminologyHit:Therequesteddataresidesinagivenlevelofmemory.Miss:Therequesteddataisnotfoundinthegivenlevelofmemory.HitR
ate:Thepercentageofmemoryaccessesfoundinagivenlevelofmemory.MissRate:Thepercentageofmemoryaccessesnotfoundinagivenlevelofmemory.Mi
ssRate=1-HitRateHitTime:Thetimerequiredtoaccesstherequestedinformationinagivenlevelofmemory.MissPenalty:Thetimere
quiredtoprocessamiss,whichincludesreplacingablockinanupperlevelofmemory,plustheadditionaltimetodelivertherequesteddatatotheprocessor.Cach
e/MainMemoryStructureCacheoperation–overviewCPUrequestscontentsofmemorylocationCheckcacheforthisdataIfpresent,getf
romcache(fast)Ifnotpresent,readrequiredblockfrommainmemorytocacheThendeliverfromcachetoCPUCacheincludestagstoide
ntifywhichblockofmainmemoryisineachcacheslotCacheReadOperation-FlowchartTypicalCacheOrganizationCacheDesignSizeMappingFunctio
nReplacementAlgorithmWritePolicyBlockSizeNumberofCachesCacheSizeSmallenoughsooverallcost/bitisclosetothatofmainmemoryLargeenoughsoover
allaverageaccesstimeisclosetothatofthecachealoneAccesstime=mainmemoryaccesstimepluscacheaccesstimeLar
gecachestendtobeslightlyslowerthansmallcachesItisimpossibletoarriveatasingle“optimum”cachesizeComparisonofCac
heSizesProcessorTypeYearofIntroductionL1cacheaL2cacheL3cacheIBM360/85Mainframe196816to32KB——PDP-11/70Minicomputer19
751KB——VAX11/780Minicomputer197816KB——IBM3033Mainframe197864KB——IBM3090Mainframe1985128to256KB——Intel80486PC19898KB——Pentium
PC19938KB/8KB256to512KB—PowerPC601PC199332KB——PowerPC620PC199632KB/32KB——PowerPCG4PC/server199932KB/32KB256KBto1MB2MBIBMS/390G4Ma
inframe199732KB256KB2MBIBMS/390G6Mainframe1999256KB8MB—Pentium4PC/server20008KB/8KB256KB—IBMSPHigh-endserver/supercomputer200064KB/32KB8MB—CRAYM
TAbSupercomputer20008KB2MB—ItaniumPC/server200116KB/16KB96KB4MBSGIOrigin2001High-endserver200132KB/32KB4MB—Itanium2PC/server2
00232KB256KB6MBIBMPOWER5High-endserver200364KB1.9MB36MBCRAYXD-1Supercomputer200464KB/64KB1MB—MappingFunctionTheelementsincludedinthefoll
owingexample:Cacheof64kByteCacheblockof4bytesi.e.cacheis16k(214)linesof4bytes16MBytesmainmemory24bitaddress(224=1
6M)1.DirectMapping2.AssociativeMapping3.SetAssociativeMappingDirectMappingDirectMappingEachblockofmainmemorymapstoonlyonecachelinei.e.ifabl
ockisincache,itmustbeinonespecificplacei=jmodmWherei=cachelinenumberj=mainmemoryblocknumberm=numberofline
sinthecacheDirectMappingAddressisintwopartsLeastSignificantwbitsidentifyuniquewordMostSignificantsbitsspecifyonememoryblockTheMSBsarespli
tintoacachelinefieldrandatagofs-r(mostsignificant)Cachem=2rDirectMappingCacheLineTableCachelineMainMemoryblocksheld00,m,2m,3m…2s-m11,m+1
,2m+1…2s-m+1m-1m-1,2m-1,3m-1…2s-1DirectMappingAddressStructureTags-rLineorSlotrWordw814224bitaddress2bitwordident
ifier(4byteblock)22bitblockidentifier8bittag(=22-14)14bitslotorlineNotwoblocksinthesamelinehavethesameTagfieldCheckcontentsofcach
ebyfindinglineandcheckingTagDirectMappingCacheOrganizationDirectMappingExampleDirectMappingSummaryAddresslength=(s+w)bitsN
umberofaddressableunits=2s+wwordsorbytesBlocksize=linesize=2wwordsorbytesNumberofblocksinmainmemory=2s+w/2w=2sNumberoflinesincache=m=2rSizeoftag=
(s–r)bitsDirectMappingpros&consSimpleInexpensiveFixedlocationforgivenblockIfaprogramaccesses2blockst
hatmaptothesamelinerepeatedly,cachemissesareveryhighAssociativeMappingAmainmemoryblockcanloadintoanylineofcacheMemoryaddressisinterp
retedastagandwordTaguniquelyidentifiesblockofmemoryEveryline’stagisexaminedforamatchCachesearchinggetsexpensiveAssociativeMappingAssocia
tiveMapping024631570246315781012141191315LineNumberBlockTagCacheMemoryAssociativeCacheOrganizationAssociativeMappingExampleTag22bi
tWord2bitAssociativeMappingAddressStructure22bittagstoredwitheach32bitblockofdataComparetagfieldwithtagentryincach
etocheckforhitLeastsignificant2bitsofaddressidentifywhich16bitwordisrequiredfrom32bitdatablocke.g.AddressTagDataCachelineFFFFFCFFFFFC246824683
FFFAssociativeMappingSummaryAddresslength=(s+w)bitsNumberofaddressableunits=2s+wwordsorbytesBlocksize=line
size=2wwordsorbytesNumberofblocksinmainmemory=2s+w/2w=2sNumberoflinesincache=undeterminedSizeoftag=sbitsSetAssociativeMappingCacheisdivided
intoanumberofsetsEachsetcontainsanumberoflinesAgivenblockmapstoanylineinagivensete.g.BlockBcanbeinanylineofseti
e.g.2linesperset2wayassociativemappingAgivenblockcanbeinoneof2linesinonlyonesetSetAssociativeMappi
ngSetAssociativeMappingBlockLineNumberCacheMemory02463157Set0Set1Set2Set30246315781012141191315KWaySetAssociativeCacheOrganizationSetAs
sociativeMappingAddressStructureUsesetfieldtodeterminecachesettolookinComparetagfieldtoseeifwehaveahite.gAddressTagDataSetnumber1FF7FFC1FF12
3456781FFF0017FFC001112233441FFFTag9bitSet13bitWord2bitSetAssociativeMappingExample13bitsetnumber000000,008000,018000,FF8000…
maptosamesetTwoWaySetAssociativeMappingExampleTwoWaySetAssociativeMappingExampleSetAssociativeMappingSummaryAddresslength
=(s+w)bitsNumberofaddressableunits=2s+wwordsorbytesBlocksize=linesize=2wwordsorbytesNumberofblocksinmainmemory=2s
+w/2w=2sNumberoflinesinset=kNumberofsets=v=2dNumberoflinesincache=k×v=k×2dSizeoftag=(s–d)bitsSetAssociativeMappingSummaryWhen
v=m,k=1,thesetassociativemappingreducestodirectmapping.Whenv=1,k=m,thesetassociativemappingreducestoassociativemapping.
Theuseoftwolinesperset(v=m/2,k=2)isthecommonsetassociativemappingorganization.ReplacementAlgorithms(1)DirectmappingNochoiceEachbl
ockonlymapstoonelineReplacethatlineReplacementAlgorithms(2)Associative&SetAssociativeHardwareimplementedalgori
thm(speed)LeastRecentlyused(LRU)e.g.in2waysetassociativeWhichofthe2blockisLRU?Firstinfirstout(FIFO)replace
blockthathasbeenincachelongestLeastfrequentlyusedreplaceblockwhichhashadfewesthitsRandomWritePolicyMustnot
overwriteacacheblockunlessmainmemoryisuptodateMultipleCPUsmayhaveindividualcachesI/Omayaddressmainmemorydirectl
yWritethroughAllwritesgotomainmemoryaswellascacheMultipleCPUscanmonitormainmemorytraffictokeeplocal(toCP
U)cacheuptodateLotsoftrafficSlowsdownwritesWritebackUpdatesinitiallymadeincacheonlyUpdatebitforcacheslotissetwhenupdateoc
cursIfblockistobereplaced,writetomainmemoryonlyifupdatebitissetOthercachesgetoutofsyncI/OmustaccessmainmemorythroughcacheLineSi
ze(块的大小)Astheblocksizeincreasesfromverysmalltolargersizes,thehitratewillatfirstincreasebecausethedatainth
evicinityofareferencedwordarelikelytobereferencedinthenearfuture.Thehitratewillbegintodecrease,astheblockbecom
esevenbigger.64~128bytecachelinesizesaremostfrequentlyused.NumberofCachesMultilevelCaches(L1/L2)On-chipCache
Off-chipCacheSplitCachesDataCacheInstructionCachePentium4Cache80386–noonchipcache80486–8kusing16bytelines
andfourwaysetassociativeorganizationPentium(allversions)–twoonchipL1cachesData&instructionsPentiumIII–L3cachea
ddedoffchipPentium4L1caches8kbytes64bytelinesfourwaysetassociativeL2cache256k128bytelines8waysetassociativeL3cacheonchipIntelCacheEvol
utionProblemSolutionProcessoronwhichfeaturefirstappearsExternalmemoryslowerthanthesystembus.Addextern
alcacheusingfastermemorytechnology.386Increasedprocessorspeedresultsinexternalbusbecomingabottleneckforcacheaccess.M
oveexternalcacheon-chip,operatingatthesamespeedastheprocessor.486Internalcacheisrathersmall,duetolimitedspaceonchipAddexternalL2cach
eusingfastertechnologythanmainmemory486ContentionoccurswhenboththeInstructionPrefetcherandtheExecutionUnitsi
multaneouslyrequireaccesstothecache.Inthatcase,thePrefetcherisstalledwhiletheExecutionUnit’sdataaccesstakesplace.Createseparatedataandins
tructioncaches.PentiumIncreasedprocessorspeedresultsinexternalbusbecomingabottleneckforL2cacheaccess.Createseparateback-sidebust
hatrunsathigherspeedthanthemain(front-side)externalbus.TheBSBisdedicatedtotheL2cache.PentiumProMoveL2cacheonto
theprocessorchip.PentiumIISomeapplicationsdealwithmassivedatabasesandmusthaverapidaccesstolargeamountsofdata.Theon-chipcachesaretoosma
ll.AddexternalL3cache.PentiumIIIMoveL3cacheon-chip.Pentium4PowerPCCacheOrganization601–single32kb8waysetassociative603–16kb(2x8kb)twoway
setassociative604–32kb620–64kbG3&G464kbL1cache8waysetassociative256k,512kor1ML2cachetwowaysetassociativ
eG532kBinstructioncache64kBdatacacheVirtualMemoryThepurposeofvirtualmemoryistousetheharddiskasanextensionofRAM,thusincreasingthe
availableaddressspaceaprocesscanuse.Themostcommonwaytoimplementvirtualmemoryisusingpaging,amethodinwhichmainmemoryisdividedintof
ixed-sizeblocksandprogramsaredividedintothesamesizeblocks.VirtualMemoryEachprogramhasapagetableassociatedw
ithitthatmapseachprogrampagetoamemorypageframe.Thus,logicaladdressesinaprogramareinterpretedasaphysicaladdress--pageframenumbe
randanoffsetwithinthepage.VirtualMemorySupposeaprogramis16byteslong,hasaccesstoan8-bytememorythatusesbytesaddressing,andapageis2bytesinlength.A
stheprogramexecutes,itgeneratesthefollowingaddressesreferencestring:0,1,2,3,6,7,10,11.ReviewQuestions(思考题
)CHAPTER01.Explainthepurposeofvirtualmemoryandcache.2.Explainhowassociativemappingcacheisdifferentfromdirectmappingcache.NextLessonCHAPTE
R0ControlUnit(控制单元)ControlUnitOperationMicroprogrammedControl