aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-18 20:49:08 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-18 20:49:08 +0100
commit0ccd55c011f72b5bb7d11a1f683e5ac949702417 (patch)
tree16d004557afeb5b023c902fddc3acdcf6d5bc453 /qtmips_machine
parent1ef78a15bdac490cf5e0b74fcde8539719f4bfe6 (diff)
downloadqtmips-0ccd55c011f72b5bb7d11a1f683e5ac949702417.tar.gz
qtmips-0ccd55c011f72b5bb7d11a1f683e5ac949702417.tar.bz2
qtmips-0ccd55c011f72b5bb7d11a1f683e5ac949702417.zip
Report forward and stall for branches and add forward to execution phase.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/core.cpp10
-rw-r--r--qtmips_machine/core.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp
index e6f0971..a282807 100644
--- a/qtmips_machine/core.cpp
+++ b/qtmips_machine/core.cpp
@@ -370,7 +370,12 @@ struct Core::dtExecute Core::execute(const struct dtDecode &dt) {
emit execute_alusrc_value(dt.alusrc);
emit execute_regdest_value(dt.regd);
emit execute_regw_num_value(dt.rwrite);
- emit execute_stall_value(dt.stall);
+ if (dt.stall)
+ emit execute_stall_forward_value(1);
+ else if (dt.ff_rs != FORWARD_NONE || dt.ff_rt != FORWARD_NONE)
+ emit execute_stall_forward_value(2);
+ else
+ emit execute_stall_forward_value(0);
return {
.inst = dt.inst,
@@ -612,6 +617,7 @@ CorePipelined::CorePipelined(Registers *regs, MemoryAccess *mem_program, MemoryA
void CorePipelined::do_step(bool skip_break) {
bool stall = false;
+ bool branch_stall = false;
bool excpt_in_progress = false;
std::uint32_t jump_branch_pc = dt_m.inst_addr;
@@ -697,6 +703,7 @@ void CorePipelined::do_step(bool skip_break) {
((dt_d.bjr_req_rs && dt_d.inst.rs() == dt_e.rwrite) ||
(dt_d.bjr_req_rt && dt_d.inst.rt() == dt_e.rwrite))) {
stall = true;
+ branch_stall = true;
} else {
if (hazard_unit != MachineConfig::HU_STALL_FORWARD || dt_m.memtoreg) {
if (dt_m.rwrite != 0 && dt_m.regwrite &&
@@ -719,6 +726,7 @@ void CorePipelined::do_step(bool skip_break) {
emit forward_m_d_rs_value(dt_d.forward_m_d_rs);
emit forward_m_d_rt_value(dt_d.forward_m_d_rt);
}
+ emit branch_forward_value((dt_d.forward_m_d_rs || dt_d.forward_m_d_rt)? 2: branch_stall);
#if 0
if (stall)
printf("STALL\n");
diff --git a/qtmips_machine/core.h b/qtmips_machine/core.h
index 950fc0c..8140f61 100644
--- a/qtmips_machine/core.h
+++ b/qtmips_machine/core.h
@@ -136,7 +136,7 @@ signals:
void execute_alusrc_value(std::uint32_t);
void execute_regdest_value(std::uint32_t);
void execute_regw_num_value(std::uint32_t);
- void execute_stall_value(std::uint32_t);
+ void execute_stall_forward_value(std::uint32_t);
void memory_inst_addr_value(std::uint32_t);
void memory_alu_value(std::uint32_t);
void memory_rt_value(std::uint32_t);
@@ -153,6 +153,7 @@ signals:
void writeback_regw_num_value(std::uint32_t);
void hu_stall_value(std::uint32_t);
+ void branch_forward_value(std::uint32_t);
void stop_on_exception_reached();