aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-01-31 01:13:14 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-01-31 01:13:14 +0100
commit644d250ff08bbc7342b570c8684a3a15019df33c (patch)
tree8ce7363e153b7bc708dd016f362f0ed47daba04b /qtmips_machine
parent4154f8e31896c90cba67ac5044425df7f8fed821 (diff)
downloadqtmips-644d250ff08bbc7342b570c8684a3a15019df33c.tar.gz
qtmips-644d250ff08bbc7342b570c8684a3a15019df33c.tar.bz2
qtmips-644d250ff08bbc7342b570c8684a3a15019df33c.zip
Display rs, rt, rd and write register number in all stages.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/core.cpp9
-rw-r--r--qtmips_machine/core.h6
2 files changed, 14 insertions, 1 deletions
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;