Commit a826aaca authored by msloniewski's avatar msloniewski

build/altera: Add possibility to turn off generation of .rbf file

For some FPGAs (e.g. MAX10) .rbf file cannot be generated.
Add possibility to turn off that feature for those chips.
parent cb2d4372
...@@ -4,6 +4,7 @@ from litex.build.altera import common, quartus ...@@ -4,6 +4,7 @@ from litex.build.altera import common, quartus
class AlteraPlatform(GenericPlatform): class AlteraPlatform(GenericPlatform):
bitstream_ext = ".sof" bitstream_ext = ".sof"
create_rbf = True
def __init__(self, *args, toolchain="quartus", **kwargs): def __init__(self, *args, toolchain="quartus", **kwargs):
GenericPlatform.__init__(self, *args, **kwargs) GenericPlatform.__init__(self, *args, **kwargs)
......
...@@ -110,7 +110,7 @@ def _build_files(device, sources, vincpaths, named_sc, named_pc, build_name): ...@@ -110,7 +110,7 @@ def _build_files(device, sources, vincpaths, named_sc, named_pc, build_name):
tools.write_to_file("{}.qsf".format(build_name), "\n".join(lines)) tools.write_to_file("{}.qsf".format(build_name), "\n".join(lines))
def _run_quartus(build_name, quartus_path): def _run_quartus(build_name, quartus_path, create_rbf):
build_script_contents = "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n" build_script_contents = "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n"
build_script_contents += """ build_script_contents += """
...@@ -119,13 +119,16 @@ set -e ...@@ -119,13 +119,16 @@ set -e
quartus_map --read_settings_files=on --write_settings_files=off {build_name} -c {build_name} quartus_map --read_settings_files=on --write_settings_files=off {build_name} -c {build_name}
quartus_fit --read_settings_files=off --write_settings_files=off {build_name} -c {build_name} quartus_fit --read_settings_files=off --write_settings_files=off {build_name} -c {build_name}
quartus_asm --read_settings_files=off --write_settings_files=off {build_name} -c {build_name} quartus_asm --read_settings_files=off --write_settings_files=off {build_name} -c {build_name}
quartus_sta {build_name} -c {build_name} quartus_sta {build_name} -c {build_name}"""
if create_rbf:
build_script_contents +="""
if [ -f "{build_name}.sof" ] if [ -f "{build_name}.sof" ]
then then
quartus_cpf -c {build_name}.sof {build_name}.rbf quartus_cpf -c {build_name}.sof {build_name}.rbf
fi fi
""".format(build_name=build_name) # noqa """
build_script_contents = build_script_contents.format(build_name=build_name) # noqa
build_script_file = "build_" + build_name + ".sh" build_script_file = "build_" + build_name + ".sh"
tools.write_to_file(build_script_file, tools.write_to_file(build_script_file,
build_script_contents, build_script_contents,
...@@ -166,7 +169,7 @@ class AlteraQuartusToolchain: ...@@ -166,7 +169,7 @@ class AlteraQuartusToolchain:
_build_sdc(self.clocks, self.false_paths, v_output.ns, build_name) _build_sdc(self.clocks, self.false_paths, v_output.ns, build_name)
if run: if run:
_run_quartus(build_name, toolchain_path) _run_quartus(build_name, toolchain_path, platform.create_rbf)
os.chdir(cwd) os.chdir(cwd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment