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.
This commit is contained in:
msloniewski 2019-06-05 18:52:40 +02:00
parent cb2d4372e4
commit a826aacac0
2 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from litex.build.altera import common, quartus
class AlteraPlatform(GenericPlatform):
bitstream_ext = ".sof"
create_rbf = True
def __init__(self, *args, toolchain="quartus", **kwargs):
GenericPlatform.__init__(self, *args, **kwargs)

View File

@ -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))
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 += """
@ -119,13 +119,16 @@ set -e
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_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" ]
then
quartus_cpf -c {build_name}.sof {build_name}.rbf
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"
tools.write_to_file(build_script_file,
build_script_contents,
@ -166,7 +169,7 @@ class AlteraQuartusToolchain:
_build_sdc(self.clocks, self.false_paths, v_output.ns, build_name)
if run:
_run_quartus(build_name, toolchain_path)
_run_quartus(build_name, toolchain_path, platform.create_rbf)
os.chdir(cwd)