SlideShare a Scribd company logo
1 of 15
Download to read offline
Digital Logic and Computer
Architecture
UNIT-5
MEMORY ORGANIZATION
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 1
Topics to be Discussed
➢Cache Memory-Introduction
➢Cache Mapping Techniques
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 2
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 3
Memory
Hierarchy
Cache Memory
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 4
 Cache Memory is placed between the CPU and Main Memory.
 10 to 100 times faster than Main Memory
 Cache Memory uses the Principle of Locality of Reference
Cache Memory-Hit and Miss
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 5
Principle of Locality of Reference
➢Cache Memory uses the Principle of Locality of Reference
➢Temporal locality of reference
The tendency of a computer Program to access the
same set of memory locations for a particular time period.
➢Spatial Locality of Reference
The tendency of the computer program to access
instructions whose addresses are near one another.
➢Average Execution Time α Average Memory Access Time
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 6
Hit Ratio & Average Memory Access Time
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 7
 Hit Ratio=
Total No. of Hits
Total No. of Memory Accesses by CPU
 Total No. of Memory Accesses= No. of Hits+ No. of
Misses
 Average Memory access time =
Tavg = h * Tc + (1-h)*(Tm + Tc)
 h- Probability of a Hit
 Tm-Main Memory Access Time
 Tc- Cache Memory Access Time
