@@ -470,13 +470,15 @@ def add_std(cls, target, eem, eem_aux=None, eem_aux2=None, ttl_out_cls=None, ios
470
470
class SUServo (_EEM ):
471
471
@staticmethod
472
472
def io (* eems , iostandard = "LVDS_25" ):
473
- assert len (eems ) == 6
474
- return (Sampler .io (* eems [0 :2 ], iostandard = iostandard )
475
- + Urukul .io_qspi (* eems [2 :4 ], iostandard = iostandard )
476
- + Urukul .io_qspi (* eems [4 :6 ], iostandard = iostandard ))
473
+ assert len (eems ) in (4 , 6 )
474
+ io = (Sampler .io (* eems [0 :2 ], iostandard = iostandard )
475
+ + Urukul .io_qspi (* eems [2 :4 ], iostandard = iostandard ))
476
+ if len (eems ) == 6 : # two Urukuls
477
+ io += Urukul .io_qspi (* eems [4 :6 ], iostandard = iostandard ),
478
+ return io
477
479
478
480
@classmethod
479
- def add_std (cls , target , eems_sampler , eems_urukul0 , eems_urukul1 ,
481
+ def add_std (cls , target , eems_sampler , eems_urukul ,
480
482
t_rtt = 4 , clk = 1 , shift = 11 , profile = 5 ,
481
483
iostandard = "LVDS_25" ):
482
484
"""Add a 8-channel Sampler-Urukul Servo
@@ -496,15 +498,14 @@ def add_std(cls, target, eems_sampler, eems_urukul0, eems_urukul1,
496
498
(default: 5)
497
499
"""
498
500
cls .add_extension (
499
- target , * (eems_sampler + eems_urukul0 + eems_urukul1 ),
501
+ target , * (eems_sampler + sum ( eems_urukul , []) ),
500
502
iostandard = iostandard )
501
503
eem_sampler = "sampler{}" .format (eems_sampler [0 ])
502
- eem_urukul0 = "urukul{}" .format (eems_urukul0 [0 ])
503
- eem_urukul1 = "urukul{}" .format (eems_urukul1 [0 ])
504
+ eem_urukul = ["urukul{}" .format (i [0 ]) for i in eems_urukul ]
504
505
505
506
sampler_pads = servo_pads .SamplerPads (target .platform , eem_sampler )
506
507
urukul_pads = servo_pads .UrukulPads (
507
- target .platform , eem_urukul0 , eem_urukul1 )
508
+ target .platform , * eem_urukul )
508
509
target .submodules += sampler_pads , urukul_pads
509
510
# timings in units of RTIO coarse period
510
511
adc_p = servo .ADCParams (width = 16 , channels = 8 , lanes = 4 , t_cnvh = 4 ,
@@ -536,30 +537,24 @@ def add_std(cls, target, eems_sampler, eems_urukul0, eems_urukul1,
536
537
target .submodules += phy
537
538
target .rtio_channels .append (rtio .Channel .from_phy (phy , ififo_depth = 4 ))
538
539
539
- phy = spi2 .SPIMaster (
540
- target .platform .request ("{}_spi_p" .format (eem_urukul0 )),
541
- target .platform .request ("{}_spi_n" .format (eem_urukul0 )))
542
- target .submodules += phy
543
- target .rtio_channels .append (rtio .Channel .from_phy (phy , ififo_depth = 4 ))
544
-
545
- pads = target .platform .request ("{}_dds_reset_sync_in" .format (eem_urukul0 ))
546
- target .specials += DifferentialOutput (0 , pads .p , pads .n )
547
-
548
- for i , signal in enumerate ("sw0 sw1 sw2 sw3" .split ()):
549
- pads = target .platform .request ("{}_{}" .format (eem_urukul0 , signal ))
550
- target .specials += DifferentialOutput (
551
- su .iir .ctrl [i ].en_out , pads .p , pads .n )
540
+ for i in range (2 ):
541
+ if len (eem_urukul ) > i :
542
+ spi_p , spi_n = (
543
+ target .platform .request ("{}_spi_p" .format (eem_urukul [i ])),
544
+ target .platform .request ("{}_spi_n" .format (eem_urukul [i ])))
545
+ else : # create a dummy bus
546
+ spi_p = Record ([("clk" , 1 ), ("cs_n" , 1 )]) # mosi, cs_n
547
+ spi_n = None
552
548
553
- phy = spi2 .SPIMaster (
554
- target .platform .request ("{}_spi_p" .format (eem_urukul1 )),
555
- target .platform .request ("{}_spi_n" .format (eem_urukul1 )))
556
- target .submodules += phy
557
- target .rtio_channels .append (rtio .Channel .from_phy (phy , ififo_depth = 4 ))
549
+ phy = spi2 .SPIMaster (spi_p , spi_n )
550
+ target .submodules += phy
551
+ target .rtio_channels .append (rtio .Channel .from_phy (phy , ififo_depth = 4 ))
558
552
559
- pads = target .platform .request ("{}_dds_reset_sync_in" .format (eem_urukul1 ))
560
- target .specials += DifferentialOutput (0 , pads .p , pads .n )
553
+ for j , eem_urukuli in enumerate (eem_urukul ):
554
+ pads = target .platform .request ("{}_dds_reset_sync_in" .format (eem_urukuli ))
555
+ target .specials += DifferentialOutput (0 , pads .p , pads .n )
561
556
562
- for i , signal in enumerate ("sw0 sw1 sw2 sw3" .split ()):
563
- pads = target .platform .request ("{}_{}" .format (eem_urukul1 , signal ))
564
- target .specials += DifferentialOutput (
565
- su .iir .ctrl [i + 4 ].en_out , pads .p , pads .n )
557
+ for i , signal in enumerate ("sw0 sw1 sw2 sw3" .split ()):
558
+ pads = target .platform .request ("{}_{}" .format (eem_urukuli , signal ))
559
+ target .specials += DifferentialOutput (
560
+ su .iir .ctrl [j * 4 + i ].en_out , pads .p , pads .n )
0 commit comments