build/altera: Add possibility to turn off generation of .rbf file
authormsloniewski <marcin.sloniewski@gmail.com>
Wed, 5 Jun 2019 16:52:40 +0000 (18:52 +0200)
committermsloniewski <marcin.sloniewski@gmail.com>
Wed, 5 Jun 2019 16:57:59 +0000 (18:57 +0200)
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
litex/build/altera/quartus.py

index 332f60d73ef5d7cc27fc8317fbfb81c2d645500f..c07f3ab71a53f9dc5ff4873b5b309c6096d9fb53 100644 (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)
index b34de9c175bfc17238df709846fd15f6e67c9656..d37d0ff029fa0819221f9cf71c5d00f5de68a76a 100644 (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)