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: 1fc63a62c04a
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: 25b280dba10e
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Aug 21, 2019

  1. build.plat: remove TemplatedPlatform.unix_interpreter.

    Vendor toolchains generally require far more workarounds than this,
    and we already have a perfectly fine way of overriding templates.
    whitequark committed Aug 21, 2019
    Copy the full SHA
    25b280d View commit details
Showing with 7 additions and 11 deletions.
  1. +0 −10 nmigen/build/plat.py
  2. +7 −1 nmigen/vendor/xilinx_spartan_3_6.py
10 changes: 0 additions & 10 deletions nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -225,13 +225,11 @@ 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")}}
""",
@@ -248,13 +246,6 @@ 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):
backend_mod = {"rtlil": rtlil, "verilog": verilog}[backend]
return backend_mod.convert_fragment(fragment, name=name)
@@ -321,7 +312,6 @@ 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,
8 changes: 7 additions & 1 deletion nmigen/vendor/xilinx_spartan_3_6.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,13 @@ def family(self):

file_templates = {
**TemplatedPlatform.build_script_templates,
"build_{{name}}.sh": r"""
# {{autogenerated}}
set -e{{verbose("x")}}
if [ -z "$BASH" ] ; then exec /bin/bash "$0" "$@"; fi
[ -n "$NMIGEN_{{platform.toolchain}}_env" ] && . "$NMIGEN_{{platform.toolchain}}_env"
{{emit_commands("sh")}}
""",
"{{name}}.v": r"""
/* {{autogenerated}} */
{{emit_design("verilog")}}
@@ -118,7 +125,6 @@ def family(self):
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
"""
}
unix_interpreter = "bash"
command_templates = [
r"""
{{get_tool("xst")}}