aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qtmips_gui/coreview.cpp9
-rw-r--r--qtmips_gui/coreview/multitext.cpp9
-rw-r--r--qtmips_gui/coreview/multitext.h3
-rw-r--r--qtmips_machine/core.cpp10
-rw-r--r--qtmips_machine/core.h3
5 files changed, 25 insertions, 9 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
index 89644ec..2e8ec5c 100644
--- a/qtmips_gui/coreview.cpp
+++ b/qtmips_gui/coreview.cpp
@@ -111,8 +111,8 @@ CoreViewScene::CoreViewScene(machine::QtMipsMachine *machine) : QGraphicsScene()
{machine::EXCAUSE_HWBREAK, "HWBREAK"},
{machine::EXCAUSE_TRAP, "TRAP"},
{machine::EXCAUSE_OVERFLOW, "OVERFLOW"}};
-
- NEW_MULTI(mm.multi_excause, 602, 447, memory_excause_value, excause_map);
+ NEW_MULTI(mm.multi_excause, 602, 447, memory_excause_value, excause_map, true);
+ new_label("Exception", 595, 437);
// WriteBack stage
NEW(Multiplexer, wb.mem_or_reg, 690, 252, 2, true);
NEW(Junction, wb.j_reg_write_val, 411, 510);
@@ -342,8 +342,9 @@ CoreViewScenePipelined::CoreViewScenePipelined(machine::QtMipsMachine *machine)
if (machine->config().hazard_unit() != machine::MachineConfig::HU_NONE) {
NEW(LogicBlock, hazard_unit, SC_WIDTH/2, SC_HEIGHT - 15, "Hazard Unit");
hazard_unit->setSize(SC_WIDTH - 100, 12);
- static QMap<std::uint32_t, QString> stall_map = {{0, "NORMAL"},{1, "STALL"}};
- NEW_MULTI(hu.multi_stall, 480, 447, execute_stall_value, stall_map);
+ static QMap<std::uint32_t, QString> stall_map = {{0, "NORMAL"},{1, "STALL"},{2, "FORWARD"}};
+ NEW_MULTI(hu.multi_stall, 480, 447, execute_stall_forward_value, stall_map);
+ NEW_MULTI(hu.multi_stall, 310, 340, branch_forward_value, stall_map);
NEW_MULTI(hu.multi_stall, 250, SC_HEIGHT - 15, hu_stall_value, stall_map);
}
coreview::Connection *con;
diff --git a/qtmips_gui/coreview/multitext.cpp b/qtmips_gui/coreview/multitext.cpp
index d28b5be..1658b55 100644
--- a/qtmips_gui/coreview/multitext.cpp
+++ b/qtmips_gui/coreview/multitext.cpp
@@ -47,13 +47,14 @@ using namespace coreview;
#define PENW 1
//////////////////////
-MultiText::MultiText(QMap<std::uint32_t, QString> value_map) :
+MultiText::MultiText(QMap<std::uint32_t, QString> value_map, bool nonzero_red) :
QGraphicsObject(nullptr), text(this) {
QFont f;
f.setPointSize(6);
text.setFont(f);
this->value_map = value_map;
+ this->nonzero_red = nonzero_red;
multitext_update(0);
}
@@ -64,7 +65,11 @@ QRectF MultiText::boundingRect() const {
void MultiText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) {
painter->setPen(QPen(QColor(240, 240, 240)));
- painter->setBrush(QBrush(QColor(240, 240, 240)));
+ if (value != 0 && nonzero_red)
+ painter->setBrush(QBrush(QColor(255, 100, 100)));
+ else
+ painter->setBrush(QBrush(QColor(240, 240, 240)));
+
painter->drawRoundRect(-WIDTH/2, 0, WIDTH, HEIGHT, ROUND, ROUND);
}
diff --git a/qtmips_gui/coreview/multitext.h b/qtmips_gui/coreview/multitext.h
index 9d1f0ab..48c9652 100644
--- a/qtmips_gui/coreview/multitext.h
+++ b/qtmips_gui/coreview/multitext.h
@@ -46,7 +46,7 @@ namespace coreview {
class MultiText : public QGraphicsObject {
Q_OBJECT
public:
- MultiText(QMap<std::uint32_t, QString> value_map);
+ MultiText(QMap<std::uint32_t, QString> value_map, bool nonzero_red = false);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@@ -58,6 +58,7 @@ private:
QGraphicsSimpleTextItem text;
std::uint32_t value;
QMap<std::uint32_t, QString> value_map;
+ std::uint32_t nonzero_red;
};
}
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();