aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-31 20:41:05 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-31 20:41:05 +0200
commitf936893d4c5be40ebf1c7b6a9341ffce4c82ea03 (patch)
treed58365b9604154c66d202f104469a4094be1ebf3 /qtmips_gui
parent8de3836bee7b844b75564f12b700c323c4f3d53b (diff)
downloadqtmips-f936893d4c5be40ebf1c7b6a9341ffce4c82ea03.tar.gz
qtmips-f936893d4c5be40ebf1c7b6a9341ffce4c82ea03.tar.bz2
qtmips-f936893d4c5be40ebf1c7b6a9341ffce4c82ea03.zip
Set gray background to stalled instructions/idled stages.
This allows to easier identify unused pipeline stages. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/coreview/instructionview.cpp11
-rw-r--r--qtmips_gui/coreview/instructionview.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/instructionview.cpp b/qtmips_gui/coreview/instructionview.cpp
index d5dbba6..b076cf1 100644
--- a/qtmips_gui/coreview/instructionview.cpp
+++ b/qtmips_gui/coreview/instructionview.cpp
@@ -54,8 +54,9 @@ InstructionView::InstructionView(QColor bgnd) : QGraphicsObject(nullptr), text(t
f.setPointSize(FontSize::SIZE6);
text.setFont(f);
this->bgnd = bgnd;
+ valid = false;
// Initialize to NOP
- instruction_update(machine::Instruction(), 0, machine::EXCAUSE_NONE);
+ instruction_update(machine::Instruction(), 0, machine::EXCAUSE_NONE, false);
}
QRectF InstructionView::boundingRect() const {
@@ -65,15 +66,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)));
if (excause == machine::EXCAUSE_NONE)
- painter->setBrush(QBrush(bgnd));
+ if (valid)
+ painter->setBrush(QBrush(bgnd));
+ else
+ 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, machine::ExceptionCause excause) {
+ std::uint32_t inst_addr, machine::ExceptionCause excause, bool valid) {
+ this->valid = valid;
QRectF prev_box = boundingRect();
text.setText(i.to_str(inst_addr));
this->excause = excause;
diff --git a/qtmips_gui/coreview/instructionview.h b/qtmips_gui/coreview/instructionview.h
index bdcaf3c..59dfad2 100644
--- a/qtmips_gui/coreview/instructionview.h
+++ b/qtmips_gui/coreview/instructionview.h
@@ -52,12 +52,13 @@ public:
public slots:
void instruction_update(const machine::Instruction &i, std::uint32_t inst_addr,
- machine::ExceptionCause excause);
+ machine::ExceptionCause excause, bool valid);
private:
QGraphicsSimpleTextItem text;
machine::ExceptionCause excause;
QColor bgnd;
+ bool valid;
};
}