* vendor.*: employ iter_extra_files.
for filename, content in self.extra_files.items():
plan.add_file(filename, content)
return plan
+
+ def iter_extra_files(self, *endswith):
+ return (f for f in self.extra_files if f.endswith(endswith))
""",
"{{name}}.ys": r"""
# {{autogenerated}}
- {% for file in platform.extra_files %}
- {% if file.endswith(".v") -%}
- read_verilog {{get_override("read_opts")|join(" ")}} {{file}}
- {% elif file.endswith(".sv") -%}
- read_verilog -sv {{get_override("read_opts")|join(" ")}} {{file}}
- {% endif %}
+ {% for file in platform.iter_extra_files(".v") -%}
+ read_verilog {{get_override("read_opts")|join(" ")}} {{file}}
+ {% endfor %}
+ {% for file in platform.iter_extra_files(".sv") -%}
+ read_verilog -sv {{get_override("read_opts")|join(" ")}} {{file}}
{% endfor %}
read_ilang {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
""",
"{{name}}.ys": r"""
# {{autogenerated}}
- {% for file in platform.extra_files %}
- {% if file.endswith(".v") -%}
- read_verilog {{get_override("read_opts")|join(" ")}} {{file}}
- {% elif file.endswith(".sv") -%}
- read_verilog -sv {{get_override("read_opts")|join(" ")}} {{file}}
- {% endif %}
+ {% for file in platform.iter_extra_files(".v") -%}
+ read_verilog {{get_override("read_opts")|join(" ")}} {{file}}
+ {% endfor %}
+ {% for file in platform.iter_extra_files(".sv") -%}
+ read_verilog -sv {{get_override("read_opts")|join(" ")}} {{file}}
{% endfor %}
read_ilang {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
"{{name}}.tcl": r"""
# {{autogenerated}}
create_project -force -name {{name}} -part {{platform.device}}{{platform.package}}-{{platform.speed}}
- {% for file in platform.extra_files %}
- {% if file.endswith((".v", ".sv")) -%}
- add_files {{file}}
- {% endif %}
+ {% for file in platform.iter_extra_files(".v", ".sv") -%}
+ add_files {{file}}
{% endfor %}
add_files {{name}}.v
read_xdc {{name}}.xdc
- {% for file in platform.extra_files %}
- {% if file.endswith("xdc") -%}
- read_xdc {{file}}
- {% endif %}
+ {% for file in platform.iter_extra_files(".xdc") -%}
+ read_xdc {{file}}
{% endfor %}
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
synth_design -top {{name}} -part {{platform.device}}{{platform.package}}-{{platform.speed}}
""",
"{{name}}.prj": r"""
# {{autogenerated}}
- {% for file in platform.extra_files -%}
- {% if file.endswith(".v") %}
- verilog work {{file}}
- {% endif %}
+ {% for file in platform.iter_extra_files(".v") -%}
+ verilog work {{file}}
{% endfor %}
verilog work {{name}}.v
""",