diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-11-08 21:33:59 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-11-08 21:33:59 -0600 |
| commit | 1ea0519a2b6b81e0ba324cd69f8785735e7cbef5 (patch) | |
| tree | a89c1aa54fac62b1b849aa147c4c7ee1b42d4601 /tb/mem.cpp | |
| parent | bf7f350e161b2dc97e023724c8f190473af78202 (diff) | |
Fix handling of multi-cycle Avalon waitrequest states in bus master
Diffstat (limited to 'tb/mem.cpp')
| -rw-r--r-- | tb/mem.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; } } |
