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,10 +1985,15 @@ class LiteXSoC(SoC):
class LiteXSoCArgumentParser(argparse.ArgumentParser):
def parse_args(self):
# FIXME: Use 2 stages parser?
def get_selected_cpu_name():
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 None
# Intercept selected CPU to fill arguments.