diff options
author | bd <bdunahu@operationnull.com> | 2025-03-08 12:51:01 -0500 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-08 12:51:01 -0500 |
commit | 2c424d29fd813b1fbef3b07595713611a1684903 (patch) | |
tree | fc5e0f85af22003dce16abd06a131cac7c1d8b5c /src/storage/dram.cc | |
parent | c5f26a0bfdaafc8d49c88d2016df1724b64e5271 (diff) |
enforce single unit per clock cycle, order to serve storage requests
Diffstat (limited to 'src/storage/dram.cc')
-rw-r--r-- | src/storage/dram.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/storage/dram.cc b/src/storage/dram.cc index 4c4ca84..32f3fbb 100644 --- a/src/storage/dram.cc +++ b/src/storage/dram.cc @@ -2,14 +2,15 @@ #include "definitions.h" #include "response.h" #include <algorithm> +#include <iostream> Dram::Dram(int lines, int delay) { this->data = new std::vector<std::array<signed int, LINE_SIZE>>; this->data->resize(lines); this->delay = delay; + this->wait_time = this->delay; this->lower = nullptr; - this->servicing = IDLE; } Dram::~Dram() { delete this->data; } @@ -23,17 +24,12 @@ Response Dram::write(Accessor accessor, signed int data, int address) r = OK; } else { /* Do this first--then process the first cycle immediately. */ - if (this->servicing == IDLE) { - this->servicing = accessor; - this->wait_time = delay; - } + this->deque.push_back(accessor); - if (this->servicing == accessor) { + if (this->deque.front() == accessor) { if (this->wait_time == 0) { this->do_write(data, address); r = OK; - } else { - --this->wait_time; } } } |