summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-08 11:36:17 -0500
committerbd <bdunahu@operationnull.com>2025-03-08 11:36:17 -0500
commitc5f26a0bfdaafc8d49c88d2016df1724b64e5271 (patch)
tree964ced6682b34a1ee536c1a86e6c5b367ef17a77 /src
parent3221a2c310afb6ed124d6b67afda110d4b8dcade (diff)
Refactor function return scheme
Diffstat (limited to 'src')
-rw-r--r--src/storage/cache.cc6
-rw-r--r--src/storage/dram.cc11
2 files changed, 8 insertions, 9 deletions
diff --git a/src/storage/cache.cc b/src/storage/cache.cc
index f4f60ba..bbefb2a 100644
--- a/src/storage/cache.cc
+++ b/src/storage/cache.cc
@@ -14,9 +14,9 @@ Cache::Cache(int lines, Storage *lower, int delay)
Cache::~Cache() { delete this->data; }
-Response *Cache::write(Accessor accessor, signed int data, int address)
+Response Cache::write(Accessor accessor, signed int data, int address)
{
- return new Response();
+ return WAIT;
}
-Response *Cache::read(Accessor accessor, int address) { return nullptr; }
+Response Cache::read(Accessor accessor, int address) { return WAIT; }
diff --git a/src/storage/dram.cc b/src/storage/dram.cc
index 3eb0748..4c4ca84 100644
--- a/src/storage/dram.cc
+++ b/src/storage/dram.cc
@@ -14,14 +14,13 @@ Dram::Dram(int lines, int delay)
Dram::~Dram() { delete this->data; }
-Response *Dram::write(Accessor accessor, signed int data, int address)
+Response Dram::write(Accessor accessor, signed int data, int address)
{
- struct Response *r = new Response();
- r->status = WAIT;
+ Response r = WAIT;
if (accessor == SIDE) {
this->do_write(data, address);
- r->status = OK;
+ r = OK;
} else {
/* Do this first--then process the first cycle immediately. */
if (this->servicing == IDLE) {
@@ -32,7 +31,7 @@ Response *Dram::write(Accessor accessor, signed int data, int address)
if (this->servicing == accessor) {
if (this->wait_time == 0) {
this->do_write(data, address);
- r->status = OK;
+ r = OK;
} else {
--this->wait_time;
}
@@ -42,4 +41,4 @@ Response *Dram::write(Accessor accessor, signed int data, int address)
return r;
}
-Response *Dram::read(Accessor accessor, int address) { return nullptr; }
+Response Dram::read(Accessor accessor, int address) { return WAIT; }