mipt-mips
mipt-mips copied to clipboard
Add unit tests for bypass module
Please follow:
- https://github.com/MIPT-ILab/mipt-mips/wiki/Data-Bypass-and-Scoreboard
- https://github.com/MIPT-ILab/mipt-mips/wiki/Unit-Tests
- Lecture 8; Advanced Pipelining
The idea is to model pipeline in a small scale:
DataBypass db( 7);
MIPS32Instr load( "ld");
load->dst = MIPSRegister::from_cpu_index( 1);
MIPS32Instr add( "add");
add->src = MIPSRegister::from_cpu_index( 1);
db.trace_new_instr( load);
db.update(); // Go to next cycle
CHECK( db.is_stall( add) ); // Add should have a data hazard
Do I have to test data_bypass_interface.h
as well?
Disclaimer: you have 10 points already in this term. Any additional work will not affect your final result.
class RegisterState
is trivial, we'll re-write it as a simple data structure later,
class BypassCommand
may be tested
Ok. How do I add new unit_test to the project?
Add the name of the file to that list:
https://github.com/MIPT-ILab/mipt-mips/blob/5fb85fc34ba081c1a3a883605e6a9ebfa86ab5da/simulator/CMakeLists.txt#L59-L82
I’ve spent a lot of time figuring out what FuncInstr in DataBypass template stands for and I still couldn’t find the answer. The question is how to create an object of this class so it’ll have correct FuncInstr? All my attempts of filling this field led me to the conflict with missing methods.
You may use RISC-V instruction
DataBypass<RISCVInstr<uint64>> bypass;
or create a dummy instruction
struct DummyInstr
{
// necessary methods and type definitions
};
DataBypass<DummyInstr> bypass;
Unfortunately, I'm not able to finish this issue until this night due to studies. My apologies.
Thank you for notification.