Commit 5f9fc55e authored by Jacques's avatar Jacques

nr ue : pucch cyclic shift for format 0 & 1

parent 4f379330
......@@ -40,8 +40,10 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "T.h"
#define DEBUG_PUCCH_TX
#define DEBUG_NR_PUCCH_TX
#ifndef NR_UNIT_TEST
#define DEBUG_PUCCH_TX
#define DEBUG_NR_PUCCH_TX
#endif
#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2)
/*
......@@ -337,7 +339,9 @@ void nr_group_sequence_hopping (//pucch_GroupHopping_t ue->pucch_config_common_n
//////////////////////////////////////initialization to be removed///////////////////////////////////////////////////////////
PUCCH_GroupHopping=neither;
n_id=10;
printf("\t\t [nr_group_sequence_hopping] initialization PUCCH_GroupHopping=%d, n_id=%d -> variable initializations TO BE REMOVED\n",PUCCH_GroupHopping,n_id);
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t [nr_group_sequence_hopping] initialization PUCCH_GroupHopping=%d, n_id=%d -> variable initializations TO BE REMOVED\n",PUCCH_GroupHopping,n_id);
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -390,7 +394,9 @@ double nr_cyclic_shift_hopping(PHY_VARS_NR_UE *ue,
//////////////////////////////////////initialization to be removed///////////////////////////////////////////////////////////
c_init=10;
printf("\t\t [nr_cyclic_shift_hopping] initialization c_init=%d -> variable initialization TO BE REMOVED\n",c_init);
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t [nr_cyclic_shift_hopping] initialization c_init=%d -> variable initialization TO BE REMOVED\n",c_init);
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -415,6 +421,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
int16_t amp,
int nr_tti_tx,
uint8_t m0,
uint8_t mcs,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
......@@ -441,8 +448,6 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
*/
// alpha is cyclic shift
double alpha;
// m0 is provided by higher layer parameter PUCCH-F0-F1-initial-cyclic-shift of PUCCH-F0-resource-config
uint8_t m0;
// lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission
uint8_t lnormal;
// lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213]
......@@ -470,15 +475,9 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
uint8_t n_hop = 0;
//uint8_t PUCCH_Frequency_Hopping; // from higher layers FIXME!!
/////////////////////////////////////////////////////////// initializing some variables for test
m0=0;
// PUCCH_GroupHopping=0;
// n_id=10;
//PUCCH_Frequency_Hopping = 0;
#ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n");
#endif
/////////////////////////////////////////////////////// ending variables initialization for test
// x_n contains the sequence r_u_v_alpha_delta(n)
int16_t x_n_re[24],x_n_im[24];
......@@ -550,6 +549,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
uint64_t payload,
int16_t amp,
int nr_tti_tx,
uint8_t m0,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB,
......@@ -557,8 +557,8 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
uint8_t timeDomainOCC,
uint8_t nr_bit) {
#ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d\n",nr_tti_tx);
printf("\t [nr_generate_pucch1] startingPRB=%d startingPRB_intraSlotHopping=%d\n",startingPRB,startingPRB_intraSlotHopping);
printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d\n",nr_tti_tx);
printf("\t [nr_generate_pucch1] startingPRB=%d startingPRB_intraSlotHopping=%d\n",startingPRB,startingPRB_intraSlotHopping);
#endif
/*
......@@ -646,8 +646,6 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
*/
// alpha is cyclic shift
double alpha;
// m0 is provided by higher layer parameter PUCCH-F0-F1-initial-cyclic-shift of PUCCH-F0-resource-config
uint8_t m0;
// lnormal is the OFDM symbol number in the PUCCH transmission where l=0 corresponds to the first OFDM symbol of the PUCCH transmission
uint8_t lnormal = 0 ;
// lprime is the index of the OFDM symbol in the slot that corresponds to the first OFDM symbol of the PUCCH transmission in the slot given by [5, TS 38.213]
......@@ -882,7 +880,7 @@ inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id,
for (i=0;i<M_bit;i++) {
c = (uint8_t)((s>>i)&1);
btilde[i] = (((B>>i)&1) ^ c);
#ifndef DEBUG_NR_PUCCH_TX
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t\t btilde[%d]=%lx from scrambled bit %d\n",i,btilde[i],((B>>i)&1));
#endif
}
......@@ -1338,7 +1336,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue,
z_im[l*(12*nrofPRB)+k] = z_im[l*(12*nrofPRB)+k]
+ (int16_t)(((int32_t)round(32767/sqrt(12*nrofPRB))*(int16_t)((((int32_t)y_n_im[l*(12*nrofPRB)+m] * (int16_t)round(32767 * cos(2*M_PI*m*k/(12*nrofPRB))))>>15)
- (((int32_t)y_n_re[l*(12*nrofPRB)+m] * (int16_t)round(32767 * sin(2*M_PI*m*k/(12*nrofPRB))))>>15)))>>15);
#ifndef DEBUG_NR_PUCCH_TX
#ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch3_4] transform precoding for formats 3 and 4: (l,k,m)=(%d,%d,%d)\tz(%d) = \t(%d, %d)\n",
l,k,m,l*(12*nrofPRB)+k,z_re[l*(12*nrofPRB)+k],z_im[l*(12*nrofPRB)+k]);
#endif
......@@ -1453,25 +1451,37 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue,
//startingPRB = startingPRB + rb;
if (((rb+startingPRB) < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is lower band
re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
printf("1 ");
#ifdef DEBUG_NR_PUCCH_TX
printf("1 ");
#endif
}
if (((rb+startingPRB) >= (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is upper band
re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*((rb+startingPRB)-(frame_parms->N_RB_DL>>1)));
printf("2 ");
#ifdef DEBUG_NR_PUCCH_TX
printf("2 ");
#endif
}
if (((rb+startingPRB) < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is lower band
re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
printf("3 ");
#ifdef DEBUG_NR_PUCCH_TX
printf("3 ");
#endif
}
if (((rb+startingPRB) > (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is upper band
re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*((rb+startingPRB)-(frame_parms->N_RB_DL>>1))) + 6;
printf("4 ");
#ifdef DEBUG_NR_PUCCH_TX
printf("4 ");
#endif
}
if (((rb+startingPRB) == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB contains DC
re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
printf("5 ");
#ifdef DEBUG_NR_PUCCH_TX
printf("5 ");
#endif
}
printf("re_offset=%d,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB));
#ifdef DEBUG_NR_PUCCH_TX
printf("re_offset=%d,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB));
#endif
txptr = &txdataF[0][re_offset];
for (int n=0; n<12; n++){
if ((n==6) && ((rb+startingPRB) == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) {
......
......@@ -228,10 +228,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
uint8_t nb_symbols_total = 0;
uint8_t nb_symbols = 0;
uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */
uint16_t second_hop = 0; /* second part for pucch for hopping */
uint16_t second_hop = 0; /* second part for pucch for hopping */
uint8_t nb_of_prbs = 0;
int m_0 = 0; /* format 0 only */
int m_CS = 0; /* for all format except for format 0 */
int m_0 = 0; /* format 0 only */
int m_CS = 0; /* for all format except for format 0 */
int index_additional_dmrs = I_PUCCH_NO_ADDITIONAL_DMRS;
int index_hopping = I_PUCCH_NO_HOPPING;
int time_domain_occ = 0;
......@@ -494,7 +494,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
tx_amp = get_tx_amp(pucch_tx_power,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
nb_of_prbs);
nb_of_prbs);
#else
tx_amp = AMP;
#endif
......@@ -505,10 +505,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
nr_generate_pucch0(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
tx_amp,
tx_amp,
nr_tti_tx,
(uint8_t)m_0,
(uint8_t)m_CS,
nb_symbols_total,
nb_symbols_total,
starting_symbol_index,
starting_prb);
break;
......@@ -519,9 +520,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
tx_amp,
nr_tti_tx,
nb_symbols_total,
(uint8_t)m_0,
nb_symbols_total,
starting_symbol_index,
starting_prb,
second_hop,
......@@ -535,9 +537,9 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
tx_amp,
nr_tti_tx,
nb_symbols_total,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
......@@ -552,13 +554,13 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
format,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
tx_amp,
nr_tti_tx,
nb_symbols_total,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
second_hop,
second_hop,
(uint8_t)N_UCI,
(uint8_t)occ_length,
(uint8_t)occ_Index);
......
......@@ -55,6 +55,9 @@ RUN_MELD="yes"
# for removing files
REMOVE="rm -f"
COMPARE="cmp"
TESTS_RUN=0
TESTS_PASS=0
TESTS_FAIL=0
#----------------------------------------------------------------------------
# List of tests
......@@ -94,7 +97,7 @@ do
echo "Option of run_test script"
echo "-b : No Build of unit tests"
echo "-c : No check for unit test"
echo "-r : No run of unit tests"
echo "-e : No run of unit tests"
echo "-m : No run of meld tool"
exit
BUILD_TEST="no"
......@@ -180,11 +183,11 @@ for file in $tst_files
if [ $EXECUTE_TEST == "yes" ]
then
echo "rm $RESULT_DIR/$RESULT_TEST_FILE"
echo "rm $RESULT_DIR/$RESULT_TEST_FILE"
rm $RESULT_DIR/$RESULT_TEST_FILE
echo "$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE"
$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE
TESTS_RUN=$((TESTS_RUN+1))
fi
if [ $CHECK_TEST == "yes" ]
......@@ -201,8 +204,10 @@ for file in $tst_files
then
echo "Test $file is PASS"
echo "Same logging file for $file"
TESTS_PASS=$((TESTS_PASS+1))
else
echo "Test $file is FAIL"
TESTS_FAIL=$((TESTS_FAIL+1))
echo "Difference of logging file for scenario $file"
let "num_diff=$num_diff + 1"
if [ $RUN_MELD == "yes" ]
......@@ -225,7 +230,8 @@ for file in $tst_files
if [ $SINGLE_TEST == "yes" ]
then
exit
echo "Test $file has been executed"
break
fi
done
......@@ -234,4 +240,6 @@ then
echo "There are $num_diff result files which are different"
fi
echo " tests run : $TESTS_RUN pass : $TESTS_PASS fail : $TESTS_FAIL"
# end of script
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