Skip to content

Commit

Permalink
build/altera/quartus: Add .svf generation (required for now with open…
Browse files Browse the repository at this point in the history
…FPGALoader) and create_rbf property.
  • Loading branch information
enjoy-digital committed Nov 26, 2024
1 parent 10dcc73 commit 29c5a1d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions litex/build/altera/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AlteraPlatform(GenericPlatform):
"flash" : ".rbf"
}
create_rbf = True
create_svf = True

_supported_toolchains = ["quartus"]

Expand Down
17 changes: 17 additions & 0 deletions litex/build/altera/quartus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += """
Expand All @@ -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)
Expand Down

0 comments on commit 29c5a1d

Please sign in to comment.