Commit 5f9fc55e authored by Jacques's avatar Jacques

nr ue : pucch cyclic shift for format 0 & 1

parent 4f379330
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#include "T.h" #include "T.h"
#define DEBUG_PUCCH_TX #ifndef NR_UNIT_TEST
#define DEBUG_NR_PUCCH_TX #define DEBUG_PUCCH_TX
#define DEBUG_NR_PUCCH_TX
#endif
#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2) #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 ...@@ -337,7 +339,9 @@ void nr_group_sequence_hopping (//pucch_GroupHopping_t ue->pucch_config_common_n
//////////////////////////////////////initialization to be removed/////////////////////////////////////////////////////////// //////////////////////////////////////initialization to be removed///////////////////////////////////////////////////////////
PUCCH_GroupHopping=neither; PUCCH_GroupHopping=neither;
n_id=10; n_id=10;
#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); 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, ...@@ -390,7 +394,9 @@ double nr_cyclic_shift_hopping(PHY_VARS_NR_UE *ue,
//////////////////////////////////////initialization to be removed/////////////////////////////////////////////////////////// //////////////////////////////////////initialization to be removed///////////////////////////////////////////////////////////
c_init=10; c_init=10;
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t [nr_cyclic_shift_hopping] initialization c_init=%d -> variable initialization TO BE REMOVED\n",c_init); 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, ...@@ -415,6 +421,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
int16_t amp, int16_t amp,
int nr_tti_tx, int nr_tti_tx,
uint8_t m0,
uint8_t mcs, uint8_t mcs,
uint8_t nrofSymbols, uint8_t nrofSymbols,
uint8_t startingSymbolIndex, uint8_t startingSymbolIndex,
...@@ -441,8 +448,6 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, ...@@ -441,8 +448,6 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
*/ */
// alpha is cyclic shift // alpha is cyclic shift
double alpha; 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 // 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; 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] // 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, ...@@ -470,15 +475,9 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
uint8_t n_hop = 0; uint8_t n_hop = 0;
//uint8_t PUCCH_Frequency_Hopping; // from higher layers FIXME!! //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 #ifdef DEBUG_NR_PUCCH_TX
printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n"); printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n");
#endif #endif
/////////////////////////////////////////////////////// ending variables initialization for test
// x_n contains the sequence r_u_v_alpha_delta(n) // x_n contains the sequence r_u_v_alpha_delta(n)
int16_t x_n_re[24],x_n_im[24]; int16_t x_n_re[24],x_n_im[24];
...@@ -550,6 +549,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, ...@@ -550,6 +549,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
uint64_t payload, uint64_t payload,
int16_t amp, int16_t amp,
int nr_tti_tx, int nr_tti_tx,
uint8_t m0,
uint8_t nrofSymbols, uint8_t nrofSymbols,
uint8_t startingSymbolIndex, uint8_t startingSymbolIndex,
uint16_t startingPRB, uint16_t startingPRB,
...@@ -646,8 +646,6 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, ...@@ -646,8 +646,6 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
*/ */
// alpha is cyclic shift // alpha is cyclic shift
double alpha; 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 // 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 ; 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] // 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, ...@@ -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++) { for (i=0;i<M_bit;i++) {
c = (uint8_t)((s>>i)&1); c = (uint8_t)((s>>i)&1);
btilde[i] = (((B>>i)&1) ^ c); 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)); printf("\t\t\t btilde[%d]=%lx from scrambled bit %d\n",i,btilde[i],((B>>i)&1));
#endif #endif
} }
...@@ -1338,7 +1336,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, ...@@ -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] 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) + (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); - (((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", 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]); l,k,m,l*(12*nrofPRB)+k,z_re[l*(12*nrofPRB)+k],z_im[l*(12*nrofPRB)+k]);
#endif #endif
...@@ -1453,25 +1451,37 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, ...@@ -1453,25 +1451,37 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue,
//startingPRB = startingPRB + rb; //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 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; re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
#ifdef DEBUG_NR_PUCCH_TX
printf("1 "); 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 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))); re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*((rb+startingPRB)-(frame_parms->N_RB_DL>>1)));
#ifdef DEBUG_NR_PUCCH_TX
printf("2 "); 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 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; re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
#ifdef DEBUG_NR_PUCCH_TX
printf("3 "); 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 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; re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*((rb+startingPRB)-(frame_parms->N_RB_DL>>1))) + 6;
#ifdef DEBUG_NR_PUCCH_TX
printf("4 "); 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 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; re_offset = ((l+startingSymbolIndex)*frame_parms->ofdm_symbol_size) + (12*(rb+startingPRB)) + frame_parms->first_carrier_offset;
#ifdef DEBUG_NR_PUCCH_TX
printf("5 "); printf("5 ");
#endif
} }
#ifdef DEBUG_NR_PUCCH_TX
printf("re_offset=%d,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB)); printf("re_offset=%d,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB));
#endif
txptr = &txdataF[0][re_offset]; txptr = &txdataF[0][re_offset];
for (int n=0; n<12; n++){ 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)) { if ((n==6) && ((rb+startingPRB) == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) {
......
...@@ -507,6 +507,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -507,6 +507,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated_nr[gNB_id],
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
(uint8_t)m_0,
(uint8_t)m_CS, (uint8_t)m_CS,
nb_symbols_total, nb_symbols_total,
starting_symbol_index, starting_symbol_index,
...@@ -521,6 +522,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -521,6 +522,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
pucch_payload, pucch_payload,
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
(uint8_t)m_0,
nb_symbols_total, nb_symbols_total,
starting_symbol_index, starting_symbol_index,
starting_prb, starting_prb,
......
...@@ -55,6 +55,9 @@ RUN_MELD="yes" ...@@ -55,6 +55,9 @@ RUN_MELD="yes"
# for removing files # for removing files
REMOVE="rm -f" REMOVE="rm -f"
COMPARE="cmp" COMPARE="cmp"
TESTS_RUN=0
TESTS_PASS=0
TESTS_FAIL=0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# List of tests # List of tests
...@@ -94,7 +97,7 @@ do ...@@ -94,7 +97,7 @@ do
echo "Option of run_test script" echo "Option of run_test script"
echo "-b : No Build of unit tests" echo "-b : No Build of unit tests"
echo "-c : No check for unit test" 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" echo "-m : No run of meld tool"
exit exit
BUILD_TEST="no" BUILD_TEST="no"
...@@ -184,7 +187,7 @@ for file in $tst_files ...@@ -184,7 +187,7 @@ for file in $tst_files
rm $RESULT_DIR/$RESULT_TEST_FILE rm $RESULT_DIR/$RESULT_TEST_FILE
echo "$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE" echo "$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE"
$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE $EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE
TESTS_RUN=$((TESTS_RUN+1))
fi fi
if [ $CHECK_TEST == "yes" ] if [ $CHECK_TEST == "yes" ]
...@@ -201,8 +204,10 @@ for file in $tst_files ...@@ -201,8 +204,10 @@ for file in $tst_files
then then
echo "Test $file is PASS" echo "Test $file is PASS"
echo "Same logging file for $file" echo "Same logging file for $file"
TESTS_PASS=$((TESTS_PASS+1))
else else
echo "Test $file is FAIL" echo "Test $file is FAIL"
TESTS_FAIL=$((TESTS_FAIL+1))
echo "Difference of logging file for scenario $file" echo "Difference of logging file for scenario $file"
let "num_diff=$num_diff + 1" let "num_diff=$num_diff + 1"
if [ $RUN_MELD == "yes" ] if [ $RUN_MELD == "yes" ]
...@@ -225,7 +230,8 @@ for file in $tst_files ...@@ -225,7 +230,8 @@ for file in $tst_files
if [ $SINGLE_TEST == "yes" ] if [ $SINGLE_TEST == "yes" ]
then then
exit echo "Test $file has been executed"
break
fi fi
done done
...@@ -234,4 +240,6 @@ then ...@@ -234,4 +240,6 @@ then
echo "There are $num_diff result files which are different" echo "There are $num_diff result files which are different"
fi fi
echo " tests run : $TESTS_RUN pass : $TESTS_PASS fail : $TESTS_FAIL"
# end of script # 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