当前位置: 首页>>代码示例>>Python>>正文


Python CoreManager.add_cores_root方法代码示例

本文整理汇总了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)
开发者ID:hoangt,项目名称:fusesoc,代码行数:34,代码来源:main.py

示例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"
开发者ID:olofk,项目名称:fusesoc,代码行数:35,代码来源:test_main.py

示例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()
开发者ID:potentialventures,项目名称:buildtools,代码行数:53,代码来源:funit.py

示例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 = []
开发者ID:olofk,项目名称:fusesoc_vunit_demo,代码行数:32,代码来源:run_vunit.py


注:本文中的fusesoc.coremanager.CoreManager.add_cores_root方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。