Homework 7 - Cashier: the naive cache simulator

pengcheng2

Homework 7 - Cashier: the naive cache simulator

Introduction

Exploiting locality in the memory access with data cache is one of the key idea in CS110 Computer Architecture.
This homework helps you to consolidate your understanding of caching through implementing cashier, the simple cache simulator.

Starter code

Download the code template via this link to starter.tar.
Use the command tar xvf starter.tar to extract all the files from the archive file.

You should see the following directory structure

# output of `exa --tree starter`
starter
├── cashier.c
├── cashier.h
├── check_comment.py
├── main.c
└── Makefile

Task description

Give correct implementation for the empty functions in cashier.c so you get a data cache simulator that:

Short explanation of the structure members, function parameters can be found in cashier.h.
Brief description of the expected behavior are also given as comments in cashier.c.
You should at least read through them before start composing your solution.

Specifications

A few rules

Spec on each function

Testing on local machine

A little feedback on each submission is provided for your convenience.
With that said, please do NOT use Autolab OJ for debugging.
The grading feedback will not be sufficient for identifying and fixing bugs in your program.

We strongly recommend you to construct your own test cases for validating the solution on your local machine.
You really should do that every time before submission.

The dot_test function in main.c servers as an example of the test cases.

You are not expected to change the environmental interfaces.

Code quality requirements

We ask you to write code of high quality and easy to maintain. It is hard to check code quality automatically. So we only check if your code bears enough number of comments.
To put it simple, we ask you to include at least one line of comment in every six non-empty lines of code (preprocessing directives such as #define and #if, lines only contains brackets { } ( ) [ ] are not counted towards code lines).
Submission with inadequate comments will receive zero score.

Submission

Create a tarball hw7.tar containing your cashier.c and upload it to Autolab.
The hw7.tar target in Makefile can do this job for you.

Contacts

You are encouraged to post the challenges you encountered on piazza. We will appreciate it if you can document the process of overcoming them. A mere sentence solved is not going to help anyone.

Contact pengcheng2 if you have any issue regarding this homework.
Bug reports and language use fix-ups are welcome.