Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 calculationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started