diff options
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/coreview.cpp | 14 | ||||
-rw-r--r-- | qtmips_gui/coreview/instructionview.cpp | 6 | ||||
-rw-r--r-- | qtmips_gui/coreview/instructionview.h | 3 | ||||
-rw-r--r-- | qtmips_gui/programmodel.cpp | 3 |
4 files changed, 12 insertions, 14 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp index a6bd8fc..36e9a8d 100644 --- a/qtmips_gui/coreview.cpp +++ b/qtmips_gui/coreview.cpp @@ -51,8 +51,8 @@ NEW_B(TYPE, VAR, __VA_ARGS__); \ VAR->setPos(X, Y); \ } while(false) -#define NEW_I(VAR, X, Y, SIG) do { \ - NEW(InstructionView, VAR, X, Y); \ +#define NEW_I(VAR, X, Y, SIG, ...) do { \ + NEW(InstructionView, VAR, X, Y, __VA_ARGS__); \ connect(machine->core(), &machine::Core::SIG, \ VAR, &coreview::InstructionView::instruction_update); \ } while(false) @@ -350,11 +350,11 @@ CoreViewScenePipelined::CoreViewScenePipelined(machine::QtMipsMachine *machine) NEW(Latch, latch_mem_wb, 660, 70, machine, 400); latch_mem_wb->setTitle("MEM/WB"); - NEW_I(inst_fetch, 79, 2, instruction_fetched); - NEW_I(inst_dec, 275, 2, instruction_decoded); - NEW_I(inst_exec, 464, 2, instruction_executed); - NEW_I(inst_mem, 598, 2, instruction_memory); - NEW_I(inst_wrb, 660, 18, instruction_writeback); + NEW_I(inst_fetch, 79, 2, instruction_fetched, QColor(255, 173, 173)); + NEW_I(inst_dec, 275, 2, instruction_decoded, QColor(255, 212, 173)); + NEW_I(inst_exec, 464, 2, instruction_executed, QColor(193, 255, 173)); + NEW_I(inst_mem, 598, 2, instruction_memory, QColor(173, 255, 229)); + NEW_I(inst_wrb, 660, 18, instruction_writeback, QColor(255, 173, 230)); if (machine->config().hazard_unit() != machine::MachineConfig::HU_NONE) { NEW(LogicBlock, hazard_unit, SC_WIDTH/2, SC_HEIGHT - 15, "Hazard Unit"); diff --git a/qtmips_gui/coreview/instructionview.cpp b/qtmips_gui/coreview/instructionview.cpp index 6897e76..d5dbba6 100644 --- a/qtmips_gui/coreview/instructionview.cpp +++ b/qtmips_gui/coreview/instructionview.cpp @@ -49,11 +49,11 @@ using namespace coreview; #define PENW 1 ////////////////////// -InstructionView::InstructionView() : QGraphicsObject(nullptr), text(this) { +InstructionView::InstructionView(QColor bgnd) : QGraphicsObject(nullptr), text(this) { QFont f; f.setPointSize(FontSize::SIZE6); text.setFont(f); - + this->bgnd = bgnd; // Initialize to NOP instruction_update(machine::Instruction(), 0, machine::EXCAUSE_NONE); } @@ -65,7 +65,7 @@ QRectF InstructionView::boundingRect() const { void InstructionView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { painter->setPen(QPen(QColor(240, 240, 240))); if (excause == machine::EXCAUSE_NONE) - painter->setBrush(QBrush(QColor(240, 240, 240))); + painter->setBrush(QBrush(bgnd)); else painter->setBrush(QBrush(QColor(255, 100, 100))); painter->drawRoundRect(-WIDTH/2, 0, WIDTH, HEIGHT, ROUND, ROUND); diff --git a/qtmips_gui/coreview/instructionview.h b/qtmips_gui/coreview/instructionview.h index 6e39bdd..bdcaf3c 100644 --- a/qtmips_gui/coreview/instructionview.h +++ b/qtmips_gui/coreview/instructionview.h @@ -45,7 +45,7 @@ namespace coreview { class InstructionView : public QGraphicsObject { Q_OBJECT public: - InstructionView(); + InstructionView(QColor bgnd = QColor(240, 240, 240)); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); @@ -57,6 +57,7 @@ public slots: private: QGraphicsSimpleTextItem text; machine::ExceptionCause excause; + QColor bgnd; }; } diff --git a/qtmips_gui/programmodel.cpp b/qtmips_gui/programmodel.cpp index 6fda037..9023b69 100644 --- a/qtmips_gui/programmodel.cpp +++ b/qtmips_gui/programmodel.cpp @@ -135,9 +135,6 @@ QVariant ProgramModel::data(const QModelIndex &index, int role) const { } else if (address == stage_addr[STAGEADDR_MEMORY]) { QBrush bgd(QColor(173, 255, 229)); return bgd; - } else if (address == stage_addr[STAGEADDR_MEMORY]) { - QBrush bgd(QColor(173, 255, 229)); - return bgd; } else if (address == stage_addr[STAGEADDR_EXECUTE]) { QBrush bgd(QColor(193, 255, 173)); return bgd; |