93 lines
2.9 KiB
Python
Executable File
93 lines
2.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# mypy: disallow-untyped-defs
|
|
# pylint: disable=
|
|
######################################################################
|
|
|
|
import argparse
|
|
import re
|
|
import sys
|
|
|
|
######################################################################
|
|
|
|
|
|
def process() -> None:
|
|
in_header = True
|
|
for line in sys.stdin:
|
|
line = line.rstrip()
|
|
line = line.expandtabs(tabsize=8)
|
|
line = re.sub(r', +', ', ', line)
|
|
line = re.sub(r'"/[^"]+/src/', '"t/uvm/src/', line)
|
|
|
|
# Replace header
|
|
if in_header:
|
|
if re.match(r'^//', line):
|
|
continue
|
|
else:
|
|
in_header = False
|
|
print_header()
|
|
in_header = False
|
|
|
|
# Drop some unneeded items
|
|
if re.match(r'^`begin_keywords ', line):
|
|
continue
|
|
if re.match(r'^`line ', line):
|
|
continue
|
|
if re.match(r'^\s*$', line):
|
|
continue
|
|
|
|
if re.match(r'^ *endpackage', line):
|
|
print(line)
|
|
break
|
|
|
|
print(line)
|
|
|
|
|
|
def print_header() -> None:
|
|
print("// DESCR"
|
|
"IPTION: Verilator: Concatenated UVM header for internal testing")
|
|
print("// SPDX-"
|
|
"License-Identifier: Apache-2.0")
|
|
print("//----------------------------------------------------------------------")
|
|
print("// To recreate:")
|
|
print("// Using verilator_ext_tests:")
|
|
print("// " + Args.test_name + " --gold")
|
|
# Copy the copyright header from original sources
|
|
with open(Args.uvm_header_filename, 'r', encoding="utf8") as fh:
|
|
for line in fh:
|
|
line = line.strip()
|
|
line = line.expandtabs(tabsize=8)
|
|
if not re.match(r'^//', line):
|
|
break
|
|
print(line)
|
|
|
|
|
|
#######################################################################
|
|
#######################################################################
|
|
|
|
parser = argparse.ArgumentParser(
|
|
allow_abbrev=False,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
description="""uvm_pkg_packer is used to create the test_regress
|
|
uvm_pkg libraries from sources in verilator_ext_test repository's tests.""",
|
|
epilog="""Copyright 2025-2025 by Wilson Snyder. This program is free software; you
|
|
can redistribute it and/or modify it under the terms of either the GNU
|
|
Lesser General Public License Version 3 or the Perl Artistic License
|
|
Version 2.0.
|
|
|
|
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0""")
|
|
|
|
parser.add_argument('--debug', action='store_true', help='enable debug')
|
|
parser.add_argument('--test-name', type=str, required=True, help='name of test to run to recreate')
|
|
parser.add_argument('--uvm-header-filename',
|
|
type=str,
|
|
required=True,
|
|
help='filename of uvm_pkg.sv')
|
|
|
|
Args = parser.parse_args()
|
|
process()
|
|
|
|
######################################################################
|
|
# Local Variables:
|
|
# compile-command: "cd $VE && t/t_uvm_hello_v2017_1_0_nodpi.py"
|
|
# End:
|