Beispiel #1
0
def test_001_column_cut_pads_output():
    results = run_and_check([JX, "c", "a"], "jx_001")
    assert results["actual"] == results["expected"]
Beispiel #2
0
def test_009_flatten_with_array_indexing():
    results = run_and_check([JX, '-F', 'a_c', 'a_d_0'], "jx_009")
    assert results["actual"] == results["expected"]
Beispiel #3
0
def test_010_autodetect_arrays():
    results = run_and_check([JX,], "jx_010")
    assert results["actual"] == results["expected"]
Beispiel #4
0
def test_007_flatten_withalternate_joiner():
    """referencing sub-objects with non-default joiner"""
    results = run_and_check([JX, '-F', '-j.', 'a.c', 'a.b'], "jx_007")
    assert results["actual"] == results["expected"]
Beispiel #5
0
def test_008_flatten_with_default_joiner():
    """referencing sub-objects with default joiner"""
    results = run_and_check([JX, '-F', 'a_c', 'a_b'], "jx_008")
    assert results["actual"] == results["expected"]
Beispiel #6
0
def test_005_smart_disabled():
    results = run_and_check([JX, '--smart', 'items'], "jx_005")
    assert results["actual"] == results["expected"]
Beispiel #7
0
def test_006_no_padding_last_field():
    results = run_and_check([JX], "jx_006")
    assert results["actual"] == results["expected"]
Beispiel #8
0
def test_004_multiline_object():
    results = run_and_check([JX, '-D'], "jx_004")
    assert results["actual"] == results["expected"]
Beispiel #9
0
def test_003_no_headers_arg():
    results = run_and_check([JX, '-H', 'a', 'c' ], "jx_003")
    assert results["actual"] == results["expected"]
Beispiel #10
0
def test_002_no_args_keeps_headers():
    """previously headers were skipped. Not sure why"""
    results = run_and_check([JX], "jx_002")
    assert results["actual"] == results["expected"]
Beispiel #11
0
def test_003_filter_extracts_timestamps_and_leaves_numbers():
    results = run_and_check([UNIXTIME, '--filter'], 'unixtime_003')
    assert results["actual"] == results["expected"]
