mipt-mips icon indicating copy to clipboard operation
mipt-mips copied to clipboard

Add unit tests for bypass module

Open pavelkryukov opened this issue 5 years ago • 9 comments

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

pavelkryukov avatar Nov 23 '18 22:11 pavelkryukov

Do I have to test data_bypass_interface.h as well?

bova-ev avatar Apr 20 '19 14:04 bova-ev

Disclaimer: you have 10 points already in this term. Any additional work will not affect your final result.

pavelkryukov avatar Apr 20 '19 14:04 pavelkryukov

class RegisterState is trivial, we'll re-write it as a simple data structure later, class BypassCommand may be tested

pavelkryukov avatar Apr 20 '19 14:04 pavelkryukov

Ok. How do I add new unit_test to the project?

bova-ev avatar Apr 20 '19 14:04 bova-ev

Add the name of the file to that list:

https://github.com/MIPT-ILab/mipt-mips/blob/5fb85fc34ba081c1a3a883605e6a9ebfa86ab5da/simulator/CMakeLists.txt#L59-L82

pavelkryukov avatar Apr 20 '19 14:04 pavelkryukov

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.

bova-ev avatar Apr 21 '19 14:04 bova-ev

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;

pavelkryukov avatar Apr 21 '19 18:04 pavelkryukov

Unfortunately, I'm not able to finish this issue until this night due to studies. My apologies.

bova-ev avatar May 07 '19 16:05 bova-ev

Thank you for notification.

pavelkryukov avatar May 07 '19 16:05 pavelkryukov