diff options
author | bd <bdunahu@operationnull.com> | 2025-04-25 21:19:10 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-25 21:19:10 -0400 |
commit | f3e6d5ed8acdeb3f5eccffb5aeeab2e7b040908c (patch) | |
tree | 347eca77379539a027ebec9ed206a45031c9e371 | |
parent | a3528b83dd10fa9cdf7ef5635f615c1b295f3f4c (diff) |
Separate update method for worker into its own method
-rw-r--r-- | gui/worker.cc | 16 | ||||
-rw-r--r-- | gui/worker.h | 7 |
2 files changed, 17 insertions, 6 deletions
diff --git a/gui/worker.cc b/gui/worker.cc index 203f907..22f8738 100644 --- a/gui/worker.cc +++ b/gui/worker.cc @@ -69,24 +69,28 @@ void Worker::configure( delete old; this->ct_mutex.unlock(); - emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc()); + this->update(); } void Worker::runSteps(int steps) { - unsigned long i; - - this->ct_mutex.lock(); qDebug() << "Running for " << steps << "steps"; this->ct->run_for(steps); + this->update(); +} - // TODO move these to separate functions +void Worker::update() +{ + unsigned long i; + + this->ct_mutex.lock(); emit register_storage(this->ct->get_gprs()); emit storage(this->s.at(0)->view(0, 255), 1); for (i = 1; i < s.size(); ++i) - emit storage(this->s.at(i - 1)->view(0, 1 << this->size_inc * i), i + 1); + emit storage( + this->s.at(i - 1)->view(0, 1 << this->size_inc * i), i + 1); emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc()); emit if_info(this->if_stage->get_instr()); diff --git a/gui/worker.h b/gui/worker.h index 072263a..06e4a16 100644 --- a/gui/worker.h +++ b/gui/worker.h @@ -78,6 +78,13 @@ class Worker : public QObject void mm_info(const InstrDTO *); void wb_info(const InstrDTO *); void finished(); + + private: + /** + * Sets the GUI signals to update the storage, clock cycle, and stage + * displays. + */ + void update(); }; #endif // WORKER_H |