aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-03 10:45:32 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-03 10:45:32 +0200
commitf33f424ccf7ca57aae95566663c8f31956fbdf8f (patch)
treed37c9ab8e5e306f79432cf8e9b3ad52db3163f10 /qtmips_gui
parent9cef3efa2251833883e0f1fcf47138776e2a45aa (diff)
downloadqtmips-f33f424ccf7ca57aae95566663c8f31956fbdf8f.tar.gz
qtmips-f33f424ccf7ca57aae95566663c8f31956fbdf8f.tar.bz2
qtmips-f33f424ccf7ca57aae95566663c8f31956fbdf8f.zip
Allow to switch between numeric and mnemonics registers names.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/MainWindow.ui12
-rw-r--r--qtmips_gui/mainwindow.cpp8
-rw-r--r--qtmips_gui/mainwindow.h1
-rw-r--r--qtmips_gui/programdock.cpp1
-rw-r--r--qtmips_gui/programdock.h1
-rw-r--r--qtmips_gui/programmodel.h2
6 files changed, 24 insertions, 1 deletions
diff --git a/qtmips_gui/MainWindow.ui b/qtmips_gui/MainWindow.ui
index d29c3ff..cd898ae 100644
--- a/qtmips_gui/MainWindow.ui
+++ b/qtmips_gui/MainWindow.ui
@@ -100,6 +100,7 @@
<addaction name="ipsMax"/>
<addaction name="separator"/>
<addaction name="actionRestart"/>
+ <addaction name="actionMnemonicRegisters"/>
<addaction name="actionShow_Symbol"/>
<addaction name="actionCompileSource"/>
</widget>
@@ -526,6 +527,17 @@
<string>Core View</string>
</property>
</action>
+ <action name="actionMnemonicRegisters">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Mnemonics Registers</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index f300b5e..b93d2ef 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -115,6 +115,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
connect(ui->actionSave, SIGNAL(triggered(bool)), this, SLOT(save_source()));
connect(ui->actionSaveAs, SIGNAL(triggered(bool)), this, SLOT(save_source_as()));
connect(ui->actionClose, SIGNAL(triggered(bool)), this, SLOT(close_source()));
+ connect(ui->actionMnemonicRegisters, SIGNAL(triggered(bool)), this, SLOT(view_mnemonics_registers(bool)));
connect(ui->actionCompileSource, SIGNAL(triggered(bool)), this, SLOT(compile_source()));
connect(ui->actionShow_Symbol, SIGNAL(triggered(bool)), this, SLOT(show_symbol_dialog()));
connect(ui->actionRegisters, SIGNAL(triggered(bool)), this, SLOT(show_registers()));
@@ -404,6 +405,13 @@ void MainWindow::set_speed() {
machine->set_speed(0);
}
+void MainWindow::view_mnemonics_registers(bool enable) {
+ machine::Instruction::set_symbolic_registers(enable);
+ if (program == nullptr)
+ return;
+ program->request_update_all();
+}
+
void MainWindow::closeEvent(QCloseEvent *event __attribute__((unused))) {
settings->setValue("windowGeometry", saveGeometry());
settings->setValue("windowState", saveState());
diff --git a/qtmips_gui/mainwindow.h b/qtmips_gui/mainwindow.h
index 9c7bb25..94365fe 100644
--- a/qtmips_gui/mainwindow.h
+++ b/qtmips_gui/mainwindow.h
@@ -100,6 +100,7 @@ public slots:
void machine_trap(machine::QtMipsException &e);
void central_tab_changed(int index);
void tab_widget_destroyed(QObject *obj);
+ void view_mnemonics_registers(bool enable);
protected:
void closeEvent(QCloseEvent *event);
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp
index bcdbd23..a561c00 100644
--- a/qtmips_gui/programdock.cpp
+++ b/qtmips_gui/programdock.cpp
@@ -106,6 +106,7 @@ ProgramDock::ProgramDock(QWidget *parent, QSettings *settings) : Super(parent) {
connect(this, SIGNAL(stage_addr_changed(uint,std::uint32_t)),
program_model, SLOT(update_stage_addr(uint,std::uint32_t)));
connect(program_model, SIGNAL(report_error(QString)), this, SLOT(report_error(QString)));
+ connect(this, SIGNAL(request_update_all()), program_model, SLOT(update_all()));
}
void ProgramDock::setup(machine::QtMipsMachine *machine) {
diff --git a/qtmips_gui/programdock.h b/qtmips_gui/programdock.h
index 50baa50..7386e62 100644
--- a/qtmips_gui/programdock.h
+++ b/qtmips_gui/programdock.h
@@ -58,6 +58,7 @@ signals:
void focus_addr(std::uint32_t);
void focus_addr_with_save(std::uint32_t);
void stage_addr_changed(uint stage, std::uint32_t addr);
+ void request_update_all();
public slots:
void set_follow_inst(int);
void fetch_inst_addr(std::uint32_t addr);
diff --git a/qtmips_gui/programmodel.h b/qtmips_gui/programmodel.h
index 95d0e3f..5e4d43d 100644
--- a/qtmips_gui/programmodel.h
+++ b/qtmips_gui/programmodel.h
@@ -54,7 +54,6 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool setData(const QModelIndex & index, const QVariant & value, int role) override;
bool adjustRowAndOffset(int &row, std::uint32_t address);
- void update_all();
inline const QFont *getFont() const {
return &data_font;
@@ -100,6 +99,7 @@ public slots:
void check_for_updates();
void toggle_hw_break(const QModelIndex & index);
void update_stage_addr(uint stage, std::uint32_t addr);
+ void update_all();
private:
const machine::MemoryAccess *mem_access() const;