本文整理汇总了Python中fusesoc.coremanager.CoreManager.add_cores_root方法的典型用法代码示例。如果您正苦于以下问题:Python CoreManager.add_cores_root方法的具体用法?Python CoreManager.add_cores_root怎么用?Python CoreManager.add_cores_root使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fusesoc.coremanager.CoreManager
的用法示例。
在下文中一共展示了CoreManager.add_cores_root方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from fusesoc.coremanager import CoreManager [as 别名]
# 或者: from fusesoc.coremanager.CoreManager import add_cores_root [as 别名]
def run(args):
cm = CoreManager()
config = Config()
for cores_root in [config.cores_root,
config.systems_root,
args.cores_root]:
try:
cm.add_cores_root(cores_root)
except (RuntimeError, IOError) as e:
pr_warn("Failed to register cores root '{}'".format(str(e)))
# Process global options
if vars(args)['32']:
config.archbits = 32
logger.debug("Forcing 32-bit mode")
elif vars(args)['64']:
config.archbits = 64
logger.debug("Forcing 64-bit mode")
else:
config.archbits = 64 if platform.architecture()[0] == '64bit' else 32
logger.debug("Autodetected " + str(config.archbits) + "-bit mode")
config.monochrome = vars(args)['monochrome']
if config.monochrome:
logger.debug("Monochrome output")
else:
logger.debug("Colorful output")
config.verbose = vars(args)['verbose']
if config.verbose:
logger.debug("Verbose output")
else:
logger.debug("Concise output")
# Run the function
args.func(args)
示例2: test_sim
# 需要导入模块: from fusesoc.coremanager import CoreManager [as 别名]
# 或者: from fusesoc.coremanager.CoreManager import add_cores_root [as 别名]
def test_sim(capsys):
class Args():
sim = None
testbench = None
target = None
keep = False
backendargs = None
setup = True
build_only = False
no_export = False
def __init__(self, system):
self.system = system
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
build_root = os.path.join(tests_dir, 'build')
config = Config()
config.build_root = build_root
config.cache_root = cache_root
common_cm = CoreManager(config)
common_cm.add_cores_root(cores_root)
args = Args(system="wb_common")
with pytest.raises(SystemExit):
sim(common_cm, args)
out, err = capsys.readouterr()
assert out == ""
#Workaround since this test fails with Travis on Python2.7. No idea why
import sys
if sys.version_info[0] > 2:
assert err == "No tool was supplied on command line or found in 'wb_common' core description\n"
示例3: main
# 需要导入模块: from fusesoc.coremanager import CoreManager [as 别名]
# 或者: from fusesoc.coremanager.CoreManager import add_cores_root [as 别名]
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()
示例4: CoreManager
# 需要导入模块: from fusesoc.coremanager import CoreManager [as 别名]
# 或者: from fusesoc.coremanager.CoreManager import add_cores_root [as 别名]
# 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)))
#Get the sorted list of dependencies starting from the top-level core
try:
cores = cm.get_depends(top_core)
except DependencyError as e:
print("'{}' or any of its dependencies requires '{}', but this core was not found".format(top_core, e.value))
exit(1)
#Hack 2. Disable for now. Should probably be hooked up to vunit_simulator
#CoreManager().tool = sim_name
#Iterate over cores, filesets and files and add all relevant sources files to vunit
incdirs = set()
src_files = []