heritagegugl.blogg.se

Direct mapped cache tutorial
Direct mapped cache tutorial











direct mapped cache tutorial

Therefore, the total number of blocks in main memory is 2048 (2K x 32 words = 64K words). Since the block size of cache is 32 words, so the main memory is also organized as block size of 32 words. Let us consider a main memory system consisting 64K words. So the total 12 bits of address is divided for two groups, lower 5 bits are used to select a word within a block, and higher 7 bits of address are used to select any block of cache memory. To select one of the block out of 128 blocks, we need 7 bits of address lines and to select one word out of 32 words, we need 5 bits of address lines. For 4K words, required address lines are 12 bits. Therefore, the cache is organized as 128 blocks. From the flexibility point of view, it is in between to the other two methods.Īll these three mapping methods are explained with the help of an example.Ĭonsider a cache of 4096 (4K) words with a block size of 32 words. In this method, blocks of cache are grouped into sets, and the mapping allows a block of main memory to reside in any block of a specific set. This is much more flexible mapping method. In this mapping function, any block of Main memory can potentially reside in any cache block position. Three different mapping functions are available:Ī particular block of main memory can be brought to a particular block of cache memory. This mapping function is used to transfer the block from main memory to cache memory.

direct mapped cache tutorial

The mapping functions are used to map a particular block of main memory to a particular block of cache.













Direct mapped cache tutorial