How to use fusesoc - 10 common examples

To help you get started, we’ve selected a few fusesoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github olofk / fusesoc / tests / test_capi1.py View on Github external
def test_core_info():
    tests_dir = os.path.dirname(__file__)
    cores_root = os.path.join(tests_dir, 'cores')
    for core_name in ['sockit', 'mor1kx-generic']:
        core = Core(os.path.join(cores_root, core_name, core_name+'.core'))
        gen_info = '\n'.join([x for x in core.info().split('\n') if not 'Core root' in x])
        with open(os.path.join(tests_dir, __name__, core_name+".info")) as f:
            assert f.read() == gen_info, core_name
github olofk / fusesoc / tests / test_capi2.py View on Github external
core = Core(os.path.join(tests_dir,
                             "capi2_cores",
                             "misc",
                             "depends.core"))
    flags = {}
    result = core.get_depends(flags)

    expected = [
        Vlnv('unversioned'),
        Vlnv('versioned-1.0'),
        Vlnv('gt-1.0'),
        Vlnv('>=gte-1.0'),
        Vlnv('::n'),
        Vlnv('::nv:1.0'),
        Vlnv(':l:nv:1.0'),
        Vlnv('v:l:nv:1.0'),
        Vlnv('<::vlnvlt:1.0'),
        Vlnv('<=::vlnvlte:1.0'),
        Vlnv('=::vlnveq:1.0'),
        Vlnv('>::vlnvgt:1.0'),
        Vlnv('>=::vlnvgte:1.0'),
    ]
    assert len(result) == len(expected)
    for i in range(len(result)):
        assert result[i] == expected[i]
github olofk / fusesoc / tests / test_capi2.py View on Github external
Vlnv('unversioned'),
        Vlnv('versioned-1.0'),
        Vlnv('gt-1.0'),
        Vlnv('>=gte-1.0'),
        Vlnv('::n'),
        Vlnv('::nv:1.0'),
        Vlnv(':l:nv:1.0'),
        Vlnv('v:l:nv:1.0'),
        Vlnv('<::vlnvlt:1.0'),
        Vlnv('<=::vlnvlte:1.0'),
        Vlnv('=::vlnveq:1.0'),
        Vlnv('>::vlnvgt:1.0'),
        Vlnv('>=::vlnvgte:1.0'),
    ]
    assert len(result) == len(expected)
    for i in range(len(result)):
        assert result[i] == expected[i]
github olofk / fusesoc / tests / test_vlnv.py View on Github external
def test_name_only_vlnv():
    assert vlnv_tuple(Vlnv("::uart16550")) == \
    ('', '', 'uart16550', '0', 0)
    assert vlnv_tuple(Vlnv("::uart16550:")) == \
    ('', '', 'uart16550', '0', 0)
github olofk / fusesoc / tests / test_vlnv.py View on Github external
def test_name_only_legacy():
    assert vlnv_tuple(Vlnv("uart16550")) == \
    ('', '', 'uart16550', '0', 0)
github olofk / fusesoc / tests / test_capi2.py View on Github external
def test_capi2_get_depends():
    from fusesoc.core import Core
    from fusesoc.vlnv import Vlnv

    core = Core(os.path.join(tests_dir,
                             "capi2_cores",
                             "misc",
                             "depends.core"))
    flags = {}
    result = core.get_depends(flags)

    expected = [
        Vlnv('unversioned'),
        Vlnv('versioned-1.0'),
        Vlnv('gt-1.0'),
        Vlnv('>=gte-1.0'),
        Vlnv('::n'),
        Vlnv('::nv:1.0'),
        Vlnv(':l:nv:1.0'),
        Vlnv('v:l:nv:1.0'),
        Vlnv('<::vlnvlt:1.0'),
        Vlnv('<=::vlnvlte:1.0'),
        Vlnv('=::vlnveq:1.0'),
        Vlnv('>::vlnvgt:1.0'),
        Vlnv('>=::vlnvgte:1.0'),
    ]
    assert len(result) == len(expected)
    for i in range(len(result)):
github olofk / fusesoc / tests / test_vlnv.py View on Github external
def test_name_version_legacy():
    assert vlnv_tuple(Vlnv("uart16550-1.5")) == \
    ('', '', 'uart16550', '1.5', 0)
github olofk / fusesoc / tests / test_vlnv.py View on Github external
def test_name_with_dash_only_legacy():
    assert vlnv_tuple(Vlnv("wb-axi")) == \
    ('', '', 'wb-axi', '0', 0)
github olofk / fusesoc / tests / test_capi2.py View on Github external
def test_capi2_export():
    import os
    import tempfile
    from fusesoc.core import Core

    core_file = os.path.join(tests_dir,
                             "capi2_cores",
                             "misc",
                             "files.core")
    core = Core(core_file)

    export_root  = tempfile.mkdtemp(prefix='capi2_export_')

    core.export(export_root)

    expected = [
        'dontpickthisfile',
        'dummy.tcl',
        'scriptfile',
        'subdir/dummy.extra',
        'vhdlfile',
        'vlogfile',
        'vpifile']
    result = []

    for root, dirs, files in os.walk(export_root):
github olofk / fusesoc / tests / test_capi1.py View on Github external
def test_ise():
    filename = os.path.join(os.path.dirname(__file__),
                            __name__,
                            "atlys.core")
    core = Core(filename)

    #Check filesets
    assert len(core.file_sets) == 4
    assert core.file_sets[0].name == 'verilog_src_files'
    assert core.file_sets[1].name == 'verilog_tb_src_files'
    assert core.file_sets[2].name == 'verilog_tb_private_src_files'

    #Check that backend files are converted to fileset properly
    compare_fileset(core.file_sets[3], 'backend_files', ['data/atlys.ucf'])
    assert core.file_sets[3].file[0].file_type == 'UCF'

    #Check backend section
    assert core.ise.export_files == []
    assert core.ise.family == 'spartan6'
    assert core.ise.device == 'xc6slx45'
    assert core.ise.package == 'csg324'