RISC-V Emulation - Analysis - Cache Simulation
Code due Mon Mar 25th by 11:59pm in your Project03 GitHub repo
Interactive Grading on Tue Mar 26th and Wed Mar 27th
Links
Tests: https://github.com/USF-CS631-S24/tests
Autograder: https://github.com/phpeterson-usf/autograder
Requirements
You will write an emulator in C for a subset of the RISC-V Instruction Set Architecture (ISA).
- You do not have to emulate the entire instruction set; just enough to emulate the following programs:
quadratic_s
(given)midpoint_s
(given)max3_s
(given)to_upper
(given)get_bitseq_s
(given)get_bitseq_signed_s
(given)swap_s
(given)sort_s
(given)fib_rec_s
(yours)
Your emulator will need the logic (decoding and emulating instructions) and state (
struct rv_state_st
) from lab05- Your emulator will support dynamic analysis of instruction execution. Here are the metrics you will collect:
- # of instructions executed (
i_count
) - # of I-type and R-type instructions executed (
ir_count
) - # of LOAD instructions executed (
ld_count
) - # of STORE instructions executed (
st_count
) - # of jump instructions executed including
j
,jal
,jalr
(j_count
) - # of conditional branches taken (
b_taken
) - # of conditional branches not taken (
b_not_taken
)
- # of instructions executed (
- Your emulator will include an implementation of a processor cache simulator for the following cache types:
- A direct mapped cache with a block size on 1 word (given)
- A direct mapped cache with a block size of 4 words
- A 4-way set associative cache with a block size of 1 word and LRU slot replacement
- A 4-way set associative cache with a block size of 4 words and LRU slot replacement
Given
- In lecture and lab, we will:
- Illustrate how to decode machine code and execute the operations specified
- Illustrate a direct-mapped cache and describe the data structures and algorithms required for a set-associative cache
- We have written a Guide to Cache Memory to help you develop your cache implementation
- In-class coding will be pushed to Github. You will provide the rest of the code yourself
- We will provide autograder test cases for the emulation targets
Grading Rubric
Automated testing
90 pts: Automated tests
Interactive grading
10 pts: code walkthrough including, but not limited to, your implementation of dynamic analysis and the instruction cache.
Code Quality
You need to have a clean repo, consistent naming and indentation, no dead code, no unnecessarily complex code. Any deductions can be earned back.
Extra Credit
- (5 points) Implement the RISC-V emulator in either Rust (https://www.rust-lang.org) or Zig (https://ziglang.org). You can only get credit for re-implementation in one language.