Commit 272344df authored by francescomani's avatar francescomani

remove unused SSB ue phy unit tests

parent a936c88f
......@@ -237,8 +237,6 @@ typedef struct {
/// estimated frequency offset (in radians) for all subcarriers
int32_t freq_offset;
/// nid2 is the PSS value, the PCI (physical cell id) will be: 3*NID1 (SSS value) + NID2 (PSS value)
int32_t nid2;
} NR_UE_COMMON;
#define NR_PRS_IDFT_OVERSAMP_FACTOR 1 // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
......@@ -413,12 +411,6 @@ typedef struct PHY_VARS_NR_UE_s {
uint32_t PF;
uint32_t PO;
#if defined(UPGRADE_RAT_NR)
/// demodulation reference signal for NR PBCH
uint32_t dmrs_pbch_bitmap_nr[DMRS_PBCH_I_SSB][DMRS_PBCH_N_HF][DMRS_BITMAP_SIZE];
#endif
// Scrambling IDs used in PUSCH DMRS
c16_t X_u[64][839];
......@@ -502,11 +494,6 @@ typedef struct PHY_VARS_NR_UE_s {
/// RF and Interface devices per CC
openair0_device rfdevice;
#if ENABLE_RAL
hash_table_t *ral_thresholds_timed;
SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX];
#endif
void* scopeData;
// Pointers to hold PDSCH data only for phy simulators
void *phy_sim_rxdataF;
......
......@@ -55,18 +55,6 @@ set(INC_UNIT_TESTS
${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h
)
add_executable(pss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c ${SRC_UNIT_TESTS} )
target_link_libraries(pss_test
-Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES}
)
add_executable(sss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c ${SRC_UNIT_TESTS} )
target_link_libraries(sss_test
-Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES}
)
add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} )
target_link_libraries(frame_config_test
-Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
......
......@@ -63,9 +63,6 @@ TESTS_FAIL=0
# List of tests
tst_files="
pss_test
sss_test
pbch_test
frame_config_test"
#---------------------------------------------------------------------------
......
......@@ -35,13 +35,7 @@ Build NR UE:
Specific test files
====================
pss_test.c: test for detection of primary synchronisation signal.
sss_test.c: test for detection of secundary synchronisation signal.
pbch_test.c: test for decoding of packet braodcast channel.
frame_config_test.c : test of frame configurations (FDD/TDD).
pss_util_test.c: common functions for running synchronisation tests.
pss_util_test.h: common headers for synchronisation tests.
input_buffer_test.h: it allows providing samples for pss test.
How to build & run tests
========================
......@@ -66,16 +60,10 @@ First command to do:
cmake CMakeList.txt -> it generates makefiles to build all projects.
Then build of test:
make pss_test -> build pss_test: detection of NR (Primary Synchronisation Channel - synchronisation of UE).
make sss_test -> build sss_test: detection of NR SSS (Secundary Synchronisation Channel - second step for UE synchronisation).
make pbch_test -> build pbch_test: decoding of NR PBCH (Packet Broadcast Channel -> UE read MIB Master Information Block which gives network parameters).
make frame_config_test -> build frame_config_test: NR FDD/TDD configuration.
make clean -> clean all projects.
And execution of tests:
./pss_test -> run NR PSS tests.
./sss_test -> run NR SSS tests.
./pbch_test -> run NR PBCH tests.
./frame_config_test -> run NR frame configuration tests.
There is a script in build/run_test.sh which allows:
......
/**********************************************************************
* FILENAME : input_buffer_test
*
* MODULE : test of UE synchronisation
*
* DESCRIPTION : it allows unitary tests of UE synchronisation on host machine
*
************************************************************************/
#ifndef INPUT_BUFFER_H
#define INPUT_BUFFER_H
#ifdef DEFINE_VARIABLES_INPUT_BUFFER_TEST_H
#define EXTERNAL
#define INIT_VARIABLES_INPUT_BUFFER_H
#else
#define EXTERNAL extern
#undef INIT_VARIABLES_INPUT_BUFFER_H
#endif
#ifndef INIT_VARIABLES_INPUT_BUFFER_H
EXTERNAL short input_buffer[]
#else
EXTERNAL short input_buffer[307360] = {0}
#endif /* INIT_VARIABLES_INPUT_BUFFER_H */
;
#undef EXTERNAL
#undef INIT_VARIABLES_INPUT_BUFFER_H
#endif /* INPUT_BUFFER_H */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/**********************************************************************
*
* FILENAME : pss_test.c
*
* MODULE : UE test bench for synchronisation
*
* DESCRIPTION : it allows unitary tests of UE synchronisation on host machine
*
************************************************************************/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "../../unit_tests/src/pss_util_test.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/INIT/init_extern.h"
#include "PHY/phy_extern_nr_ue.h"
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/NR_REFSIG/pss_nr.h"
#include "PHY/NR_REFSIG/sss_nr.h"
#include "PHY/NR_REFSIG/dmrs_nr.h"
/************** DEFINE *******************************************/
/*************** LOCAL VARIABLES***********************************/
/*************** FUNCTIONS ****************************************/
/********************************************************************
*
* NAME : pss_test
*
* INPUT : UE context
* for a pss sequence
* - position of pss in the received UE buffer
* - number of pss sequence
*
* RETURN : 0 if OK else error
*
* DESCRIPTION : detect pss sequences in the received UE buffer
*
* Test procedure:
*
* - reference pss sequences is written at a specific position
* - correlation is done between the received buffer and the possible pss sequences
* - results indicate pss sequence number and correlation result.
*
* Test is pass if detection of pss position is the one which has been set.
*
* (10 ms)
* <--------------------------------------------------------------------------->
* -----------------------------------------------------------------------------
* | Received UE data buffer |
* ----------------------------------------------------------------------------
* +-----------+
* <--------->| pss |
* position +-----------+
* ^
* |
* peak position
* given by maximum of correlation result
* position matches beginning of ofdm symbol
*
* Remark: memory position should be aligned on a multiple of 4 due to I & Q samples of int16
* An OFDM symbol is composed of x number of received samples depending of Rf front end sample rate.
*
* I & Q storage in memory
*
* First samples Second samples
* ------------------------- ------------------------- ...
* | I1 | Q1 | I2 | Q2 |
* --------------------------------------------------- ...
* ^ 16 bits 16 bits ^
* | |
* --------------------------------------------------- ...
* | sample 1 | sample 2 |
* ---------------------------------------------------- ...
* ^
* |
* OFDM in time
*
*********************************************************************/
void test_synchro_pss_nr(PHY_VARS_NR_UE *PHY_VARS_NR_UE, int position_symbol, int pss_sequence_number, test_t *test)
{
int rate_change = SYNCHRO_RATE_CHANGE_FACTOR;
int synchro_position;
int NID2_value;
display_test_configuration_pss(position_symbol, pss_sequence_number);
set_sequence_pss(PHY_VARS_NR_UE, position_symbol, pss_sequence_number);
/* search pss */
synchro_position = pss_synchro_nr(PHY_VARS_NR_UE, rate_change);
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
if (pss_sequence_number < pss_sequence) {
NID2_value = pss_sequence_number;
} else {
NID2_value = pss_sequence;
}
if (NID2_value < pss_sequence) {
test->number_of_tests++;
/* position should be adjusted with i&q samples which are successively stored as int16 in the received buffer */
int test_margin = PSS_DETECTION_MARGIN_MAX; /* warning correlation results give an offset position between 0 and 12 */
int delta_position = abs(position_symbol - (synchro_position*rate_change));
printf("%s ", test->test_current);
if (PHY_VARS_NR_UE->common_vars.eNb_id == pss_sequence_number) {
if ( delta_position != 0) {
if (delta_position > test_margin*rate_change) {
printf("Test is fail due to wrong position %d instead of %d \n", (synchro_position*rate_change), position_symbol);
printf("%s ", test->test_current);
printf("Test is fail : pss detected with a shift of %d \n", delta_position);
test->number_of_fail++;
}
else {
printf("Test is pass with warning: pss detected with a shift of %d \n", delta_position);
test->number_of_pass_warning++;
}
}
else {
printf("Test is pass: pss detected at right position \n");
test->number_of_pass++;
}
}
else {
printf("Test is fail due to wrong NID2 detection %d instead of %d \n", PHY_VARS_NR_UE->common_vars.eNb_id, NID2_value);
test->number_of_fail++;
}
}
}
/*******************************************************************
*
* NAME : main
*
* DESCRIPTION : test bench for synchronisation sequence (pss/sss/pbch)
* purpose of test is to check that synchronisation sequence can be
* properly detected depending of input waveforms.
*
* - First step of synchronisation is pss sequence.
* pss sequence should be detected at the right position
* in the received buffer whatever the position along the
* received data buffer.
* Detection of position is based on correlation in time domain between
* received signal and pss sequence -> position is given by
* peak of correlation result.
*
*********************************************************************/
int main(int argc, char *argv[])
{
VOID_PARAMETER argc;
VOID_PARAMETER argv;
uint8_t transmission_mode = 1;
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint16_t Nid_cell=123;
uint8_t frame_type=FDD;
int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag=NORMAL;
const char *name_test = "PSS NR";
test_t test = { name_test, 0, 0, 0, 0};
/* this is a pointer to the function in charge of the test */
void (*p_test_synchro_pss)(PHY_VARS_NR_UE *PHY_VARS_NR_UE, int position_symbol, int pss_sequence_number, test_t *test) = test_synchro_pss_nr;
int test_position[] = { 0, 492, 493, 56788, 56888, 111111, 151234, 151500, 200000, 250004, (307200-2048) };
int size_test_position = sizeof(test_position)/sizeof(int);
printf(" PSS TEST \n");
printf("----------\n");
if (init_test(nb_antennas_tx, nb_antennas_rx, transmission_mode, extended_prefix_flag, frame_type, Nid_cell, N_RB_DL) != 0) {
printf("Initialisation problem for synchronisation test \n");
exit(-1);;
}
printf("***********************************\n");
printf(" %s Test synchronisation \n", test.test_current);
printf("***********************************\n");
#if 0
printf("Synchronisation with random data\n");
test_synchro_pss_nr(PHY_vars_UE, 0, INVALID_PSS_SEQUENCE, &test);
#endif
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
for (int index_position = 0; index_position < size_test_position; index_position++) {
for (int number_pss_sequence = 0; number_pss_sequence < pss_sequence; number_pss_sequence++) {
p_test_synchro_pss(PHY_vars_UE, test_position[index_position], number_pss_sequence, &test);
//break;
}
//break;
}
printf("\n%s Number of tests : %d Pass : %d Pass with warning : %d Fail : %d \n\n", test.test_current, test.number_of_tests, test.number_of_pass, test.number_of_pass_warning, test.number_of_fail);
printf("%s Synchronisaton test is terminated.\n\n", test.test_current);
/* reset test statistics */
test.number_of_tests = test.number_of_pass = test.number_of_pass_warning = test.number_of_fail = 0;
free_context_synchro_nr();
return(0);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/**********************************************************************
*
* FILENAME : pss_util_test.h
*
* MODULE : UE utilities for test bench of synchronisation
*
* DESCRIPTION : it allows unitary tests of UE synchronisation on host machine
*
************************************************************************/
#ifndef PSS_UTIL_TEST_H
#define PSS_UTIL_TEST_H
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "PHY/defs_nr_UE.h"
#include "PHY/INIT/init_extern.h"
#include "PHY/phy_extern_nr_ue.h"
#include "PHY/NR_REFSIG/pss_nr.h"
#ifdef DEFINE_VARIABLES_PSS_NR_H
#define EXTERN
#define INIT_VARIABLES_PSS_NR_H
#else
#define EXTERN extern
#undef INIT_VARIABLES_PSS_NR_H
#endif
/************** DEFINE *******************************************/
//#define DEBUG_TEST_PSS
#define PSS_DETECTION_MARGIN_MAX (4)
#define NUMEROLOGY_INDEX_MAX_NR (5)
/*************** TYPE*********************************************/
typedef struct {
const char *test_current;
int number_of_tests;
int number_of_pass;
int number_of_pass_warning;
int number_of_fail;
} test_t;
/*************** GLOBAL VARIABLES***********************************/
EXTERN PHY_VARS_eNB *PHY_vars_eNB;
EXTERN PHY_VARS_NR_UE *PHY_vars_UE;
/*************** FUNCTIONS *****************************************/
void undefined_function(const char *function);
void display_data(int pss_sequence_number, int16_t *rxdata, int position);
void init_decimator_test(void);
void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int **rxdata);
void restore_context_frame(int **rxdata);
int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number);
int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode,
unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell,
int N_RB_DL);
void display_test_configuration_pss(int position, int pss_sequence_number);
void display_test_configuration_sss(int sss_sequence_number);
int set_pss_nr(int ofdm_symbol_size);
void set_random_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int amp);
void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_sequence_number);
int set_pss_in_rx_buffer_from_external_buffer(PHY_VARS_NR_UE *PHY_vars_UE, short *inputBuffer);
void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, int16_t phase_shift_im);
#endif /* PSS_UTIL_TEST_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment