def setUpClass(cls): TestBase.setUpClass() adc5g.set_test_mode(cls._roach, 0) adc5g.set_test_mode(cls._roach, 1) #adc5g.set_test_mode(cls._roach,1) print "\nSETTING SYN" #adc5g.sync_adc(self._roach) # cls._optimal_phase, cls._glitches = adc5g.calibrate_mmcm_phase( #cls._roach, cls._zdok_n, ['scope_raw_%d_snap_bram' % cls._zdok_n]) # cls._roach, cls._zdok_n, ['snap']) #BOFFILE = 'adc5g_test.bof' BOFFILE = 'adcethvfullv64zdk1_2015_Oct_09_1201.bof' #'adcethvfullv64_2015_Sep_09_0946.bof' #'adcethvfullv61_2015_Sep_02_1653.bof' #'adc5g_test_2014_Jul_21_2138.bof'#1649.bof' #'adc5g_test_rev2.bof' ROACH = '192.168.100.182' #182 or 2 #ROACH = '10.0.1.213' SNAPNAME = 'snap' #'scope_raw_0_snap' def br(x): return np.binary_repr(x, width=8) r = corr.katcp_wrapper.FpgaClient(ROACH) time.sleep(0.1) #r.progdev(BOFFILE) adc5g.set_test_mode(r, 0, counter=False) adc5g.sync_adc(r) adc5g.calibrate_all_delays(r, 0, snaps=[SNAPNAME], verbosity=5) # adc5g.calibrate_mmcm_phase(r, 0, [SNAPNAME]) #adc5g.calibrate_mmcm_phase(r, 0, ['snap']) adc5g.unset_test_mode(r, 0) #a, b, c, d = adc5g.get_test_vector(r, ['snap']) a, b, c, d = adc5g.get_test_vector(r, [SNAPNAME]) #x = adc5g.get_snapshot(r, 'scope_raw_0_snap') #a = x[0::4] #b = x[1::4] #c = x[2::4] #d = x[3::4] for i in range(32): print br(a[i]), br(b[i]), br(c[i]), br(d[i]) # for cn, core in enumerate([a,b,c,d]): # pylab.plot(np.array(core) & 0xf, label='%d'%cn) # pylab.legend() #pylab.show() # adc5g.unset_test_mode(roach, 0) # adc5g.unset_test_mode(roach, 1) # time.sleep(4) print "\ntest finished"
def check_core_alignment(r,cores=4): adc.set_spi_register(r,0,0x05+0x80,0) #use counter adc.set_test_mode(r, 0) adc.sync_adc(r,zdok_0=True,zdok_1=True) test_vec = np.array(adc.get_test_vector(r, ['snapshot_adc0'])) #for i in range(1): # for core in range(cores): # print "%3d"%test_vec[core,i], # print '' s = test_vec[:,0] if np.any(s==255): # Lazy way to make sure we aren't looking at a wrapping section of the counter s = test_vec[100] offset = np.min(s) - s #these are the relative arrival times. i.e. -1 means arrival is one clock too soon return offset
def dotest(plotcore = 1): """ Put the adc in test mode and get a sample of the test vector. Plot core 1 by default. """ global snap_name adc5g.set_spi_control(roach2, zdok, test=1) cores = (corea, corec, coreb, cored) = adc5g.get_test_vector(roach2, [snap_name,]) if plotcore == 2: plotcore = 3 elif plotcore == 3: plotcore = 2 plt.plot(cores[plotcore]) adc5g.set_spi_control(roach2, zdok)
def dotest(plotcore=1): """ Put the adc in test mode and get a sample of the test vector. Plot core 1 by default. """ global snap_name adc5g.set_spi_control(roach2, zdok, test=1) cores = (corea, corec, coreb, cored) = adc5g.get_test_vector(roach2, [ snap_name, ]) if plotcore == 2: plotcore = 3 elif plotcore == 3: plotcore = 2 plt.plot(cores[plotcore]) adc5g.set_spi_control(roach2, zdok)
adc.set_spi_register(r,0,0x05+0x80,1) #use strobing test mode adc.set_test_mode(r, 0) adc.set_test_mode(r, 1) adc.sync_adc(r,zdok_0=True,zdok_1=False) BITS = 8 DELAY_RANGE = 32 CORES = 4 glitches = np.zeros([CORES,BITS,DELAY_RANGE]) for delay in range(DELAY_RANGE): print "setting delay %d"%(delay) set_io_delay(r,0,0,delay) set_io_delay(r,0,1,delay) set_io_delay(r,0,2,delay) set_io_delay(r,0,3,delay) test_vec = np.array(adc.get_test_vector(r, ['snapshot_adc0'])) #for i in range(4096): # print np.binary_repr(core_a[i],width=8), # print np.binary_repr(core_b[i],width=8), # print np.binary_repr(core_c[i],width=8), # print np.binary_repr(core_d[i],width=8) # print core_a[i], # print core_b[i], # print core_c[i], # print core_d[i] if delay==4: print "values at delay %d"%delay for i in range(len(test_vec[0])): for core in range(CORES): print "%4d"%test_vec[core,i], np.binary_repr(test_vec[core,i],width=8), #print "%4d"%test_vec[core,i],
adc.set_spi_register(r, 0, 0x05 + 0x80, 1) #use strobing test mode adc.set_test_mode(r, 0) adc.set_test_mode(r, 1) adc.sync_adc(r, zdok_0=True, zdok_1=False) BITS = 8 DELAY_RANGE = 32 CORES = 4 glitches = np.zeros([CORES, BITS, DELAY_RANGE]) for delay in range(DELAY_RANGE): print "setting delay %d" % (delay) set_io_delay(r, 0, 0, delay) set_io_delay(r, 0, 1, delay) set_io_delay(r, 0, 2, delay) set_io_delay(r, 0, 3, delay) test_vec = np.array(adc.get_test_vector(r, ['snapshot_adc0'])) #for i in range(4096): # print np.binary_repr(core_a[i],width=8), # print np.binary_repr(core_b[i],width=8), # print np.binary_repr(core_c[i],width=8), # print np.binary_repr(core_d[i],width=8) # print core_a[i], # print core_b[i], # print core_c[i], # print core_d[i] if delay == 4: print "values at delay %d" % delay for i in range(len(test_vec[0])): for core in range(CORES): print "%4d" % test_vec[core, i], np.binary_repr(test_vec[core, i],
adc.set_spi_register(r,0,0x05+0x80,0) #use strobing test mode adc.set_test_mode(r, 0) adc.set_test_mode(r, 1) adc.sync_adc(r,zdok_0=True,zdok_1=False) glitches_a = [] glitches_b = [] glitches_c = [] glitches_d = [] for delay in range(32): print "setting delay", delay set_io_delay(r,0,0,delay) set_io_delay(r,0,1,delay) set_io_delay(r,0,2,delay) set_io_delay(r,0,3,delay) core_a, core_b, core_c, core_d = adc.get_test_vector(r, ['snapshot_adc0']) #for i in range(4096): # print np.binary_repr(core_a[i],width=8), # print np.binary_repr(core_b[i],width=8), # print np.binary_repr(core_c[i],width=8), # print np.binary_repr(core_d[i],width=8) # print core_a[i], # print core_b[i], # print core_c[i], # print core_d[i] glitches_a += [adc.total_glitches(core_a, 8)] glitches_b += [adc.total_glitches(core_b, 8)] glitches_c += [adc.total_glitches(core_c, 8)] glitches_d += [adc.total_glitches(core_d, 8)] print "GLITCHES IN CORE A B C D BY IODELAY"
def br(x): return np.binary_repr(x, width=8) r = corr.katcp_wrapper.FpgaClient(ROACH) time.sleep(0.1) r.progdev(BOFFILE) adc5g.set_test_mode(r, 0, counter=False) adc5g.sync_adc(r) adc5g.calibrate_all_delays(r, 0, snaps=['snap'], verbosity=5) #adc5g.calibrate_mmcm_phase(r, 0, ['snap']) #adc5g.unset_test_mode(r, 0) #a, b, c, d = adc5g.get_test_vector(r, ['snap']) a, b, c, d = adc5g.get_test_vector(r, [SNAPNAME]) #x = adc5g.get_snapshot(r, 'scope_raw_0_snap') #a = x[0::4] #b = x[1::4] #c = x[2::4] #d = x[3::4] for i in range(32): print br(a[i]), br(b[i]), br(c[i]), br(d[i]) for cn, core in enumerate([a,b,c,d]): pylab.plot(np.array(core) & 0xf, label='%d'%cn) pylab.legend() pylab.show()
adc.sync_adc(r, zdok_0=True, zdok_1=True) time.sleep(0.5) #opt0, glitches0 = adc.calibrate_mmcm_phase(r, ADC, ['feng_snapshot_adc%d'%ADC,]) #print opt0, glitches0 CORES = 4 glitches = np.zeros([CORES]) #for i in range(1000000): i = 0 while (True): try: test_vec = np.array( adc.get_test_vector(r, ['feng_snapshot_adc%d' % ADC])) #pylab.subplot(2,1,1) #[pylab.plot(test_vec[core]) for core in range(4)] #pylab.subplot(2,1,2) #[pylab.plot(gray[test_vec[core]]) for core in range(4)] #pylab.show() for core in range(CORES): glitches[core] += adc.total_glitches(test_vec[core], 8) #for j in range(100): # for core in range(CORES): # print "%3d"%test_vec[core,j], # print '' print "Glitches after %d runs:" % i, glitches i += 1 sys.stdout.flush()
adc.set_test_mode(r, 1) adc.sync_adc(r,zdok_0=True,zdok_1=True) time.sleep(0.5) #opt0, glitches0 = adc.calibrate_mmcm_phase(r, ADC, ['feng_snapshot_adc%d'%ADC,]) #print opt0, glitches0 CORES = 4 glitches = np.zeros([CORES]) #for i in range(1000000): i = 0 while(True): try: test_vec = np.array(adc.get_test_vector(r, ['feng_snapshot_adc%d'%ADC])) #pylab.subplot(2,1,1) #[pylab.plot(test_vec[core]) for core in range(4)] #pylab.subplot(2,1,2) #[pylab.plot(gray[test_vec[core]]) for core in range(4)] #pylab.show() for core in range(CORES): glitches[core] += adc.total_glitches(test_vec[core],8) #for j in range(100): # for core in range(CORES): # print "%3d"%test_vec[core,j], # print '' print "Glitches after %d runs:"%i, glitches i += 1 sys.stdout.flush()