diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-11-14 21:10:40 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-11-14 21:10:40 -0600 |
| commit | 6fb3849e73b797d4610a2b782127f927dec0c9c9 (patch) | |
| tree | 9d17de8907d860b795761e0644f17d0fd33106de /tb/avalon.impl.hpp | |
| parent | cad870295dfb741d5c24c25016c5bba878bc37e5 (diff) | |
Implement VGA simulation
Diffstat (limited to '')
| -rw-r--r-- | tb/avalon.impl.hpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tb/avalon.impl.hpp b/tb/avalon.impl.hpp index f701e73..03685d0 100644 --- a/tb/avalon.impl.hpp +++ b/tb/avalon.impl.hpp @@ -1,5 +1,5 @@ -#ifndef AVALON_IMPL_HPP -#define AVALON_IMPL_HPP +#ifndef TALLER_AVALON_IMPL_HPP +#define TALLER_AVALON_IMPL_HPP #include <cassert> #include <cstdio> @@ -61,11 +61,9 @@ namespace taller::avalon avl_byteenable = plat.avl_byteenable; assert(!avl_read || !avl_write); - - if(avl_address & 0b11) + if(!avl_read && !avl_write) { - fprintf(stderr, "[avl] unaligned address: 0x%08x\n", avl_address); - assert(false); + return; } for(auto &binding : devices) @@ -83,13 +81,21 @@ namespace taller::avalon fprintf(stderr, "[avl] attempt to %s memory hole at 0x%08x\n", op, avl_address); assert(false); } + + if(avl_address & active->word_mask()) + { + fprintf(stderr, "[avl] unaligned address: 0x%08x\n", avl_address); + assert(false); + } } - auto pos = (avl_address & ~active->address_mask()) >> 2; + auto pos = (avl_address & ~active->address_mask()) >> active->word_bits(); if(avl_read) { - plat.avl_waitrequest = !active->read(pos, plat.avl_readdata); + std::uint32_t readdata; + plat.avl_waitrequest = !active->read(pos, readdata); + plat.avl_readdata = readdata; } else if(avl_write) { plat.avl_waitrequest = !active->write(pos, avl_writedata, avl_byteenable); |
