summaryrefslogtreecommitdiff
path: root/gui/worker.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-18 21:56:45 -0400
committerbd <bdunahu@operationnull.com>2025-04-18 21:56:45 -0400
commit1613c52e8e52a5c1a2a8120fcfa7ed3a011fbdf1 (patch)
treea5d2a424fc2f3bfb0b6638366ccc6fb4fc80e68f /gui/worker.cc
parent04d8976223821833ef9d93ae03b8058626d4e1e6 (diff)
Remove/comment out a lot of code in charge of loading
Diffstat (limited to 'gui/worker.cc')
-rw-r--r--gui/worker.cc89
1 files changed, 13 insertions, 76 deletions
diff --git a/gui/worker.cc b/gui/worker.cc
index 3c2c952..1d87fd3 100644
--- a/gui/worker.cc
+++ b/gui/worker.cc
@@ -2,86 +2,27 @@
Worker::Worker(QObject *parent) : QObject(parent) {}
-void Worker::configure(std::vector<int> ways, std::vector<int> size, bool is_pipelined, bool is_cache_enabled) {
- this->d = new Dram(ways.size()+10);
- setWays(ways);
- setSize(size);
- qDebug() << "is cache enabled:" << is_cache_enabled;
- qDebug() << "is pipelined:" << is_pipelined;
- this->cache_enabled = is_cache_enabled;
- if (!is_cache_enabled || ways.size() == 0) {
- this->ct = new Controller(wb_stage, this->d, is_pipelined);
- } else {
- // 0th index cache has largest delay
- for(int i=0;i<ways.size();i++) {
- if(i==0){
- Cache* cache = new Cache(this->d, size[i], ways[i], ways.size());
- this->c.push_back(cache);
- } else {
- Cache* cache = new Cache(this->c[i-1], size[i], ways[i], ways.size()-i);
- this->c.push_back(cache);
- }
- }
- this->ct = new Controller(wb_stage, this->c.at(ways.size()-1), is_pipelined);
- }
- emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc());
-}
-
-void Worker::setWays(std::vector<int> ways) {
- this->cache_ways = ways;
-}
-
-void Worker::setSize(std::vector<int> size) {
- this->cache_size = size;
-}
-
-std::vector<int> Worker::getWays() {
- return this->cache_ways;
-}
-
-std::vector<int> Worker::getSize() {
- return this->cache_size;
-}
-
-void Worker::doWork()
-{
- qDebug() << "Initializing...";
-
- this->if_stage = new IF(nullptr);
- this->id_stage = new ID(if_stage);
- this->ex_stage = new EX(id_stage);
- this->mm_stage = new MM(ex_stage);
- this->wb_stage = new WB(mm_stage);
-}
-
Worker::~Worker()
{
emit finished();
qDebug() << "Worker destructor called in thread:"
<< QThread::currentThread();
delete this->ct;
- for(Cache *cache: this->c) {
- delete cache;
- }
-}
-
-void Worker::loadProgram(std::vector<signed int> p) {
- this->d->load(p);
}
void Worker::refreshDram()
{
qDebug() << "Refreshing Dram";
- emit dram_storage(this->d->view(0, 255));
+ // emit dram_storage(this->d->view(0, 255));
}
void Worker::refreshCache()
{
qDebug() << "Refreshing Cache";
- if(getWays().size() > 0) {
- unsigned int size = this->c.at(getWays().size()-1)->get_size();
- emit cache_storage(this->c.at(getWays().size()-1)->view(0, 1<<size));
- }
+ // if(getWays().size() > 0) {
+ // unsigned int size = this->c.at(getWays().size()-1)->get_size();
+ // emit cache_storage(this->c.at(getWays().size()-1)->view(0, 1<<size));
+ // }
}
void Worker::refreshRegisters()
@@ -94,16 +35,12 @@ void Worker::runSteps(int steps)
{
qDebug() << "Running for " << steps << "steps";
this->ct->run_for(steps);
- emit dram_storage(this->d->view(0, 255));
- if(this->cache_enabled && getWays().size() > 0) {
- unsigned int size = this->c.at(getWays().size()-1)->get_size();
- emit cache_storage(this->c.at(getWays().size()-1)->view(0, 1<<size));
- }
- emit register_storage(this->ct->get_gprs());
- emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc());
- emit if_info(this->if_stage->stage_info());
- emit id_info(this->id_stage->stage_info());
- emit ex_info(this->ex_stage->stage_info());
- emit mm_info(this->mm_stage->stage_info());
- emit wb_info(this->wb_stage->stage_info());
+ // emit dram_storage(this->d->view(0, 255));
+ // emit register_storage(this->ct->get_gprs());
+ // emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc());
+ // emit if_info(this->if_stage->stage_info());
+ // emit id_info(this->id_stage->stage_info());
+ // emit ex_info(this->ex_stage->stage_info());
+ // emit mm_info(this->mm_stage->stage_info());
+ // emit wb_info(this->wb_stage->stage_info());
}