From c00703033380d68eeff47c40a9c7dc5f8cd7fb1f Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 27 Apr 2025 13:06:44 -0400 Subject: Report status correctly when steps have finished running --- gui/gui.cc | 5 ++++- gui/gui.h | 2 ++ gui/worker.cc | 1 + gui/worker.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gui/gui.cc b/gui/gui.cc index b4feda6..28876ba 100644 --- a/gui/gui.cc +++ b/gui/gui.cc @@ -72,6 +72,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI) connect(worker, &Worker::wb_info, this, &GUI::onWorkerWriteBackInfo); + connect(worker, &Worker::steps_done, this, &GUI::onWorkerStepsDone); + // Display cache connect(worker, &Worker::storage, this, &GUI::onWorkerShowStorage); @@ -139,7 +141,6 @@ void GUI::on_worker_refresh_gui(int cycles, int pc) { ui->p_counter->set_value(pc); ui->cycle_counter->set_value(cycles); - this->set_status(get_waiting, "idle"); } void GUI::onWorkerFetchInfo(const InstrDTO *i) @@ -215,6 +216,8 @@ void GUI::onWorkerWriteBackInfo(const InstrDTO *i) } } +void GUI::onWorkerStepsDone() { this->set_status(get_waiting, "idle"); } + void GUI::onWorkerShowStorage(const QVector> &data, int i) { this->tab_boxes.at(i)->set_data(data); diff --git a/gui/gui.h b/gui/gui.h index 830d852..8e0b5b4 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -68,6 +68,8 @@ class GUI : public QMainWindow void onWorkerWriteBackInfo(const InstrDTO *); + void onWorkerStepsDone(); + void onWorkerShowStorage(const QVector> &data, int i); void onWorkerShowRegisters(const std::array &data); diff --git a/gui/worker.cc b/gui/worker.cc index 0ba364b..dd7b637 100644 --- a/gui/worker.cc +++ b/gui/worker.cc @@ -72,6 +72,7 @@ void Worker::runSteps(int steps) { this->ct->run_for(steps); this->update(); + emit steps_done(); } void Worker::update() diff --git a/gui/worker.h b/gui/worker.h index c62f4ed..5ffb6ef 100644 --- a/gui/worker.h +++ b/gui/worker.h @@ -72,6 +72,7 @@ class Worker : public QObject void ex_info(const InstrDTO *); void mm_info(const InstrDTO *); void wb_info(const InstrDTO *); + void steps_done(); void finished(); private: -- cgit v1.2.3