COEN 180 Main Memory Cache Architectures. Basics Speed difference between cache and memory is small. Therefore:  Cache algorithms need to be implemented.

Slides:



Advertisements
Similar presentations
SE-292 High Performance Computing
Advertisements

361 Computer Architecture Lecture 15: Cache Memory
SE-292 High Performance Computing Memory Hierarchy R. Govindarajan
Lecture 19: Cache Basics Today’s topics: Out-of-order execution
Practical Caches COMP25212 cache 3. Learning Objectives To understand: –Additional Control Bits in Cache Lines –Cache Line Size Tradeoffs –Separate I&D.
1 Recap: Memory Hierarchy. 2 Memory Hierarchy - the Big Picture Problem: memory is too slow and or too small Solution: memory hierarchy Fastest Slowest.
Overview of Cache and Virtual MemorySlide 1 The Need for a Cache (edited from notes with Behrooz Parhami’s Computer Architecture textbook) Cache memories.
How caches take advantage of Temporal locality
Modified from notes by Saeid Nooshabadi
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Oct 31, 2005 Topic: Memory Hierarchy Design (HP3 Ch. 5) (Caches, Main Memory and.
1  Caches load multiple bytes per block to take advantage of spatial locality  If cache block size = 2 n bytes, conceptually split memory into 2 n -byte.
Cache Memories Effectiveness of cache is based on a property of computer programs called locality of reference Most of programs time is spent in loops.
Unit-4 (CO-MPI Autonomous)
Maninder Kaur CACHE MEMORY 24-Nov
CMPE 421 Parallel Computer Architecture
Memory/Storage Architecture Lab Computer Architecture Memory Hierarchy.
Lecture 10 Memory Hierarchy and Cache Design Computer Architecture COE 501.
Chapter Twelve Memory Organization
10/18: Lecture topics Memory Hierarchy –Why it works: Locality –Levels in the hierarchy Cache access –Mapping strategies Cache performance Replacement.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 10 Memory Hierarchy.
CSIE30300 Computer Architecture Unit 08: Cache Hsin-Chou Chi [Adapted from material by and
L/O/G/O Cache Memory Chapter 3 (b) CS.216 Computer Architecture and Organization.
CPE432 Chapter 5A.1Dr. W. Abu-Sufah, UJ Chapter 5A: Exploiting the Memory Hierarchy, Part 2 Adapted from Slides by Prof. Mary Jane Irwin, Penn State University.
Computer Architecture Lecture 26 Fasih ur Rehman.
3-May-2006cse cache © DW Johnson and University of Washington1 Cache Memory CSE 410, Spring 2006 Computer Systems
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
CSE 241 Computer Engineering (1) هندسة الحاسبات (1) Lecture #3 Ch. 6 Memory System Design Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Additional Slides By Professor Mary Jane Irwin Pennsylvania State University Group 3.
Lecture 08: Memory Hierarchy Cache Performance Kai Bu
Outline Cache writes DRAM configurations Performance Associative caches Multi-level caches.
11 Intro to cache memory Kosarev Nikolay MIPT Nov, 2009.
Review °We would like to have the capacity of disk at the speed of the processor: unfortunately this is not feasible. °So we create a memory hierarchy:
Lecture 20 Last lecture: Today’s lecture: Types of memory
COMP SYSTEM ARCHITECTURE PRACTICAL CACHES Sergio Davies Feb/Mar 2014COMP25212 – Lecture 3.
1 Appendix C. Review of Memory Hierarchy Introduction Cache ABCs Cache Performance Write policy Virtual Memory and TLB.
CAM Content Addressable Memory
Cache Small amount of fast memory Sits between normal main memory and CPU May be located on CPU chip or module.
COMP 3221: Microprocessors and Embedded Systems Lectures 27: Cache Memory - III Lecturer: Hui Wu Session 2, 2005 Modified.
Characteristics Location Capacity Unit of transfer Access method Performance Physical type Physical characteristics Organisation.
Associative Mapping A main memory block can load into any line of cache Memory address is interpreted as tag and word Tag uniquely identifies block of.
CSCI206 - Computer Organization & Programming
CMSC 611: Advanced Computer Architecture
Main Memory Cache Architectures
CSE 351 Section 9 3/1/12.
Memory COMPUTER ARCHITECTURE
CAM Content Addressable Memory
CSC 4250 Computer Architectures
Multilevel Memories (Improving performance using alittle “cash”)
Basic Performance Parameters in Computer Architecture:
Cache Memory Presentation I
Consider a Direct Mapped Cache with 4 word blocks
William Stallings Computer Organization and Architecture 7th Edition
Lecture 21: Memory Hierarchy
Lecture 21: Memory Hierarchy
Lecture 23: Cache, Memory, Virtual Memory
Module IV Memory Organization.
Direct Mapping.
Module IV Memory Organization.
CDA 5155 Caches.
ECE232: Hardware Organization and Design
Morgan Kaufmann Publishers Memory Hierarchy: Cache Basics
Main Memory Cache Architectures
EE108B Review Session #6 Daxia Ge Friday February 23rd, 2007
Lecture 22: Cache Hierarchies, Memory
Basic Cache Operation Prof. Eric Rotenberg
Lecture 21: Memory Hierarchy
Cache - Optimization.
Lecture 13: Cache Basics Topics: terminology, cache organization (Sections )
10/18: Lecture Topics Using spatial locality
Overview Problem Solution CPU vs Memory performance imbalance
Presentation transcript:

COEN 180 Main Memory Cache Architectures

Basics Speed difference between cache and memory is small. Therefore:  Cache algorithms need to be implemented in hardware and be simple.  MM is byte addressable, but only words are moved, typically, the last two bits of the address are not even transmitted.  Hit rate needs to be high.

Basics Average Access Time = (Hit Rate)*(Access to Cache) + (Miss Rate)*(Access to MM)

Direct Mapped Cache  Each Item in MM can be located in only one position in cache.

Direct Mapped Cache  Tag (highest order bits);  Index;  2 LSB distinguish the byte in the word. Address is split into

Direct Mapped Cache  Tag serves to identify the data item in the cache.  Index is the address of the word in the cache.

Direct Mapped Cache Example Memory Addresses are 8b long. Cache with 8 words in it.

Byte located at Tag is 011. Index is 010. The two least significant bits are 11. Since the tags, the byte is in the cache. If the byte is in the cache, it is byte 3 in the word stored in line 010 = 2.

Write Policies  Write-through: A write is performed to both the cache and to the main memory.  Copy-back: A write is performed only to cache. If an item is replaced by another item, then the item to be replaced is copied back to main memory.

Dirty Bit To implement copy-back: Add one bit that tells us whether the data item is dirty (has changed) or not.

Cache Operations Write-Through READ: 1.Extract Tag and Index from Address. 2.Go to the cache line given by Index. 3.See whether the Tag matches the Tag stored there. 4.If they match: Hit. Satisfy read from cache. 5.If they do not match: Miss. Satisfy read from main memory. Also store item in cache.

Cache Operations Write-Through Write: 1.Extract Tag and Index from address. 2.Write datum in cache at location given by Index. 3.Reset the tag field in the cache line with Tag. 4.Write datum in main memory.

Cache Operations Copy-Back  If there is a read miss, then before the current item in cache is replaced, check the dirty bit. If the current item is dirty, then it needs to be written to main memory before being replaced.  Writes are only to cache and set the dirty bit.

Cache Overhead Assume a cache that contains 1MB worth of data. Hence, it contains 256K data words. Hence, it has 2**18 cache lines. Hence, index is 18 bits long, tag is 12 bits long. Hence, each cache line stores 12b+32b (write through). Hence, overhead is 12/32 = 37.5%. Cache uses 1.375MB actual storage.

Blocks Moving only one word to cache does not exploit spatial locality.  Move blocks of words into cache.  Split address into: Address =Tag:Index:Word in Block:2 ls bits.

Blocks  If there is a miss on a read, bring all words in the block into the cache.  For a write operation: –Write the word, bring other words into the cache. Or –Write directly to main memory. Do not update cache.

Example: Blocked Cache Read access to byte at address Extract components: 011:10:1:01. Go to cache line 2. Compare tags. No match, hence a miss. Dirty bit set. Move the two words to MM. Bring in words starting at and 0111 R0100. Read access to byte at address Extract components: 010:00:1:01. Go to cache line 0. Compare tags. They match, hence a hit. Byte is the second byte in word 1, i.e (assuming low-endian).

Set Associative Cache In a direct mapped cache, there is only one possible location for a datum in the cache.  Contention between two (or more) popular data is possible, resulting in low hit rates. Solution: Place more than one item in a cache line.

Set Associative Cache  A n-way set associative cache has a cache line consisting of n pairs of Tag + Datum.  The larger the associativity n, the larger the hit rate.  The larger the associativity n, the more complex the read, since all n tags need to be compared in parallel.  Cache replacement is more difficult to implement.

Set Associative Cache Example Popular words at address and fit both into cache. Split address into 0011:00:00 and address into 1011:00:00.

Set Associative Cache Assume a l-way set associative cache.  On a miss, we need to replace one of the l data in the cache line.  We need to implement in hardware a choice.  Random: Replaces one of the items at random.  LRU: If the associativity is two, then we can store in a single bit the priority. If the set associativity is larger, then we use an approximation.