def _build_xst_files(device, sources, vincpaths, build_name, xst_opt): prj_contents = "" for filename, language, library in sources: prj_contents += language + " " + library + " " + tools.cygpath(filename) + "\n" tools.write_to_file(build_name + ".prj", prj_contents) xst_contents = """run -ifn {build_name}.prj -top {build_name} {xst_opt} -ofn {build_name}.ngc -p {device} """.format(build_name=build_name, xst_opt=xst_opt, device=device) for path in vincpaths: xst_contents += "-vlgincdir " + tools.cygpath(path) + "\n" tools.write_to_file(build_name + ".xst", xst_contents)
def _build_xst_files(device, sources, vincpaths, build_name, xst_opt): prj_contents = "" for filename, language, library in sources: prj_contents += language + " " + library + " " + tools.cygpath(filename) + "\n" tools.write_to_file(build_name + ".prj", prj_contents) xst_contents = """run -ifn {build_name}.prj -top top {xst_opt} -ofn {build_name}.ngc -p {device} """.format(build_name=build_name, xst_opt=xst_opt, device=device) for path in vincpaths: xst_contents += "-vlgincdir " + tools.cygpath(path) + "\n" tools.write_to_file(build_name + ".xst", xst_contents)
def find_flash_proxy(self): for d in self.flash_proxy_dirs: fulldir = os.path.abspath(os.path.expanduser(d)) fullname = tools.cygpath( os.path.join(fulldir, self.flash_proxy_basename)) if os.path.exists(fullname): return fullname raise OSError("Failed to find flash proxy bitstream")
def _run_ise(build_name, ise_path, source, mode, ngdbuild_opt, toolchain, platform, ver=None): if sys.platform == "win32" or sys.platform == "cygwin": source_cmd = "call " script_ext = ".bat" shell = ["cmd", "/c"] build_script_contents = "@echo off\nrem Autogenerated by Migen\n" fail_stmt = " || exit /b" else: source_cmd = "source " script_ext = ".sh" shell = ["bash"] build_script_contents = "# Autogenerated by Migen\nset -e\n" fail_stmt = "" if source: settings = common.settings(ise_path, ver, "ISE_DS") build_script_contents += source_cmd + tools.cygpath(settings) + "\n" if mode == "edif": ext = "edif" else: ext = "ngc" build_script_contents += """ xst -ifn {build_name}.xst{fail_stmt} """ build_script_contents += """ ngdbuild {ngdbuild_opt} -uc {build_name}.ucf {build_name}.{ext} {build_name}.ngd{fail_stmt} """ if mode == "cpld": build_script_contents += """ cpldfit -ofmt verilog {par_opt} -p {device} {build_name}.ngd{fail_stmt} taengine -f {build_name}.vm6 -detail -iopath -l {build_name}.tim{fail_stmt} hprep6 -s IEEE1532 -i {build_name}.vm6{fail_stmt} """ else: build_script_contents += """ map {map_opt} -o {build_name}_map.ncd {build_name}.ngd {build_name}.pcf{fail_stmt} par {par_opt} {build_name}_map.ncd {build_name}.ncd {build_name}.pcf{fail_stmt} bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit{fail_stmt} """ build_script_contents = build_script_contents.format( build_name=build_name, ngdbuild_opt=ngdbuild_opt, bitgen_opt=toolchain.bitgen_opt, ext=ext, par_opt=toolchain.par_opt, map_opt=toolchain.map_opt, device=platform.device, fail_stmt=fail_stmt) build_script_contents += toolchain.ise_commands.format(build_name=build_name) build_script_file = "build_" + build_name + script_ext tools.write_to_file(build_script_file, build_script_contents, force_unix=False) command = shell + [build_script_file] r = tools.subprocess_call_filtered(command, common.colors) if r != 0: raise OSError("Subprocess failed")
def _run_ise(build_name, ise_path, source, mode, ngdbuild_opt, toolchain, platform, ver=None): if sys.platform == "win32" or sys.platform == "cygwin": source_cmd = "call " script_ext = ".bat" shell = ["cmd", "/c"] build_script_contents = "@echo off\nrem Autogenerated by Migen\n" fail_stmt = " || exit /b" else: source_cmd = "source " script_ext = ".sh" shell = ["bash"] build_script_contents = "# Autogenerated by Migen\nset -e\n" fail_stmt = "" if source: settings = common.settings(ise_path, ver, "ISE_DS") build_script_contents += source_cmd + tools.cygpath(settings) + "\n" if mode == "edif": ext = "edif" else: ext = "ngc" build_script_contents += """ xst -ifn {build_name}.xst{fail_stmt} """ build_script_contents += """ ngdbuild {ngdbuild_opt} -uc {build_name}.ucf {build_name}.{ext} {build_name}.ngd{fail_stmt} """ if mode == "cpld": build_script_contents += """ cpldfit -ofmt verilog {par_opt} -p {device} {build_name}.ngd{fail_stmt} taengine -f {build_name}.vm6 -detail -iopath -l {build_name}.tim{fail_stmt} hprep6 -s IEEE1532 -i {build_name}.vm6{fail_stmt} """ else: build_script_contents += """ map {map_opt} -o {build_name}_map.ncd {build_name}.ngd {build_name}.pcf{fail_stmt} par {par_opt} {build_name}_map.ncd {build_name}.ncd {build_name}.pcf{fail_stmt} bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit{fail_stmt} """ build_script_contents = build_script_contents.format(build_name=build_name, ngdbuild_opt=ngdbuild_opt, bitgen_opt=toolchain.bitgen_opt, ext=ext, par_opt=toolchain.par_opt, map_opt=toolchain.map_opt, device=platform.device, fail_stmt=fail_stmt) build_script_contents += toolchain.ise_commands.format(build_name=build_name) build_script_file = "build_" + build_name + script_ext tools.write_to_file(build_script_file, build_script_contents, force_unix=False) command = shell + [build_script_file] r = tools.subprocess_call_filtered(command, common.colors) if r != 0: raise OSError("Subprocess failed")