forked from M-Labs/artiq
1
0
Fork 0

gateware/targets: expose variant lists

This allows writing scripts that build all variants.
This commit is contained in:
Sebastien Bourdeauducq 2018-11-17 21:47:32 +08:00
parent 69e699c7bd
commit 78d4b3a7da
2 changed files with 14 additions and 13 deletions

View File

@ -1123,24 +1123,26 @@ class VLBAISatellite(_SatelliteBase):
self.add_rtio(self.rtio_channels)
VARIANTS = {cls.__name__.lower(): cls for cls in [
Opticlock, SUServo, PTB, PTB2, HUB, LUH,
SYSU, MITLL, MITLL2, USTC, Tsinghua, Tsinghua2, WIPM, NUDT,
VLBAIMaster, VLBAISatellite, Tester, Master, Satellite]}
def main():
parser = argparse.ArgumentParser(
description="ARTIQ device binary builder for Kasli systems")
builder_args(parser)
soc_kasli_args(parser)
parser.set_defaults(output_dir="artiq_kasli")
variants = {cls.__name__.lower(): cls for cls in [
Opticlock, SUServo, PTB, PTB2, HUB, LUH,
SYSU, MITLL, MITLL2, USTC, Tsinghua, Tsinghua2, WIPM, NUDT,
VLBAIMaster, VLBAISatellite, Tester, Master, Satellite]}
parser.add_argument("-V", "--variant", default="opticlock",
help="variant: {} (default: %(default)s)".format(
"/".join(sorted(variants.keys()))))
"/".join(sorted(VARIANTS.keys()))))
args = parser.parse_args()
variant = args.variant.lower()
try:
cls = variants[variant]
cls = VARIANTS[variant]
except KeyError:
raise SystemExit("Invalid variant (-V/--variant)")

View File

@ -400,6 +400,9 @@ class SMA_SPI(_StandaloneBase):
self.csr_devices.append("rtio_analyzer")
VARIANTS = {cls.__name__.lower(): cls for cls in [NIST_CLOCK, NIST_QC2, SMA_SPI]}
def main():
parser = argparse.ArgumentParser(
description="KC705 gateware and firmware builder")
@ -413,13 +416,9 @@ def main():
args = parser.parse_args()
variant = args.variant.lower()
if variant == "nist_clock":
cls = NIST_CLOCK
elif variant == "nist_qc2":
cls = NIST_QC2
elif variant == "sma_spi":
cls = SMA_SPI
else:
try:
cls = VARIANTS[variant]
except KeyError:
raise SystemExit("Invalid variant (-V/--variant)")
soc = cls(**soc_kc705_argdict(args))