summaryrefslogtreecommitdiff
path: root/tb/top/conspiracion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tb/top/conspiracion.cpp')
-rw-r--r--tb/top/conspiracion.cpp42
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();
}