diff options
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/coreview.cpp | 9 | ||||
-rw-r--r-- | qtmips_gui/coreview/multitext.cpp | 9 | ||||
-rw-r--r-- | qtmips_gui/coreview/multitext.h | 3 |
3 files changed, 14 insertions, 7 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; }; } |