|
| 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 | +if not os.path.exists(uvm_root): |
| 19 | + test.run(cmd=[ |
| 20 | + "cd " + uvm_git + |
| 21 | + # " && git fetch --tags" # .gitmodules doesn't pull tags - now using branch |
| 22 | + " && git worktree prune && git worktree add --detach " + uvm_root + |
| 23 | + " origin/uvm-2020-3.1-vlt" |
| 24 | + ]) |
| 25 | + |
| 26 | +## Make uvm_pkg_all |
| 27 | + |
| 28 | +e_filename = test.obj_dir + "/pp__" + test.name + "__all1.vpp" |
| 29 | + |
| 30 | +test.run( |
| 31 | + cmd=[ |
| 32 | + os.environ["VERILATOR_ROOT"] + "/bin/verilator", |
| 33 | + "--E --preproc-defines --no-preproc-comments ", # |
| 34 | + "+define+UVM_NO_DPI", |
| 35 | + "+incdir+" + uvm_root + "/src", |
| 36 | + test.top_filename, |
| 37 | + "> " + e_filename, |
| 38 | + ], |
| 39 | + verilator_run=True) |
| 40 | + |
| 41 | +packed_filename = test.obj_dir + "/pp__" + test.name + "__all2.vpp" |
| 42 | + |
| 43 | +test.run(cmd=[ |
| 44 | + os.environ["VERILATOR_ROOT"] + "/nodist/uvm_pkg_packer", |
| 45 | + "--test-name " + test.name, |
| 46 | + "--uvm-header-filename " + uvm_root + "/src/uvm_pkg.sv", # |
| 47 | + "< " + e_filename, |
| 48 | + "> " + packed_filename, |
| 49 | +]) |
| 50 | + |
| 51 | +test.copy_if_golden( |
| 52 | + packed_filename, os.environ["VERILATOR_ROOT"] + |
| 53 | + "/test_regress/t/uvm/uvm_pkg_all_v2020_3_1_nodpi.svh") |
| 54 | + |
| 55 | +## Test |
| 56 | + |
| 57 | +test.compile( |
| 58 | + v_flags2=["+define+UVM_NO_DPI"], |
| 59 | + verilator_flags2=[ |
| 60 | + "--binary -j 0 -Wall --dump-inputs", # |
| 61 | + "-Wno-EOFNEWLINE", # Temp - need to cleanup UVM repo |
| 62 | + "+incdir+" + uvm_root + "/src", |
| 63 | + ]) |
| 64 | + |
| 65 | +test.execute() |
| 66 | + |
| 67 | +test.file_grep(test.run_log_filename, r'Hello World') |
| 68 | + |
| 69 | +test.passes() |
0 commit comments