From cdc1f889a5d302c9ad83846e1b686523f26ed423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 21 Jan 2018 20:46:16 +0100 Subject: Add instruction view to single core --- qtmips_gui/coreview.cpp | 26 ++++---------------------- qtmips_gui/coreview.h | 3 +-- qtmips_machine/core.cpp | 2 ++ qtmips_machine/core.h | 1 + 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp index e51345f..eb39a47 100644 --- a/qtmips_gui/coreview.cpp +++ b/qtmips_gui/coreview.cpp @@ -168,10 +168,11 @@ coreview::Signal *CoreViewScene::new_signal(const coreview::Connector *a, const } CoreViewSceneSimple::CoreViewSceneSimple(CoreView *view, machine::QtMipsMachine *machine) : CoreViewScene(view, machine) { - if (machine->config().delay_slot()) + NEW_I(instr_prim, 230, 60, instruction_fetched(const machine::Instruction&)); + if (machine->config().delay_slot()) { NEW(Latch, delay_slot_latch, 55, 470, machine, 25); - else - delay_slot_latch = nullptr; + NEW_I(instr_delay, 60, 500, instruction_program_counter(const machine::Instruction&)); + } coreview::Connection *con; // Fetch stage @@ -214,11 +215,6 @@ CoreViewSceneSimple::CoreViewSceneSimple(CoreView *view, machine::QtMipsMachine } } -CoreViewSceneSimple::~CoreViewSceneSimple() { - if (delay_slot_latch != nullptr) - delete delay_slot_latch; -} - CoreViewScenePipelined::CoreViewScenePipelined(CoreView *view, machine::QtMipsMachine *machine) : CoreViewScene(view, machine) { NEW(Latch, latch_if_id, 158, 70, machine, 400); latch_if_id->setTitle("IF/ID"); @@ -286,17 +282,3 @@ CoreViewScenePipelined::CoreViewScenePipelined(CoreView *view, machine::QtMipsMa con = new_bus(dc.add->connector_out(), ft.multiplex->connector_in(1)); con->setAxes({CON_AXIS_Y(360), CON_AXIS_X(480), CON_AXIS_Y(10)}); } - -CoreViewScenePipelined::~CoreViewScenePipelined() { - delete latch_if_id; - delete latch_id_ex; - delete latch_ex_mem; - delete latch_mem_wb; - delete inst_fetch; - delete inst_dec; - delete inst_exec; - delete inst_mem; - delete inst_wrb; - if (hazard_unit != nullptr) - delete hazard_unit; -} diff --git a/qtmips_gui/coreview.h b/qtmips_gui/coreview.h index ed8a8ad..d5b39c1 100644 --- a/qtmips_gui/coreview.h +++ b/qtmips_gui/coreview.h @@ -84,16 +84,15 @@ protected: class CoreViewSceneSimple : public CoreViewScene { public: CoreViewSceneSimple(CoreView *view, machine::QtMipsMachine *machine); - ~CoreViewSceneSimple(); private: + coreview::InstructionView *instr_prim, *instr_delay; coreview::Latch *delay_slot_latch; }; class CoreViewScenePipelined : public CoreViewScene { public: CoreViewScenePipelined(CoreView *view, machine::QtMipsMachine *machine); - ~CoreViewScenePipelined(); private: coreview::Latch *latch_if_id, *latch_id_ex, *latch_ex_mem, *latch_mem_wb; diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp index 9ca7b9d..fd6c6f4 100644 --- a/qtmips_machine/core.cpp +++ b/qtmips_machine/core.cpp @@ -171,6 +171,8 @@ void Core::writeback(const struct dtMemory &dt) { } void Core::handle_pc(const struct dtDecode &dt) { + emit instruction_program_counter(dt.inst); + bool branch = false; bool link = false; // TODO implement link diff --git a/qtmips_machine/core.h b/qtmips_machine/core.h index 3ff6a98..a0bc2a2 100644 --- a/qtmips_machine/core.h +++ b/qtmips_machine/core.h @@ -26,6 +26,7 @@ signals: void instruction_executed(const machine::Instruction &inst); void instruction_memory(const machine::Instruction &inst); void instruction_writeback(const machine::Instruction &inst); + void instruction_program_counter(const machine::Instruction &inst); protected: Registers *regs; -- cgit v1.2.3