diff --git a/litex/build/altera/platform.py b/litex/build/altera/platform.py index f7b3b0a8ef..fe14303362 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 5be426c293..ef6b505b0c 100644 --- a/litex/build/altera/quartus.py +++ b/litex/build/altera/quartus.py @@ -192,6 +192,8 @@ def build_script(self): 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 @@ def build_script(self): 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) diff --git a/litex/build/efinix/efinity.py b/litex/build/efinix/efinity.py index 6f81e8db82..7cc29af963 100644 --- a/litex/build/efinix/efinity.py +++ b/litex/build/efinix/efinity.py @@ -391,7 +391,9 @@ def run_script(self, script): if r != 0: raise OSError("Error occurred during efx_map execution.") - + vdbfile = f"work_syn/{self._build_name}.vdb" + if not os.path.exists(vdbfile): + vdbfile = f"outflow/{self._build_name}.vdb" r = tools.subprocess_call_filtered([self.efinity_path + "/bin/efx_pnr", "--circuit", f"{self._build_name}", @@ -401,7 +403,7 @@ def run_script(self, script): "--pack", "--place", "--route", - "--vdb_file", f"work_syn/{self._build_name}.vdb", + "--vdb_file", vdbfile, "--use_vdb_file", "on", "--place_file", f"outflow/{self._build_name}.place", "--route_file", f"outflow/{self._build_name}.route",