Accessing Cache
Total number of bits needed for a cache
-size of tag field is
-32-(n+m+2)
-the total number of bits in direct-mapped cache
-2nx(block size+ tag size+ valid field size)
Block size = 2m words (2m+5 bits), 1 bit for valid field size
Total number of bits in cache is
-2n x (2m x 32 + (32-n-m-2) +1)
=2n x (2m x32 +31-n-m)
-size of tag field is
-32-(n+m+2)
-the total number of bits in direct-mapped cache
-2nx(block size+ tag size+ valid field size)
Block size = 2m words (2m+5 bits), 1 bit for valid field size
Total number of bits in cache is
-2n x (2m x 32 + (32-n-m-2) +1)
=2n x (2m x32 +31-n-m)
Example
How many total bit are required for a direct mapped cache with 16kb of data and 4-word blocks, assuming a 32-bit address?
-16kb is 4K (212) words
-with block size of 4 words (22), 1024 (210) blocks remaining for cache size
-each block has 4 x 32= 128 bits data plus a tag, which is 32 – 10 – 2 – 2 bits
-plus a valid bit
-total cache size = 210 x (4 x 32+ (32 – 10 – 2 – 2) + 1)
= 210 x 147
=147 Kbits
How many total bit are required for a direct mapped cache with 16kb of data and 4-word blocks, assuming a 32-bit address?
-16kb is 4K (212) words
-with block size of 4 words (22), 1024 (210) blocks remaining for cache size
-each block has 4 x 32= 128 bits data plus a tag, which is 32 – 10 – 2 – 2 bits
-plus a valid bit
-total cache size = 210 x (4 x 32+ (32 – 10 – 2 – 2) + 1)
= 210 x 147
=147 Kbits
No comments:
Post a Comment