From 644d250ff08bbc7342b570c8684a3a15019df33c Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Thu, 31 Jan 2019 01:13:14 +0100 Subject: Display rs, rt, rd and write register number in all stages. Signed-off-by: Pavel Pisa --- qtmips_gui/coreview.cpp | 12 +++++++++++- qtmips_machine/core.cpp | 9 ++++++++- qtmips_machine/core.h | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp index 0f10628..897f92e 100644 --- a/qtmips_gui/coreview.cpp +++ b/qtmips_gui/coreview.cpp @@ -140,6 +140,13 @@ CoreViewScene::CoreViewScene(machine::QtMipsMachine *machine) : QGraphicsScene() // Write back stage NEW_V(710, 330, writeback_value, true); // Write back value + NEW_V(205, 250, decode_rs_num_value, false, 2); + NEW_V(205, 270, decode_rt_num_value, false, 2); + + NEW_V(320, 380, decode_rt_num_value, false, 2); + NEW_V(320, 390, decode_rd_num_value, false, 2); + NEW_V(320, 500, writeback_regw_num_value, false, 2); + connect(regs, SIGNAL(open_registers()), this, SIGNAL(request_registers())); connect(mem_program, SIGNAL(open_mem()), this, SIGNAL(request_program_memory())); connect(mem_data, SIGNAL(open_mem()), this, SIGNAL(request_data_memory())); @@ -392,7 +399,10 @@ CoreViewScenePipelined::CoreViewScenePipelined(machine::QtMipsMachine *machine) NEW_V(460, 45, writeback_regw_value, false, 1); NEW_V(360, 105, decode_regw_value, false, 1); NEW_V(460, 105, execute_regw_value, false, 1); - NEW_V(560, 105, execute_regw_value, false, 1); + NEW_V(560, 105, memory_regw_value, false, 1); + + NEW_V(500, 385, execute_regw_num_value, false, 2); + NEW_V(610, 385, memory_regw_num_value, false, 2); if (machine->config().hazard_unit() == machine::MachineConfig::HU_STALL_FORWARD) { NEW_V(448, 460, execute_reg1_ff_value, false, 1); // Register 1 forward diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp index 5768d9c..f6f0cdd 100644 --- a/qtmips_machine/core.cpp +++ b/qtmips_machine/core.cpp @@ -147,6 +147,9 @@ struct Core::dtDecode Core::decode(const struct dtFetch &dt) { emit decode_memread_value((bool)(dec.flags & DM_MEMREAD)); emit decode_alusrc_value((bool)(dec.flags & DM_ALUSRC)); emit decode_regdest_value((bool)(dec.flags & DM_REGD)); + emit decode_rs_num_value(dt.inst.rs()); + emit decode_rt_num_value(dt.inst.rt()); + emit decode_rd_num_value(dt.inst.rd()); return { .inst = dt.inst, @@ -178,6 +181,7 @@ struct Core::dtExecute Core::execute(const struct dtDecode &dt) { alu_sec = dt.immediate_val; // Sign or zero extend immediate value std::uint32_t alu_val = alu_operate(dt.aluop, dt.val_rs, alu_sec, dt.inst.shamt(), regs); + std::uint8_t rwrite = dt.regd ? dt.inst.rd() : dt.inst.rt(); emit execute_alu_value(alu_val); emit execute_reg1_value(dt.val_rs); @@ -191,6 +195,7 @@ struct Core::dtExecute Core::execute(const struct dtDecode &dt) { emit execute_memwrite_value(dt.memwrite); emit execute_alusrc_value(dt.alusrc); emit execute_regdest_value(dt.regd); + emit execute_regw_num_value(rwrite); return { .inst = dt.inst, @@ -199,7 +204,7 @@ struct Core::dtExecute Core::execute(const struct dtDecode &dt) { .regwrite = regwrite, .memctl = dt.memctl, .val_rt = dt.val_rt, - .rwrite = dt.regd ? dt.inst.rd() : dt.inst.rt(), + .rwrite = rwrite, .alu_val = alu_val, }; } @@ -220,6 +225,7 @@ struct Core::dtMemory Core::memory(const struct dtExecute &dt) { emit memory_memtoreg_value(dt.memread); emit memory_memread_value(dt.memread); emit memory_memwrite_value(dt.memwrite); + emit memory_regw_num_value(dt.rwrite); return { .inst = dt.inst, @@ -233,6 +239,7 @@ void Core::writeback(const struct dtMemory &dt) { emit instruction_writeback(dt.inst); emit writeback_value(dt.towrite_val); emit writeback_regw_value(dt.regwrite); + emit writeback_regw_num_value(dt.rwrite); if (dt.regwrite) regs->write_gp(dt.rwrite, dt.towrite_val); } diff --git a/qtmips_machine/core.h b/qtmips_machine/core.h index 0c9a1b1..625fe29 100644 --- a/qtmips_machine/core.h +++ b/qtmips_machine/core.h @@ -46,6 +46,9 @@ signals: void decode_memread_value(std::uint32_t); void decode_alusrc_value(std::uint32_t); void decode_regdest_value(std::uint32_t); + void decode_rs_num_value(std::uint32_t); + void decode_rt_num_value(std::uint32_t); + void decode_rd_num_value(std::uint32_t); void execute_alu_value(std::uint32_t); void execute_reg1_value(std::uint32_t); void execute_reg2_value(std::uint32_t); @@ -58,6 +61,7 @@ signals: void execute_memread_value(std::uint32_t); void execute_alusrc_value(std::uint32_t); void execute_regdest_value(std::uint32_t); + void execute_regw_num_value(std::uint32_t); void memory_alu_value(std::uint32_t); void memory_rt_value(std::uint32_t); void memory_mem_value(std::uint32_t); @@ -65,8 +69,10 @@ signals: void memory_memtoreg_value(std::uint32_t); void memory_memwrite_value(std::uint32_t); void memory_memread_value(std::uint32_t); + void memory_regw_num_value(std::uint32_t); void writeback_value(std::uint32_t); void writeback_regw_value(std::uint32_t); + void writeback_regw_num_value(std::uint32_t); protected: virtual void do_step() = 0; -- cgit v1.2.3