New York Institute of Technology School of Engineering and Computing Sciences EENG/CSCI 641 – Computer Architecture 1 Term Project Summer 2014 Dr. B. Beheshti Overview You are to write (in any language you like) a program that simulates a simple cache. The parameters associated with the memory system are as follows: • Memory Block Size = Cache Line Size = 8 • Number of Blocks in Memory =8 • Number of Cache Lines = 2 • Direct Mapped Cache • Write Through Cache Policy Each line of the cache has the following components: Valid Bit Tag Data Values 0 = Empty 1 = Valid Block Number of Memory Block Copy Byte 0 Byte 1 Byte 2 … Byte 7 Your memory has the following initial values: block 0 00 01 02 03 04 05 06 07 block 1 10 11 12 13 14 15 16 17 block 2 20 21 22 23 24 25 26 27 block 3 30 31 32 33 34 35 36 37 block 4 40 41 42 43 44 45 46 47 block 5 50 51 52 53 54 55 56 57 block 6 60 61 62 63 64 65 66 67 block 7 70 71 72 73 74 75 76 77 1 Your program should have the following functions: void print_cache(void) This function prints all current contents of cache. For example: =================== CACHE ========================== v = 1 tag = 2 20 21 22 88 24 25 26 27 v = 1 tag = 1 10 11 12 13 14 15 16 17 void print_mem(void) This function prints all current contents of memory. For example: ==================== MEM ========================== 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22 88 24 25 26 27 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77 void init_cache(void) This function initializes the cache to the following state: =================== CACHE ========================== v = 0 tag = -99 0 0 0 0 0 0 0 0 v = 0 tag = -99 0 0 0 0 0 0 0 0 int direct_map(int block_num) This function receives the memory block number of interest and calculates the cache line number associated with is using the formula for DIRECT MAPPED caches. 2 void write_to_cache(int block_num, int offset, int value) This function writes a...

  • 6 years ago
Computer Architecture A+ Tutorial use as Guide
NOT RATED

Purchase the answer to view it

blurred-text
  • attachment
    computer_architecture.docx
  • attachment
    computer_architecture_1.txt
  • attachment
    computer_architecture_2.txt
  • attachment
    computer_architecture_3.txt