caching - Cache bits per row and total length -
caching - Cache bits per row and total length -
if have a
32bit address
,
cache size(c) 8 kb
,
block size(b) 16 b
,
set associativity(a) 1
its direct mapped cache bits per line in cache? including dirty bit , validity bit. total no of lines in cache?
some thought got via searching on net is
offset bits = log b = 4 bits index bits = log c/b * 1024 = 9 bits tag bits = 32 - offset - index = 19 bits validity , dirty have 1, 1 bit
still confused how calculate size of cache or how many lines cache have?
your net search gave right answer.
block size of 16 bytes -> need 4 bits specify offset within block. 8k byte cache , 16 byte lines -> 512 blocks. (8k / 16 = 512) direct mapped cache -> 512 / 1 way set associativity = 512 sets 512 sets -> need 9 bits index (512 = 2^9)with 32 bit address, if 4 bits used block offset , 9 index means remaining 19 bits needed tag.
since direct map cache, no bits needed replacement policy (e.g. lru). you'll need @ to the lowest degree 1 bit validity. 2 bits can implement cache coherence algorithm mesi. figure 20 21 bits needed per block.
caching computer-architecture cpu-cache lru
Comments
Post a Comment