本文整理汇总了Python中vunit.VUnit类的典型用法代码示例。如果您正苦于以下问题:Python VUnit类的具体用法?Python VUnit怎么用?Python VUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VUnit类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
ui = VUnit.from_argv()
ui.add_osvvm()
ui.enable_location_preprocessing()
# ui.add_com()
ui.disable_ieee_warnings()
root = dirname(__file__)
for library_name in ('common_lib', 'memory'):
ui.add_library(library_name).add_source_files(
join(root, library_name, 'src', '*.vhd'))
ui.add_library('str_format').add_source_files(
join(root, 'hdl_string_format', 'src', '*.vhd'))
ui.add_library('memory_tb').add_source_files(
join(root, 'memory', 'test', 'async_fifo_tb.vhd'))
ui.add_library('exp_golomb').add_source_files(
join(root, 'exponential_golomb', 'src', '*.vhd'))
# ui.add_library('exp_golomb_tb').add_source_files(
# join(root, 'exponential_golomb', 'test', '*.vhd'))
add_async_fifo_tests(ui.library('memory_tb').entity('async_fifo_tb'))
ui.set_compile_option('modelsim.vcom_flags', ['-novopt', '-explicit'])
ui.set_sim_option('modelsim.vsim_flags', ['-novopt'])
ui.main()
示例2: run
def run(value):
"""
Utility function to first run with pkg_body1 then pkg_body2
"""
tb_pkg_file_name = join(self.data_path, "tb_pkg.vhd")
pkg_file_name = join(self.data_path, "pkg.vhd")
pkg_body_file_name = join(self.data_path, "pkg_body%i.vhd" % value)
argv = ["--output-path=%s" % self.output_path,
"-v"]
if value == 1:
argv.append("--clean")
ui = VUnit.from_argv(argv=argv)
lib = ui.add_library("lib")
lib.add_source_files(tb_pkg_file_name)
lib.add_source_files(pkg_file_name)
lib.add_source_files(pkg_body_file_name)
lib.entity("tb_pkg").set_generic("value", value)
try:
ui.main()
except SystemExit as ex:
self.assertEqual(ex.code, 0)
示例3: run
def run():
ui = VUnit.from_argv()
# ui.add_osvvm()
src_path = join(dirname(__file__), "vhdl_files")
src_lib = ui.add_library("src_lib")
src_lib.add_source_files(join(src_path, "src", "*.vhd"))
test_lib = ui.add_library("test_lib")
test_lib.add_source_files(join(src_path, "test", "*.vhd"))
ui.main()
示例4: main
def main():
# VUnit steals the command line args so we use an environment variable
# to determine which core we're picking up
toplevel = os.getenv("CORE", "")
if not toplevel:
sys.stderr.write("Need to provide CORE environment variable")
sys.exit(1)
# Create VUnit instance by parsing command line arguments
vu = VUnit.from_argv()
#Create singleton instances for core manager and configuration handler
#Configuration manager is not needed in this example
cm = CoreManager()
# Assume we're running in the same directory containing the cores
cm.add_cores_root(".")
#Get the sorted list of dependencies starting from the top-level core
try:
cores = cm.get_depends(toplevel)
except DependencyError as e:
print("'{}' or any of its dependencies requires '{}', but this core was not found".format(top_core, e.value))
sys.exit(2)
#Iterate over cores, filesets and files and add all relevant sources files to vunit
incdirs = set()
src_files = []
#'usage' is a list of tags to look for in the filesets.
# Only look at filesets where any of these tags are present
usage = ['sim']
for core_name in cores:
core = cm.get_core(core_name)
core.setup()
basepath = core.files_root
for fs in core.file_sets:
if (set(fs.usage) & set(usage)) and ((core_name == toplevel) or not fs.private):
for file in fs.file:
if file.is_include_file:
#TODO: incdirs not used right now
incdirs.add(os.path.join(basepath, os.path.dirname(file.name)))
else:
try:
vu.library(file.logical_name)
except KeyError:
vu.add_library(file.logical_name)
vu.add_source_file(os.path.join(basepath, file.name), file.logical_name)
# Run vunit function
vu.main()
示例5: main
def main():
ui = VUnit.from_argv()
ui.add_osvvm()
root_path = dirname(__file__)
exp_golomb = ui.add_library("exp_golomb")
exp_golomb.add_source_files(join(root_path, "src", "*.vhd"))
exp_golomb_tb = ui.add_library("exp_golomb_tb")
exp_golomb_tb.add_source_files(join(root_path, "test", "*.vhd"))
ui.set_compile_option('modelsim.vcom_flags', ['-novopt', '-explicit'])
ui.set_sim_option('modelsim.vsim_flags', ['-novopt'])
ui.main()
示例6: Copyright
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2015, Lars Asplund [email protected]
from os.path import join, dirname
from vunit import VUnit
root = dirname(__file__)
ui = VUnit.from_argv()
lib = ui.add_library("lib")
lib.add_source_files(join(root, "test", "*.vhd"))
ui.main()
示例7: Copyright
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2018, Lars Asplund [email protected]
from os.path import join, dirname
from vunit import VUnit
root = dirname(__file__)
prj = VUnit.from_argv()
prj.add_com()
tb_com_lib = prj.add_library("tb_com_lib")
tb_com_lib.add_source_files(join(root, 'test', '*.vhd'))
pkg = tb_com_lib.package('custom_types_pkg')
pkg.generate_codecs(codec_package_name='custom_codec_pkg', used_packages=['ieee.std_logic_1164', 'constants_pkg',
'tb_com_lib.more_constants_pkg'])
prj.main()
示例8: dirname
# -------
from vunit import VUnit, VUnitCLI
root = dirname(__file__)
# These lines add the option to specify the Bitvis Utility Library root directory
# from the command line (python run.py -b <path to my BVUL root>). They
# can be replaced by a single line, ui = VUnit.from_argv(), if you assign the root
# directory to the bvul_root variable directly
cli = VUnitCLI()
cli.parser.add_argument('-b', '--bvul-root',
required=True,
help='Bitvis Utility Library root directory')
args = cli.parse_args()
ui = VUnit.from_args(args)
# ------
# Create VHDL libraries and add the related BVUL files to these
bvul_root = args.bvul_root
bvul_lib = ui.add_library('bitvis_util')
bvul_lib.add_source_files(join(bvul_root, 'bitvis_util', 'src2008', '*.vhd'))
bitvis_vip_spi_lib = ui.add_library('bitvis_vip_sbi')
bitvis_vip_spi_lib.add_source_files(join(bvul_root, 'bitvis_vip_sbi', 'src', '*.vhd'))
# Add all testbenches to lib
lib = ui.add_library('lib')
lib.add_source_files(join(root, 'test', '*.vhd'))
示例9: Copyright
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015, Lars Asplund [email protected]
from os.path import join, dirname, basename
from vunit import VUnit
from vunit.check_preprocessor import CheckPreprocessor
from glob import glob
vhdl_path = join(dirname(__file__), "test")
ui = VUnit.from_argv(compile_builtins=False)
ui.add_builtins('vunit_lib', mock_log=True)
lib = ui.add_library('lib')
lib.add_source_files(join(vhdl_path, "test_support.vhd"))
if ui.vhdl_standard in ('2002', '2008'):
lib.add_source_files(join(vhdl_path, "test_count.vhd"))
lib.add_source_files(join(vhdl_path, "test_types.vhd"))
elif ui.vhdl_standard == '93':
lib.add_source_files(join(vhdl_path, "test_count93.vhd"))
if ui.vhdl_standard == '2008':
lib.add_source_files(join(vhdl_path, "tb_check_relation.vhd"), [CheckPreprocessor()])
else:
lib.add_source_files(join(vhdl_path, "tb_check_relation93_2002.vhd"), [CheckPreprocessor()])
for file_name in glob(join(vhdl_path, "tb_*.vhd")):
if basename(file_name) == "tb_check_relation.vhd":
continue
示例10: VUnitCLI
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from collections import OrderedDict
import os.path
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager, DependencyError
from vunit import VUnitCLI, VUnit
cli = VUnitCLI()
cli.parser.add_argument('--core', nargs=1, required=True, help='Top-level FuseSoC core')
args = cli.parse_args()
# Create VUnit instance by parsing command line arguments
vu = VUnit.from_args(args=args)
top_core = args.core[0]
#Create singleton instances for core manager and configuration handler
#Configuration manager is not needed in this example
cm = CoreManager()
#config = Config()
#Add core libraries that were picked up from fusesoc.conf by the config handler
#Not really necessary for this example as we can just add 'corelib' manually
try:
#cm.add_cores_root(config.cores_root)
cm.add_cores_root('corelib')
except (RuntimeError, IOError) as e:
pr_warn("Failed to register cores root '{}'".format(str(e)))
示例11: Copyright
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015, Lars Asplund [email protected]
"""
Example of how you can extract compilation order using VUnit
Note that you cannot run VUnit normally via this script
"""
from os.path import join
from vunit import VUnit
from project import create_project, ROOT
ui = VUnit.from_argv(argv=[])
create_project(ui)
source_files = ui.get_project_compile_order(target=join(ROOT, "compile_order_top.vhd"))
for source_file in source_files:
print(source_file.library.name + ", " + source_file.name)