diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-17 10:50:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 10:50:58 -0400 |
commit | 62b9e280d5d0222710e491dcd28fe26bea915dcd (patch) | |
tree | e1f68ac7a6e4dc481c19346e38ad20d113f13825 /gui/worker.cc | |
parent | b778ccc3e7c2f2ac3c4892a87f5269f342fd895f (diff) | |
parent | 430986b4b1ee1013db070991ce289176f48fa8e8 (diff) |
Merge pull request #52 from bdunahu/bdunahu
[WIP] Partial fixes for changes in DRAM/Cache, including uncovered bug
Diffstat (limited to 'gui/worker.cc')
-rw-r--r-- | gui/worker.cc | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/gui/worker.cc b/gui/worker.cc index e7c9876..9202b89 100644 --- a/gui/worker.cc +++ b/gui/worker.cc @@ -6,7 +6,7 @@ void Worker::doWork() { qDebug() << "Initializing..."; this->d = new Dram(0); - this->c = new Cache(this->d, 0); + this->c = new Cache(this->d, 5, 0, 0); this->if_stage = new IF(nullptr); this->id_stage = new ID(if_stage); this->ex_stage = new EX(id_stage); @@ -16,55 +16,41 @@ void Worker::doWork() emit clock_cycles(this->ct->get_clock_cycle(), this->ct->get_pc()); emit dram_storage(this->d->view(0, 32)); - emit cache_storage(this->c->view(0, 8)); + emit cache_storage(this->c->view(0, 7)); emit register_storage(this->ct->get_gprs()); signed int b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, - b15, b16, b17, b18, b19; + b15, b16, b17, b18, b19, b20; std::vector<signed int> p; // I-TYPE / / / / - b0 = 0b00000010000000000001000000001101; // ADDI $2 $0 0x200; - b1 = 0b00000000000000010010100000001101; // ADDI $5 $0 0x1; - b2 = 0b00000000000000000010100010101101; // STORE $5 0($2); - // I-TYPE / / / / - b3 = 0b00000000000000100010100000001101; // ADDI $5 $0 0x2; - b4 = 0b00000000000000010010100010101101; // STORE $5 1($2); - // I-TYPE / / / / - b5 = 0b00000000000000110010100000001101; // ADDI $5 $0 0x3; - b6 = 0b00000000000000100010100010101101; // STORE $5 2($2); - // I-TYPE / / / / - b7 = 0b00000000000001000010100000001101; // ADDI $5 $0 0x4; - b8 = 0b00000000000000110010100010101101; // STORE $5 3($2); - // // I-TYPE / / / / - b9 = 0b00000000000000000010100000001101; // ADDI $5 $0 0x0; - // // I-TYPE / / / / - b10 = 0b00000000000000110011000000001101; // ADDI $6 $0 0x3; - // // J-TYPE / / / - b11 = 0b00000000000000000011100000001010; // JRL CHECK - // // R-TYPE / / / / / - b12 = 0b00000000000100100101000100000100; // ADD $9 $2 $5; - // // I-TYPE / / / / - b13 = 0b00000000000000000011101001000101; // LOAD $7 0($9); (RAW HAZARD)! - // // I-TYPE / / / / - b14 = 0b00000000000000010100001001000101; // LOAD $8 1($9); - // // R-TYPE / / / / / - b15 = 0b00000000000011101000001110000100; // ADD $7 $7 $8; - // I-TYPE / / / / - b16 = 0b00000000000000000011101001101101; // STORE $7 0($9); - b17 = 0b00000000000000010010100101001101; // ADDI $5 $5 0x1; - // // R-TYPE / / / / / - b18 = 0b00000000000111100101001101000000; // CMP $6 $5 - // // J-TYPE / / / - b19 = 0b11111111111111111100000000010110; // bgt LOOP + b0 = 0b00000010000000000001000000001101; + b1 = 0b00000000000000010010100000001101; + b2 = 0b00000000000000000010100010101001; + b3 = 0b00000000000000100010100000001101; + b4 = 0b00000000000000010010100010101001; + b5 = 0b00000000000000110010100000001101; + b6 = 0b00000000000000100010100010101001; + b7 = 0b00000000000001000010100000001101; + b8 = 0b00000000000000110010100010101001; + b9 = 0b00000000000000000010100000001101; + b10 = 0b00000000000000110011000000001101; + b11 = 0b00000000000000000011100000001010; + b12 = 0b00000000000100100101000100000100; + b13 = 0b00000000000000000100100111000101; + b14 = 0b00000000000000010100101000000101; + b15 = 0b00000000000011101000001110000100; + b16 = 0b00000000000000000011101001101001; + b17 = 0b00000000000000010010100101001101; + b18 = 0b00000000000000000101001101000000; + b19 = 0b11111111111111111100100000010110; + // b20 = 0b00000000000000000000000000010000; - p = {b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, - b10, b11, b12, b13, b14, b15, b16, b17, b18, b19}; + p = {b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, + b11, b12, b13, b14, b15, b16, b17, b18, b19}; this->d->load(p); } - - Worker::~Worker() { emit finished(); @@ -83,7 +69,7 @@ void Worker::refreshDram() void Worker::refreshCache() { qDebug() << "Refreshing Dram"; - emit cache_storage(this->c->view(0, 8)); + emit cache_storage(this->c->view(0, 7)); } void Worker::refreshRegisters() @@ -97,7 +83,7 @@ void Worker::runSteps(int steps) qDebug() << "Running for steps: " << steps; this->ct->run_for(steps); emit dram_storage(this->d->view(0, 256)); - emit cache_storage(this->c->view(0, 8)); + emit cache_storage(this->c->view(0, 7)); 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()); @@ -112,7 +98,7 @@ void Worker::runStep() qDebug() << "Running for 1 step "; this->ct->advance(WAIT); emit dram_storage(this->d->view(0, 256)); - emit cache_storage(this->c->view(0, 8)); + emit cache_storage(this->c->view(0, 7)); 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()); |