summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-14 00:57:21 +0800
committerruki <[email protected]>2023-01-14 00:57:21 +0800
commitbc17e4ba11e0d413a87a5a681f37f53f0c609335 (patch)
treefb4fab982b65487effdcf9ca7bf8489a92d099f4 /tests/projects
parent0d3ab3160992195fbf4dc7e5ed51b33d78ea1a4b (diff)
add sim_main.cpp
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/embed/verilator/hello/src/sim_main.cpp12
-rw-r--r--tests/projects/embed/verilator/hello/xmake.lua1
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/projects/embed/verilator/hello/src/sim_main.cpp b/tests/projects/embed/verilator/hello/src/sim_main.cpp
new file mode 100644
index 000000000..093fdac3e
--- /dev/null
+++ b/tests/projects/embed/verilator/hello/src/sim_main.cpp
@@ -0,0 +1,12 @@
+ #include "hello.h"
+ #include "verilated.h"
+
+ int main(int argc, char** argv) {
+ VerilatedContext* contextp = new VerilatedContext;
+ contextp->commandArgs(argc, argv);
+ hello* top = new hello{contextp};
+ while (!contextp->gotFinish()) { top->eval(); }
+ delete top;
+ delete contextp;
+ return 0;
+ }
diff --git a/tests/projects/embed/verilator/hello/xmake.lua b/tests/projects/embed/verilator/hello/xmake.lua
index b472abb37..2f2d6d158 100644
--- a/tests/projects/embed/verilator/hello/xmake.lua
+++ b/tests/projects/embed/verilator/hello/xmake.lua
@@ -3,3 +3,4 @@ target("hello")
add_rules("verilator.binary")
set_toolchains("@verilator")
add_files("src/*.v")
+ add_files("src/*.cpp")