Merge pull request #2006 from trabucayre/update_altera_build
Update altera build
This commit is contained in:
commit
d838a9ca73
|
@ -62,3 +62,11 @@ class AlteraPlatform(GenericPlatform):
|
|||
for pad in common.altera_reserved_jtag_pads:
|
||||
r[pad] = self.request(pad)
|
||||
return r
|
||||
|
||||
@classmethod
|
||||
def fill_args(cls, toolchain, parser):
|
||||
quartus.fill_args(parser)
|
||||
|
||||
@classmethod
|
||||
def get_argdict(cls, toolchain, args):
|
||||
return quartus.get_argdict(args)
|
||||
|
|
|
@ -28,10 +28,19 @@ class AlteraQuartusToolchain(GenericToolchain):
|
|||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._synth_tool = "quartus_map"
|
||||
self.additional_sdc_commands = []
|
||||
self.additional_qsf_commands = []
|
||||
self.cst = []
|
||||
|
||||
def build(self, platform, fragment,
|
||||
synth_tool = "quartus_map",
|
||||
**kwargs):
|
||||
|
||||
self._synth_tool = synth_tool
|
||||
|
||||
return GenericToolchain.build(self, platform, fragment, **kwargs)
|
||||
|
||||
# IO/Placement Constraints (.qsf) --------------------------------------------------------------
|
||||
|
||||
def _format_constraint(self, c, signame, fmt_r):
|
||||
|
@ -143,7 +152,8 @@ class AlteraQuartusToolchain(GenericToolchain):
|
|||
|
||||
# Add IPs
|
||||
for filename in self.platform.ips:
|
||||
qsf.append("set_global_assignment -name QSYS_FILE " + filename.replace("\\", "/"))
|
||||
file_ext = os.path.splitext(filename)[1][1:].upper()
|
||||
qsf.append(f"set_global_assignment -name {file_ext}_FILE " + filename.replace("\\", "/"))
|
||||
|
||||
# Add include paths
|
||||
for path in self.platform.verilog_include_paths:
|
||||
|
@ -178,7 +188,7 @@ class AlteraQuartusToolchain(GenericToolchain):
|
|||
script_contents += "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n"
|
||||
script_contents += "set -e -u -x -o pipefail\n"
|
||||
script_contents += """
|
||||
quartus_map --read_settings_files=on --write_settings_files=off {build_name} -c {build_name}
|
||||
{synth_tool} --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}"""
|
||||
|
@ -196,7 +206,7 @@ then
|
|||
quartus_cpf -c {build_name}.sof {build_name}.rbf
|
||||
fi
|
||||
"""
|
||||
script_contents = script_contents.format(build_name=build_name)
|
||||
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)
|
||||
|
||||
return script_file
|
||||
|
@ -207,10 +217,19 @@ fi
|
|||
else:
|
||||
shell = ["bash"]
|
||||
|
||||
if which("quartus_map") is None:
|
||||
if which(self._synth_tool) is None:
|
||||
msg = "Unable to find Quartus toolchain, please:\n"
|
||||
msg += "- Add Quartus toolchain to your $PATH."
|
||||
raise OSError(msg)
|
||||
|
||||
if subprocess.call(shell + [script]) != 0:
|
||||
raise OSError("Error occured during Quartus's script execution.")
|
||||
|
||||
def fill_args(parser):
|
||||
toolchain_group = parser.add_argument_group(title="Quartus toolchain options")
|
||||
toolchain_group.add_argument("--synth-tool", default="quartus_map", help="Synthesis mode (quartus_map or quartus_syn).")
|
||||
|
||||
def get_argdict(args):
|
||||
return {
|
||||
"synth_tool" : args.synth_tool,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue