aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/machineconfig.cpp2
-rw-r--r--qtmips_machine/machineconfig.h2
-rw-r--r--qtmips_machine/qtmipsmachine.cpp7
-rw-r--r--qtmips_machine/qtmipsmachine.h7
4 files changed, 10 insertions, 8 deletions
diff --git a/qtmips_machine/machineconfig.cpp b/qtmips_machine/machineconfig.cpp
index 0947e22..cf8629c 100644
--- a/qtmips_machine/machineconfig.cpp
+++ b/qtmips_machine/machineconfig.cpp
@@ -9,7 +9,7 @@ MachineConfig::MachineConfig() {
elf_path = QString("");
}
-MachineConfig::MachineConfig(MachineConfig *cc) {
+MachineConfig::MachineConfig(const MachineConfig *cc) {
pipeline = cc->pipelined();
delayslot = cc->delay_slot();
cache_type = cc->cache();
diff --git a/qtmips_machine/machineconfig.h b/qtmips_machine/machineconfig.h
index d872686..c55228a 100644
--- a/qtmips_machine/machineconfig.h
+++ b/qtmips_machine/machineconfig.h
@@ -8,7 +8,7 @@ namespace machine {
class MachineConfig {
public:
MachineConfig();
- MachineConfig(MachineConfig *cc);
+ MachineConfig(const MachineConfig *cc);
enum CacheType {
CCT_NONE,
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp
index a652363..744c5e2 100644
--- a/qtmips_machine/qtmipsmachine.cpp
+++ b/qtmips_machine/qtmipsmachine.cpp
@@ -3,7 +3,7 @@
using namespace machine;
-QtMipsMachine::QtMipsMachine(const MachineConfig &cc) {
+QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) {
stat = ST_READY;
ProgramLoader program(cc.elf());
@@ -29,7 +29,6 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) {
throw QTMIPS_EXCEPTION(Sanity, "Trying to configure unknown cache type", "");
}
- cr_pipelined = cc.pipelined();
if (cc.pipelined())
cr = new CorePipelined(regs, coremem);
else
@@ -40,6 +39,10 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) {
connect(run_t, SIGNAL(timeout()), this, SLOT(step()));
}
+const MachineConfig &QtMipsMachine::config() {
+ return mcnf;
+}
+
void QtMipsMachine::set_speed(unsigned val) {
run_t->setInterval(val);
}
diff --git a/qtmips_machine/qtmipsmachine.h b/qtmips_machine/qtmipsmachine.h
index d2e60de..d130225 100644
--- a/qtmips_machine/qtmipsmachine.h
+++ b/qtmips_machine/qtmipsmachine.h
@@ -18,6 +18,7 @@ class QtMipsMachine : public QObject {
public:
QtMipsMachine(const MachineConfig &cc);
+ const MachineConfig &config();
void set_speed(unsigned);
const Registers *registers();
@@ -49,19 +50,17 @@ signals:
void tick(); // Time tick
private:
+ MachineConfig mcnf;
+
Registers *regs;
Memory *mem, *mem_program_only;
Cache *cch;
Core *cr;
- bool cr_pipelined;
-
- unsigned run_speed;
QTimer *run_t;
std::uint32_t program_end;
enum Status stat;
-
void set_status(enum Status st);
};