build.plat: allow removing src attributes from RTLIL output.

This is important for Glasgow, which uses RTLIL hash as cache key,
and expects it to be stable between CI jobs.
This commit is contained in:
Catherine 2023-10-05 01:42:24 +00:00
parent c9416674d1
commit cce4e4462e

View file

@ -303,7 +303,7 @@ class TemplatedPlatform(Platform):
continue
yield net_signal, port_signal, frequency
def toolchain_prepare(self, fragment, name, **kwargs):
def toolchain_prepare(self, fragment, name, *, emit_src=True, **kwargs):
# Restrict the name of the design to a strict alphanumeric character set. Platforms will
# interpolate the name of the design in many different contexts: filesystem paths, Python
# scripts, Tcl scripts, ad-hoc constraint files, and so on. It is not practical to add
@ -319,7 +319,7 @@ class TemplatedPlatform(Platform):
# and to incorporate the Amaranth version into generated code.
autogenerated = "Automatically generated by Amaranth {}. Do not edit.".format(__version__)
rtlil_text, self._name_map = rtlil.convert_fragment(fragment, name=name)
rtlil_text, self._name_map = rtlil.convert_fragment(fragment, name=name, emit_src=emit_src)
# Retrieve an override specified in either the environment or as a kwarg.
# expected_type parameter is used to assert the type of kwargs, passing `None` will disable