build/altera/platform,quartus: allows user to select Analysis&Synthesis tool (quartus_map (default) or quartus_syn
This commit is contained in:
parent
d4d1a1bfd7
commit
7393c35264
|
@ -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):
|
||||
|
@ -178,7 +187,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 +205,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 +216,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