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


Python coremanager.CoreManager类代码示例

本文整理汇总了Python中fusesoc.coremanager.CoreManager的典型用法代码示例。如果您正苦于以下问题:Python CoreManager类的具体用法?Python CoreManager怎么用?Python CoreManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CoreManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_sim

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,代码行数:33,代码来源:test_main.py

示例2: run

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,代码行数:32,代码来源:main.py

示例3: system_info

def system_info(args):
    if args.system in CoreManager().get_systems():
        core = CoreManager().get_core(args.system)
        core.info()
        core.system.info()
    else:
        pr_err("Can't find system '" + args.system + "'")
开发者ID:hoangt,项目名称:fusesoc,代码行数:7,代码来源:main.py

示例4: configure

 def configure(self):
     if os.path.exists(self.work_root): 
         shutil.rmtree(self.work_root)
     os.makedirs(self.work_root)
     cm = CoreManager()
     for name in self.cores:
         pr_info("Preparing " + name)
         core = cm.get_core(name)
         dst_dir = os.path.join(Config().build_root, self.system.name, 'src', name)
         core.setup()
         core.export(dst_dir)
开发者ID:horos,项目名称:fusesoc,代码行数:11,代码来源:backend.py

示例5: configure

 def configure(self):
     logger.debug('configure() *Entered*')
     if os.path.exists(self.work_root): 
         shutil.rmtree(self.work_root)
     os.makedirs(self.work_root)
     cm = CoreManager()
     for name in self.cores:
         print("Preparing " + name)
         core = cm.get_core(name)
         dst_dir = os.path.join(Config().build_root, self.system.name, 'src', name)
         core.setup()
         core.export(dst_dir)
     logger.debug('configure() -Done-')
开发者ID:Carlosaarodrigues,项目名称:fusesoc,代码行数:13,代码来源:backend.py

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

示例7: __init__

    def __init__(self, system):
        logger.debug('__init__() *Entered*')
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.name)
        self.systems_root = config.systems_root

        self.src_root = os.path.join(self.build_root, 'src')

        self.include_dirs = []
        self.src_files = []
        self.vhdl_src_files = []
        self.cm = CoreManager()

        self.env = os.environ.copy()
        self.env['SYSTEM_ROOT'] = os.path.abspath(os.path.join(self.systems_root, self.system.name))
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)
        self.env['BACKEND'] = self.TOOL_NAME

        self.cores = self.cm.get_depends(self.system.name)
        for core_name in self.cores:
            logger.debug('core_name=' + core_name)
            core = self.cm.get_core(core_name)
            if core.verilog:
                if core.verilog.include_dirs:
                    logger.debug('core.include_dirs=' + str(core.verilog.include_dirs))
                else:
                    logger.debug('core.include_dirs=None')
                self.include_dirs += [os.path.join(self.src_root, core_name, d) for d in core.verilog.include_dirs]
                self.src_files    += [os.path.join(self.src_root, core_name, f) for f in core.verilog.src_files]
            if core.vhdl:
                self.vhdl_src_files += [os.path.join(self.src_root, core_name, f) for f in core.vhdl.src_files]

        logger.debug('__init__() -Done-')
开发者ID:Limb,项目名称:fusesoc,代码行数:34,代码来源:backend.py

示例8: configure

 def configure(self):
     if os.path.exists(self.work_root): 
         shutil.rmtree(self.work_root)
     os.makedirs(self.work_root)
     cm = CoreManager()
     for name in self.cores:
         pr_info("Preparing " + name)
         core = cm.get_core(name)
         dst_dir = os.path.join(Config().build_root, self.system.name, 'src', name)
         try:
             core.setup()
         except URLError as e:
             raise RuntimeError("Problem while fetching '" + core.name + "': " + str(e.reason))
         except urllib.HTTPError as e:
             raise RuntimeError("Problem while fetching '" + core.name + "': " + str(e.reason))
         core.export(dst_dir)
开发者ID:rinderer,项目名称:fusesoc,代码行数:16,代码来源:backend.py

示例9: list_cores

def list_cores(args):
    cores = CoreManager().get_cores()
    print("\nAvailable cores:\n")
    if not cores:
        cores_root = CoreManager().get_cores_root()
        if cores_root:
            pr_err("No cores found in "+':'.join(cores_root))
        else:
            pr_err("cores_root is not defined")
        exit(1)
    maxlen = max(map(len,cores.keys()))
    print('Core'.ljust(maxlen) + '   Cache status')
    print("="*80)
    for name in sorted(cores.keys()):
        core = cores[name]
        print(name.ljust(maxlen) + ' : ' + core.cache_status())
开发者ID:hoangt,项目名称:fusesoc,代码行数:16,代码来源:main.py

