diff options
author | Karel Kočí <cynerd@email.cz> | 2018-04-08 11:55:52 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-04-08 11:55:52 +0200 |
commit | 15dbd208fa6c1ac4dc0684c95c43cc40b2462cbf (patch) | |
tree | c360138011f0312860356ba1ff95387cb468588d /qtmips_machine/qtmipsmachine.cpp | |
parent | 3652d0a13857b7c341fb08a882e12c0b2205c8c0 (diff) | |
download | qtmips-15dbd208fa6c1ac4dc0684c95c43cc40b2462cbf.tar.gz qtmips-15dbd208fa6c1ac4dc0684c95c43cc40b2462cbf.tar.bz2 qtmips-15dbd208fa6c1ac4dc0684c95c43cc40b2462cbf.zip |
Integrate cache with rest of the machine core
Diffstat (limited to 'qtmips_machine/qtmipsmachine.cpp')
-rw-r--r-- | qtmips_machine/qtmipsmachine.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp index e96924a..4a2b0f2 100644 --- a/qtmips_machine/qtmipsmachine.cpp +++ b/qtmips_machine/qtmipsmachine.cpp @@ -13,11 +13,13 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) { regs = new Registers(); mem = new Memory(*mem_program_only); + cch_program = new Cache(mem, &cc.cache_program()); + cch_data = new Cache(mem, &cc.cache_data()); if (cc.pipelined()) - cr = new CorePipelined(regs, mem, cc.hazard_unit()); + cr = new CorePipelined(regs, cch_program, cch_data, cc.hazard_unit()); else - cr = new CoreSingle(regs, mem, cc.delay_slot()); + cr = new CoreSingle(regs, cch_program, cch_data, cc.delay_slot()); run_t = new QTimer(this); set_speed(0); // In default run as fast as possible @@ -40,8 +42,12 @@ const Memory *QtMipsMachine::memory() { return mem; } -const Cache *QtMipsMachine::cache() { - return cch; +const Cache *QtMipsMachine::cache_program() { + return cch_program; +} + +const Cache *QtMipsMachine::cache_data() { + return cch_data; } const Core *QtMipsMachine::core() { @@ -105,7 +111,8 @@ void QtMipsMachine::restart() { pause(); regs->reset(); mem->reset(*mem_program_only); - // TODO cache + cch_program->reset(); + cch_data->reset(); cr->reset(); set_status(ST_READY); } |