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/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 34a97b27512a
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6b025df12cea
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 4, 2019

  1. build.plat: allow selecting a specific UNIX shell interpreter.

    Mostly because vendor tools have bashisms.
    whitequark committed Aug 4, 2019
    Copy the full SHA
    5eb4e2e View commit details
  2. Copy the full SHA
    6b025df View commit details
Showing with 11 additions and 0 deletions.
  1. +10 −0 nmigen/build/plat.py
  2. +1 −0 nmigen/vendor/xilinx_spartan_3_6.py
10 changes: 10 additions & 0 deletions nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -221,11 +221,13 @@ class TemplatedPlatform(Platform):
toolchain = abstractproperty()
file_templates = abstractproperty()
command_templates = abstractproperty()
unix_interpreter = "sh"

build_script_templates = {
"build_{{name}}.sh": """
# {{autogenerated}}
set -e{{verbose("x")}}
{{emit_unix_interpreter()}}
[ -n "$NMIGEN_{{platform.toolchain}}_env" ] && . "$NMIGEN_{{platform.toolchain}}_env"
{{emit_commands("sh")}}
""",
@@ -242,6 +244,13 @@ def toolchain_prepare(self, fragment, name, **kwargs):
# and to incorporate the nMigen version into generated code.
autogenerated = "Automatically generated by nMigen {}. Do not edit.".format(__version__)

def emit_unix_interpreter():
if self.unix_interpreter == "sh":
return "# runs on any POSIX sh"
if self.unix_interpreter == "bash":
return """if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi"""
assert False

def emit_design(backend):
return {"rtlil": rtlil, "verilog": verilog}[backend].convert(fragment, name=name,
ports=list(self.iter_ports()), missing_domain=lambda name: None)
@@ -308,6 +317,7 @@ def render(source, origin):
return compiled.render({
"name": name,
"platform": self,
"emit_unix_interpreter": emit_unix_interpreter,
"emit_design": emit_design,
"emit_commands": emit_commands,
"get_tool": get_tool,
1 change: 1 addition & 0 deletions nmigen/vendor/xilinx_spartan_3_6.py
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@ def family(self):
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
"""
}
unix_interpreter = "bash"
command_templates = [
r"""
{{get_tool("xst")}}