summaryrefslogtreecommitdiff
path: root/verilator_example_systemc/sc_main.cc
diff options
context:
space:
mode:
authorMartin Stensgård <mastensg@mastensg.net>2025-04-26 17:56:22 +0200
committerMartin Stensgård <mastensg@mastensg.net>2025-04-26 17:56:22 +0200
commite3146a4830eeb07daf4688e1aae3690ff94db3e1 (patch)
tree2b3543e99fe510584d0d33fcb9efc775908ac98f /verilator_example_systemc/sc_main.cc
parent0925abbbe788f4b3661f5dbfc8b1597814b90c9a (diff)
verilator_example_systemc: hello
Diffstat (limited to 'verilator_example_systemc/sc_main.cc')
-rw-r--r--verilator_example_systemc/sc_main.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/verilator_example_systemc/sc_main.cc b/verilator_example_systemc/sc_main.cc
new file mode 100644
index 0000000..0634207
--- /dev/null
+++ b/verilator_example_systemc/sc_main.cc
@@ -0,0 +1,19 @@
+#include <cstdio>
+
+#include "Vhello.h"
+
+using namespace sc_core;
+
+int
+sc_main(int argc, char **argv)
+{
+ Verilated::commandArgs(argc, argv);
+ sc_clock clk{"clk", 10, SC_NS, 0.5, 3, SC_NS, true};
+
+ Vhello *top = new Vhello{"top"};
+ top->clk(clk);
+ while (!Verilated::gotFinish())
+ sc_start(1, SC_NS);
+ fprintf(stderr, "it finished.\n");
+ return 0;
+}