summaryrefslogtreecommitdiff
path: root/tb/soc/irq
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-08-03 12:32:22 -0400
committerIan Moffett <ian@osmora.org>2024-08-03 12:32:22 -0400
commitaba8a9f6f4c7589889a7134b5592369395ec498e (patch)
tree952fe3a25cdbe1cc871fcc6a87e2f718a6206978 /tb/soc/irq
parentf4c018a11f9c25f89179af81871aa9b512fab0d5 (diff)
soc: pimc: Add initial testbench
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'tb/soc/irq')
-rw-r--r--tb/soc/irq/tb_pimc.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tb/soc/irq/tb_pimc.cpp b/tb/soc/irq/tb_pimc.cpp
new file mode 100644
index 0000000..8dd0186
--- /dev/null
+++ b/tb/soc/irq/tb_pimc.cpp
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include <iostream>
+#include <verilated.h>
+#include <verilated_vcd_c.h>
+#include "Vpimc.h"
+#include "Vpimc___024root.h"
+
+#define MAX_SIM_ITER 100
+
+int main(int argc, char** argv, char** env) {
+ Vpimc *pimc = new Vpimc;
+
+ Verilated::traceEverOn(true);
+ VerilatedVcdC *m_trace = new VerilatedVcdC;
+ pimc->trace(m_trace, 5);
+ m_trace->open("waveform.vcd");
+
+ pimc->notify = 1;
+ pimc->irq_in = 0b00000010; /* Pulse IRQ line high */
+
+ for (int i = 0; i < MAX_SIM_ITER; ++i) {
+ if (i == 5) {
+ pimc->irq_in = 0b00000000;
+ }
+
+ pimc->clk ^= 1;
+ pimc->eval();
+ m_trace->dump(i);
+ }
+
+ m_trace->close();
+ delete pimc;
+ exit(EXIT_SUCCESS);
+}
+