Advanced Computer Architecture: BY Dr. Radwa M. Tawfeek
Advanced Computer Architecture: BY Dr. Radwa M. Tawfeek
COMPUTER
ARCHITECTURE
BY
DR. RADWA M. TAWFEEK
LAST LECTURE
• Pipelining
• Working with Hazards and Datapath Control Structures
• Hazards:
• Data, Control and Structural
MEMORY
Ch 5
THIS LECTURE
• Memory Hierarchy
• Includes caches, main memory, and disks
• Caches
• Small and fast
• Contain subset of data from main memory
• Generally close to the processor
• Terminology
• Cache blocks, hit rate, miss rate
MEMORY TECHNOLOGY TRADE-OFFS
MEMORY BASICS
• Magnetic disk
• 5ms – 20ms, $0.20 – $2 per GB
• Ideal memory
• Access time of SRAM
• Capacity and cost/GB of disk
ASSIGNMENT 1
• Memory hierarchies only work if the small, fast memory actually stores
data that is reused by the processor
MEMORY REFERENCE PATTERN
THE GOAL: ILLUSION OF LARGE, FAST, CHEAP
MEMORY
• How do we create a memory that is large, cheap and fast (most of the
time)?
• Strategy: Provide a Small, Fast Memory which holds a subset of the main
memory – called cache
• Keep frequently-accessed locations in fast cache
• Cache retrieves more than one word at a time
• Sequential accesses are faster after first access
TAKING ADVANTAGE OF LOCALITY
• Memory hierarchy
• Store everything on disk
• Copy recently accessed (and nearby) items from disk to smaller DRAM
memory
• Main memory
• Copy more recently accessed (and nearby) items from DRAM to smaller
SRAM memory
• Cache memory attached to CPU
MEMORY HIERARCHY LEVELS
• Registers « Memory
• By the compiler (or assembly language Programmer)
The total number of bits needed for a cache is a function of the cache size and the
address size, because the cache includes both the storage for the data and the tags.
The size of the block above was one word, but normally it is several. For the
following situation:
32-bit addresses
A direct-mapped cache
The cache size is 2n blocks, so n bits are used for the index
The block size is 2m words (2m+2 bytes), so m bits are used for the word within the
block, and two bits are used for the byte part of the address
the size of the tag field is
32 - (n + m + 2).
BLOCK REPLACEMENT: WHICH BLOCK TO REPLACE?
• •Cache Miss
• –No Write Allocate – only write to main memory
• –Write Allocate – fetch block into cache, then write
WRITE-THROUGH