Problems
1. If a CPU has 39 Cache Hits and 2 Cache Misses
over a given timeframe, then find the Cache Hit
ratio. (Ans:
2. Calculate the average access time if cache
memory access time is 150ns and memory access
time is 900 ns and we have the hit ratio for cache
memory as h=0.8.
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 8
Problems
1. If a CPU has 39 Cache Hits and 2 Cache Misses
over a given timeframe, then find the Cache Hit
ratio.
(Ans: 0.95)
1. Calculate the average access time if cache
memory access time is 150ns and memory access
time is 900 ns and we have the hit ratio for cache
memory as h=0.8.
(Ans: 0.8*150+0.2*1050=330ns)
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 9
Cache Mapping Techniques
➢Entire Main Memory is divided into equal sized
Blocks.
➢Cache Memory is also divided into same-sized Blocks
➢Cache Mapping Technique defines mapping between
Blocks of Main Memory and Blocks of Cache Memory.
➢Direct Mapping
➢Associative Mapping
➢Set – Associative Mapping
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 10
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 11
Cache Memory
Main Memory
Assumption
Consider a cache consisting of 128 blocks of 16
words each, for total of 2048 (2K) words and assume
that the main memory is addressable by 16 bit
address. Main memory is 64K which will be viewed
as 4K blocks of 16 words each.
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 12
Cache Memory
No. of Blocks=128
No. of Words=128 *16
=2048
=2*1024
=2K
Main Memory (16-bit Address)
No. of Words=216
= 26 * 210
= 64K
=16*4K
No. of Blocks=4K
Direct Mapping
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 13
Cache Memory
No. of Blocks/Lines
=128
Main Memory
No. of Blocks=4K
=4*1024=4096
Block J of the main
memory maps on to
Block J modulo 128 of
the cache (Line)
Line 0-Block 0,128,256…
Line 1-Block 1,129,257…
Line 2-Block 2,130,258…
…..
Line 127-Block 127,255…
No.of Tag Bits=No. of
Possiible Blocks in each
line=log2(4096/128)
Associative Mapping
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 14
Cache Memory
No. of Blocks/Lines
=128
Main Memory
No. of Blocks=4K
=4*1024=4096
➢ More Flexible
➢ Any Main Memory
Block can be placed
into any Cache Block
position (Line).
No.of Tag Bits=
No. of Possiible Blocks in
each Cache Line
=log2(4096) = 12
Set Associative Mapping
(2-way)
DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 15
Cache Memory
No. of Blocks/Lines
=128
Main Memory
No. of Blocks=4K
=4*1024=4096
➢ Combination of Direct and
Associative Mappings
➢ Reduces Contention
Problem of Direct
Mapping
➢ Reduces the H/W cost by
reducing the size of
Associative Search
Line 0 - Set 0
Line 1 Blocks 0,64,128,.. 4032
No.of Set bits= log2(128/2) = 6, No. of Tag Bits=log2(4096/256)

More Related Content

Similar to DLCA-UNIT-5-Memory Organization-Cache.pdf

Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2Hsien-Hsin Sean Lee, Ph.D.
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptxRamanRay105
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureHaris456
 
memeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesmemeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesGauravDaware2
 
computer system embedded system volume1.ppt
computer system embedded system volume1.pptcomputer system embedded system volume1.ppt
computer system embedded system volume1.pptmshanajoel6
 
CPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching TechniquesCPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching TechniquesDilum Bandara
 
Chp3 designing bus system, memory & io copy
Chp3 designing bus system, memory & io   copyChp3 designing bus system, memory & io   copy
Chp3 designing bus system, memory & io copymkazree
 
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptx
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptxonur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptx
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptxsivasubramanianManic2
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : MemoryAmin Omi
 
Chapter 8 memory-updated
Chapter 8 memory-updatedChapter 8 memory-updated
Chapter 8 memory-updatedDelowar hossain
 
High-Performance Physics Solver Design for Next Generation Consoles
High-Performance Physics Solver Design for Next Generation ConsolesHigh-Performance Physics Solver Design for Next Generation Consoles
High-Performance Physics Solver Design for Next Generation ConsolesSlide_N
 
SO-Memoria.pdf
SO-Memoria.pdfSO-Memoria.pdf
SO-Memoria.pdfKadu37
 

Similar to DLCA-UNIT-5-Memory Organization-Cache.pdf (20)

Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
Lec10 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part2
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptx
 
Coa presentation3
Coa presentation3Coa presentation3
Coa presentation3
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer Architecture
 
Cache Memory
Cache MemoryCache Memory
Cache Memory
 
Lecture 25
Lecture 25Lecture 25
Lecture 25
 
memeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesmemeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memories
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
cache memory management
cache memory managementcache memory management
cache memory management
 
computer system embedded system volume1.ppt
computer system embedded system volume1.pptcomputer system embedded system volume1.ppt
computer system embedded system volume1.ppt
 
CPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching TechniquesCPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching Techniques
 
Chp3 designing bus system, memory & io copy
Chp3 designing bus system, memory & io   copyChp3 designing bus system, memory & io   copy
Chp3 designing bus system, memory & io copy
 
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptx
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptxonur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptx
onur-comparch-fall2018-lecture3b-memoryhierarchyandcaches-afterlecture.pptx
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
Chapter 8 memory-updated
Chapter 8 memory-updatedChapter 8 memory-updated
Chapter 8 memory-updated
 
High-Performance Physics Solver Design for Next Generation Consoles
High-Performance Physics Solver Design for Next Generation ConsolesHigh-Performance Physics Solver Design for Next Generation Consoles
High-Performance Physics Solver Design for Next Generation Consoles
 
SO-Memoria.pdf
SO-Memoria.pdfSO-Memoria.pdf
SO-Memoria.pdf
 
SO-Memoria.pdf
SO-Memoria.pdfSO-Memoria.pdf
SO-Memoria.pdf
 
Caches microP
Caches microPCaches microP
Caches microP
 

Recently uploaded

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...vershagrag
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 

Recently uploaded (20)

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 

DLCA-UNIT-5-Memory Organization-Cache.pdf

  • 1. Digital Logic and Computer Architecture UNIT-5 MEMORY ORGANIZATION DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 1
  • 2. Topics to be Discussed ➢Cache Memory-Introduction ➢Cache Mapping Techniques DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 2
  • 3. DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 3 Memory Hierarchy
  • 4. Cache Memory DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 4  Cache Memory is placed between the CPU and Main Memory.  10 to 100 times faster than Main Memory  Cache Memory uses the Principle of Locality of Reference
  • 5. Cache Memory-Hit and Miss DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 5
  • 6. Principle of Locality of Reference ➢Cache Memory uses the Principle of Locality of Reference ➢Temporal locality of reference The tendency of a computer Program to access the same set of memory locations for a particular time period. ➢Spatial Locality of Reference The tendency of the computer program to access instructions whose addresses are near one another. ➢Average Execution Time α Average Memory Access Time DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 6
  • 7. Hit Ratio & Average Memory Access Time DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 7  Hit Ratio= Total No. of Hits Total No. of Memory Accesses by CPU  Total No. of Memory Accesses= No. of Hits+ No. of Misses  Average Memory access time = Tavg = h * Tc + (1-h)*(Tm + Tc)  h- Probability of a Hit  Tm-Main Memory Access Time  Tc- Cache Memory Access Time
  • 8. Problems 1. If a CPU has 39 Cache Hits and 2 Cache Misses over a given timeframe, then find the Cache Hit ratio. (Ans: 2. Calculate the average access time if cache memory access time is 150ns and memory access time is 900 ns and we have the hit ratio for cache memory as h=0.8. DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 8
  • 9. Problems 1. If a CPU has 39 Cache Hits and 2 Cache Misses over a given timeframe, then find the Cache Hit ratio. (Ans: 0.95) 1. Calculate the average access time if cache memory access time is 150ns and memory access time is 900 ns and we have the hit ratio for cache memory as h=0.8. (Ans: 0.8*150+0.2*1050=330ns) DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 9
  • 10. Cache Mapping Techniques ➢Entire Main Memory is divided into equal sized Blocks. ➢Cache Memory is also divided into same-sized Blocks ➢Cache Mapping Technique defines mapping between Blocks of Main Memory and Blocks of Cache Memory. ➢Direct Mapping ➢Associative Mapping ➢Set – Associative Mapping DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 10
  • 11. DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 11 Cache Memory Main Memory
  • 12. Assumption Consider a cache consisting of 128 blocks of 16 words each, for total of 2048 (2K) words and assume that the main memory is addressable by 16 bit address. Main memory is 64K which will be viewed as 4K blocks of 16 words each. DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 12 Cache Memory No. of Blocks=128 No. of Words=128 *16 =2048 =2*1024 =2K Main Memory (16-bit Address) No. of Words=216 = 26 * 210 = 64K =16*4K No. of Blocks=4K
  • 13. Direct Mapping DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 13 Cache Memory No. of Blocks/Lines =128 Main Memory No. of Blocks=4K =4*1024=4096 Block J of the main memory maps on to Block J modulo 128 of the cache (Line) Line 0-Block 0,128,256… Line 1-Block 1,129,257… Line 2-Block 2,130,258… ….. Line 127-Block 127,255… No.of Tag Bits=No. of Possiible Blocks in each line=log2(4096/128)
  • 14. Associative Mapping DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 14 Cache Memory No. of Blocks/Lines =128 Main Memory No. of Blocks=4K =4*1024=4096 ➢ More Flexible ➢ Any Main Memory Block can be placed into any Cache Block position (Line). No.of Tag Bits= No. of Possiible Blocks in each Cache Line =log2(4096) = 12
  • 15. Set Associative Mapping (2-way) DR. K. RADHIKA, PROFESSOR, IT DEPARTMENT, CBIT 15 Cache Memory No. of Blocks/Lines =128 Main Memory No. of Blocks=4K =4*1024=4096 ➢ Combination of Direct and Associative Mappings ➢ Reduces Contention Problem of Direct Mapping ➢ Reduces the H/W cost by reducing the size of Associative Search Line 0 - Set 0 Line 1 Blocks 0,64,128,.. 4032 No.of Set bits= log2(128/2) = 6, No. of Tag Bits=log2(4096/256)