Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/migen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f8b1152b988e
Choose a base ref
...
head repository: m-labs/migen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7d8f4d1009c4
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 18, 2015

  1. Xilinx Platforms now use cmd.exe on Windows instead of bash to run sc…

    …ripts
    
    (remove MSYS dependency)
    cr1901 authored and enjoy-digital committed Jun 18, 2015
    Copy the full SHA
    6370acd View commit details
  2. Copy the full SHA
    743a5f6 View commit details
  3. mibuild/xilinx/ise: fix source and set source to False by default on …

    …Windows (tools supposed to be in the PATH)
    enjoy-digital committed Jun 18, 2015
    Copy the full SHA
    7d8f4d1 View commit details
Showing with 35 additions and 9 deletions.
  1. +7 −1 mibuild/xilinx/common.py
  2. +28 −8 mibuild/xilinx/ise.py
8 changes: 7 additions & 1 deletion mibuild/xilinx/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
from distutils.version import StrictVersion

from migen.fhdl.std import *
@@ -25,8 +26,13 @@ def settings(path, ver=None, sub=None):
if tools.arch_bits() == 32:
search.reverse()

if sys.platform == "win32" or sys.platform == "cygwin":
script_ext = "bat"
else:
script_ext = "sh"

for b in search:
settings = os.path.join(full, "settings{0}.sh".format(b))
settings = os.path.join(full, "settings{0}.{1}".format(b, script_ext))
if os.path.exists(settings):
return settings

36 changes: 28 additions & 8 deletions mibuild/xilinx/ise.py
Original file line number Diff line number Diff line change
@@ -98,11 +98,18 @@ def _run_yosys(device, sources, vincpaths, build_name):
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"
source_cmd = "call "
script_ext = ".bat"
shell = ["cmd", "/c"]
build_script_contents = "@echo off\nrem Autogenerated by mibuild\n"
else:
source_cmd = "source "
script_ext = ".sh"
shell = ["bash"]
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"
build_script_contents += source_cmd + settings + "\n"
if mode == "edif":
ext = "edif"
else:
@@ -121,14 +128,27 @@ def _run_ise(build_name, ise_path, source, mode, ngdbuild_opt,
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])
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 = subprocess.call(command)
if r != 0:
raise OSError("Subprocess failed")


def _default_ise_path():
if sys.platform == "win32":
return "C:\\Xilinx"
elif sys.platform == "cygwin":
return "/cygdrive/c/Xilinx"
else:
return "/opt/Xilinx"


def _default_source():
return False if sys.platform == "win32" else True


class XilinxISEToolchain:
def __init__(self):
self.xst_opt = """-ifmt MIXED
@@ -142,7 +162,7 @@ def __init__(self):
self.ise_commands = ""

def build(self, platform, fragment, build_dir="build", build_name="top",
ise_path="/opt/Xilinx", source=True, run=True, mode="xst"):
ise_path=_default_ise_path(), source=_default_source(), run=True, mode="xst"):
tools.mkdir_noerror(build_dir)
os.chdir(build_dir)