projects/oscope/software/ltc_setup_litex_client.py
def autoIdelay(r, VAL=1):
    '''
    testpattern must be 0x01
    bitslips must have been carried out already such that
    data_peek reads 0x01
    '''
    # approximately center the idelay first
    setIdelay(r, 16)

    # decrement until the channels break
    for i in range(32):
        val0 = r.regs.lvds_data_peek0.read()
        val1 = r.regs.lvds_data_peek2.read()
        if val0 != VAL or val1 != VAL:
            break
        r.regs.lvds_idelay_dec.write(1)
    minValue = r.regs.lvds_idelay_value.read()

    # step back up a little
    for i in range(5):
        r.regs.lvds_idelay_inc.write(1)

    # increment until the channels break
    for i in range(32):
        val0 = r.regs.lvds_data_peek0.read()
        val1 = r.regs.lvds_data_peek2.read()
        if val0 != VAL or val1 != VAL:
            break
        r.regs.lvds_idelay_inc.write(1)
    maxValue = r.regs.lvds_idelay_value.read()

    # set idelay to the sweet spot in the middle
    setIdelay(r, (minValue + maxValue) // 2)

    print('autoIdelay(): min = {:}, mean = {:}, max = {:} idelays'.format(
        minValue,
        r.regs.lvds_idelay_value.read(),
        maxValue
    ))

    testpattern must be 0x01
    bitslips must have been carried out already such that
    data_peek reads 0x01
    
testpattern must be 0x01
bitslips must have been carried out already such that
data_peek reads 0x01
testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01
def autoIdelay(r, VAL=1):
    setIdelay(r, 16)
    for i in range(32):
        val0 = r.regs.lvds_data_peek0.read()
        val1 = r.regs.lvds_data_peek2.read()
        if val0 != VAL or val1 != VAL:
            break
        r.regs.lvds_idelay_dec.write(1)
    minValue = r.regs.lvds_idelay_value.read()
    for i in range(5):
        r.regs.lvds_idelay_inc.write(1)
    for i in range(32):
        val0 = r.regs.lvds_data_peek0.read()
        val1 = r.regs.lvds_data_peek2.read()
        if val0 != VAL or val1 != VAL:
            break
        r.regs.lvds_idelay_inc.write(1)
    maxValue = r.regs.lvds_idelay_value.read()
    setIdelay(r, (minValue + maxValue) // 2)
    print('autoIdelay(): min = {:}, mean = {:}, max = {:} idelays'.format(
        minValue,
        r.regs.lvds_idelay_value.read(),
        maxValue
    ))
def autoIdelay ( r , VAL = 1 ) : setIdelay ( r , 16 ) for i in range ( 32 ) : val0 = r . regs . lvds_data_peek0 . read ( ) val1 = r . regs . lvds_data_peek2 . read ( ) if val0 != VAL or val1 != VAL : break r . regs . lvds_idelay_dec . write ( 1 ) minValue = r . regs . lvds_idelay_value . read ( ) for i in range ( 5 ) : r . regs . lvds_idelay_inc . write ( 1 ) for i in range ( 32 ) : val0 = r . regs . lvds_data_peek0 . read ( ) val1 = r . regs . lvds_data_peek2 . read ( ) if val0 != VAL or val1 != VAL : break r . regs . lvds_idelay_inc . write ( 1 ) maxValue = r . regs . lvds_idelay_value . read ( ) setIdelay ( r , ( minValue + maxValue ) // 2 ) print ( 'autoIdelay(): min = {:}, mean = {:}, max = {:} idelays' . format ( minValue , r . regs . lvds_idelay_value . read ( ) , maxValue ) )
testpattern must be 0x01
bitslips must have been carried out already such that
data_peek reads 0x01
testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01
'''
    testpattern must be 0x01
    bitslips must have been carried out already such that
    data_peek reads 0x01
    ''' # approximately center the idelay first # decrement until the channels break # step back up a little # increment until the channels break # set idelay to the sweet spot in the middle
r
VAL