summaryrefslogtreecommitdiff
path: root/tb
diff options
context:
space:
mode:
Diffstat (limited to 'tb')
-rw-r--r--tb/avalon.hpp7
-rw-r--r--tb/avalon.impl.hpp22
-rw-r--r--tb/interval_timer.hpp2
-rw-r--r--tb/jtag_uart.cpp1
-rw-r--r--tb/jtag_uart.hpp7
-rw-r--r--tb/top/conspiracion.cpp6
6 files changed, 36 insertions, 9 deletions
diff --git a/tb/avalon.hpp b/tb/avalon.hpp
index 4e33ab5..30eac2c 100644
--- a/tb/avalon.hpp
+++ b/tb/avalon.hpp
@@ -50,6 +50,12 @@ namespace taller::avalon
return ~mask + 1;
}
+ inline virtual void tick() noexcept
+ {}
+
+ inline virtual void bail() noexcept
+ {}
+
virtual bool read(std::uint32_t addr, std::uint32_t &data) = 0;
virtual bool write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) = 0;
@@ -72,6 +78,7 @@ namespace taller::avalon
bool tick(bool clk);
void attach(slave &dev);
+ void bail() noexcept;
std::uint32_t dump(std::uint32_t addr);
diff --git a/tb/avalon.impl.hpp b/tb/avalon.impl.hpp
index 3173af8..5ba514f 100644
--- a/tb/avalon.impl.hpp
+++ b/tb/avalon.impl.hpp
@@ -52,7 +52,14 @@ namespace taller::avalon
}
return true;
- } else if(!active)
+ }
+
+ for(auto &binding : devices)
+ {
+ binding.dev.tick();
+ }
+
+ if(!active)
{
avl_address = plat.avl_address;
avl_read = plat.avl_read;
@@ -77,6 +84,8 @@ namespace taller::avalon
if(!active)
{
+ bail();
+
const char *op = avl_read ? "read" : "write";
fprintf(stderr, "[avl] attempt to %s memory hole at 0x%08x\n", op, avl_address);
return false;
@@ -84,6 +93,8 @@ namespace taller::avalon
if(avl_address & active->word_mask())
{
+ bail();
+
fprintf(stderr, "[avl] unaligned address: 0x%08x\n", avl_address);
return false;
}
@@ -105,6 +116,15 @@ namespace taller::avalon
}
template<class Platform>
+ void interconnect<Platform>::bail() noexcept
+ {
+ for(auto &binding : devices)
+ {
+ binding.dev.bail();
+ }
+ }
+
+ template<class Platform>
std::uint32_t interconnect<Platform>::dump(std::uint32_t addr)
{
std::uint32_t avl_address = addr << 2;
diff --git a/tb/interval_timer.hpp b/tb/interval_timer.hpp
index 7cce265..eec9364 100644
--- a/tb/interval_timer.hpp
+++ b/tb/interval_timer.hpp
@@ -12,7 +12,7 @@ namespace taller::avalon
public:
interval_timer(std::uint32_t base) noexcept;
- void tick() noexcept;
+ virtual void tick() noexcept final override;
virtual bool read(std::uint32_t addr, std::uint32_t &data) noexcept final override;
virtual bool write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) noexcept final override;
diff --git a/tb/jtag_uart.cpp b/tb/jtag_uart.cpp
index 3bef42e..f33a7ab 100644
--- a/tb/jtag_uart.cpp
+++ b/tb/jtag_uart.cpp
@@ -144,6 +144,7 @@ namespace taller::avalon
if(took_over)
{
::endwin();
+ putchar('\n');
}
}
}
diff --git a/tb/jtag_uart.hpp b/tb/jtag_uart.hpp
index 3c378c3..79032a2 100644
--- a/tb/jtag_uart.hpp
+++ b/tb/jtag_uart.hpp
@@ -13,7 +13,12 @@ namespace taller::avalon
jtag_uart(std::uint32_t base) noexcept;
~jtag_uart() noexcept;
- void tick() noexcept;
+ virtual void tick() noexcept final override;
+
+ inline virtual void bail() noexcept final override
+ {
+ release();
+ }
virtual bool read(std::uint32_t addr, std::uint32_t &data) noexcept final override;
virtual bool write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) noexcept final override;
diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp
index bf0ee89..07b35a5 100644
--- a/tb/top/conspiracion.cpp
+++ b/tb/top/conspiracion.cpp
@@ -337,12 +337,6 @@ int main(int argc, char **argv)
top.clk_clk = !top.clk_clk;
top.eval();
- if(top.clk_clk)
- {
- ttyJ0.tick();
- timer.tick();
- }
-
if(!avl.tick(top.clk_clk))
{
failed = true;