From f33f424ccf7ca57aae95566663c8f31956fbdf8f Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 3 Jul 2019 10:45:32 +0200 Subject: Allow to switch between numeric and mnemonics registers names. Signed-off-by: Pavel Pisa --- qtmips_gui/MainWindow.ui | 12 ++++++++++++ qtmips_gui/mainwindow.cpp | 8 ++++++++ qtmips_gui/mainwindow.h | 1 + qtmips_gui/programdock.cpp | 1 + qtmips_gui/programdock.h | 1 + qtmips_gui/programmodel.h | 2 +- 6 files changed, 24 insertions(+), 1 deletion(-) (limited to 'qtmips_gui') 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 @@ + @@ -526,6 +527,17 @@ Core View + + + true + + + false + + + Mnemonics Registers + + 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; -- cgit v1.2.3