Skip to content

Commit 8c72e04

Browse files
committed
Tests: Add UVM DPI tests
1 parent b0f5598 commit 8c72e04

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

t/t_uvm_hello_v2017_1_0_dpi.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
3+
#
4+
# Copyright 2024 by Wilson Snyder. This program is free software; you
5+
# can redistribute it and/or modify it under the terms of either the GNU
6+
# Lesser General Public License Version 3 or the Perl Artistic License
7+
# Version 2.0.
8+
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
9+
10+
import vltest_bootstrap
11+
12+
test.scenarios('vlt')
13+
test.top_filename = "t/t_uvm_hello.v"
14+
15+
uvm_git = os.path.abspath(test.t_dir + "/../submodules/uvm")
16+
uvm_root = os.path.abspath(test.obj_dir + "/uvm-worktree")
17+
18+
test.pli_filename = uvm_root + "/src/dpi/uvm_dpi.cc"
19+
20+
if not os.path.exists(uvm_root):
21+
test.run(cmd=[
22+
"cd " + uvm_git +
23+
" && git worktree prune && git worktree add --detach " + uvm_root +
24+
" origin/uvm-2017-1.0-vlt"
25+
])
26+
27+
## Test
28+
29+
test.compile(verilator_flags2=[
30+
"--binary -j 0 -Wall --dump-inputs", #
31+
"--vpi", #
32+
"+incdir+" + uvm_root + "/src",
33+
test.pli_filename,
34+
])
35+
36+
test.execute()
37+
38+
test.file_grep(test.run_log_filename, r'Hello World')
39+
40+
test.passes()

t/t_uvm_hello_v2017_1_0_nodpi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
if not os.path.exists(uvm_root):
1919
test.run(cmd=[
2020
"cd " + uvm_git +
21-
# " && git fetch --tags" # .gitmodules doesn't pull tags - now using branch
2221
" && git worktree prune && git worktree add --detach " + uvm_root +
2322
" origin/uvm-2017-1.0-vlt"
2423
])

t/t_uvm_hello_v2020_3_1_dpi.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
3+
#
4+
# Copyright 2024 by Wilson Snyder. This program is free software; you
5+
# can redistribute it and/or modify it under the terms of either the GNU
6+
# Lesser General Public License Version 3 or the Perl Artistic License
7+
# Version 2.0.
8+
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
9+
10+
import vltest_bootstrap
11+
12+
test.scenarios('vlt')
13+
test.top_filename = "t/t_uvm_hello.v"
14+
15+
uvm_git = os.path.abspath(test.t_dir + "/../submodules/uvm")
16+
uvm_root = os.path.abspath(test.obj_dir + "/uvm-worktree")
17+
18+
test.pli_filename = uvm_root + "/src/dpi/uvm_dpi.cc"
19+
20+
if not os.path.exists(uvm_root):
21+
test.run(cmd=[
22+
"cd " + uvm_git +
23+
" && git worktree prune && git worktree add --detach " + uvm_root +
24+
" origin/uvm-2020-3.1-vlt"
25+
])
26+
27+
## Test
28+
29+
test.compile(verilator_flags2=[
30+
"--binary -j 0 -Wall --dump-inputs", #
31+
"--vpi", #
32+
"+incdir+" + uvm_root + "/src",
33+
test.pli_filename,
34+
])
35+
36+
test.execute()
37+
38+
test.file_grep(test.run_log_filename, r'Hello World')
39+
40+
test.passes()

t/t_uvm_hello_v2020_3_1_nodpi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
if not os.path.exists(uvm_root):
1919
test.run(cmd=[
2020
"cd " + uvm_git +
21-
# " && git fetch --tags" # .gitmodules doesn't pull tags - now using branch
2221
" && git worktree prune && git worktree add --detach " + uvm_root +
2322
" origin/uvm-2020-3.1-vlt"
2423
])

0 commit comments

Comments
 (0)