DOC PREVIEW
CSUN COMP 546 - Cache skeleton

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

#include <stdlib.h> /* declare global var's */ /* define structure of dynamic cache and initialize var */ /* define dynamic array for main memory */ /**********************************************************************/ void set_params() { /* declare local var's */ /* Prompt for main memory size, cache size, block size */ /* allocate and initialize main memory--value at index i = size of main memory-i*/ /* allocate memory for cache */ return; } /**********************************************************************/ void read_addr() { /* declare local var's */ /* Prompt for main memory address to read from */ /* Translate main mem addr to cache addr fields*/ /* MISS--BLOCK NOT ALLOCATED */ /* Allocate cache block based on block size */ /* MISS--NON-MATCHING TAG */ /* Print message of Read miss */ /* Overwrite tag */ /* Transfer equivalent block of main memory to cache--one word at a time */ /* HIT--read cache word */ /* Print message of word, block, tag, data value */ return; } /**********************************************************************/ void write_addr() { /* declare local var's *//* Prompt for main memory address to write from, and data value to write */ /* Translate main mem addr to cache addr fields*/ /* MISS--BLOCK NOT ALLOCATED */ /* Allocate cache block based on block size */ /* MISS--NON-MATCHING TAG */ /* Print message of write miss */ /* Overwrite tag */ /* Transfer equivalent block of main memory to cache--one word at a time */ /* HIT--read cache word */ /* Copy data value to appropriate word in cache */ /* Print message of word, block, tag, data value */ return; } /**********************************************************************/ void delete_cache() { /* declare local var's */ /* free each allocated block */ /* free top level cache var */ /* free main meory if allocated */ return; } /**********************************************************************/ int main() { /* declare local var's */ /* until program exits, print menu, select choice via switch statement and call appropriate function*/ return 0;


View Full Document

CSUN COMP 546 - Cache skeleton

Download Cache skeleton
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Cache skeleton and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Cache skeleton 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?