soc/LiteXSoCArgumentParser: Fix --cpu-type parsing.

Could still be improved.
This commit is contained in:
Florent Kermarrec 2022-05-17 19:15:06 +02:00
parent 71a5ef2380
commit 4810cc15da
1 changed files with 6 additions and 1 deletions

View File

@ -1985,9 +1985,14 @@ class LiteXSoC(SoC):
class LiteXSoCArgumentParser(argparse.ArgumentParser): class LiteXSoCArgumentParser(argparse.ArgumentParser):
def parse_args(self): def parse_args(self):
# FIXME: Use 2 stages parser?
def get_selected_cpu_name(): def get_selected_cpu_name():
for name, cpu_cls in cpu.CPUS.items(): for name, cpu_cls in cpu.CPUS.items():
if f"--cpu-type={name}" in sys.argv: # FIXME: Improve. if f"--cpu-type={name}" in sys.argv:
return cpu_cls
if f"--cpu-type" in sys.argv:
if name in sys.argv:
return cpu_cls return cpu_cls
return None return None