Skip to content
Snippets Groups Projects
Commit c3016eea authored by Pepping's avatar Pepping
Browse files

Updated to test transpose.

parent 7fb08f74
No related branches found
No related tags found
No related merge requests found
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
# #
############################################################################### ###############################################################################
"""Test case for the reorder_transpose entity. """Test case for the reorder_transpose entity in the apertif_unb1_fn_beamformer_bg_tp design
Description: Description:
Usage: Usage:
> python tc_reorder_transpose.py --unb 0 --fn 0 --sim > python tc_apertif_unb1_fn_beamformer_bg_tp.py --unb 0 --fn 0 --sim
""" """
...@@ -74,7 +74,7 @@ g_in_weight_w = 16 # 16 ...@@ -74,7 +74,7 @@ g_in_weight_w = 16 # 16
g_blocks_per_sync = 800000 #32 # 781250 g_blocks_per_sync = 800000 #32 # 781250
if tc.sim == True: if tc.sim == True:
g_blocks_per_sync = 16 # 781250 g_blocks_per_sync = 64 #16 # 781250
g_wr_chunksize = 176 g_wr_chunksize = 176
g_rd_chunksize = 16 g_rd_chunksize = 16
g_rd_nof_chunks = 11 g_rd_nof_chunks = 11
...@@ -96,12 +96,12 @@ g_gapsize = 0 ...@@ -96,12 +96,12 @@ g_gapsize = 0
# Define settings for the block generator # Define settings for the block generator
c_bg_nof_streams = g_nof_input_streams c_bg_nof_streams = 4
c_nof_sp_per_input_stream = g_nof_signal_paths / g_nof_input_streams c_nof_sp_per_input_stream = g_nof_signal_paths / g_nof_input_streams
c_nof_subbands_per_stream = g_nof_subbands*c_nof_sp_per_input_stream c_nof_subbands_per_stream = g_nof_subbands*c_nof_sp_per_input_stream
c_bg_ram_size = c_nof_subbands_per_stream c_bg_ram_size = 512
c_samples_per_packet = c_nof_sp_per_input_stream * g_nof_subbands c_samples_per_packet = 256
c_gapsize = g_nof_weights - c_samples_per_packet c_gapsize = 0
c_mem_low_addr = 0 c_mem_low_addr = 0
c_mem_high_addr = c_samples_per_packet-1 c_mem_high_addr = c_samples_per_packet-1
c_bsn_init = 42 c_bsn_init = 42
...@@ -113,13 +113,8 @@ c_interleave = 2 ...@@ -113,13 +113,8 @@ c_interleave = 2
c_bf_in_dat_w = 16 c_bf_in_dat_w = 16
c_tp_in_dat_w = 8 c_tp_in_dat_w = 8
c_write_bg_data = True
c_write_bg_data = False
c_write_bg_data_to_file = False c_write_bg_data_to_file = False
c_write_weights = False
c_write_weights_to_file = False
c_write_bf_ss_wide = False
c_write_bf_ss_wide_to_file = False
tc.append_log(3, '>>>') tc.append_log(3, '>>>')
tc.append_log(1, '>>> Title : Test script for apertif_unb1_fn_beamformer_tp_bg' ) tc.append_log(1, '>>> Title : Test script for apertif_unb1_fn_beamformer_tp_bg' )
...@@ -131,13 +126,7 @@ tc.set_result('PASSED') ...@@ -131,13 +126,7 @@ tc.set_result('PASSED')
io = node_io.NodeIO(tc.nodeImages, tc.base_ip) io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
# Create block generator instance # Create block generator instance
bg = pi_diag_block_gen.PiDiagBlockGen(tc, io, g_nof_input_streams, c_bg_ram_size) bg = pi_diag_block_gen.PiDiagBlockGen(tc, io, c_bg_nof_streams, c_bg_ram_size)
# Create instances for the beamformer units (BF)
bf=[]
for i in range(tc.nofFnNodes):
for j in xrange(g_nof_bf_units):
bf.append(pi_bf_bf.PiBfBf(tc, io, g_nof_weights, g_nof_signal_paths, g_nof_input_streams, xstEnable=True, instanceNr=j, nodeNr=tc.nodeFnNrs[i]))
# BSN monitor # BSN monitor
bsn_out = pi_bsn_monitor.PiBsnMonitor(tc, io, instanceName='OUTPUT', nofStreams=2) bsn_out = pi_bsn_monitor.PiBsnMonitor(tc, io, instanceName='OUTPUT', nofStreams=2)
...@@ -179,9 +168,6 @@ if __name__ == "__main__": ...@@ -179,9 +168,6 @@ if __name__ == "__main__":
tc.append_log(3, '>>> Write settings to the block generator') tc.append_log(3, '>>> Write settings to the block generator')
tc.append_log(3, '>>>') tc.append_log(3, '>>>')
if tc.sim == False:
bg.write_block_gen_settings(256, g_blocks_per_sync, 0, 0, 127, c_bsn_init)
else:
bg.write_block_gen_settings(c_samples_per_packet, g_blocks_per_sync, c_gapsize, c_mem_low_addr, c_mem_high_addr, c_bsn_init) bg.write_block_gen_settings(c_samples_per_packet, g_blocks_per_sync, c_gapsize, c_mem_low_addr, c_mem_high_addr, c_bsn_init)
# - Create a list with the input data and write it to the RAMs of the block generator # - Create a list with the input data and write it to the RAMs of the block generator
...@@ -189,70 +175,22 @@ if __name__ == "__main__": ...@@ -189,70 +175,22 @@ if __name__ == "__main__":
tc.append_log(3, '>>> Write data to the waveform RAM of all channels') tc.append_log(3, '>>> Write data to the waveform RAM of all channels')
tc.append_log(3, '>>>') tc.append_log(3, '>>>')
inputData = [] inputData = []
for i in xrange(g_nof_input_streams): for i in xrange(c_bg_nof_streams):
dataList = bg.generate_data_list(c_nof_sp_per_input_stream, g_nof_subbands, 2048*i*4, i, c_bf_in_dat_w) stream_re = []
stream_im = []
for j in range(c_samples_per_packet):
stream_re.append(j)
stream_im.append(j)
data_concat = dsp_test_bg.concatenate_two_lists(stream_re, stream_im, c_bf_in_dat_w)
inputData.append(data_concat)
for i in xrange(c_bg_nof_streams):
if c_write_bg_data == True: if c_write_bg_data == True:
bg.write_waveform_ram(dataList, i) bg.write_waveform_ram(inputData[i], i)
if c_write_bg_data_to_file == True: if c_write_bg_data_to_file == True:
filename = "../../src/hex/bg_in_data_" + str(i) + ".hex" filename = "../../src/hex/bg_in_data_" + str(i) + ".hex"
mem_init_file.list_to_hex(list_in=dataList, filename=filename, mem_width=c_nof_complex*c_bf_in_dat_w, mem_depth=2**(ceil_log2(c_bg_ram_size))) mem_init_file.list_to_hex(list_in=inputData[i], filename=filename, mem_width=c_nof_complex*c_bf_in_dat_w, mem_depth=2**(ceil_log2(c_bg_ram_size)))
dataListComplex = bg.convert_concatenated_to_complex(dataList, c_bf_in_dat_w)
inputData.append(dataListComplex)
################################################################################
##
## Create and Write the weight factors
##
################################################################################
tc.append_log(3, '>>>')
tc.append_log(3, '>>> Create and write weightfactors for all signal paths on all bf_units ')
tc.append_log(3, '>>>')
weightsNodes = []
for k in xrange(tc.nofFnNodes):
weightsBf = []
for i in range(g_nof_bf_units):
weightsBfUnit=[]
for j in range(g_nof_signal_paths):
weightsSignalPath = bf[k*g_nof_bf_units+i].generate_weights(g_nof_weights, i+j, i, g_in_weight_w)
if c_write_weights_to_file == True:
filename = "../../src/hex/bf_weights_" + str(i) + "_" + str(j) + ".hex"
mem_init_file.list_to_hex(list_in=weightsSignalPath, filename=filename, mem_width=c_nof_complex*g_in_weight_w, mem_depth=g_nof_weights)
if c_write_weights == True:
bf[k*g_nof_bf_units+i].write_weights(weightsSignalPath, j)
weightsSignalPathComplex = bg.convert_concatenated_to_complex(weightsSignalPath, g_in_weight_w)
weightsBfUnit.append(weightsSignalPathComplex)
weightsBf.append(weightsBfUnit)
weightsNodes.append(weightsBf)
################################################################################
##
## Create and Write the selection buffers
##
################################################################################
tc.append_log(3, '>>>')
tc.append_log(3, '>>> Create and write selection settings for ss_wides in all bf_units ')
tc.append_log(3, '>>>')
select_buf = []
for b in xrange(g_nof_bf_units):
for i in range(c_nof_sp_per_input_stream):
select_buf_line = []
for j in range(4):
for k in range(g_nof_weights/4):
select_buf_line.append(i*g_nof_subbands + j)
select_buf.append(select_buf_line)
if c_write_bf_ss_wide_to_file == True:
filename = "../../src/hex/bf_ss_wide_" + str(b) + "_" + str(i) + ".hex"
mem_init_file.list_to_hex(list_in=flatten(select_buf_line), filename=filename, mem_width=ceil_log2(c_nof_subbands_per_stream), mem_depth=g_nof_weights)
if c_write_bf_ss_wide == True:
for i in range(tc.nofFnNodes):
for j in xrange(g_nof_bf_units):
for k in range(g_nof_input_streams):
bf[i*g_nof_bf_units + j].ss_wide[k].write_selects(flatten(select_buf));
############################################################################### ###############################################################################
# #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment