cache.circ file to gradescope. You do not need to submit your test sequence from part D, but make sure you have this signed off before the lab deadline.
In this lab, you will implement a direct-mapped cache for read-only memory in Logisim.
The memory system you are implementing will use eight bit addresses and a four-entry cache with four-byte cache lines. Before starting your implementation, answer the following questions:
Have the instructor or a mentor approve your answers before moving on to the next part of the lab.
For this part of the lab you will implement a single entry for the direct-mapped cache.
To start, download the cache.circ and cache-test.circ starter circuit files.
The file cache-test.circ contains an instance of your cache connected to a read-only memory element, a clock, an address input, and data output.
This component will be useful in a later part of the lab.
For now, open cache.circ in Logisim and double-click the “cache-entry” subcircuit to open it.
Remember that you can start Logisim with the following shell command:
$ java -jar /home/curtsinger/bin/logisim.jar &
The “cache-entry” subcircuit implements a single entry in a cache. The subcircuit in the provided Logisim file has the following inputs:
data_intagclockdata_in input and the tag. Reading from the cache entry is always enabled.The subcircuit also has the following outputs:
data_outmissTo complete this part of the lab you will need to implement a cache entry in this subcircuit. You will need registers to hold
Make sure your cache entry correctly reports a miss, and will store both the data input and tag on the clock input’s falling edge. We want these registers to update on the falling edge rather than the rising edge to allow time for the ROM read to occur while the clock input is high. At the end of the high clock signal, the registers should store the value from ROM. Warning: The default for registers in Logisim is to store on the rising edge. Do not forget to change your registers to update on the falling edge.
Do not add any additional inputs or outputs to this subcircuit or edit the subcircuit’s appearance.
Ask the instructor or a mentor to sign off on this part of the lab before moving on.
Once you have completed your “cache-entry” subcircuit, you can use it to build your complete cache.
To implement caching behavior, the “main” subcircuit is designed to sit in front of a ROM element.
(You can see an example use of this cache in the cache-test.circ circuit.)
While the “main” subcircuit has been operationally “completed” for you, it does not yet implement a cache;
instead, it passes along all requests to memory.
Open the cache-test.circ file. You should see the following components:
Address inputData outputYou should use this circuit to test your cache implementation as you complete it.
Note that you will likely need to close and re-open cache-test.circ each time you edit your cache.circ implementation.
If you look in the “main” subcircuit of cache.circ, you should see some basic components already in place.
First, let’s look at the main cache inputs and output:
address inputread enable inputdata_out outputIn addition to these primary connections for the cache, the “main” subcircuit has three pins to interface with the ROM element:
ROM read address outputROM read enable outputROM data in inputBefore completing your cache you will need to delete the wire connecting the read enable input to the ROM read enable output. The other components can stay in place, although you may need to move or modify them slightly.
Do not add any additional inputs or outputs to this subcircuit or edit the subcircuit’s appearance.
Use four copies of your “cache-entry” subcircuit to implement a four-entry direct-mapped cache:
read enable input is on, request data from ROM by turning on the ROM read enable output. When the read enable input falls, the registers in the selected cache entry will store the value read from ROM.You do not need to have anyone sign off on this part of the lab; instead, move on to the next part where you will design an access sequence to test your cache implementation.
Now that you have a (hopefully) working cache, you will need to design an exhaustive test for the cache. It is not enough just to verify that your cache returns the correct data; it must also access memory at the appropriate times. For example, if you access an address twice in a row, the cache should only access memory the first time.
Write down a series of memory accesses that you can perform using the cache-test.circ test harness to verify that your cache has the following properties:
Write out your access pattern as well as the expected behavior for each access:
Verify that your cache has the expected behavior. When you have completed your tests, ask the instructor or a mentor to sign off on your tests. Be prepared to re-run your tests, and to explain how your access sequence demonstrates each of the four properties above.