Description
Write a program in VS C++ 2017 to determine the tag, set number, and offset for a memory address of a system supporting an N-way set-associative cache. Your program should first read in the information for N, memory capacity (in bytes), block/line size (in bytes), cache capacity (in bytes), and a memory address (in decimal). It then does the necessary mapping and displays the result to the screen. You may assume that all the information entered is power of 2 except the memory address. The following shows a scenario of running a sample program, where user’s inputs are represented in boldface.
Enter N: 4
Enter memory capacity: 512
Enter block/line size: 8
Enter cache capacity: 128
Enter a memory address: 73
The tag, set number, and offset for the address are 2, 1, and 1, respectively
More conversions (y or n): y
Enter N: 2
Enter memory capacity: 128
Enter block/line size: 4
Enter cache capacity: 64
Enter a memory address: 109
The tag, set number, and offset for the address are 3, 3, and 1, respectively
More conversions (y or n): n
Good bye!
Follow the criteria shown below to prepare and turn your program in to Canvas.
-
You MUST use VS C++ 2017 to develop, compile, debug, test, and run your program.
-
Submit only the source-code file to Canvas (on time or late).
-
Make sure your program compiles successfully in order not to lose a major portion of total points.
-
Your program will be tested using the test cases similar to those shown above.
Page 1 of 1