Project 3
RSCPU-E-Cache
You are going to add a 1K direct-mapped, write allocate/ write through cache to your RSCPU-E processor. The cache lines are 4 bytes.

You should represent the cache as an array of  structures consisting of 4 bytes of data and a tag field.

You must initialize the cache properly so that the code works properly. You must set each tag value to an invalid value. I suggest setting each tag value to 255 and each data value within the tag to zero.

On each memory read, you must first check the cache to determine if the data is in the cache, cache hit. If you have a cache hit, take the data from the cache. If you have a cache miss, you must read the memory from main memory and update the cache.

On each memory write, bring the line into the cache then you must write the data to both the cache and to main memory.

In addition to the printing requirements specified in Project 2, on each memory access you must print the following:

Submit your program
  1. (85 points) Use turnin to submit your program. On the command line type turnin, cs398c, RSCPUECACHE.Your program must be called rscpuecache.cpp.    Please note that your code must written in C++. It is your responsibility to check the output file generated by turnin to be sure that your program turned in properly. Programs that do not compile are not worth any credit. Programs that do not run to a normal completion are worth very little.
  2. (15 points)Using a word processor, answer the following:
    1. What is m?
    2. How many bits make up r (#bits in the line field)?
    3. How many bits make up s-r (# bits in the tag field)?
    4. Run your program against the following 2 programs:
    5. Program 1

      mvi 0x01

      mvac

      mvi 0x06

      loop:

      stac 0x2050

      ldac 0x2050

      sub

      jpnz loop

      halt

      Program 2

      mvie 0x0001

      stace 0x0400

      inace

      stace 0x0400

      inace

      stace 0x0404

      inace

      stace 0x0404

      ldace 0x0400

      halt


A link to my turnin .out file.
 

© This project is copyright protected by Barbara Bracken

This page is maintained by Barbara Bracken
Last Modified: 8/11/2024