From 1c16705355ac2450fdb282d5e10e685346ff7978 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 8 Apr 2020 00:03:44 +0200 Subject: [PATCH] pucch receiver for format 0 reworked without floating point and no generation of sequences for each decoding attempt, SR detection integrated --- cmake_targets/autotests/test_case_list.xml | 16 +++--- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 64 +++++++++++++++++----- openair1/PHY/defs_gNB.h | 17 +++--- 3 files changed, 67 insertions(+), 30 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index b3954db1fd..b7222d0330 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1177,21 +1177,23 @@ execution - nr_pucchsim Test cases. (Test1: Format 0 ACK miss 106 PRB), - (Test2: Format 1 ACK miss 106 PRB), - (Test3: Format 1 ACK miss 273 PRB), - (Test4: Format 1 NACKtoACK 106 PRB) + nr_pucchsim Test cases. (Test1: Format 0 1-bit ACK miss 106 PRB), + (Test2: Format 0 2-bit ACK miss 106 PRB), + (Test3: Format 1 ACK miss 106 PRB), + (Test4: Format 1 ACK miss 273 PRB), + (Test5: Format 1 NACKtoACK 106 PRB) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash $OPENAIR_DIR/targets/bin/nr_pucchsim.Rel15 - -R 106 -i 1 -P 0 -b 1 -s3 -n100 - -R 106 -i 14 -P 1 -b 1 -s-6 -n100 + -R 106 -i 1 -P 0 -b 1 -s-7 -n1000 + -R 106 -i 1 -P 0 -b 2 -s-7 -n1000 + -R 106 -i 14 -P 1 -b 1 -s-6 -n100 -R 273 -i 14 -P 1 -b 1 -s-6 -n100 -R 106 -i 14 -P 1 -b 1 -s-6 -T 0.001 -n1000 - nr_pucchsim.test1 nr_pucchsim.test2 nr_pucchsim.test3 nr_pucchsim.test4 + nr_pucchsim.test1 nr_pucchsim.test2 PUCCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index bb087aad0d..ee3e247cb0 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -94,7 +94,15 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); - if(pucch_pdu->bit_len_harq==1){ + AssertFatal(pucch_pdu->bit_len_harq > 0 || pucch_pdu->sr_flag > 0, + "Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n", + pucch_pdu->bit_len_harq,pucch_pdu->sr_flag); + + if(pucch_pdu->bit_len_harq==0){ + mcs=table1_mcs; + nr_sequences=1; + } + else if(pucch_pdu->bit_len_harq==1){ mcs=table1_mcs; nr_sequences=4>>(1-pucch_pdu->sr_flag); } @@ -275,6 +283,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, maxpos=i; } } + + uint8_t xrtmag_dB = dB_fixed(xrtmag); #ifdef DEBUG_NR_PUCCH_RX printf("PUCCH 0 : maxpos %d\n",maxpos); @@ -288,21 +298,45 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->ul_cqi = 0xff; // currently not valid uci_pdu->timing_advance = 0xffff; // currently not valid uci_pdu->rssi = 0xffff; // currently not valid - if (pucch_pdu->sr_flag) { - //currently not supported - } - else - uci_pdu->sr = NULL; - if (pucch_pdu->bit_len_harq>0) { - uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); - uci_pdu->harq->num_harq = pucch_pdu->bit_len_harq; - uci_pdu->harq->harq_confidence_level = 0xff; // currently not valid - uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(uci_pdu->harq->num_harq); - for (i=0; iharq->num_harq; i++) // FIXME for non present - uci_pdu->harq->harq_list[i].harq_value = (index>>i)&0x01; - } - else + + if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; + uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); + if (xrtmag_dB>(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres)) { + uci_pdu->sr->sr_indication = 1; + uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres); + } else { + uci_pdu->sr->sr_indication = 0; + uci_pdu->sr->sr_confidence_level = (gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres)-xrtmag_dB; + } + } + else if (pucch_pdu->bit_len_harq==1) { + uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); + uci_pdu->harq->num_harq = 1; + uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres); + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); + uci_pdu->harq->harq_list[0].harq_value = index&0x01; + if (pucch_pdu->sr_flag == 1) { + uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); + uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres); + } + } + else { + uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); + uci_pdu->harq->num_harq = 2; + uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres); + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); + + uci_pdu->harq->harq_list[0].harq_value = index&0x01; + uci_pdu->harq->harq_list[1].harq_value = (index>>1)&0x01; + + if (pucch_pdu->sr_flag == 1) { + uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); + uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres); + } + } } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index d64153414f..d39f0d4e0b 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -568,13 +568,13 @@ typedef struct { //! estimated avg noise power (dB) short n0_power_tot_dBm; //! estimated avg noise power per RB per RX ant (lin) - unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][100]; + unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275]; //! estimated avg noise power per RB per RX ant (dB) - unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][100]; + unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275]; //! estimated avg noise power per RB (dB) - short n0_subband_power_tot_dB[100]; + short n0_subband_power_tot_dB[275]; //! estimated avg noise power per RB (dBm) - short n0_subband_power_tot_dBm[100]; + short n0_subband_power_tot_dBm[275]; // gNB measurements (per user) //! estimated received spatial signal power (linear) unsigned int rx_spatial_power[NUMBER_OF_NR_DLSCH_MAX][2][2]; @@ -594,13 +594,13 @@ typedef struct { /// Wideband CQI (sum of all RX antennas, in dB) char wideband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX]; /// Subband CQI per RX antenna and RB (= SINR) - int subband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][100]; + int subband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275]; /// Total Subband CQI and RB (= SINR) - int subband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX][100]; + int subband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX][275]; /// Subband CQI in dB and RB (= SINR dB) - int subband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][100]; + int subband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275]; /// Total Subband CQI and RB - int subband_cqi_tot_dB[NUMBER_OF_NR_DLSCH_MAX][100]; + int subband_cqi_tot_dB[NUMBER_OF_NR_DLSCH_MAX][275]; /// PRACH background noise level int prach_I0; } PHY_MEASUREMENTS_gNB; @@ -707,6 +707,7 @@ typedef struct PHY_VARS_gNB_s { /// counter to average prach energh over first 100 prach opportunities int prach_energy_counter; + int pucch0_thres; /* time_stats_t phy_proc; */