diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index e220549045..90c9d63925 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -69,8 +69,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint32_t preamble_shift2; uint16_t preamble_index0=0,n_shift_ra=0,n_shift_ra_bar; uint16_t d_start=0; - uint16_t numshift=0; - uint16_t *prach_root_sequence_map; + uint16_t numshift = 0; uint8_t not_found; int k=0; uint16_t u; @@ -221,7 +220,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, if (eNB) start_meas(&eNB->rx_prach); - prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; + const uint16_t *prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; // PDP is oversampled, e.g. 1024 sample instead of 839 // Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839 NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139); @@ -495,7 +494,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, new_dft = 0; if (br_flag == 1) { - Xu=(c16_t *)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx]; + Xu = eNB->X_u_br[ce_level][preamble_offset - first_nonzero_root_idx]; prach_ifft = prach_ifftp[prach_ifft_cnt++]; if (eNB->prach_vars_br.repetition_number[ce_level]==1) memset(prach_ifft,0,((N_ZC==839)?2048:256)*sizeof(int32_t)); diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index 2d9ef9d712..0939398c60 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -35,12 +35,13 @@ #include "PHY/phy_extern_ue.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/lte/prach_utils.h" +#include "openair1/PHY/LTE_TRANSPORT/prach_extern.h" const uint16_t NCS_unrestricted[16] = {0, 13, 15, 18, 22, 26, 32, 38, 46, 59, 76, 93, 119, 167, 279, 419}; const uint16_t NCS_restricted[15] = {15, 18, 22, 26, 32, 38, 46, 55, 68, 82, 100, 128, 158, 202, 237}; // high-speed case const uint16_t NCS_4[7] = {2, 4, 6, 8, 10, 12, 15}; -int16_t ru[2*839]; // quantized roots of unity +c16_t root_unit[839]; // quantized roots of unity static uint32_t ZC_inv[839]; // multiplicative inverse for roots u uint16_t du[838]; @@ -367,13 +368,13 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t s return(prach_mask); } - void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, frame_type_t frame_type, - uint32_t X_u[64][839]) { + c16_t X_u[64][839]) +{ // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) unsigned int k,inv_u,i,NCS=0,num_preambles; int N_ZC; @@ -495,7 +496,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, for (k=0; kframe_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset, tdd_mapindex, Nf); - prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; + const uint16_t *prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; /* // this code is not part of get_prach_prb_offset if (frame_type == TDD) { // TDD @@ -215,20 +210,6 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 #endif // nsymb = (frame_parms->Ncp==0) ? 14:12; // subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb; - k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL; - - if (k<0) - k+=ue->frame_parms.ofdm_symbol_size; - - k*=12; - k+=13; - Xu = (int16_t *)ue->X_u[preamble_offset-first_nonzero_root_idx]; - /* - k+=(12*ue->frame_parms.first_carrier_offset); - if (k>(12*ue->frame_parms.ofdm_symbol_size)) - k-=(12*ue->frame_parms.ofdm_symbol_size); - */ - k*=2; switch (ue->frame_parms.N_RB_UL) { case 6: @@ -259,20 +240,26 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 break; } + { + int k = (12 * n_ra_prb) - 6 * ue->frame_parms.N_RB_UL; - for (offset=0,offset2=0; offset= N_ZC) - offset2 -= N_ZC; + if (k < 0) + k += ue->frame_parms.ofdm_symbol_size; - Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); - Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); - prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15; - prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15; + k *= 12; + k += 13; + c16_t *Xu_ue = ue->X_u[preamble_offset - first_nonzero_root_idx]; + c16_t *complex_prachF = (c16_t *)prachF; + for (int offset = 0, offset2 = 0; offset < N_ZC; offset++, offset2 += preamble_shift) { + if (offset2 >= N_ZC) + offset2 -= N_ZC; + c16_t Xu = c16mulRealShift(*Xu_ue++, amp, 15); + complex_prachF[k++] = c16mulShift(Xu, root_unit[offset2], 15); - if (k==(12*2*ue->frame_parms.ofdm_symbol_size)) - k=0; + if (k == 12 * ue->frame_parms.ofdm_symbol_size) + k = 0; + } } - switch (prach_fmt) { case 0: Ncp = 3168; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index 9aab56e52a..06bf87fc74 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1649,8 +1649,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, frame_type_t frame_type, - uint32_t X_u[64][839]); - + c16_t X_u[64][839]); void init_prach_tables(int N_ZC); diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 17ae02610e..20d5a9ab8d 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -640,7 +640,7 @@ typedef struct { /// mbsfn reference symbols uint32_t lte_gold_mbsfn_khz_1dot25_table[10][150]; - uint32_t X_u[64][839]; + c16_t X_u[64][839]; uint32_t high_speed_flag; uint32_t perfect_ce; diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 68ebf65462..98d1080ee3 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -600,8 +600,8 @@ typedef struct PHY_VARS_eNB_s { // PUCCH1a/b energy detection parameters for eMTC per CE-level int pucch1ab_DTX_threshold_emtc[4]; - uint32_t X_u[64][839]; - uint32_t X_u_br[4][64][839]; + c16_t X_u[64][839]; + c16_t X_u_br[4][64][839]; uint8_t pbch_configured; uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE char eNB_generate_rar;