diff --git a/litex/build/altera/platform.py b/litex/build/altera/platform.py index f7b3b0a8e..fe1430336 100644 --- a/litex/build/altera/platform.py +++ b/litex/build/altera/platform.py @@ -18,6 +18,7 @@ class AlteraPlatform(GenericPlatform): "flash" : ".rbf" } create_rbf = True + create_svf = True _supported_toolchains = ["quartus"] diff --git a/litex/build/altera/quartus.py b/litex/build/altera/quartus.py index 5be426c29..ef6b505b0 100644 --- a/litex/build/altera/quartus.py +++ b/litex/build/altera/quartus.py @@ -192,6 +192,8 @@ class AlteraQuartusToolchain(GenericToolchain): 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}""" + + # Create .rbf. if self.platform.create_rbf: if sys.platform in ["win32", "cygwin"]: script_contents += """ @@ -205,6 +207,21 @@ if [ -f "{build_name}.sof" ] then quartus_cpf -c {build_name}.sof {build_name}.rbf fi +""" + # Create .svf. + if self.platform.create_svf: + if sys.platform in ["win32", "cygwin"]: + script_contents += """ +if exist "{build_name}.sof" ( + quartus_cpf -c -q \"12.0MHz\" -g 3.3 -n p {build_name}.sof {build_name}.svf +) +""" + else: + script_contents += """ +if [ -f "{build_name}.sof" ] +then + quartus_cpf -c -q \"12.0MHz\" -g 3.3 -n p {build_name}.sof {build_name}.svf +fi """ script_contents = script_contents.format(build_name=build_name, synth_tool=self._synth_tool) tools.write_to_file(script_file, script_contents, force_unix=True)