Question: Write a C++ program that allows the user to enter the main memory size, cache size, block size, and offset, and prints the number of
Write a C++ program that allows the user to enter the main memory size, cache size, block size, and offset, and prints the number of bits, number of blocks, number of cache lines, and tag according to the following formulas:

Given: Main memory size-4GB Cache size-64MB Block size 16 Bytes Offset- logz(BS)- 24-4 bits. Calculate: Addressing Bits-log2(MMS)-(22x20)-232-32 bits The number of blocks(p)-log2(MMS/BS) (22x230)/24 228-28. The number of cache lines (q)- log2(CS/BS)- (26x220/24-222-22. Calculate Tag as log2(p/q)- 228/22226 Tag Line Offset 4 Hence: 6+22+4-32Bits. Please note: 1. That you can be given the Addressing bits as 32 and then required to calculate the Main Memory Size. How???? 2. See conversion from above example Bits, Bytes, KB, MB, GB.... 3. Assume that MMS>CS>BS Write a C++ program to allow the user to enter the given and do the calculation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
