Skip to content
Snippets Groups Projects
Commit 18b2fcf0 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Use unb_apertif.py to determine active TP and visibilities and to get Apertif...

Use unb_apertif.py to determine active TP and visibilities and to get Apertif correlator packet info.
parent d6ce166e
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,7 @@ import common as cm
import test_case
import node_io
import pi_diag_data_buffer
import unb_apertif as apr
N_dish = 12
N_pol = 2
......@@ -81,40 +82,20 @@ else:
c_expIdMarker = 65
c_expIdVersion = 2
wsrtTelescopes = ['2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd']
###############################################################################
# Classes, functions
# Use class ApertifUnb1CorrelatorPacketInfo in Python as record. Similar as t_apertif_unb1_correlator_packet_info
# VHDL record in apertif_unb1_correlator_pkg.vhd.
class ApertifUnb1CorrelatorPacketInfo:
def __init__(self, nof_visibilities):
"""Define parameters for correlator packet info
. nof_visibilities determines the packet payload size
. size in number of cm.c_word_w = 32b words
"""
self.vis_header_size = 21 # (pad(2) + eth(14) + ip(20) + udp(8) + app_id(16) + app_flags(24)) / 4 = 84 bytes / 4 = 21 words
self.vis_payload_size = nof_visibilities * cm.c_nof_complex
self.vis_payload_nof_bits = self.vis_payload_size * cm.c_word_w
self.vis_packet_size = self.vis_header_size + self.vis_payload_size
# account for ethernet overhead
self.eth_tail_size = 1 # for the eth CRC word
self.eth_gap_size = 3 # 3 words for c_network_eth_gap_len of 12 bytes idle time between packets
self.eth_packet_size = self.vis_packet_size + self.eth_tail_size + self.eth_gap_size
# express ethernet packet time in effective number of bits on the link
self.eth_packet_nof_bits = self.eth_packet_size * cm.c_word_w
# Calculate ethernet packet overhead compared to visibility payload due to header, tail and interpacket gap
self.eth_packet_overhead = 1.0 * self.eth_packet_nof_bits / self.vis_payload_nof_bits
# Declaring an object of this class is equivalent to func_apertif_unb1_correlator_packet_info() in VHDL.
corrPacketInfo = ApertifUnb1CorrelatorPacketInfo(N_vis)
###############################################################################
# Instantiations
tc = test_case.Testcase('VERIFY_BF_CORRELATOR_LINK - ', '')
tc.set_result('PASSED')
# Determine active telescope paths and visibilities from --tel and --pol
activeDishes = apr.get_active_dishes(tc.telStrList)
activePolarizations = tc.polNrs
activeTp = apr.get_active_telescope_paths(activeDishes, activePolarizations)
activeVis = apr.get_active_visibilities(activeTp)
# Declaring an object of this class is equivalent to func_apertif_unb1_correlator_packet_info() in VHDL.
corrPacketInfo = apr.CorrelatorPacketInfo(N_vis)
# One or more beamlet and channel indices to select the visibility packets
beamlets = tc.beamlets
channels = tc.channels
......@@ -286,6 +267,22 @@ for bui in beamlets:
rdBsn += cm.to_unsigned(rdData[14], 32)
tc.append_log(tc.V_INFO_DETAILS, reportStr + 'read BSN = %d' % rdBsn)
###################################################################
# Verify payload data
# Visibility (col, row) indices for
# 0 vis (0,0)
# 1 vis (0,1) 24 vis (1,1)
# 2 vis (0,2) 25 vis (1,2) 47 vis (2,2)
# 3 vis (0,3) 26 vis (1,3) 48 vis (2,3)
# ... ... ...
# 23 vis (0,23) 46 vis (1,23) 68 vis (2,23) ... 299 vis (23,23)
#
# 24 + 23 + 22 ... + 1 = 300 visibilities
#
# The visibilities are stored in two 32b words: real, imag, so in total 600 words.
#
#
###############################################################################
# End
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment