In direct memory management, CPU references address of 15-bits. Main memory size is 512 * 8 and cache memory size is 128 * 8. What is the size of Tag and line in bits?

Block size=8=2^3

I have found the number of bits in the word field as follows, Block size=8=2^3 Therefore, word bits=3 bits

Now number of bits in line field is 7 (128=2^7) i guess.


Main memory size of 512 doesn't make sense to me; it's too small for 15-bit addresses, and it also makes the cache of 128 appear huge being fully 1/4 of 512.

From the 15-bits in addresses, we subtract the 3 lowest bits because of the block size, leaving 12-bits of addresses to provide to the cache in order to lookup a byte or word.

With cache size at 2^7=128, and a block size of 2^3, the cache has 2^(7-3=4) indexes (aka elements, positions, blocks). (I take it that it is direct mapped, aka 1-way set associative).

So, out of the 12 bits provided to the cache, as 4 are index bits then remaining 8 are tag bits.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.