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.
This commit is contained in:
parent
1fc63a62c0
commit
25b280dba1
|
@ -225,13 +225,11 @@ class TemplatedPlatform(Platform):
|
||||||
toolchain = abstractproperty()
|
toolchain = abstractproperty()
|
||||||
file_templates = abstractproperty()
|
file_templates = abstractproperty()
|
||||||
command_templates = abstractproperty()
|
command_templates = abstractproperty()
|
||||||
unix_interpreter = "sh"
|
|
||||||
|
|
||||||
build_script_templates = {
|
build_script_templates = {
|
||||||
"build_{{name}}.sh": """
|
"build_{{name}}.sh": """
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
set -e{{verbose("x")}}
|
set -e{{verbose("x")}}
|
||||||
{{emit_unix_interpreter()}}
|
|
||||||
[ -n "$NMIGEN_{{platform.toolchain}}_env" ] && . "$NMIGEN_{{platform.toolchain}}_env"
|
[ -n "$NMIGEN_{{platform.toolchain}}_env" ] && . "$NMIGEN_{{platform.toolchain}}_env"
|
||||||
{{emit_commands("sh")}}
|
{{emit_commands("sh")}}
|
||||||
""",
|
""",
|
||||||
|
@ -248,13 +246,6 @@ class TemplatedPlatform(Platform):
|
||||||
# and to incorporate the nMigen version into generated code.
|
# and to incorporate the nMigen version into generated code.
|
||||||
autogenerated = "Automatically generated by nMigen {}. Do not edit.".format(__version__)
|
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):
|
def emit_design(backend):
|
||||||
backend_mod = {"rtlil": rtlil, "verilog": verilog}[backend]
|
backend_mod = {"rtlil": rtlil, "verilog": verilog}[backend]
|
||||||
return backend_mod.convert_fragment(fragment, name=name)
|
return backend_mod.convert_fragment(fragment, name=name)
|
||||||
|
@ -321,7 +312,6 @@ class TemplatedPlatform(Platform):
|
||||||
return compiled.render({
|
return compiled.render({
|
||||||
"name": name,
|
"name": name,
|
||||||
"platform": self,
|
"platform": self,
|
||||||
"emit_unix_interpreter": emit_unix_interpreter,
|
|
||||||
"emit_design": emit_design,
|
"emit_design": emit_design,
|
||||||
"emit_commands": emit_commands,
|
"emit_commands": emit_commands,
|
||||||
"get_tool": get_tool,
|
"get_tool": get_tool,
|
||||||
|
|
8
nmigen/vendor/xilinx_spartan_3_6.py
vendored
8
nmigen/vendor/xilinx_spartan_3_6.py
vendored
|
@ -76,6 +76,13 @@ class XilinxSpartan3Or6Platform(TemplatedPlatform):
|
||||||
|
|
||||||
file_templates = {
|
file_templates = {
|
||||||
**TemplatedPlatform.build_script_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"""
|
"{{name}}.v": r"""
|
||||||
/* {{autogenerated}} */
|
/* {{autogenerated}} */
|
||||||
{{emit_design("verilog")}}
|
{{emit_design("verilog")}}
|
||||||
|
@ -118,7 +125,6 @@ class XilinxSpartan3Or6Platform(TemplatedPlatform):
|
||||||
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
|
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
unix_interpreter = "bash"
|
|
||||||
command_templates = [
|
command_templates = [
|
||||||
r"""
|
r"""
|
||||||
{{get_tool("xst")}}
|
{{get_tool("xst")}}
|
||||||
|
|
Loading…
Reference in a new issue