summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-11 16:39:47 -0400
committerbd <bdunahu@operationnull.com>2025-03-11 16:39:47 -0400
commit5f13f583e373bb02b7bf20cbcc9298dc1480a697 (patch)
tree0574ee516499001244d33785a5fc380801c557c9 /src
parentaed0a13d39bfe0b189ea43117aeb2e8b9188c3d9 (diff)
Rename read/write to read_line and write_word
Diffstat (limited to 'src')
-rw-r--r--src/cli/cli.cc2
-rw-r--r--src/storage/cache.cc6
-rw-r--r--src/storage/dram.cc22
3 files changed, 17 insertions, 13 deletions
diff --git a/src/cli/cli.cc b/src/cli/cli.cc
index 0729e00..a885aee 100644
--- a/src/cli/cli.cc
+++ b/src/cli/cli.cc
@@ -115,7 +115,7 @@ void Cli::load(Accessor accessor, int address)
void Cli::store(Accessor accessor, int data, int address)
{
- Response r = this->cache->write(accessor, data, address);
+ Response r = this->cache->write_word(accessor, data, address);
std::cout << r << " to " << accessor << " storing " << data << " in"
<< address << std::endl;
}
diff --git a/src/storage/cache.cc b/src/storage/cache.cc
index 5e071ac..533d0ec 100644
--- a/src/storage/cache.cc
+++ b/src/storage/cache.cc
@@ -25,7 +25,7 @@ Cache::~Cache()
delete this->data;
}
-Response Cache::write(Accessor accessor, signed int data, int address)
+Response Cache::write_word(Accessor accessor, signed int data, int address)
{
Response r = WAIT;
@@ -75,7 +75,7 @@ Response Cache::write_line(
}
// TODO: tests for multi level cache
-Response Cache::read(
+Response Cache::read_line(
Accessor accessor,
int address,
std::array<signed int, LINE_SIZE> &data_line)
@@ -140,7 +140,7 @@ void Cache::fetch_resource(int expected)
meta->at(1) = -1;
}
} else {
- r = this->lower->read(L1CACHE, expected, actual);
+ r = this->lower->read_line(L1CACHE, expected, actual);
if (r == OK) {
meta->at(0) = tag;
}
diff --git a/src/storage/dram.cc b/src/storage/dram.cc
index 76c4f90..f375a76 100644
--- a/src/storage/dram.cc
+++ b/src/storage/dram.cc
@@ -28,7 +28,9 @@ void Dram::do_write(signed int data, int address)
this->data->at(line).at(word) = data;
}
-void Dram::do_write_line(std::array<signed int, LINE_SIZE> data_line, int address){
+void Dram::do_write_line(
+ std::array<signed int, LINE_SIZE> data_line, int address)
+{
int line = address / LINE_SIZE;
this->data->at(line) = data_line;
}
@@ -46,9 +48,8 @@ void Dram::do_read_word(signed int &data, int address)
data = this->data->at(line).at(word);
}
-
-
-Response Dram::write_line(Accessor accessor, std::array<signed int, LINE_SIZE> data_line, int address)
+Response Dram::write_line(
+ Accessor accessor, std::array<signed int, LINE_SIZE> data_line, int address)
{
Response r = WAIT;
@@ -70,8 +71,7 @@ Response Dram::write_line(Accessor accessor, std::array<signed int, LINE_SIZE> d
return r;
}
-
-Response Dram::write(Accessor accessor, signed int data, int address)
+Response Dram::write_word(Accessor accessor, signed int data, int address)
{
Response r = WAIT;
@@ -94,7 +94,11 @@ Response Dram::write(Accessor accessor, signed int data, int address)
return r;
}
-Response Dram::read(Accessor accessor, int address, std::array<signed int, LINE_SIZE>& data_line) {
+Response Dram::read_line(
+ Accessor accessor,
+ int address,
+ std::array<signed int, LINE_SIZE> &data_line)
+{
Response r = WAIT;
if (this->requester == IDLE)
@@ -110,7 +114,8 @@ Response Dram::read(Accessor accessor, int address, std::array<signed int, LINE_
return r;
}
-Response Dram::read_word(Accessor accessor, int address, signed int& data) {
+Response Dram::read_word(Accessor accessor, int address, signed int &data)
+{
Response r = WAIT;
if (this->requester == IDLE)
@@ -149,4 +154,3 @@ std::ostream &operator<<(std::ostream &os, const Dram &d)
std::cout.fill(default_fill);
return os;
}
-