summaryrefslogtreecommitdiff
path: root/gui/worker.h
diff options
context:
space:
mode:
authorSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-04-01 21:54:38 -0400
committerSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-04-01 21:54:38 -0400
commitcc2781682a47dc331f7bbcb5d7842db5197d29fc (patch)
tree248c770c6e1a51756c5a8fa904ec4873fb66644e /gui/worker.h
parent6f536bd1bd1abab307c79d688c993e930cf7c250 (diff)
GUI and controller on separate threads
Diffstat (limited to 'gui/worker.h')
-rw-r--r--gui/worker.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/gui/worker.h b/gui/worker.h
new file mode 100644
index 0000000..99ab39a
--- /dev/null
+++ b/gui/worker.h
@@ -0,0 +1,50 @@
+#ifndef WORKER_H
+#define WORKER_H
+
+#include <QObject>
+#include <QThread>
+#include <QDebug>
+
+#include "controller.h"
+#include "dram.h"
+#include "cache.h"
+#include "id.h"
+#include "if.h"
+#include "ex.h"
+#include "mm.h"
+#include "wb.h"
+
+class Worker : public QObject {
+ Q_OBJECT
+
+private:
+ Cache *c;
+ Dram *d;
+ Controller *ct;
+ ID *id_stage;
+ IF *if_stage;
+ EX *ex_stage;
+ MM *mm_stage;
+ WB *wb_stage;
+
+public:
+ explicit Worker(QObject *parent = nullptr);
+ ~Worker();
+
+public slots:
+ void doWork();
+ void refreshDram();
+ void refreshCache();
+ void refreshRegisters();
+ void runSteps(int steps);
+ void runStep();
+
+signals:
+ void clock_cycles(int value, int pc);
+ void dram_storage(const std::vector<std::array<signed int, LINE_SIZE>> data);
+ void cache_storage(const std::vector<std::array<signed int, LINE_SIZE>> data);
+ void register_storage(const std::array<int, GPR_NUM> data);
+ void finished();
+};
+
+#endif // WORKER_H \ No newline at end of file