def digitiser_start(dig_tx_tuple): fdig = KatcpClientFpga(dhost) fdig.deprogram() stime = time.time() print 'Programming digitiser', sys.stdout.flush() fdig.upload_to_ram_and_program(dbof) print time.time() - stime fdig.test_connection() fdig.get_system_information() # stop sending data fdig.registers.control.write(gbe_txen = False) # start the local timer on the test d-engine - mrst, then a fake sync fdig.registers.control.write(mrst = 'pulse') fdig.registers.control.write(msync = 'pulse') # the all_fpgas have tengbe cores, so set them up ip_bits = dip_start.split('.') ipbase = int(ip_bits[3]) mac_bits = dmac_start.split(':') macbase = int(mac_bits[5]) for ctr in range(0,4): mac = '%s:%s:%s:%s:%s:%d' % (mac_bits[0], mac_bits[1], mac_bits[2], mac_bits[3], mac_bits[4], macbase + ctr) ip = '%s.%s.%s.%d' % (ip_bits[0], ip_bits[1], ip_bits[2], ipbase + ctr) fdig.tengbes['gbe%d' % ctr].setup(mac=mac, ipaddress=ip, port=7777) for gbe in fdig.tengbes: gbe.tap_start(True) # set the destination IP and port for the tx txaddr = dig_tx_tuple[0] txaddr_bits = txaddr.split('.') txaddr_base = int(txaddr_bits[3]) txaddr_prefix = '%s.%s.%s.' % (txaddr_bits[0], txaddr_bits[1], txaddr_bits[2]) print 'digitisers sending to: %s%d port %d' % (txaddr_prefix, txaddr_base + 0, dig_tx_tuple[2]) fdig.write_int('gbe_iptx0', tengbe.str2ip('%s%d' % (txaddr_prefix, txaddr_base + 0))) fdig.write_int('gbe_iptx1', tengbe.str2ip('%s%d' % (txaddr_prefix, txaddr_base + 1))) fdig.write_int('gbe_iptx2', tengbe.str2ip('%s%d' % (txaddr_prefix, txaddr_base + 2))) fdig.write_int('gbe_iptx3', tengbe.str2ip('%s%d' % (txaddr_prefix, txaddr_base + 3))) fdig.write_int('gbe_porttx', dig_tx_tuple[2]) fdig.registers.control.write(gbe_rst=False) # enable the tvg on the digitiser and set up the pol id bits fdig.registers.control.write(tvg_select0=True) fdig.registers.control.write(tvg_select1=True) fdig.registers.id2.write(pol1_id=1) # start tx print 'Starting dig TX...', sys.stdout.flush() fdig.registers.control.write(gbe_txen=True) print 'done.' sys.stdout.flush() fdig.disconnect()
for fpga in xfpgas: for gbe in fpga.tengbes: gbe.setup(mac='02:02:00:00:02:%02x' % macbase, ipaddress='10.0.0.%d' % xipbase, port=8778) macbase += 1 xipbase += 1 fpga.registers.board_id.write_int(board_id) board_id += 4 # see the model file as to why this must incrementby 4 - this needs to be changed!! # tap start for fpga in all_fpgas: for gbe in fpga.tengbes: gbe.tap_start(True) # set the destination IP and port for the tx if not args.unicast: fdig.write_int('gbe_iptx0', tengbe.str2ip('239.2.0.64')) fdig.write_int('gbe_iptx1', tengbe.str2ip('239.2.0.65')) fdig.write_int('gbe_iptx2', tengbe.str2ip('239.2.0.66')) fdig.write_int('gbe_iptx3', tengbe.str2ip('239.2.0.67')) else: fdig.write_int('gbe_iptx0', tengbe.str2ip('10.0.0.90')) fdig.write_int('gbe_iptx1', tengbe.str2ip('10.0.0.91')) fdig.write_int('gbe_iptx2', tengbe.str2ip('10.0.0.92')) fdig.write_int('gbe_iptx3', tengbe.str2ip('10.0.0.93')) fdig.write_int('gbe_porttx', 7777) if program: # start the tap devices arptime = 200 stime = time.time() while time.time() < stime + arptime: