diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-28 21:49:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 21:49:25 -0400 |
commit | 32a1762b3b9091f6e2d553601f3e3a3a5d87b889 (patch) | |
tree | cb12daab120a8298d5e78219602fded822bdd671 | |
parent | 9e7debd7bff14893f2722c37f42d9c6b70fbdcbf (diff) | |
parent | 930ec733e988c4996918065b4656f0508c6e2df6 (diff) |
Merge pull request #76 from bdunahu/bdunahu
Fix bug with pipeline blockage, swap DRAM delay to 100
-rw-r--r-- | gui/gui.cc | 4 | ||||
-rw-r--r-- | gui/gui.h | 2 | ||||
-rw-r--r-- | gui/gui.ui | 2 | ||||
-rw-r--r-- | gui/worker.cc | 5 | ||||
-rw-r--r-- | gui/worker.h | 2 | ||||
-rw-r--r-- | inc/controller.h | 2 | ||||
-rw-r--r-- | inc/pipe_spec.h | 6 | ||||
-rw-r--r-- | src/controller.cc | 2 | ||||
-rw-r--r-- | src/stage.cc | 9 |
9 files changed, 20 insertions, 14 deletions
@@ -94,7 +94,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI) // Update the step button with step amount connect(ui->step_slider, &QSlider::valueChanged, this, [=](int index) { - int value = step_values[index]; + long value = step_values[index]; ui->step_btn->setText(QString("Step %1").arg(value)); }); @@ -268,7 +268,7 @@ void GUI::on_step_btn_clicked() return; this->set_status(get_running, "busy"); - int steps = step_values[ui->step_slider->value()]; + long steps = step_values[ui->step_slider->value()]; emit sendRunSteps(steps); } @@ -140,7 +140,7 @@ class GUI : public QMainWindow /** * The possible step slider values. */ - QVector<int> step_values = {1, 5, 20, 50, 250, 1000, 10000, 100000, 500000, 100000000}; + QVector<long> step_values = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000}; QThread workerThread; @@ -554,7 +554,7 @@ <number>0</number> </property> <property name="maximum"> - <number>9</number> + <number>10</number> </property> <property name="pageStep"> <number>1</number> diff --git a/gui/worker.cc b/gui/worker.cc index a48888c..755c797 100644 --- a/gui/worker.cc +++ b/gui/worker.cc @@ -18,6 +18,7 @@ #include "worker.h" #include "storage.h" #include "util.h" +#include <cmath> Worker::Worker(QObject *parent) : QObject(parent) {} @@ -49,7 +50,7 @@ void Worker::configure( for (i = ways.size(); i > 0; --i) { s = static_cast<Storage *>(new Cache( s, cache_size_mapper(ways.size() - 1, i - 1), ways.at(i - 1), - CACHE_DELAY + i)); + static_cast<int>(pow(CACHE_DELAY_SCALE, (i - 1))))); this->s.push_front(s); } @@ -68,7 +69,7 @@ void Worker::configure( this->update(); } -void Worker::runSteps(int steps) +void Worker::runSteps(long steps) { this->ct->run_for(steps); this->update(); diff --git a/gui/worker.h b/gui/worker.h index 2a362a4..ad7f162 100644 --- a/gui/worker.h +++ b/gui/worker.h @@ -56,7 +56,7 @@ class Worker : public QObject QMutex &get_ct_mutex() { return ct_mutex; } public slots: - void runSteps(int steps); + void runSteps(long steps); void configure( std::vector<unsigned int> ways, std::vector<signed int> program, diff --git a/inc/controller.h b/inc/controller.h index cd59fc8..d8f6439 100644 --- a/inc/controller.h +++ b/inc/controller.h @@ -41,7 +41,7 @@ class Controller : public Stage * Direct the simulator to run for `number` clock cycles. * @param the number of clock cycles to run for. */ - void run_for(int number); + void run_for(long number); /** * @return the current clock cycle. */ diff --git a/inc/pipe_spec.h b/inc/pipe_spec.h index d8153af..ad8a7fc 100644 --- a/inc/pipe_spec.h +++ b/inc/pipe_spec.h @@ -73,12 +73,12 @@ /** * The delay on DRAM objects. */ -#define DRAM_DELAY 10 +#define DRAM_DELAY 100 /** - * The (base) on cache objects. + * The difference in delays between two adjacent cache levels. */ -#define CACHE_DELAY 1 +#define CACHE_DELAY_SCALE 1 #define VECTOR_MEM_DELAY 10 diff --git a/src/controller.cc b/src/controller.cc index a5c6691..e439b30 100644 --- a/src/controller.cc +++ b/src/controller.cc @@ -35,7 +35,7 @@ Controller::Controller(Stage *stage, Storage *storage, bool is_pipelined) this->gprs.at(2) = MEM_WORDS; // set the stack pointer } -void Controller::run_for(int number) +void Controller::run_for(long number) { int i; for (i = 0; i < number; ++i) { diff --git a/src/stage.cc b/src/stage.cc index ac688d8..4eab7d3 100644 --- a/src/stage.cc +++ b/src/stage.cc @@ -59,10 +59,15 @@ InstrDTO *Stage::advance(Response p) this->status = READY; } - n = (p != READY || this->status != READY) ? STALLED : READY; + if (!this->curr_instr) + n = READY; + else + n = (p != READY || this->status != READY) ? STALLED : READY; + s = this->next->advance(n); - if (s) + if (s) { this->curr_instr = s; + } return r; } |