diff options
| author | ruki <[email protected]> | 2023-01-14 19:00:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-01-14 19:00:53 +0800 |
| commit | ee21646e7b1d123fd92eeee814ba493ee4af1d0e (patch) | |
| tree | 89ede75703d97af3b1f8a06819d010af0d8ccafc /tests/projects | |
| parent | 59b982c3a89d4d0ce2ecfede7362e905f9da3eb6 (diff) | |
add tests
Diffstat (limited to 'tests/projects')
9 files changed, 55 insertions, 20 deletions
diff --git a/tests/projects/embed/iverilog/hello/src/main.v b/tests/projects/embed/iverilog/hello/src/main.v index 9661c433e..b7f80008d 100644 --- a/tests/projects/embed/iverilog/hello/src/main.v +++ b/tests/projects/embed/iverilog/hello/src/main.v @@ -1,8 +1,6 @@ module hello; initial begin $display("hello world!"); - $dumpfile("hello.vcd"); - $dumpvars(0, hello); $finish ; end endmodule diff --git a/tests/projects/embed/iverilog/hello_vcd/src/main.v b/tests/projects/embed/iverilog/hello_vcd/src/main.v new file mode 100644 index 000000000..9661c433e --- /dev/null +++ b/tests/projects/embed/iverilog/hello_vcd/src/main.v @@ -0,0 +1,8 @@ +module hello; + initial begin + $display("hello world!"); + $dumpfile("hello.vcd"); + $dumpvars(0, hello); + $finish ; + end +endmodule diff --git a/tests/projects/embed/iverilog/hello_vcd/xmake.lua b/tests/projects/embed/iverilog/hello_vcd/xmake.lua new file mode 100644 index 000000000..a59478b51 --- /dev/null +++ b/tests/projects/embed/iverilog/hello_vcd/xmake.lua @@ -0,0 +1,5 @@ +add_requires("iverilog") +target("hello") + add_rules("iverilog.binary") + set_toolchains("@iverilog") + add_files("src/*.v") diff --git a/tests/projects/embed/verilator/hello/src/main.v b/tests/projects/embed/verilator/hello/src/main.v index 9bd2c43b5..b7f80008d 100644 --- a/tests/projects/embed/verilator/hello/src/main.v +++ b/tests/projects/embed/verilator/hello/src/main.v @@ -1,7 +1,6 @@ module hello; initial begin $display("hello world!"); - $dumpvars(0, hello); $finish ; end endmodule diff --git a/tests/projects/embed/verilator/hello/src/sim_main.cpp b/tests/projects/embed/verilator/hello/src/sim_main.cpp index 0aa763a0a..44cb1da1f 100644 --- a/tests/projects/embed/verilator/hello/src/sim_main.cpp +++ b/tests/projects/embed/verilator/hello/src/sim_main.cpp @@ -1,26 +1,10 @@ #include "hello.h" #include "verilated.h" -#include "verilated_vcd_c.h" - -double sc_time_stamp() { - return 0; -} int main(int argc, char** argv) { - char const* vcdfile = NULL; - if (argc == 2) { - vcdfile = argv[1]; - } else { - printf("xmake run hello [vcdfile]\n"); - return -1; - } VerilatedContext* contextp = new VerilatedContext; contextp->commandArgs(argc, argv); hello* top = new hello{contextp}; - VerilatedVcdC* tfp = new VerilatedVcdC; - top->trace(tfp, 99); - Verilated::traceEverOn(true); - tfp->open(vcdfile); while (!contextp->gotFinish()) { top->eval(); } delete top; delete contextp; diff --git a/tests/projects/embed/verilator/hello/xmake.lua b/tests/projects/embed/verilator/hello/xmake.lua index 786dc5332..2f2d6d158 100644 --- a/tests/projects/embed/verilator/hello/xmake.lua +++ b/tests/projects/embed/verilator/hello/xmake.lua @@ -4,4 +4,3 @@ target("hello") set_toolchains("@verilator") add_files("src/*.v") add_files("src/*.cpp") - add_values("verilator.flags", "--trace", "--timing") diff --git a/tests/projects/embed/verilator/hello_vcd/src/main.v b/tests/projects/embed/verilator/hello_vcd/src/main.v new file mode 100644 index 000000000..9bd2c43b5 --- /dev/null +++ b/tests/projects/embed/verilator/hello_vcd/src/main.v @@ -0,0 +1,7 @@ +module hello; + initial begin + $display("hello world!"); + $dumpvars(0, hello); + $finish ; + end +endmodule diff --git a/tests/projects/embed/verilator/hello_vcd/src/sim_main.cpp b/tests/projects/embed/verilator/hello_vcd/src/sim_main.cpp new file mode 100644 index 000000000..0aa763a0a --- /dev/null +++ b/tests/projects/embed/verilator/hello_vcd/src/sim_main.cpp @@ -0,0 +1,28 @@ +#include "hello.h" +#include "verilated.h" +#include "verilated_vcd_c.h" + +double sc_time_stamp() { + return 0; +} + +int main(int argc, char** argv) { + char const* vcdfile = NULL; + if (argc == 2) { + vcdfile = argv[1]; + } else { + printf("xmake run hello [vcdfile]\n"); + return -1; + } + VerilatedContext* contextp = new VerilatedContext; + contextp->commandArgs(argc, argv); + hello* top = new hello{contextp}; + VerilatedVcdC* tfp = new VerilatedVcdC; + top->trace(tfp, 99); + Verilated::traceEverOn(true); + tfp->open(vcdfile); + while (!contextp->gotFinish()) { top->eval(); } + delete top; + delete contextp; + return 0; +} diff --git a/tests/projects/embed/verilator/hello_vcd/xmake.lua b/tests/projects/embed/verilator/hello_vcd/xmake.lua new file mode 100644 index 000000000..786dc5332 --- /dev/null +++ b/tests/projects/embed/verilator/hello_vcd/xmake.lua @@ -0,0 +1,7 @@ +add_requires("verilator") +target("hello") + add_rules("verilator.binary") + set_toolchains("@verilator") + add_files("src/*.v") + add_files("src/*.cpp") + add_values("verilator.flags", "--trace", "--timing") |
