mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
xilinx_ise: add --no-source option to disable sourcing of ISE settings file
This commit is contained in:
parent
59d64e92e8
commit
31b1960188
1 changed files with 14 additions and 13 deletions
|
@ -85,29 +85,28 @@ def _build_files(device, sources, named_sc, named_pc, build_name):
|
||||||
-p %s""" % (build_name, build_name, device)
|
-p %s""" % (build_name, build_name, device)
|
||||||
tools.write_to_file(build_name + ".xst", xst_contents)
|
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):
|
def is_valid_version(v):
|
||||||
try:
|
try:
|
||||||
Decimal(v)
|
Decimal(v)
|
||||||
return os.path.isdir(os.path.join(ise_path, v))
|
return os.path.isdir(os.path.join(ise_path, v))
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
vers = [ver for ver in os.listdir(ise_path) if is_valid_version(ver)]
|
build_script_contents = "# Autogenerated by mibuild\nset -e\n"
|
||||||
tools_version = max(vers)
|
if source:
|
||||||
bits = struct.calcsize("P")*8
|
vers = [ver for ver in os.listdir(ise_path) if is_valid_version(ver)]
|
||||||
xilinx_settings_file = '%s/%s/ISE_DS/settings%d.sh' % (ise_path, tools_version, bits)
|
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 = """# Autogenerated by mibuild
|
build_script_contents += """
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
source {xilinx_settings_file}
|
|
||||||
xst -ifn {build_name}.xst
|
xst -ifn {build_name}.xst
|
||||||
ngdbuild -uc {build_name}.ucf {build_name}.ngc
|
ngdbuild -uc {build_name}.ucf {build_name}.ngc
|
||||||
map -ol high -w {build_name}.ngd
|
map -ol high -w {build_name}.ngd
|
||||||
par -ol high -w {build_name}.ncd {build_name}-routed.ncd
|
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
|
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"
|
build_script_file = "build_" + build_name + ".sh"
|
||||||
tools.write_to_file(build_script_file, build_script_contents)
|
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)
|
return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)
|
||||||
|
|
||||||
def build(self, fragment, build_dir="build", build_name="top",
|
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)
|
tools.mkdir_noerror(build_dir)
|
||||||
os.chdir(build_dir)
|
os.chdir(build_dir)
|
||||||
|
|
||||||
|
@ -143,13 +142,14 @@ class XilinxISEPlatform(GenericPlatform):
|
||||||
sources = self.sources + [(v_file, "verilog")]
|
sources = self.sources + [(v_file, "verilog")]
|
||||||
_build_files(self.device, sources, named_sc, named_pc, build_name)
|
_build_files(self.device, sources, named_sc, named_pc, build_name)
|
||||||
if run:
|
if run:
|
||||||
_run_ise(build_name, ise_path)
|
_run_ise(build_name, ise_path, source)
|
||||||
|
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
def build_arg_ns(self, ns, *args, **kwargs):
|
def build_arg_ns(self, ns, *args, **kwargs):
|
||||||
for n in ["build_dir", "build_name", "ise_path"]:
|
for n in ["build_dir", "build_name", "ise_path"]:
|
||||||
kwargs[n] = getattr(ns, n)
|
kwargs[n] = getattr(ns, n)
|
||||||
|
kwargs["source"] = not ns.no_source
|
||||||
kwargs["run"] = not ns.no_run
|
kwargs["run"] = not ns.no_run
|
||||||
self.build(*args, **kwargs)
|
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-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("--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("--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")
|
parser.add_argument("--no-run", action="store_true", help="Only generate files, do not run ISE")
|
||||||
|
|
Loading…
Reference in a new issue