Ejemplo n.º 1
0
def digitiser_stop():
    print 'Stopping digitiser'
    fdig = KatcpClientFpga(dhost)
    if fdig.is_running():
        fdig.test_connection()
        fdig.get_system_information()
        fdig.registers.control.write(gbe_txen = False)
        fdig.deprogram()
    fdig.disconnect()
Ejemplo n.º 2
0
parser.add_argument('-r', '--reset_count', dest='rstcnt', action='store_true',
                    default=False,
                    help='reset all counters at script startup')
args = parser.parse_args()

polltime = args.polltime

xeng_hosts = args.hosts.lstrip().rstrip().replace(' ', '').split(',')

xeng_hosts = ['roach020921', 'roach020927', 'roach020919', 'roach020925',
          'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

# create the devices and connect to them
ffpgas = []
for host in xeng_hosts:
    xeng_fpga = KatcpClientFpga(host)
    xeng_fpga.get_system_information()
    if args.rstcnt:
        xeng_fpga.registers.control.write(cnt_rst='pulse')
    ffpgas.append(xeng_fpga)

def get_fpga_data(fpga):
    data = {}
    for pol in [0,1]:
        data['rx_cnt%i' % pol] = fpga.device_by_name('rx_cnt%i' % pol).read()['data']['reg']
        data['rx_err_cnt%i' % pol] = fpga.device_by_name('rx_err_cnt%i' % pol).read()['data']['reg']
    return data

data = get_fpga_data(ffpgas[0])
reg_names = data.keys()
reg_names.sort()
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
 def __init__(self, host_device, port=7147):
     KatcpClientFpga.__init__(self, host_device, port)
     LOGGER.info('New Digitiser created - %s', str(self))
Ejemplo n.º 5
0
#                    default=5120, type=int,
#                    help='the 10GBE SPEAD payload size, in bytes')
args = parser.parse_args()

polltime = args.polltime
num_spead_headers = 4

xeng_hosts = args.hosts.lstrip().rstrip().replace(' ', '').split(',')

xeng_hosts = ['roach020921', 'roach020927', 'roach020919', 'roach020925',
          'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

# create the devices and connect to them
xfpgas = []
for host in xeng_hosts:
    xeng_fpga = KatcpClientFpga(host)
    time.sleep(0.3)
    if not xeng_fpga.is_connected():
        xeng_fpga.connect()
    xeng_fpga.test_connection()
    xeng_fpga.get_system_information()
    numgbes = len(xeng_fpga.tengbes)
    if numgbes < 1:
        raise RuntimeError('Cannot have an xengine with no 10gbe cores?')
    print '%s: found %i 10gbe core%s.' % (host, numgbes, '' if numgbes == 1 else 's')
    xfpgas.append(xeng_fpga)

def print_headers(scr):
    '''Print the table headers.
    '''
    scr.addstr(2, 2, 'xhost')
Ejemplo n.º 6
0
                    default=False,
                    help='transmit unicast to the first f-engine, not multicast to all of them')
args = parser.parse_args()

#hosts = ['roach020958', 'roach02091b', 'roach020914', 'roach020922', 'roach020921', 'roach020927', 'roach020919', 'roach020925', 'roach02091a', 'roach02091e', 'roach020923', 'roach020924']
andrewhost = 'roach020915'
dhost = 'roach020959'
fhosts = ['roach020958', 'roach02091b', 'roach020914', 'roach020922']
xhosts = ['roach020921', 'roach020927', 'roach020919', 'roach020925',
          'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

dfpg = '/srv/bofs/deng/r2_deng_tvg_2014_May_30_1123.fpg'
ffpg = '/srv/bofs/feng/feng_rx_test_2014_Jun_05_1818.fpg'
xfpg = '/srv/bofs/xeng/x_rx_reorder_2014_Jun_02_1913.fpg'

fdig = KatcpClientFpga(dhost)
ffpgas = []
for host in fhosts:
    fpga = KatcpClientFpga(host)
    ffpgas.append(fpga)
xfpgas = []
for host in xhosts:
    fpga = KatcpClientFpga(host)
    xfpgas.append(fpga)
all_fpgas = [fdig]
all_fpgas.extend(ffpgas)
all_fpgas.extend(xfpgas)

if args.deprogram:
    for fpga in all_fpgas:
        try:
Ejemplo n.º 7
0
               'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

rxhosts = ['roach020826', 'roach02070f', 'roach020828', 'roach02082c',
    'roach02064f', 'roach02064a', 'roach020815', 'roach020650',
    'roach02080f', 'roach020813', 'roach020712', 'roach02082d',
    'roach02081c', 'roach020637', 'roach02081e', 'roach02064b',
    'roach02070f', 'roach02082c', 'roach020818', 'roach02070e']

fchan_per_x = 128


xengines



f = KatcpClientFpga('roach020921')
f.get_system_information()

#
#import corr, struct
#f = corr.katcp_wrapper.FpgaClient('roach020921')
#time.sleep(0.3)
#sd = f.snapshot_get('snap_reord0_ss', circular_capture=True, man_trig=True)
#up = struct.unpack('>2048Q', sd['data'])
#for ctr in range(0, 2048, 2):
#    print ctr, ':',
#    w1 = up[ctr]
#    w2 = up[ctr+1]
#    sync = (w1 >> 63) & 0x01
#    data = (w1 >> 31) & 0xffffffff
#    valid = (w1 >> 30) & 0x01
Ejemplo n.º 8
0
parser.add_argument('-l', '--listcores', dest='listcores', action='store_true',
                    default=False,
                    help='list cores on this device')
parser.add_argument('-c', '--core', dest='core', action='store',
                    default='gbe0', type=str,
                    help='the core to query')
parser.add_argument('-d', '--direction', dest='direction', action='store',
                    default='tx', type=str,
                    help='tx or rx stream')
parser.add_argument('-s', '--spead', dest='spead', action='store_true',
                    default=False,
                    help='try and decode spead in this 10Gbe stream')
args = parser.parse_args()

# create the device and connect to it
fpga = KatcpClientFpga(args.hostname, 7147)
time.sleep(0.2)
if not fpga.is_connected():
    fpga.connect()
fpga.test_connection()
fpga.get_system_information()

verbose = False

# list the cores we find
if args.listcores:
    cores = fpga.tengbes.names()
    numgbes = len(cores)
    print 'Found %i ten gbe core%s:' % (numgbes, '' if numgbes == 1 else 's')
    for core in cores:
        print '\t', core
Ejemplo n.º 9
0
args = parser.parse_args()

andrewhost = 'roach020915'
dhost = 'roach020959'
fhosts = ['roach020958', 'roach02091b', 'roach020914', 'roach020922']
xhosts = ['roach020921', 'roach020927', 'roach020919', 'roach020925',
          'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

dfpg = '/srv/bofs/deng/r2_deng_tvg_2014_May_30_1123.fpg'
ffpg = '/srv/bofs/feng/feng_rx_test_2014_Jun_05_1818.fpg'
xfpg = '/srv/bofs/xeng/x_rx_reorder_2014_Jun_02_1913.fpg'

fdig = Digitiser(dhost)
ffpgas = []
for host in fhosts:
    fpga = KatcpClientFpga(host)
    ffpgas.append(fpga)
xfpgas = []
for host in xhosts:
    fpga = KatcpClientFpga(host)
    xfpgas.append(fpga)
all_fpgas = [fdig]
all_fpgas.extend(ffpgas)
all_fpgas.extend(xfpgas)

if args.deprogram:
    for fpga in all_fpgas:
        try:
            fpga.deprogram()
            fpga.disconnect()
        except:
Ejemplo n.º 10
0
                    default=False,
                    help='transmit unicast to the first f-engine, not multicast to all of them')
args = parser.parse_args()

#hosts = ['roach020958', 'roach02091b', 'roach020914', 'roach020922', 'roach020921', 'roach020927', 'roach020919', 'roach020925', 'roach02091a', 'roach02091e', 'roach020923', 'roach020924']
andrewhost = 'roach020915'
dhost = 'roach020959'
fhosts = ['roach020958', 'roach02091b', 'roach020914', 'roach020922']
xhosts = ['roach020921', 'roach020927', 'roach020919', 'roach020925',
          'roach02091a', 'roach02091e', 'roach020923', 'roach020924']

dfpg = '/srv/bofs/deng/r2_deng_tvg_2014_May_30_1123.fpg'
ffpg = '/srv/bofs/feng/feng_rx_test_2014_Jun_05_1818.fpg'
xfpg = '/srv/bofs/xeng/x_rx_reorder_2014_Jun_02_1913.fpg'

fdig = KatcpClientFpga(dhost)
ffpgas = []
for host in fhosts:
    fpga = KatcpClientFpga(host)
    ffpgas.append(fpga)
xfpgas = []
for host in xhosts:
    fpga = KatcpClientFpga(host)
    xfpgas.append(fpga)
all_fpgas = [fdig]
all_fpgas.extend(ffpgas)
all_fpgas.extend(xfpgas)

if args.deprogram:
    for fpga in all_fpgas:
        try:
Ejemplo n.º 11
0
parser = argparse.ArgumentParser(description='Test the d-engine to f-engine links.',
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(dest='hosts', type=str, action='store',
                    help='comma-delimited list of f-engine hosts')
parser.add_argument('-p', '--polltime', dest='polltime', action='store',
                    default=1, type=int,
                    help='time at which to poll fengine data, in seconds')
parser.add_argument('-r', '--reset_counters', dest='reset_counters', action='store_true',
                    default=False,
                    help='reset f-engine error counters')
args = parser.parse_args()
polltime = args.polltime
reset_counters = args.reset_counters

# switch on the tvg on the d-engine
fdig = KatcpClientFpga(dhost)
fdig.get_system_information()
#fdig.tvg_on()

# init the f-engines
ffpgas = []
for fhost in fhosts:
    fpga = KatcpClientFpga(fhost)
    fpga.get_system_information()
    if reset_counters:
        fpga.registers.control.write(unpack_cnt_rst='pulse')
    ffpgas.append(fpga)

# set up the curses scroll screen
scroller = scroll.Scroll(debug=False)
scroller.screen_setup()
Ejemplo n.º 12
0
 def is_running(self):
     """All hosts must supply a is_running method that returns true or false.
     @return: True or False
     """
     return KatcpClientFpga.is_running(self)
Ejemplo n.º 13
0
 def __init__(self, host, katcp_port=7147, boffile=None, connect=False):
     Host.__init__(self, host, katcp_port)
     KatcpClientFpga.__init__(self, host, katcp_port, connect=connect)
     self.boffile = boffile
Ejemplo n.º 14
0
from casperfpga import KatcpClientFpga

parser = argparse.ArgumentParser(description='Display reorder preprocess snapblock info.',
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(dest='host', type=str, action='store',
                    help='x-engine host')
parser.add_argument('--eof', dest='eof', action='store_true',
                    default=False,
                    help='show only eofs')
args = parser.parse_args()

xeng_host = args.host

# create the device and connect to it
xeng_fpga = KatcpClientFpga(xeng_host)
xeng_fpga.get_system_information()
snapdata = []
snapdata.append(xeng_fpga.snapshots.snap_unpack0_ss.read()['data'])
snapdata.append(xeng_fpga.snapshots.snap_unpack1_ss.read()['data'])
snapdata.append(xeng_fpga.snapshots.snap_unpack2_ss.read()['data'])
snapdata.append(xeng_fpga.snapshots.snap_unpack3_ss.read()['data'])
for ctr in range(0, len(snapdata[0]['eof'])):
    if (snapdata[0]['eof'][ctr] == 1) or (not args.eof):
        for snap in snapdata:
            print 'valid(%i) fengid(%i) eof(%i) freq(%i) time(%i) |' % (
                snap['valid'][ctr],
                snap['feng_id'][ctr],
                snap['eof'][ctr],
                snap['freq'][ctr],
                snap['time'][ctr], ),