summaryrefslogtreecommitdiff
path: root/src/storage.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-11 21:22:18 -0400
committerbd <bdunahu@operationnull.com>2025-04-11 21:22:18 -0400
commit1fb7a9bd5eb41e87871bcbb3423caaabdd8ce1d9 (patch)
tree08549aa6c7cbae114958df62f92c9e60eb5f114c /src/storage.cc
parent101f0facf8002907ca6e19faabfdcf472c0c3152 (diff)
First part of storage rework (see description)
- Removed response enum. - Removed messy ostream override, and cli.cc test class - Removed accessor enum, and instead used unique pointer to identify accessor. - Simplified storage by removing is_waiting variables. - Rewrote DRAM and Cache to use Storage constructor.
Diffstat (limited to 'src/storage.cc')
-rw-r--r--src/storage.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/storage.cc b/src/storage.cc
index fed607b..4ad916b 100644
--- a/src/storage.cc
+++ b/src/storage.cc
@@ -2,15 +2,19 @@
#include "definitions.h"
#include <algorithm>
+Storage::Storage(int delay) {
+ this->data = new std::vector<std::array<signed int, LINE_SIZE>>;
+ this->delay = delay;
+ this->lower = nullptr;
+ this->current_request = nullptr;
+ this->wait_time = this->delay;
+}
+
std::vector<std::array<signed int, LINE_SIZE>>
Storage::view(int base, int lines) const
{
base = (base / LINE_SIZE) * LINE_SIZE;
std::vector<std::array<signed int, LINE_SIZE>> ret(lines + 1);
- std::copy(
- this->data->begin() + base, this->data->begin() + base + lines,
- ret.begin());
+ std::copy(this->data->begin() + base, this->data->begin() + base + lines, ret.begin());
return ret;
}
-
-Storage *Storage::get_lower() { return this->lower; }