diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-09-18 00:40:22 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-09-18 00:40:22 -0600 |
| commit | 1f27d200401eb0497c23054ebbe04c488c6974b9 (patch) | |
| tree | ef41f81bb10770b95c996401be43eb1f7b7b9c73 /tb/top/conspiracion.cpp | |
| parent | d743c48b821bad11943b77bdc9a5d9d975fd8cb0 (diff) | |
Update testbench
Diffstat (limited to 'tb/top/conspiracion.cpp')
| -rw-r--r-- | tb/top/conspiracion.cpp | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp index d4bdbcb..b8f803c 100644 --- a/tb/top/conspiracion.cpp +++ b/tb/top/conspiracion.cpp @@ -2,18 +2,48 @@ #include <cstdio> #include "Vconspiracion.h" +#include "Vconspiracion_conspiracion.h" +#include "Vconspiracion_platform.h" + +#include "../avalon.hpp" int main(int argc, char **argv) { - Verilated::commandArgs(argc, argv); // Remember args - Verilated::traceEverOn(true); + using namespace taller::avalon; + + Verilated::commandArgs(argc, argv); Vconspiracion top; - // Do not instead make Vtop as a file-scope static - // variable, as the "C++ static initialization order fiasco" - // may cause a crash + interconnect<Vconspiracion_platform> avl(*top.conspiracion->plat); + + int time = 0; + auto tick = [&]() + { + top.clk_clk = 0; + top.eval(); + top.clk_clk = 1; + top.eval(); + avl.tick(); + + std::printf("[%02d] out=0x%02x, done=%d\n", ++time, top.out, top.done); + }; + + top.dir = 1; + top.io = 1; + top.mov = 1; + top.clr = 1; + + for(int i = 0; i < 5; ++i) + { + top.add = 0; + tick(); + top.add = 1; + tick(); + } - top.eval(); + top.io = 0; + tick(); + tick(); top.final(); } |
