Question: C language: Computer Organization Assignment #2Cache Memory Objective: To simulate reading and writing to a custom-sized direct-mapped cache, involving a custom-sized main memory. Inputs: The

C language:

Computer Organization Assignment #2Cache Memory

Objective:

To simulate reading and writing to a custom-sized direct-mapped cache, involving a custom-sized main memory.

Inputs: The total size of accessible main memory (in words) The total size of the cache (in words) The block size (words/block) A signal to read (0) or write (1) to the cache The main memory address to read from/write to The contents of the address for writing to the cache Outputs: The corresponding cache tag, block, and word for a main memory address The contents of the address resulting from reading/writing to the cache A message indicating either a hit or a miss to the cache Specification:

The program simulates reading from and writing to a cache based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are: 1) Enter parameters 2) Access cache for reading/writing and transfer data 3) Quit program

Notes:

Use a structure (struct) to represent a cache line consisting of a tag (integer) and a block (integer pointer). Define the cache to be a pointer to the struct. Upon entering the parameters, the main memory and cache are to be dynamically allocated based on their respective total sizes. Each word i of main memory is initialized with the value Mi, where M is the size of main memory in words. Reading/writing from/to a new block in the cache results in dynamically allocating the block based on the block size.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!