示例10: __init__

    def __init__(self, system):
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.name)

        self.src_root = os.path.join(self.build_root, 'src')

        if 'toplevel' in self.system.simulator:
            self.toplevel = self.system.simulator['toplevel']
        else:
            self.toplevel = 'orpsoc_tb'
            
        self.vpi_modules = []

        self.cm = CoreManager()
        self.cores = self.cm.get_depends(self.system.name)
        logger.debug( "depend -->  " +str (self.cores))

        self.env = os.environ.copy()
        self.env['CORE_ROOT'] = os.path.abspath(self.system.core_root)
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)
        self.env['SIMULATOR'] = self.TOOL_NAME

        for core_name in self.cores:
            logger.debug('core_name=' + core_name)
            core = self.cm.get_core(core_name)

            if core.vpi:
                vpi_module = {}
                core_root = os.path.join(self.src_root, core_name)
                vpi_module['include_dirs']  = [os.path.abspath(os.path.join(core_root, d)) for d in core.vpi.include_dirs]
                vpi_module['src_files']     = [os.path.abspath(os.path.join(core_root, f.name)) for f in core.vpi.src_files]
                vpi_module['name']          = core.name
                vpi_module['libs']          = [l for l in core.vpi.libs]
                self.vpi_modules += [vpi_module]
开发者ID:fjullien,项目名称:fusesoc,代码行数:35,代码来源:simulator.py

示例11: __init__

    def __init__(self, system):
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.name)
        self.src_root = os.path.join(self.build_root, 'src')

        self.cm = CoreManager()
        self.cores = self.cm.get_depends(self.system.name)

        self.env = os.environ.copy()
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)
开发者ID:andrzej-r,项目名称:fusesoc,代码行数:11,代码来源:edatool.py

示例12: fetch

def fetch(args):
    core = CoreManager().get_core(args.core)
    if core:
        cores = CoreManager().get_depends(core.name)
        try:
            core.setup()
        except URLError as e:
            pr_err("Problem while fetching '" + core.name + "': " + str(e.reason))
            exit(1)
        except HTTPError as e:
            pr_err("Problem while fetching '" + core.name + "': " + str(e.reason))
            exit(1)
        for name in cores:
             pr_info("Fetching " + name)
             core = CoreManager().get_core(name)
             try:
                 core.setup()
             except URLError as e:
                 pr_err("Problem while fetching '" + core.name + "': " + str(e.reason))
                 exit(1)
             except HTTPError as e:
                 pr_err("Problem while fetching '" + core.name + "': " + str(e.reason))
                 exit(1)
    else:
        pr_err("Can't find core '" + args.core + "'")
开发者ID:hoangt,项目名称:fusesoc,代码行数:25,代码来源:main.py

示例13: __init__

    def __init__(self, system):
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.sanitized_name)
        self.src_root = os.path.join(self.build_root, 'src')

        self.cm = CoreManager()
        self.cores = self.cm.get_depends(self.system.name)

        self.env = os.environ.copy()
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)

        self.plusarg    = {}
        self.vlogparam  = {}
        self.generic    = {}
        self.cmdlinearg = {}
开发者ID:hoangt,项目名称:fusesoc,代码行数:16,代码来源:edatool.py

示例14: EdaTool

