Exemplo n.º 1
0
Arquivo: ise.py Projeto: fallen/migen
def _run_ise(build_name, ise_path, source, mode, ngdbuild_opt,
        bitgen_opt, ise_commands, map_opt, par_opt, ver=None):
    if sys.platform == "win32" or sys.platform == "cygwin":
        source = False
    build_script_contents = "# Autogenerated by mibuild\nset -e\n"
    if source:
        settings = common.settings(ise_path, ver, "ISE_DS")
        build_script_contents += "source " + settings + "\n"
    if mode == "edif":
        ext = "edif"
    else:
        ext = "ngc"
        build_script_contents += """
xst -ifn {build_name}.xst
"""

    build_script_contents += """
ngdbuild {ngdbuild_opt} -uc {build_name}.ucf {build_name}.{ext} {build_name}.ngd
map {map_opt} -o {build_name}_map.ncd {build_name}.ngd {build_name}.pcf
par {par_opt} {build_name}_map.ncd {build_name}.ncd {build_name}.pcf
bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit
"""
    build_script_contents = build_script_contents.format(build_name=build_name,
            ngdbuild_opt=ngdbuild_opt, bitgen_opt=bitgen_opt, ext=ext,
            par_opt=par_opt, map_opt=map_opt)
    build_script_contents += ise_commands.format(build_name=build_name)
    build_script_file = "build_" + build_name + ".sh"
    tools.write_to_file(build_script_file, build_script_contents, force_unix=True)

    r = subprocess.call(["bash", build_script_file])
    if r != 0:
        raise OSError("Subprocess failed")
Exemplo n.º 2
0
def _run_vivado(path, ver, cmds):
    if sys.platform == "win32" or sys.platform == "cygwin":
        vivado_cmd = "vivado -mode tcl"
    else:
        settings = common.settings(path, ver)
        vivado_cmd = "bash -c \"source " + settings + "&& vivado -mode tcl\""
    with subprocess.Popen(vivado_cmd, stdin=subprocess.PIPE, shell=True) as process:
        process.stdin.write(cmds.encode("ASCII"))
        process.communicate()
Exemplo n.º 3
0
def _run_vivado(build_name, vivado_path, source, ver=None):
    if sys.platform == "win32" or sys.platform == "cygwin":
        build_script_contents = "REM Autogenerated by mibuild\n"
        build_script_contents += "vivado -mode batch -source " + build_name + ".tcl\n"
        build_script_file = "build_" + build_name + ".bat"
        tools.write_to_file(build_script_file, build_script_contents)
        r = subprocess.call([build_script_file])
    else:
        build_script_contents = "# Autogenerated by mibuild\nset -e\n"
        settings = common.settings(vivado_path, ver)
        build_script_contents += "source " + settings + "\n"
        build_script_contents += "vivado -mode batch -source " + build_name + ".tcl\n"
        build_script_file = "build_" + build_name + ".sh"
        tools.write_to_file(build_script_file, build_script_contents)
        r = subprocess.call(["bash", build_script_file])

    if r != 0:
        raise OSError("Subprocess failed")