aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-11 22:19:23 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-11 22:19:23 +0100
commit54d7ef4272673e55b6a4324373d11875280dad84 (patch)
treefc59ca3ca89408e6c8ceda594ed9994ffcd5aa90 /qtmips_gui
parentbb7092e96401e4c89c44773c932788c9b0f87b53 (diff)
downloadqtmips-54d7ef4272673e55b6a4324373d11875280dad84.tar.gz
qtmips-54d7ef4272673e55b6a4324373d11875280dad84.tar.bz2
qtmips-54d7ef4272673e55b6a4324373d11875280dad84.zip
Display red background for instruction causing exception and skip HW breakpoint for first cycle after resume.
Instruction for stage is updated when given stage is flushed as well. But other signals are left intact, it is duty of memory stage to discard effect of instruction causing interrupt. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/coreview/instructionview.cpp13
-rw-r--r--qtmips_gui/coreview/instructionview.h4
2 files changed, 13 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/instructionview.cpp b/qtmips_gui/coreview/instructionview.cpp
index d989b7b..495edfb 100644
--- a/qtmips_gui/coreview/instructionview.cpp
+++ b/qtmips_gui/coreview/instructionview.cpp
@@ -52,7 +52,8 @@ InstructionView::InstructionView() : QGraphicsObject(nullptr), text(this) {
f.setPointSize(6);
text.setFont(f);
- instruction_update(machine::Instruction(), 0); // Initialize to NOP
+ // Initialize to NOP
+ instruction_update(machine::Instruction(), 0, machine::EXCAUSE_NONE);
}
QRectF InstructionView::boundingRect() const {
@@ -61,13 +62,19 @@ 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)));
- painter->setBrush(QBrush(QColor(240, 240, 240)));
+ if (excause == machine::EXCAUSE_NONE)
+ painter->setBrush(QBrush(QColor(240, 240, 240)));
+ else
+ painter->setBrush(QBrush(QColor(255, 100, 100)));
painter->drawRoundRect(-WIDTH/2, 0, WIDTH, HEIGHT, ROUND, ROUND);
}
-void InstructionView::instruction_update(const machine::Instruction &i, std::uint32_t inst_addr) {
+void InstructionView::instruction_update(const machine::Instruction &i,
+ std::uint32_t inst_addr, machine::ExceptionCause excause) {
+
QRectF prev_box = boundingRect();
text.setText(i.to_str(inst_addr));
+ this->excause = excause;
QRectF box = text.boundingRect();
text.setPos(-box.width()/2, GAP);
update(prev_box.united(boundingRect()));
diff --git a/qtmips_gui/coreview/instructionview.h b/qtmips_gui/coreview/instructionview.h
index 8c63fc1..6e39bdd 100644
--- a/qtmips_gui/coreview/instructionview.h
+++ b/qtmips_gui/coreview/instructionview.h
@@ -51,10 +51,12 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
public slots:
- void instruction_update(const machine::Instruction &i, std::uint32_t inst_addr);
+ void instruction_update(const machine::Instruction &i, std::uint32_t inst_addr,
+ machine::ExceptionCause excause);
private:
QGraphicsSimpleTextItem text;
+ machine::ExceptionCause excause;
};
}