Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Embedded Systems
4 - Hardware Architecture
Power Management
RMR2012
address
data
cache controller
cache
address data
CPU
main memory
data
2008 Wayne Wolf
RMR2012
Cache operation
Many main memory locations are mapped onto one cache entry. May have caches for:
instructions; data; data + instructions (unied).
Maths is not everything
RMR2012
Terms
Cache hit: required location is in cache. Cache miss: required location is not in cache.
Compulsory (cold): location has never been accessed. Capacity: working set is too large. Conict: multiple locations in working set map to same cache entry.
2008 Wayne Wolf
Maths is not everything
RMR2012
h = cache hit rate. tcache = cache access time, tmain = main memory access time. Average memory access time:
Maths is not everything
RMR2012
CPU
L1 cache
L2 cache
RMR2012
h1 = cache hit rate. h2 = rate for miss on L1, hit on L2. Average memory access time:
tav = h1tL1 + (h2-h1)tL2 + (1- h2-h1)tmain
Maths is not everything
RMR2012
Replacement policies
Replacement policy: strategy for choosing which cache entry to throw out to make room for a new memory location. Two popular strategies:
Random.
2008 Wayne Wolf
Maths is not everything
RMR2012
Cache organizations
Fully-associative: any memory location can be stored anywhere in the cache (almost never implemented). Direct-mapped: each memory location maps onto exactly one cache entry.
Maths is not everything
RMR2012
Keep frequently-accessed locations in fast cache. Cache retrieves more than one word at a time.
Sequential accesses are faster after rst access.
Maths is not everything
RMR2012
Direct-mapped cache
0xabcd
valid
data
address tag
2008 Wayne Wolf
index
offset
=
Maths is not everything
hit
value byte
RMR2012
Write operations
Write-through: immediately copy write to main memory. Write-back: write to main memory only when location is removed from cache.
2008 Wayne Wolf
RMR2012
Many locations map onto the same cache block. Conflict misses are easy to generate:
Array a[ ] uses locations 0, 1, 2, Array b[ ] uses locations 1024, 1025, 1026,
2008 Wayne Wolf
Maths is not everything
RMR2012
Set-associative cache
Set 1
Set 2
...
Set n
hit
data
RMR2012
RMR2012
data 1111 -
RMR2012
RMR2012
RMR2012
RMR2012
RMR2012
RMR2012
CPU
main memory
RMR2012
Allows programs to move in physical memory during execution. Allows virtual memory:
memory images kept in secondary storage; images returned to main memory on demand during execution.
2008 Wayne Wolf
RMR2012
Address translation
Requires some sort of register/table to allow arbitrary mappings of logical to physical addresses. Two basic schemes:
segmented; paged.
2008 Wayne Wolf
RMR2012
memory
RMR2012
segment 2
logical address
+
segment lower bound segment upper bound
2008 Wayne Wolf
range check
range error
physical address
RMR2012
offset
concatenate
RMR2012
page
offset
page descriptor
page descriptor
at
tree
RMR2012
Large translation tables require main memory access. TLB: cache for address translation.
Typically small.
RMR2012
RMR2012
1st index
2nd index
offset
concatenate concatenate
physical address
RMR2012