diff options
author | bd <bdunahu@operationnull.com> | 2025-04-19 04:16:00 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-19 04:16:00 -0400 |
commit | 24de6faf71c85e0281b32fb899fcbe4fe82380c4 (patch) | |
tree | f0a6dc277b3684f036c544ac66ca695c6eef46f9 /gui | |
parent | c9b553e68dbd95a8faf5abf4f8e1362261bec99f (diff) |
Reinstate rest of worker.cc functions such that programs work again
Diffstat (limited to 'gui')
-rw-r--r-- | gui/dynamicwaysentry.cc | 2 | ||||
-rw-r--r-- | gui/worker.cc | 34 | ||||
-rw-r--r-- | gui/worker.h | 7 |
3 files changed, 23 insertions, 20 deletions
diff --git a/gui/dynamicwaysentry.cc b/gui/dynamicwaysentry.cc index f35c9ef..4e2cd66 100644 --- a/gui/dynamicwaysentry.cc +++ b/gui/dynamicwaysentry.cc @@ -26,6 +26,8 @@ int DynamicWaysEntry::parse_valid_way(QString t) return (s && i >= 0 && 5 > i) ? i : -1; } +// TODO if you enter something valid and then make it invalid, +// the next box still shows void DynamicWaysEntry::on_number_enter(const QString &t) { int i; diff --git a/gui/worker.cc b/gui/worker.cc index 6ec564e..cd79821 100644 --- a/gui/worker.cc +++ b/gui/worker.cc @@ -16,13 +16,14 @@ void Worker::configure( std::vector<signed int> program, bool is_pipelined) { - unsigned int size_inc; Dram *d; Storage *s; int i; - if (ways.size() != 0) - size_inc = MEM_LINE_SPEC / ways.size(); + if (ways.size() != 0) { + // will ensure the largest cache is only half of DRAM + this->size_inc = (MEM_LINE_SPEC / ways.size()) / 2; + } d = new Dram(DRAM_DELAY); s = (Storage *)d; @@ -31,7 +32,7 @@ void Worker::configure( for (i = ways.size(); i > 0; --i) { s = (Storage *)new Cache( - s, size_inc * (i), ways.at(i - 1), CACHE_DELAY + i); + s, this->size_inc * (i), ways.at(i - 1), CACHE_DELAY + i); this->s.push_front(s); } @@ -49,16 +50,15 @@ void Worker::configure( void Worker::refreshDram() { qDebug() << "Refreshing Dram"; - // emit dram_storage(this->d->view(0, 255)); + emit dram_storage(this->s.back()->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(this->s.size() > 0) { + emit cache_storage(this->s.at(0)->view(0, 1 << this->size_inc)); + } } void Worker::refreshRegisters() @@ -71,12 +71,12 @@ void Worker::runSteps(int steps) { qDebug() << "Running for " << steps << "steps"; this->ct->run_for(steps); - // 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()); + emit dram_storage(this->s.back()->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()); } diff --git a/gui/worker.h b/gui/worker.h index b6332b0..acfffcf 100644 --- a/gui/worker.h +++ b/gui/worker.h @@ -23,15 +23,16 @@ class Worker : public QObject * The storage objects, stored smallest to largest. */ std::deque<Storage *> s; - /** - * The stage objects, starting with fetch. - */ IF *if_stage; ID *id_stage; EX *ex_stage; MM *mm_stage; WB *wb_stage; Controller *ct; + /** + * The size each progressive cache level increases by. + */ + unsigned int size_inc; public: explicit Worker(QObject *parent = nullptr); |