summaryrefslogtreecommitdiff
path: root/soc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'soc.cpp')
-rw-r--r--soc.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/soc.cpp b/soc.cpp
new file mode 100644
index 0000000..c6c378b
--- /dev/null
+++ b/soc.cpp
@@ -0,0 +1,51 @@
+#include <verilated.h>
+#include <verilated_vcd_c.h>
+#include "Vsystem.h"
+#include <iostream>
+
+#include "DRAM.h"
+
+struct Bench {
+ Vsystem *system;
+ DRAM *dram;
+
+ Bench() {
+ system = new Vsystem();
+ dram = new DRAM();
+
+ system->eval();
+ eval();
+ }
+ ~Bench() {
+ delete dram;
+ delete system;
+ }
+
+ void eval() {
+ // Apply signals to the DRAM
+ dram->apply(
+ system->clk,
+ system->mem_we,
+ system->mem_claddr,
+ &system->mem_cldata
+ );
+ // Eval the DRAM
+ dram->eval();
+
+ // Eval the system
+ system->eval();
+ }
+
+ void tick() {
+ system->clk ^= 1;
+ eval();
+ }
+};
+
+int main() {
+ Bench bench;
+
+
+ for (int i = 0; i < 10000; i++)
+ bench.tick();
+} \ No newline at end of file