class EdaTool(object):

    def __init__(self, system):
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.sanitized_name)
        self.src_root = os.path.join(self.build_root, 'src')

        self.cm = CoreManager()
        self.cores = self.cm.get_depends(self.system.name)

        self.env = os.environ.copy()
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)

        self.plusarg    = {}
        self.vlogparam  = {}
        self.generic    = {}
        self.cmdlinearg = {}

    def configure(self, args):
        if os.path.exists(self.work_root):
            for f in os.listdir(self.work_root):
                if os.path.isdir(os.path.join(self.work_root, f)):
                    shutil.rmtree(os.path.join(self.work_root, f))
                else:
                    os.remove(os.path.join(self.work_root, f))
        else:
            os.makedirs(self.work_root)

        for name in self.cores:
            pr_info("Preparing " + str(name))
            core = self.cm.get_core(name)
            dst_dir = os.path.join(Config().build_root, self.system.sanitized_name, 'src', core.sanitized_name)
            try:
                core.setup()
            except URLError as e:
                raise RuntimeError("Problem while fetching '" + core.name + "': " + str(e.reason))
            except HTTPError as e:
                raise RuntimeError("Problem while fetching '" + core.name + "': " + str(e.reason))
            core.export(dst_dir)

    def parse_args(self, args, prog, paramtypes):
        typedict = {'bool' : {'action' : 'store_true'},
                    'file' : {'type' : str , 'nargs' : 1, 'action' : FileAction},
                    'int'  : {'type' : int , 'nargs' : 1},
                    'str'  : {'type' : str , 'nargs' : 1},
                    }
        progname = 'fusesoc {} {}'.format(prog,
                                          self.system.name)
        parser = argparse.ArgumentParser(prog = progname,
                                         conflict_handler='resolve')
        param_groups = {}
        _descr = {'plusarg'    : 'Verilog plusargs (Run-time option)',
                  'vlogparam'  : 'Verilog parameters (Compile-time option)',
                  'generic'    : 'VHDL generic (Run-time option)',
                  'cmdlinearg' : 'Command-line arguments (Run-time option)'}
        all_params = {}
        for name in self.cores:
            core = self.cm.get_core(name)

            for param_name, param in core.parameter.items():
                if param.paramtype in paramtypes and \
                   (name == self.system.name or \
                   param.scope == 'public'):
                    if not param.paramtype in param_groups:
                        param_groups[param.paramtype] = \
                        parser.add_argument_group(_descr[param.paramtype])

                    default = None
                    if not param.default == '':
                        try:
                            default = [typedict[param.datatype]['type'](param.default)]
                            print("Converted to " + str(default[0]))
                        except KeyError as e:
                            pass
                    try:
                        param_groups[param.paramtype].add_argument('--'+param_name,
                                                                   help=param.description,
                                                                   default=default,
                                                                   **typedict[param.datatype])
                    except KeyError as e:
                        raise RuntimeError("Invalid data type {} for parameter '{}' in '{}'".format(str(e),
                                                                                                   param_name,
                                                                                                   core.name))
                    all_params[param_name.replace('-','_')] = param.paramtype
        p = parser.parse_args(args)

        for key,value in vars(p).items():
            paramtype = all_params[key]
            if value == True:
                getattr(self, paramtype)[key] = "true"
            elif value == False or value is None:
                pass
            else:
                if type(value[0]) == str and paramtype == 'vlogparam':
                    _value = '"'+str(value[0])+'"'
                else:
                    _value = str(value[0])
                getattr(self, paramtype)[key] = _value
开发者ID:hoangt,项目名称:fusesoc,代码行数:99,代码来源:edatool.py

示例15: Backend

class Backend(object):

    def __init__(self, system):
        logger.debug('__init__() *Entered*')
        config = Config()
        self.system = system
        self.build_root = os.path.join(config.build_root, self.system.name)
        self.systems_root = config.systems_root

        self.src_root = os.path.join(self.build_root, 'src')

        self.include_dirs = []
        self.src_files = []
        self.vhdl_src_files = []
        self.cm = CoreManager()

        self.env = os.environ.copy()
        self.env['SYSTEM_ROOT'] = os.path.abspath(os.path.join(self.systems_root, self.system.name))
        self.env['BUILD_ROOT'] = os.path.abspath(self.build_root)
        self.env['BACKEND'] = self.TOOL_NAME

        self.cores = self.cm.get_depends(self.system.name)
        for core_name in self.cores:
            logger.debug('core_name=' + core_name)
            core = self.cm.get_core(core_name)
            if core.verilog:
                if core.verilog.include_dirs:
                    logger.debug('core.include_dirs=' + str(core.verilog.include_dirs))
                else:
                    logger.debug('core.include_dirs=None')
                self.include_dirs += [os.path.join(self.src_root, core_name, d) for d in core.verilog.include_dirs]
                self.src_files    += [os.path.join(self.src_root, core_name, f) for f in core.verilog.src_files]
            if core.vhdl:
                self.vhdl_src_files += [os.path.join(self.src_root, core_name, f) for f in core.vhdl.src_files]

        logger.debug('__init__() -Done-')

    def configure(self):
        logger.debug('configure() *Entered*')
        if os.path.exists(self.work_root): 
            shutil.rmtree(self.work_root)
        os.makedirs(self.work_root)
        cm = CoreManager()
        for name in self.cores:
            pr_info("Preparing " + name)
            core = cm.get_core(name)
            dst_dir = os.path.join(Config().build_root, self.system.name, 'src', name)
            core.setup()
            core.export(dst_dir)
        logger.debug('configure() -Done-')

    def build(self, args):
        for script in self.system.pre_build_scripts:
            script = os.path.abspath(os.path.join(self.systems_root, self.system.name, script))
            pr_info("Running " + script);
            try:
                Launcher(script, cwd = os.path.abspath(self.build_root), env = self.env, shell=True).run()
            except RuntimeError:
                print("Error: script " + script + " failed")

    def done(self):
        for script in self.system.post_build_scripts:
            script = os.path.abspath(os.path.join(self.systems_root, self.system.name, script))
            pr_info("Running " + script);
            try:
                Launcher(script, cwd = os.path.abspath(self.build_root), env = self.env, shell=True).run()
            except RuntimeError:
                print("Error: script " + script + " failed")
开发者ID:Limb,项目名称:fusesoc,代码行数:68,代码来源:backend.py


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