Beispiel #12
0
def build(argv, build_logger):
    required_len_argv = 4

    if len(argv) != required_len_argv:
        print(
            f'{required_len_argv} arguments should be given, not {len(argv)}.')
        print_help()
        return False

    board_type = argv[1]
    target = {v: k for k, v in TARGET_TO_SYMBOL.items()}.get(argv[2])
    component_file_name = argv[3]
    component_name = 'intel_hls_qconv1x1_impl'

    if not target:
        print(f'Gien 2nd arg {argv[2]} is not supported.')
        print_help()

    src_prj_path = path.join(env.ROOT_DIR, 'projects', board_type)
    prj_name = f'{path.basename(src_prj_path)}.prj'
    PROJECT_DIR = path.join(env.ROOT_DIR, prj_name)

    component_prj = f'{component_file_name}.prj'
    IP_DIR = path.join(env.ROOT_DIR, component_prj)

    if target <= Target.SIM:
        symbol = TARGET_TO_SYMBOL[Target.SIM]
        name = TARGET_TO_NAME[Target.SIM]
        build_logger.info(f'Run {name}.')
        logger = make_logger(symbol, INFO)

        run_and_check('make clean', logger)

        cmd = f'make {symbol} -j{env.NUM_THREADS}'
        run_and_check(cmd, logger)

        cmd = f'./{symbol}.elf random'
        run_and_check(cmd, logger)

    if target <= Target.SYN:
        symbol = TARGET_TO_SYMBOL[Target.SYN]
        name = TARGET_TO_NAME[Target.SYN]
        build_logger.info(f'Run {name}.')
        logger = make_logger(symbol, INFO)

        run_and_check('make clean', logger)
        cmd = f'make {symbol} -j{env.NUM_THREADS}'
        run_and_check(cmd, logger)

        src_path = path.join(env.INTEL_HLS_DIR, component_prj)
        dst_path = path.join(IP_DIR)

        if path.exists(IP_DIR):
            shutil.rmtree(IP_DIR)
        shutil.move(src_path, dst_path)

        # cmd = f'./{symbol}.elf random'
        # run_and_check(cmd, logger)

    if target <= Target.QSYS:
        symbol = TARGET_TO_SYMBOL[Target.QSYS]
        name = TARGET_TO_NAME[Target.QSYS]
        build_logger.info(f'Run {name}.')
        logger = make_logger(symbol, INFO)

        if path.exists(PROJECT_DIR):
            shutil.rmtree(PROJECT_DIR)
        shutil.copytree(src_prj_path, PROJECT_DIR)

        component_dir = path.join(IP_DIR, 'components', component_name)

        qsys_tcl_file = path.join(PROJECT_DIR, 'soc_system.tcl')
        cmd = f'qsys-script --search-path={component_dir}/,$ --script={qsys_tcl_file}'
        run(cmd, logger, cwd=PROJECT_DIR)

        qsys_prj_file = path.join(PROJECT_DIR, 'soc_system.qsys')
        cmd = f'qsys-generate {qsys_prj_file} --search-path={component_dir}/,$ --synthesis=VHDL'
        run(cmd, logger, cwd=PROJECT_DIR)

    bootfiles_dir = path.join(PROJECT_DIR, 'bootfiles')

    if path.exists(bootfiles_dir):
        shutil.rmtree(bootfiles_dir)

    os.mkdir(bootfiles_dir)

    if target <= Target.QUARTUS:
        symbol = TARGET_TO_SYMBOL[Target.QUARTUS]
        name = TARGET_TO_NAME[Target.QUARTUS]
        build_logger.info(f'Run {name}.')
        logger = make_logger(symbol, INFO)

        quartus_prj_file = path.join(PROJECT_DIR, 'DE10_NANO_SoC_GHRD.qpf')
        cmd = f'quartus_sh --flow compile {quartus_prj_file}'
        run(cmd, logger, cwd=PROJECT_DIR)

        sof_file = path.join(PROJECT_DIR, 'output_files',
                             'DE10_NANO_SoC_GHRD.sof')
        rbf_file = path.join(bootfiles_dir, 'soc_system.rbf')
        cmd = f'quartus_cpf -c -o bitstream_compression=on {sof_file} {rbf_file}'
        run(cmd, logger, cwd=PROJECT_DIR)

    if target <= Target.BSP:
        symbol = TARGET_TO_SYMBOL[Target.QUARTUS]
        name = TARGET_TO_NAME[Target.QUARTUS]
        build_logger.info(f'Run {name}.')
        logger = make_logger(symbol, INFO)

        bsp_build_dir = path.join(PROJECT_DIR, 'bsp_build_dir')
        if path.exists(bsp_build_dir):
            shutil.rmtree(bsp_build_dir)
        os.mkdir(bsp_build_dir)

        hps_dir = path.join(PROJECT_DIR, 'hps_isw_handoff', 'soc_system_hps_0')
        cmd = f'bsp-create-settings --type spl --bsp-dir {bsp_build_dir} '
        '--settings settings.bsp --preloader-settings-dir {hps_dir}'
        run(cmd, logger, cwd=PROJECT_DIR)

        run(f'make -j{env.NUM_THREADS}', logger, cwd=bsp_build_dir)

        preloader_file_name = 'preloader-mkpimage.bin'
        preloader_file = path.join(bsp_build_dir, preloader_file_name)
        shutil.move(preloader_file,
                    path.join(bootfiles_dir, preloader_file_name))

        uboot_file_name = 'u-boot.img'
        uboot_file = path.join(bsp_build_dir, 'uboot-socfpga', uboot_file_name)
        run('make clean', logger)
        run(f'make uboot -j{env.NUM_THREADS}', logger, cwd=bsp_build_dir)
        shutil.move(uboot_file, path.join(bootfiles_dir, uboot_file_name))

    # temporary
    return True