From: Sebastien Bourdeauducq Date: Tue, 16 Apr 2013 20:39:35 +0000 (+0200) Subject: xilinx_ise: add --no-source option to disable sourcing of ISE settings file X-Git-Tag: 24jan2021_ls180~2099^2~443^2~40 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31b1960188f58d55cd3784f1d2d295db8f37ad22;p=litex.git xilinx_ise: add --no-source option to disable sourcing of ISE settings file --- diff --git a/mibuild/xilinx_ise.py b/mibuild/xilinx_ise.py index a6c31c00..0d7a663b 100644 --- a/mibuild/xilinx_ise.py +++ b/mibuild/xilinx_ise.py @@ -85,29 +85,28 @@ def _build_files(device, sources, named_sc, named_pc, build_name): -p %s""" % (build_name, build_name, device) tools.write_to_file(build_name + ".xst", xst_contents) -def _run_ise(build_name, ise_path): +def _run_ise(build_name, ise_path, source): def is_valid_version(v): try: Decimal(v) return os.path.isdir(os.path.join(ise_path, v)) except: return False - vers = [ver for ver in os.listdir(ise_path) if is_valid_version(ver)] - tools_version = max(vers) - bits = struct.calcsize("P")*8 - xilinx_settings_file = '%s/%s/ISE_DS/settings%d.sh' % (ise_path, tools_version, bits) - - build_script_contents = """# Autogenerated by mibuild - -set -e - -source {xilinx_settings_file} + build_script_contents = "# Autogenerated by mibuild\nset -e\n" + if source: + vers = [ver for ver in os.listdir(ise_path) if is_valid_version(ver)] + tools_version = max(vers) + bits = struct.calcsize("P")*8 + xilinx_settings_file = '%s/%s/ISE_DS/settings%d.sh' % (ise_path, tools_version, bits) + build_script_contents += "source " + xilinx_settings_file + "\n" + + build_script_contents += """ xst -ifn {build_name}.xst ngdbuild -uc {build_name}.ucf {build_name}.ngc map -ol high -w {build_name}.ngd par -ol high -w {build_name}.ncd {build_name}-routed.ncd bitgen -g LCK_cycle:6 -g Binary:Yes -w {build_name}-routed.ncd {build_name}.bit -""".format(build_name=build_name, xilinx_settings_file=xilinx_settings_file) +""".format(build_name=build_name) build_script_file = "build_" + build_name + ".sh" tools.write_to_file(build_script_file, build_script_contents) @@ -133,7 +132,7 @@ class XilinxISEPlatform(GenericPlatform): return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs) def build(self, fragment, build_dir="build", build_name="top", - ise_path="/opt/Xilinx", run=True): + ise_path="/opt/Xilinx", source=True, run=True): tools.mkdir_noerror(build_dir) os.chdir(build_dir) @@ -143,13 +142,14 @@ class XilinxISEPlatform(GenericPlatform): sources = self.sources + [(v_file, "verilog")] _build_files(self.device, sources, named_sc, named_pc, build_name) if run: - _run_ise(build_name, ise_path) + _run_ise(build_name, ise_path, source) os.chdir("..") def build_arg_ns(self, ns, *args, **kwargs): for n in ["build_dir", "build_name", "ise_path"]: kwargs[n] = getattr(ns, n) + kwargs["source"] = not ns.no_source kwargs["run"] = not ns.no_run self.build(*args, **kwargs) @@ -157,4 +157,5 @@ class XilinxISEPlatform(GenericPlatform): parser.add_argument("--build-dir", default="build", help="Set the directory in which to generate files and run ISE") parser.add_argument("--build-name", default="top", help="Base name for the generated files") parser.add_argument("--ise-path", default="/opt/Xilinx", help="ISE installation path (without version directory)") + parser.add_argument("--no-source", action="store_true", help="Do not source ISE settings file") parser.add_argument("--no-run", action="store_true", help="Only generate files, do not run ISE")