build/argument_parser: Minor styles changes.

This commit is contained in:
Florent Kermarrec 2022-11-06 21:19:17 +01:00
parent 8040c83268
commit c62306d57e
1 changed files with 7 additions and 8 deletions

View File

@ -58,13 +58,13 @@ class LiteXArgumentParser(argparse.ArgumentParser):
self._target_group = self.add_argument_group(title="Target options") self._target_group = self.add_argument_group(title="Target options")
if toolchains is not None: if toolchains is not None:
self.add_target_argument("--toolchain", self.add_target_argument("--toolchain",
default=self._default_toolchain, default = self._default_toolchain,
choices=toolchains, choices = toolchains,
help="FPGA toolchain ({}).".format(" or ".join(toolchains))) help = "FPGA toolchain ({}).".format(" or ".join(toolchains)))
else: else:
self.add_target_argument("-toolchain", help="FPGA toolchain") self.add_target_argument("-toolchain", help="FPGA toolchain")
self.add_target_argument("--build", action="store_true", help="Build design.") self.add_target_argument("--build", action="store_true", help="Build design.")
self.add_target_argument("--load", action="store_true", help="Load bitstream.") self.add_target_argument("--load", action="store_true", help="Load bitstream.")
builder_args(self) builder_args(self)
soc_core_args(self) soc_core_args(self)
@ -147,13 +147,12 @@ class LiteXArgumentParser(argparse.ArgumentParser):
# Intercept selected toolchain to fill arguments. # Intercept selected toolchain to fill arguments.
if self._platform is not None: if self._platform is not None:
self._toolchain = self.get_value_from_key("--toolchain", self._toolchain = self.get_value_from_key("--toolchain", self._default_toolchain)
self._default_toolchain)
if self._toolchain is not None: if self._toolchain is not None:
self._platform.fill_args(self._toolchain, self) self._platform.fill_args(self._toolchain, self)
# Intercept selected CPU to fill arguments. # Intercept selected CPU to fill arguments.
cpu_cls = None cpu_cls = None
cpu_name = self.get_value_from_key("--cpu-type") cpu_name = self.get_value_from_key("--cpu-type")
if cpu_name is not None: if cpu_name is not None:
cpu_cls = cpu.CPUS[cpu_name] cpu_cls = cpu.CPUS[cpu_name]