summaryrefslogtreecommitdiff
path: root/tb/mem.cpp
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-11-08 21:33:59 -0600
committerAlejandro Soto <alejandro@34project.org>2022-11-08 21:33:59 -0600
commit1ea0519a2b6b81e0ba324cd69f8785735e7cbef5 (patch)
treea89c1aa54fac62b1b849aa147c4c7ee1b42d4601 /tb/mem.cpp
parentbf7f350e161b2dc97e023724c8f190473af78202 (diff)
Fix handling of multi-cycle Avalon waitrequest states in bus master
Diffstat (limited to '')
-rw-r--r--tb/mem.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tb/mem.cpp b/tb/mem.cpp
index bfbc3ea..6eeb7df 100644
--- a/tb/mem.cpp
+++ b/tb/mem.cpp
@@ -16,7 +16,7 @@ namespace taller::avalon
bool mem::read(std::uint32_t addr, std::uint32_t &data)
{
data = block[addr];
- return true;
+ return ready();
}
bool mem::write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable)
@@ -44,6 +44,12 @@ namespace taller::avalon
}
block[addr] = (data & bytes) | (block[addr] & ~bytes);
- return true;
+ return ready();
+ }
+
+ bool mem::ready() noexcept
+ {
+ count = count > 0 ? count - 1 : 2;
+ return count == 0;
}
}