summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-22 14:38:35 -0400
committerbd <bdunahu@operationnull.com>2025-03-22 14:38:35 -0400
commit6ad8d012bc494f1119368c1466ac5d5d1bca2b96 (patch)
tree78c4981b2ad7db57bbe3d210655b577ad558018d /src
parent4bad9ab29a5fa6c442a257974beb7daeaf91f046 (diff)
Remove manual clock advancing / resolution from storage devices
Diffstat (limited to 'src')
-rw-r--r--src/cli/cli.cc16
-rw-r--r--src/storage/cache.cc4
-rw-r--r--src/storage/dram.cc10
-rw-r--r--src/storage/storage.cc12
4 files changed, 12 insertions, 30 deletions
diff --git a/src/cli/cli.cc b/src/cli/cli.cc
index e25b316..022b266 100644
--- a/src/cli/cli.cc
+++ b/src/cli/cli.cc
@@ -60,11 +60,6 @@ Cli::Cli()
return;
};
- commands['c'] = [this](std::vector<std::string> args) {
- clock();
- return;
- };
-
commands['h'] = [this](std::vector<std::string> args) {
help();
return;
@@ -85,11 +80,6 @@ void Cli::help()
<< " [p]eek <storage-level> <base> <lines> - side door function that "
"peeks the current status of the entire memory subsystem"
<< std::endl
- << std::endl
- << " [c]ycle - manually advances the clock" << std::endl
- << " [f]orce - advances the clock until one operation reports "
- "completion"
- << std::endl
<< " [r]eset - side door function that resets the memory "
"configuration and "
"cycles"
@@ -122,12 +112,6 @@ void Cli::store(Accessor accessor, int data, int address)
<< address << std::endl;
}
-void Cli::clock()
-{
- this->cache->resolve();
- ++this->cycle;
-}
-
void Cli::reset()
{
this->initialize();
diff --git a/src/storage/cache.cc b/src/storage/cache.cc
index 8acdf08..d96efe2 100644
--- a/src/storage/cache.cc
+++ b/src/storage/cache.cc
@@ -88,7 +88,11 @@ Response Cache::is_access_cleared(Accessor accessor, int address)
if (this->is_waiting)
r = BLOCKED;
else if (this->wait_time == 0) {
+ this->requester = IDLE;
+ this->wait_time = delay;
r = OK;
+ } else {
+ --this->wait_time;
}
}
return r;
diff --git a/src/storage/dram.cc b/src/storage/dram.cc
index 2c24b4b..371503d 100644
--- a/src/storage/dram.cc
+++ b/src/storage/dram.cc
@@ -80,9 +80,15 @@ Response Dram::is_access_cleared(Accessor accessor)
else {
if (this->requester == IDLE)
this->requester = accessor;
- if (this->requester == accessor)
- if (this->wait_time == 0)
+ if (this->requester == accessor) {
+ if (this->wait_time == 0) {
+ this->requester = IDLE;
+ this->wait_time = delay;
r = OK;
+ } else {
+ --this->wait_time;
+ }
+ }
}
return r;
}
diff --git a/src/storage/storage.cc b/src/storage/storage.cc
index 8e2e461..fed607b 100644
--- a/src/storage/storage.cc
+++ b/src/storage/storage.cc
@@ -14,15 +14,3 @@ Storage::view(int base, int lines) const
}
Storage *Storage::get_lower() { return this->lower; }
-
-void Storage::resolve()
-{
- if (this->lower)
- this->lower->resolve();
- if (this->wait_time == 0) {
- this->requester = IDLE;
- this->wait_time = delay;
- } else if (this->requester != IDLE && !this->is_waiting) {
- --this->wait_time;
- }
-}