diff options
author | Karel Kočí <cynerd@email.cz> | 2018-01-05 16:24:29 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-01-05 16:30:23 +0100 |
commit | 6528cdb58abcbe432dd387d565c9a1157f90795a (patch) | |
tree | b686944f40fca86523435320369d9bbf73cb709f /qtmips_gui/programdock.cpp | |
parent | 799dcddc2420ce1450ac2bdd0d69bccf4a2f2e1f (diff) | |
download | qtmips-6528cdb58abcbe432dd387d565c9a1157f90795a.tar.gz qtmips-6528cdb58abcbe432dd387d565c9a1157f90795a.tar.bz2 qtmips-6528cdb58abcbe432dd387d565c9a1157f90795a.zip |
Implement initial dialog for program memory dock
I am missing memory view for now.
Diffstat (limited to 'qtmips_gui/programdock.cpp')
-rw-r--r-- | qtmips_gui/programdock.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp new file mode 100644 index 0000000..240fb0a --- /dev/null +++ b/qtmips_gui/programdock.cpp @@ -0,0 +1,85 @@ +#include "programdock.h" +#include "qtmipsexception.h" + +ProgramDock::ProgramDock(QWidget *parent) : QDockWidget(parent) { + widg = new QWidget(this); + widg_layout = new QBoxLayout(QBoxLayout::TopToBottom, widg); + widg_layout->setSizeConstraint(QLayout::SetMinAndMaxSize); + + // TODO memory view + + /* + ctlline = new QLineEdit(widg); + ctlline->setText("0x00000000"); + ctlline->setInputMask("\\0\\xHHHHHHHH"); + ctlline->hide(); + widg_layout->addWidget(ctlline); + connect(ctlline, SIGNAL(returnPressed()), this, SLOT(ctlline_returnPress())); + */ + + ctlbox_single = new QComboBox(widg); + ctlbox_single->addItems({ + "Don't follow", + "Follow executing instruction" + }); + ctlbox_single->setCurrentIndex(1); + ctlbox_single->hide(); + widg_layout->addWidget(ctlbox_single); + connect(ctlbox_single, SIGNAL(currentIndexChanged(int)), this, SLOT(ctlbox_single_changed(int))); + + ctlbox_pipelined = new QComboBox(widg); + ctlbox_pipelined->addItems({ + "Don't follow", + "Follow Instruction fetch stage", + "Follow Instruction decode stage", + "Follow Execution stage", + "Follow Memory access stage", + "Follow Registers write back stage", + }); + ctlbox_pipelined->hide(); + ctlbox_pipelined->setCurrentIndex(1); + widg_layout->addWidget(ctlbox_pipelined); + connect(ctlbox_pipelined, SIGNAL(currentIndexChanged(int)), this, SLOT(ctlbox_pipelined_changed(int))); + + setWidget(widg); + setObjectName("Program"); + setWindowTitle("Program memory"); +} + +ProgramDock::~ProgramDock() { + delete ctlbox_single; + delete ctlbox_pipelined; + delete widg; + delete widg_layout; +} + +void ProgramDock::setup(machine::QtMipsMachine *machine) { + if (machine == nullptr) { + // TODO zero memory viewer + return; + } + + // TODO pass to viewer + + bool pipelined = machine->config().pipelined(); + ctlbox_single->setVisible(!pipelined); + ctlbox_pipelined->setVisible(pipelined); + // Sync selection somewhat + if (pipelined) { + if (ctlbox_single->currentIndex() == 0) + ctlbox_pipelined->setCurrentIndex(0); + else if (ctlbox_pipelined->currentIndex() == 0) + ctlbox_pipelined->setCurrentIndex(1); + } else + ctlbox_single->setCurrentIndex(ctlbox_pipelined->currentIndex() == 0 ? 0 : 1); + + // TODO also update current setting of memory viewer +} + +void ProgramDock::ctlbox_single_changed(int index) { + // TODO set memory view +} + +void ProgramDock::ctlbox_pipelined_changed(int index) { + // TODO set memory view +} |