1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
}
|