p1_0 = (data >> 32) & 0xffff p0_1 = (data >> 16) & 0xffff p1_1 = (data >> 0) & 0xffff data = '%d, %d, %d, %d' % (p0_0, p1_0, p0_1, p1_1) if current_fchan != -1: if (p0_0 != current_fchan) or (p0_1 != current_fchan) or (p1_0 != current_fchan + 4096) or (p1_1 != current_fchan + 4096): print 'hdr says fchan %d, data in that packet says %d, %d, %d, %d. Issue.' % (current_fchan, p0_0, p1_0, p0_1, p1_1) data = '%d, %d, %d, %d' % (p0_0, p1_0, p0_1, p1_1) return None, data if args.direction == 'tx': key_order = ['led_tx', 'eof', 'valid', 'tx_full', 'tx_over', 'link_up', 'ip', 'data'] data_key = 'data' ip_key = 'ip' eof_key = 'eof' coredata = fpga.device_by_name(args.core).read_txsnap() else: key_order = ['led_up', 'led_rx', 'valid_in', 'eof_in', 'bad_frame', 'overrun', 'ip_in', 'data_in'] data_key = 'data_in' ip_key = 'ip_in' eof_key = 'eof_in' coredata = fpga.device_by_name(args.core).read_rxsnap() # read the snap block spead_info = {} packet_counter = 1 discovered_fchans = [] for ppp in range(0,1000): current_fchan = -1 coredata = fpga.device_by_name(args.core).read_rxsnap() print '.',
while True: # get key presses from ncurses keypress, character = scroller.on_keypress() if keypress == -1: break elif keypress > 0: scroller.draw_screen() if time.time() > last_refresh + polltime: scroller.clear_buffer() scroller.add_line('Polling %i fengine%s every %s - %is elapsed. The numbers before the : should all tick over, anything after the : indicate errors.' % (len(ffpgas), '' if len(ffpgas) == 1 else 's', 'second' if polltime == 1 else ('%i seconds' % polltime), time.time() - STARTTIME), 0, 0, absolute=True) scroller.set_ypos(newpos=2) for fpga in ffpgas: fifo_vcnt0 = fpga.device_by_name('unpack_fifo_vcnt0').read()['data'] fifo_vcnt1 = fpga.device_by_name('unpack_fifo_vcnt1').read()['data'] vcnt = fpga.device_by_name('unpack_vcnt').read()['data'] fstring = '%s [%10d,%10d,%10d,%10d,%10d,%10d]: ' % (fpga.host, fifo_vcnt0['fifo0'], fifo_vcnt0['fifo1'], fifo_vcnt1['fifo2'], fifo_vcnt1['fifo3'], vcnt['arb'], vcnt['reord']) for interface in [0, 1, 2, 3]: errors = fpga.device_by_name('unpack_err_%i' % interface).read()['data'] if (errors['cnt'] > 0) or (errors['time'] > 0) or (errors['timestep'] > 0): fstring += ('if_%d(%i, %i, %i) ' % (interface, errors['cnt'], errors['time'], errors['timestep'])) # and check it after the fifo and reorder block for interface in [0, 1]: errors = fpga.device_by_name('unpack_err_reorder%i' % interface).read()['data'] if (errors['cnt'] > 0) or (errors['time'] > 0) or (errors['timestep'] > 0): fstring += ('reord_pol%d(%i, %i, %i) ' % (interface, errors['cnt'], errors['time'], errors['timestep'])) scroller.add_line('%s' % fstring) scroller.draw_screen()