aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qtmips_gui/coreview.cpp2
-rw-r--r--qtmips_gui/coreview.h1
-rw-r--r--qtmips_gui/coreview/programcounter.cpp7
-rw-r--r--qtmips_gui/coreview/programcounter.h9
-rw-r--r--qtmips_gui/mainwindow.cpp1
-rw-r--r--qtmips_gui/programdock.cpp8
-rw-r--r--qtmips_gui/programdock.h5
7 files changed, 33 insertions, 0 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
index eb39a47..d811208 100644
--- a/qtmips_gui/coreview.cpp
+++ b/qtmips_gui/coreview.cpp
@@ -140,6 +140,8 @@ CoreViewScene::CoreViewScene(CoreView *view, machine::QtMipsMachine *machine) :
connect(regs, SIGNAL(open_registers()), this, SIGNAL(request_registers()));
connect(mem_program, SIGNAL(open_mem()), this, SIGNAL(request_program_memory()));
connect(mem_data, SIGNAL(open_mem()), this, SIGNAL(request_data_memory()));
+ connect(ft.pc, SIGNAL(open_program()), this, SIGNAL(request_program_memory()));
+ connect(ft.pc, SIGNAL(jump_to_pc(std::uint32_t)), this, SIGNAL(request_jump_to_program_counter(std::uint32_t)));
}
CoreViewScene::~CoreViewScene() {
diff --git a/qtmips_gui/coreview.h b/qtmips_gui/coreview.h
index d5b39c1..5f74f4f 100644
--- a/qtmips_gui/coreview.h
+++ b/qtmips_gui/coreview.h
@@ -40,6 +40,7 @@ signals:
void request_registers();
void request_data_memory();
void request_program_memory();
+ void request_jump_to_program_counter(std::uint32_t addr);
protected:
coreview::ProgramMemory *mem_program;
diff --git a/qtmips_gui/coreview/programcounter.cpp b/qtmips_gui/coreview/programcounter.cpp
index ab7d49b..5d34fac 100644
--- a/qtmips_gui/coreview/programcounter.cpp
+++ b/qtmips_gui/coreview/programcounter.cpp
@@ -10,6 +10,8 @@ using namespace coreview;
//////////////////////
ProgramCounter::ProgramCounter(machine::QtMipsMachine *machine) : QGraphicsObject(nullptr), name("PC", this), value(this) {
+ registers = machine->registers();
+
QFont font;
font.setPointSize(7);
@@ -49,6 +51,11 @@ const Connector *ProgramCounter::connector_out() const {
return con_out;
}
+void ProgramCounter::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event __attribute__((unused))) {
+ emit open_program();
+ emit jump_to_pc(registers->read_pc());
+}
+
void ProgramCounter::pc_update(std::uint32_t val) {
value.setText(QString("0x") + QString::number(val, 16));
}
diff --git a/qtmips_gui/coreview/programcounter.h b/qtmips_gui/coreview/programcounter.h
index c60ad36..6b5772a 100644
--- a/qtmips_gui/coreview/programcounter.h
+++ b/qtmips_gui/coreview/programcounter.h
@@ -20,10 +20,19 @@ public:
const Connector *connector_in() const;
const Connector *connector_out() const;
+signals:
+ void open_program();
+ void jump_to_pc(std::uint32_t addr);
+
+protected:
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+
private slots:
void pc_update(std::uint32_t val);
private:
+ const machine::Registers *registers;
+
QGraphicsSimpleTextItem name;
QGraphicsSimpleTextItem value;
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index 0f5d11a..21581d2 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -100,6 +100,7 @@ void MainWindow::create_core(const machine::MachineConfig &config) {
connect(corescene, SIGNAL(request_registers()), this, SLOT(show_registers()));
connect(corescene, SIGNAL(request_program_memory()), this, SLOT(show_program()));
connect(corescene, SIGNAL(request_data_memory()), this, SLOT(show_memory()));
+ connect(corescene, SIGNAL(request_jump_to_program_counter(std::uint32_t)), program, SLOT(jump_to_pc(std::uint32_t)));
// Setup docks
registers->setup(machine);
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp
index 3d881df..70d6a83 100644
--- a/qtmips_gui/programdock.cpp
+++ b/qtmips_gui/programdock.cpp
@@ -45,6 +45,10 @@ void ProgramView::setup(machine::QtMipsMachine *machine) {
cb_single->setCurrentIndex(cb_pipelined->currentIndex() == 0 ? 0 : 1);
}
+void ProgramView::jump_to_pc(std::uint32_t addr) {
+ set_focus(addr);
+}
+
QList<QWidget*> ProgramView::row_widget(std::uint32_t address, QWidget *parent) {
QList<QWidget*> widgs;
QLabel *l;
@@ -86,3 +90,7 @@ ProgramDock::ProgramDock(QWidget *parent) : QDockWidget(parent) {
void ProgramDock::setup(machine::QtMipsMachine *machine) {
view->setup(machine);
}
+
+void ProgramDock::jump_to_pc(std::uint32_t addr) {
+ view->jump_to_pc(addr);
+}
diff --git a/qtmips_gui/programdock.h b/qtmips_gui/programdock.h
index 9ed0896..156c380 100644
--- a/qtmips_gui/programdock.h
+++ b/qtmips_gui/programdock.h
@@ -16,6 +16,8 @@ public:
void setup(machine::QtMipsMachine*);
+ void jump_to_pc(std::uint32_t);
+
protected:
QList<QWidget*> row_widget(std::uint32_t address, QWidget *parent);
@@ -35,6 +37,9 @@ public:
void setup(machine::QtMipsMachine *machine);
+public slots:
+ void jump_to_pc(std::uint32_t);
+
private:
ProgramView *view;
};