diff --git a/applications/arts/designs/arts_unb2b_sc3/tb/python/pi_arts_unb2b_sc3_output_tab.py b/applications/arts/designs/arts_unb2b_sc3/tb/python/pi_arts_unb2b_sc3_output_tab.py new file mode 100644 index 0000000000000000000000000000000000000000..d31ab510dd2fb8807d03d0c699ded08e77838305 --- /dev/null +++ b/applications/arts/designs/arts_unb2b_sc3/tb/python/pi_arts_unb2b_sc3_output_tab.py @@ -0,0 +1,77 @@ +#! /usr/bin/env python +############################################################################### +# +# Copyright (C) 2015 +# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################### + +# Purpose: +# . Read/write common registers for the 10GbE destination MAC and IP addresses (ARTS SC3) +# Usage: +# . Read all fields: +# . python pi_arts_unb1_sc1_bg_1GbE.py --unb2 4 --pn2 3 +# . Read specific field: +# . python pi_arts_unb1_sc1_bg_1GbE.py --unb2 4 --pn2 3 --reg id_beamlet_index + + +import os +from test_case import Testcase +from node_io import NodeIO +from pi_common_mm import PiCommonMm + +PINAME_IP = 'REG_TAB_DEST_IP' +PINAME_MAC = 'REG_TAB_DEST_MAC' +PID_IP = 'TAB_DEST_IP' +PID_MAC = 'TAB_DEST_MAC' +ADDR_W = 3 +NOF_INST = 40 + +tc = Testcase('UTIL - ', '') +tc.set_result('PASSED') +tc.append_log(0, '>>> Title : Set IP, MAC address on %s' % tc.unb_nodes_string('')) +io = NodeIO(tc.nodeImages, tc.base_ip) + +cmd = tc.number +print cmd, tc.streamNumbers, tc.gpNumbers + +tabdestip = PiCommonMm(tc, io, "REG", PID_IP, slaveName='', piInstanceName='', nofInst=NOF_INST, sizePerInst=1) +tabdestmac = PiCommonMm(tc, io, "REG", PID_MAC, slaveName='', piInstanceName='', nofInst=NOF_INST, sizePerInst=2) + +if cmd == 0: + for i in tc.streamNumbers: + tabdestip.read_mm(n=None, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3) + tabdestmac.read_mm(n=None, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3) + +elif cmd == 1: + for i in tc.streamNumbers: + tabdestip.write_mm(data=tc.gpNumbers[i], instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3) + +elif cmd == 2: + for i in tc.streamNumbers: + datatowrite = [tc.gpNumbers[i],tc.gpNumbers[i] / 2**32] + print tc.gpNumbers, datatowrite + tabdestmac.write_mm(data=datatowrite, instNr=i, offset=0, nodeNrs=None, width=32, radix='uns', nofColumns=16, vLevel=3) + +else: + tc.append_log(0, '>>> Usage [-n <command number>]:') + tc.append_log(0, ' . 0 : read back the IP and MAC registers [--stream <stream numbers>] ') + tc.append_log(0, ' . 1 : write -r values to IP register [--stream <stream numbers>] -r value,value') + tc.append_log(0, ' . 2 : write -r values to MAC register [--stream <stream numbers>] -r [valuelo,valuehi]') + tc.append_log(0, ' else print this messgage.') + +