From a826aacac02a5071c1489538251c76a634435f35 Mon Sep 17 00:00:00 2001 From: msloniewski Date: Wed, 5 Jun 2019 18:52:40 +0200 Subject: [PATCH] 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. --- litex/build/altera/platform.py | 1 + litex/build/altera/quartus.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/litex/build/altera/platform.py b/litex/build/altera/platform.py index 332f60d73..c07f3ab71 100644 --- a/litex/build/altera/platform.py +++ b/litex/build/altera/platform.py @@ -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) diff --git a/litex/build/altera/quartus.py b/litex/build/altera/quartus.py index b34de9c17..d37d0ff02 100644 --- a/litex/build/altera/quartus.py +++ b/litex/build/altera/quartus.py @@ -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)