aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qtmips_gui/coreview.cpp14
-rw-r--r--qtmips_gui/coreview/value.cpp6
-rw-r--r--qtmips_gui/coreview/value.h4
3 files changed, 14 insertions, 10 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
index b360520..040c86d 100644
--- a/qtmips_gui/coreview.cpp
+++ b/qtmips_gui/coreview.cpp
@@ -178,12 +178,12 @@ CoreViewScene::CoreViewScene(machine::QtMipsMachine *machine) : QGraphicsScene()
// Write back stage
NEW_V(710, 330, writeback_value, true); // Write back value
- NEW_V(205, 250, decode_rs_num_value, false, 2);
- NEW_V(205, 270, decode_rt_num_value, false, 2);
+ NEW_V(205, 250, decode_rs_num_value, false, 2, 0, 10);
+ NEW_V(205, 270, decode_rt_num_value, false, 2, 0, 10);
- NEW_V(320, 380, decode_rt_num_value, false, 2);
- NEW_V(320, 390, decode_rd_num_value, false, 2);
- NEW_V(320, 500, writeback_regw_num_value, false, 2);
+ NEW_V(320, 380, decode_rt_num_value, false, 2, 0, 10);
+ NEW_V(320, 390, decode_rd_num_value, false, 2, 0, 10);
+ NEW_V(320, 500, writeback_regw_num_value, false, 2, 0, 10);
connect(regs, SIGNAL(open_registers()), this, SIGNAL(request_registers()));
connect(mem_program, SIGNAL(open_mem()), this, SIGNAL(request_program_memory()));
@@ -439,8 +439,8 @@ CoreViewScenePipelined::CoreViewScenePipelined(machine::QtMipsMachine *machine)
NEW_V(460, 105, execute_regw_value, false, 1);
NEW_V(560, 105, memory_regw_value, false, 1);
- NEW_V(500, 385, execute_regw_num_value, false, 2);
- NEW_V(610, 385, memory_regw_num_value, false, 2);
+ NEW_V(500, 385, execute_regw_num_value, false, 2, 0, 10);
+ NEW_V(610, 385, memory_regw_num_value, false, 2, 0, 10);
if (machine->config().hazard_unit() == machine::MachineConfig::HU_STALL_FORWARD) {
NEW_V(448, 460, execute_reg1_ff_value, false, 1); // Register 1 forward to ALU
diff --git a/qtmips_gui/coreview/value.cpp b/qtmips_gui/coreview/value.cpp
index 12f7a55..9a3ab09 100644
--- a/qtmips_gui/coreview/value.cpp
+++ b/qtmips_gui/coreview/value.cpp
@@ -41,9 +41,11 @@ using namespace coreview;
#define LETWIDTH 7
// TODO orientation
-Value::Value(bool vertical, unsigned width, std::uint32_t init_val) : QGraphicsObject(nullptr) {
+Value::Value(bool vertical, unsigned width, std::uint32_t init_val,
+ unsigned a_base) : QGraphicsObject(nullptr) {
wid = width;
val = init_val;
+ base = a_base;
this->vertical = vertical;
}
@@ -68,7 +70,7 @@ void Value::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __at
painter->setBackgroundMode(Qt::OpaqueMode);
painter->drawRect(rect);
painter->setBackgroundMode(Qt::TransparentMode);
- QString str = QString("%1").arg(val, wid, 16, QChar('0'));
+ QString str = QString("%1").arg(val, wid, base, QChar('0'));
if (vertical) {
rect.setHeight(HEIGHT + 1);
for (unsigned i = 0; i < wid; i++) {
diff --git a/qtmips_gui/coreview/value.h b/qtmips_gui/coreview/value.h
index d6cac8a..755a9b2 100644
--- a/qtmips_gui/coreview/value.h
+++ b/qtmips_gui/coreview/value.h
@@ -44,7 +44,8 @@ namespace coreview {
class Value : public QGraphicsObject {
Q_OBJECT
public:
- Value(bool vertical = false, unsigned width = 8, unsigned init_val = 0); // width is for number of character to be shown from number
+ Value(bool vertical = false, unsigned width = 8,
+ unsigned init_val = 0, unsigned base = 16); // width is for number of character to be shown from number
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@@ -57,6 +58,7 @@ protected:
private:
unsigned wid;
+ unsigned base;
bool vertical;
};