Cache

Direct Mapped Cache Cache's are directed mapped if each memory location is mapped to exactly one location in the cache. An example would be:

     location = (Block Address) MOD (Number of cache blocks in the cache)

In this way we can map a memory location to a cache location.

Example: Suppose we have a cache with 8 slots 2^3. Then a word at 45 would be found at slot 5 in the cache.

https://www.scotnpatti.com/images/directmappedcache.jpg

Tags contain the address information required to identify if the information in a cache location coresponds to the data needed. These tags contain the upper bits of the memory address. NOTE: The byte offset is the number of bits required to specify bytes in a block. Since this example uses 4 byte (word) sized blocks the byte offset is 2 bits

https://www.scotnpatti.com/images/directmappedcache2.jpg