diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 79fd825a4b..9d19c9b346 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -47,14 +47,8 @@ //#define CALLGRIND 1 struct treillis { - union { - simde__m64 systematic_andp1_64[3]; - uint8_t systematic_andp1_8[24]; - }; - union { - simde__m64 parity2_64[3]; - uint8_t parity2_8[24]; - }; + uint8_t systematic_andp1[24] __attribute__((aligned(32))); + uint8_t parity2[24] __attribute__((aligned(32))); int exit_state; } __attribute__ ((aligned(64))); @@ -91,12 +85,11 @@ static void treillis_table_init(void) { current_state=i; for (b=0; b<8 ; b++ ) { // pre-compute the image of the byte j in _m128i vector right place - all_treillis[i][j].systematic_andp1_8[b*3]= (j&(1<<(7-b)))>>(7-b); - v=threegpplte_rsc( all_treillis[i][j].systematic_andp1_8[b*3] , - ¤t_state); - all_treillis[i][j].systematic_andp1_8[b*3+1]=v; // for the yparity1 + all_treillis[i][j].systematic_andp1[b * 3] = (j & (1 << (7 - b))) >> (7 - b); + v = threegpplte_rsc(all_treillis[i][j].systematic_andp1[b * 3], ¤t_state); + all_treillis[i][j].systematic_andp1[b * 3 + 1] = v; // for the yparity1 // all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1 - all_treillis[i][j].parity2_8[b*3+2]=v; // for the yparity2 + all_treillis[i][j].parity2[b * 3 + 2] = v; // for the yparity2 } all_treillis[i][j].exit_state=current_state; @@ -275,13 +268,9 @@ char interleave_compact_byte(short *base_interleaver,unsigned char *input, unsig } */ -void threegpplte_turbo_encoder_sse(unsigned char *input, - unsigned short input_length_bytes, - unsigned char *output, - unsigned char F) { - int i; +void threegpplte_turbo_encoder_sse(unsigned char *input, unsigned short input_length_bytes, unsigned char *output, unsigned char F) +{ unsigned char *x; - unsigned char state0=0,state1=0; unsigned short input_length_bits = input_length_bytes<<3; short *base_interleaver; @@ -290,6 +279,7 @@ void threegpplte_turbo_encoder_sse(unsigned char *input, } // look for f1 and f2 precomputed interleaver values + int i; for (i=0; i < 188 && f1f2mat[i].nb_bits != input_length_bits; i++); if ( i == 188 ) { @@ -301,24 +291,19 @@ void threegpplte_turbo_encoder_sse(unsigned char *input, unsigned char systematic2[768] __attribute__((aligned(32))); interleave_compact_byte(base_interleaver, input, systematic2, input_length_bytes); - simde__m64 *ptr_output = (simde__m64 *)output; - unsigned char cur_s1, cur_s2; - int code_rate; - - for ( state0=state1=i=0 ; iframe_parms; init_delay_table(frame_parms->ofdm_symbol_size, MAX_DELAY_COMP, NR_MAX_OFDM_SYMBOL_SIZE, frame_parms->delay_table); crcTableInit(); - init_scrambling_luts(); + init_byte2m128i(); load_dftslib(); init_context_synchro_nr(frame_parms); generate_ul_reference_signal_sequences(SHRT_MAX); diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 6b499f14db..e613efd6ca 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -42,25 +42,24 @@ #include "PHY_INTERFACE/phy_interface.h" #include "transport_proto.h" -static const int8_t wACK_RX[5][4] = {{-1, -1, -1, -1}, {-1, 1, -1, 1}, {-1, -1, 1, 1}, {-1, 1, 1, -1}, {1, 1, 1, 1}}; - -void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) { - int i,r; +static const int wACK_RX[5][4] = {{-1, -1, -1, -1}, {-1, 1, -1, 1}, {-1, -1, 1, 1}, {-1, 1, 1, -1}, {1, 1, 1, 1}}; +void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) +{ if (ulsch) { - for (i=0; i<8; i++) { + for (int i = 0; i < 8; i++) { if (ulsch->harq_processes[i]) { if (ulsch->harq_processes[i]->decodedBytes) { free16(ulsch->harq_processes[i]->decodedBytes,MAX_ULSCH_PAYLOAD_BYTES); ulsch->harq_processes[i]->decodedBytes = NULL; } - for (r=0; rharq_processes[i]->c[r],((r==0)?8:0) + 768); ulsch->harq_processes[i]->c[r] = NULL; } - for (r=0; rharq_processes[i]->d[r]) { free16(ulsch->harq_processes[i]->d[r],((3*8*6144)+12+96)*sizeof(short)); ulsch->harq_processes[i]->d[r] = NULL; @@ -411,32 +410,17 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id]; uint8_t harq_pid; - unsigned short nb_rb; - unsigned int A; - uint8_t Q_m; - unsigned int i,i2,q,j,j2; - int iprime; - unsigned int ret=0; - // uint8_t dummy_channel_output[(3*8*block_length)+12]; - int r,Kr; + unsigned int ret = 0; const uint8_t *columnset; - unsigned int sumKr=0; unsigned int Qprime,L,G,Q_CQI,Q_RI,H,Hprime,Hpp,Cmux,Rmux_prime,O_RCC; - unsigned int Qprime_ACK,Qprime_RI,len_ACK=0,len_RI=0; - // uint8_t q_ACK[MAX_ACK_PAYLOAD],q_RI[MAX_RI_PAYLOAD]; - int metric,metric_new; - uint32_t x1, x2, s=0; - int16_t ys,c; - uint32_t wACK_idx; + unsigned int Qprime_ACK, Qprime_RI, len_ACK = 0, len_RI = 0; uint8_t dummy_w_cc[3*(MAX_CQI_BITS+8+32)]; int16_t y[6*14*1200] __attribute__((aligned(32))); uint8_t ytag[14*1200]; // uint8_t ytag2[6*14*1200],*ytag2_ptr; int16_t cseq[6*14*1200] __attribute__((aligned(32))); - int off; - int frame = proc->frame_rx; - int subframe = proc->subframe_rx; - LTE_UL_eNB_HARQ_t *ulsch_harq; + const int frame = proc->frame_rx; + const int subframe = proc->subframe_rx; LOG_D(PHY,"ue_type %d\n",ulsch->ue_type); @@ -446,15 +430,16 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe); // x1 is set in lte_gold_generic - x2 = ((uint32_t)ulsch->rnti<<14) + ((uint32_t)subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1 - ulsch_harq = ulsch->harq_processes[harq_pid]; + uint32_t x2 = + ((uint32_t)ulsch->rnti << 14) + ((uint32_t)subframe << 9) + frame_parms->Nid_cell; // this is c_init in 36.211 Sec 6.3.1 + LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid]; AssertFatal(harq_pid!=255, "FATAL ERROR: illegal harq_pid, returning\n"); AssertFatal(ulsch_harq->Nsymb_pusch != 0, "FATAL ERROR: harq_pid %d, Nsymb 0!\n",harq_pid); - nb_rb = ulsch_harq->nb_rb; - A = ulsch_harq->TBS; - Q_m = ulsch_harq->Qm; + const int nb_rb = ulsch_harq->nb_rb; + const uint A = ulsch_harq->TBS; + const uint Q_m = ulsch_harq->Qm; G = nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch; LOG_D(PHY, "PUSCH nb_rb %d Q_m %d ulsch_harq->Nsymb_pusch %d\n",nb_rb, Q_m, ulsch_harq->Nsymb_pusch); //#ifdef DEBUG_ULSCH_DECODING @@ -517,15 +502,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, // CLEAR LLR's HERE for first packet in process //} // printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]); - sumKr = 0; - - for (r=0; rC; r++) { + unsigned int sumKr = 0; + for (int r = 0; r < ulsch_harq->C; r++) { if (rCminus) - Kr = ulsch_harq->Kminus; + sumKr += ulsch_harq->Kminus; else - Kr = ulsch_harq->Kplus; - - sumKr += Kr; + sumKr += ulsch_harq->Kplus; } AssertFatal(sumKr>0, @@ -616,15 +598,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, Cmux = ulsch_harq->Nsymb_pusch; Rmux_prime = Hpp/Cmux; // Clear "tag" interleaving matrix to allow for CQI/DATA identification - memset(ytag,0,Cmux*Rmux_prime); - i=0; + memset(ytag, 0, Cmux * Rmux_prime); memset(y,LTE_NULL,Q_m*Hpp); // read in buffer and unscramble llrs for everything but placeholder bits // llrs stored per symbol correspond to columns of interleaving matrix - s = lte_gold_unscram(&x1, &x2, 1); - i2=0; - - for (i=0; i<((Hpp*Q_m)>>5); i++) { + uint32_t x1 = 0; + uint32_t s = lte_gold_unscram(&x1, &x2, 1); + for (int i = 0, i2 = 0; i < ((Hpp * Q_m) >> 5); i++) { /* for (j=0; j<32; j++) { cseq[i2++] = (int16_t)((((s>>j)&1)<<1)-1); @@ -642,18 +622,18 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, else columnset = cs_ri_extended; - j=0; + int j = 0; - for (i=0; i>2); + for (int i = 0; i < Qprime_RI; i++) { + int r = Rmux_prime - 1 - (i >> 2); /* for (q=0;q>2); - off =((Rmux_prime*Q_m*columnset[j])+(r*Q_m)); + for (int i = 0; i < Qprime_ACK; i++) { + int r = Rmux_prime - 1 - (i >> 2); + int off = ((Rmux_prime * Q_m * columnset[j]) + (r * Q_m)); if (ulsch_harq->O_ACK == 1) { if (ulsch->bundling==0) cseq[off+1] = cseq[off]; // PUSCH_y - for (q=2; qO_ACK == 2) { - for (q=2; qq_ACK[i] = 0; - for (i=0; i>2); + for (int i = 0; i < Qprime_ACK; i++) { + int r = Rmux_prime - 1 - (i >> 2); - for (q=0; qq_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))]; + for (int q = 0; q < Q_m; q++) { + if (y[q + Q_m * (r * Cmux + columnset[j])] != 0) + ulsch_harq->q_ACK[(q + (Q_m * i)) % len_ACK] += y[q + Q_m * (r * Cmux + columnset[j])]; - y[q+(Q_m*((r*Cmux) + columnset[j]))]=0; // NULL LLRs in ACK positions + y[q + Q_m * (r * Cmux + columnset[j])] = 0; // NULL LLRs in ACK positions } j=(j+3)&3; @@ -851,7 +804,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, return(-1); } - for (i=0; iq_RI[i] = 0; if (frame_parms->Ncp == 0) @@ -861,10 +814,10 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, j=0; - for (i=0; i>2); + for (int i = 0; i < Qprime_RI; i++) { + int r = Rmux_prime - 1 - (i >> 2); - for (q=0; qq_RI[(q+(Q_m*i))%len_RI] += y[q+(Q_m*((r*Cmux) + columnset[j]))]; ytag[(r*Cmux) + columnset[j]] = LTE_NULL; @@ -874,19 +827,19 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, // printf("after RI2 c[%d] = %p\n",0,ulsch_harq->c[0]); // CQI and Data bits j=0; - j2=0; + int j2 = 0; // r=0; if (Q_RI>0) { - for (i=0; i<(Q_CQI/Q_m); i++) { + for (int i = 0; i < (Q_CQI / Q_m); i++) { while (ytag[j]==LTE_NULL) { j++; j2+=Q_m; } - for (q=0; q127) ulsch_harq->q[q+(Q_m*i)] = 127; @@ -901,7 +854,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, switch (Q_m) { case 2: - for (iprime=0; iprime0 else { - for (i=0; i<(Q_CQI/Q_m); i++) { - for (q=0; q127) ulsch_harq->q[q+(Q_m*i)] = 127; @@ -961,88 +914,74 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, j2+=Q_m; } - - /* To be improved according to alignment of j2 - for (iprime=0; iprimee[iprime]) = *((simde__m256i *)&y[j2]); - */ - int16_t *yp,*ep; - - for (iprime=0,yp=&y[j2],ep=&ulsch_harq->eUL[0]; - iprimeeUL; + memcpy(ep, yp, G * sizeof(*yp)); } stop_meas(&eNB->ulsch_demultiplexing_stats); // printf("after ACKNAK2 c[%d] = %p (iprime %d, G %d)\n",0,ulsch_harq->c[0],iprime,G); // Do CQI/RI/HARQ-ACK Decoding first and pass to MAC // HARQ-ACK - wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3); + const uint32_t wACK_idx = ulsch->bundling == 0 ? 4 : (Nbundled - 1) & 3; + const int *wACK = wACK_RX[wACK_idx]; + uint8_t *o_ACK = ulsch_harq->o_ACK; + int16_t *q_ACK = ulsch_harq->q_ACK; if (ulsch_harq->O_ACK == 1) { - ulsch_harq->q_ACK[0] *= wACK_RX[wACK_idx][0]; - ulsch_harq->q_ACK[0] += (ulsch->bundling==0) ? ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][0] : ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][1]; + q_ACK[0] *= wACK[0]; + q_ACK[0] += (ulsch->bundling == 0) ? q_ACK[1] * wACK[0] : q_ACK[1] * wACK[1]; - if (ulsch_harq->q_ACK[0] < 0) - ulsch_harq->o_ACK[0] = 0; + if (q_ACK[0] < 0) + o_ACK[0] = 0; else - ulsch_harq->o_ACK[0] = 1; + o_ACK[0] = 1; } if (ulsch_harq->O_ACK == 2) { switch (Q_m) { case 2: - ulsch_harq->q_ACK[0] = ulsch_harq->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[3]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[1] = ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[4]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[2] = ulsch_harq->q_ACK[2]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[5]*wACK_RX[wACK_idx][1]; + q_ACK[0] = q_ACK[0] * wACK[0] + q_ACK[3] * wACK[1]; + q_ACK[1] = q_ACK[1] * wACK[0] + q_ACK[4] * wACK[1]; + q_ACK[2] = q_ACK[2] * wACK[0] + q_ACK[5] * wACK[1]; break; case 4: - ulsch_harq->q_ACK[0] = ulsch_harq->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[5]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[1] = ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[8]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[2] = ulsch_harq->q_ACK[4]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[9]*wACK_RX[wACK_idx][1]; + q_ACK[0] = q_ACK[0] * wACK[0] + q_ACK[5] * wACK[1]; + q_ACK[1] = q_ACK[1] * wACK[0] + q_ACK[8] * wACK[1]; + q_ACK[2] = q_ACK[4] * wACK[0] + q_ACK[9] * wACK[1]; break; case 6: - ulsch_harq->q_ACK[0] = ulsch_harq->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[7]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[1] = ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[12]*wACK_RX[wACK_idx][1]; - ulsch_harq->q_ACK[2] = ulsch_harq->q_ACK[6]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[13]*wACK_RX[wACK_idx][1]; + q_ACK[0] = q_ACK[0] * wACK[0] + q_ACK[7] * wACK[1]; + q_ACK[1] = q_ACK[1] * wACK[0] + q_ACK[12] * wACK[1]; + q_ACK[2] = q_ACK[6] * wACK[0] + q_ACK[13] * wACK[1]; break; } - ulsch_harq->o_ACK[0] = 1; - ulsch_harq->o_ACK[1] = 1; - metric = ulsch_harq->q_ACK[0]+ulsch_harq->q_ACK[1]-ulsch_harq->q_ACK[2]; - metric_new = -ulsch_harq->q_ACK[0]+ulsch_harq->q_ACK[1]+ulsch_harq->q_ACK[2]; + o_ACK[0] = 1; + o_ACK[1] = 1; + int metric = q_ACK[0] + q_ACK[1] - q_ACK[2]; + int metric_new = -q_ACK[0] + q_ACK[1] + q_ACK[2]; if (metric_new > metric) { - ulsch_harq->o_ACK[0]=0; - ulsch_harq->o_ACK[1]=1; + o_ACK[0] = 0; + o_ACK[1] = 1; metric = metric_new; } - metric_new = ulsch_harq->q_ACK[0]-ulsch_harq->q_ACK[1]+ulsch_harq->q_ACK[2]; + metric_new = q_ACK[0] - q_ACK[1] + q_ACK[2]; if (metric_new > metric) { - ulsch_harq->o_ACK[0] = 1; - ulsch_harq->o_ACK[1] = 0; + o_ACK[0] = 1; + o_ACK[1] = 0; metric = metric_new; } - metric_new = -ulsch_harq->q_ACK[0]-ulsch_harq->q_ACK[1]-ulsch_harq->q_ACK[2]; + metric_new = -q_ACK[0] - q_ACK[1] - q_ACK[2]; if (metric_new > metric) { - ulsch_harq->o_ACK[0] = 0; - ulsch_harq->o_ACK[1] = 0; + o_ACK[0] = 0; + o_ACK[1] = 0; metric = metric_new; } } @@ -1100,32 +1039,40 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { char output[16384]; - int stroff=0; - for (int i=0;iulsch_stats[i].rnti>0 && eNB->ulsch_stats[i].round_trials[0]>100) { - for (int aa=0;aaframe_parms.nb_antennas_rx;aa++) - stroff+=sprintf(output+stroff,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n", - eNB->ulsch_stats[i].rnti, aa,eNB->ulsch_stats[i].ulsch_power[aa],aa,eNB->ulsch_stats[i].ulsch_noise_power[aa]); - AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n"); - stroff+=sprintf(output+stroff,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n", - eNB->ulsch_stats[i].rnti, - eNB->ulsch_stats[i].round_trials[0], - (double)eNB->ulsch_stats[i].round_trials[1]/eNB->ulsch_stats[i].round_trials[0], - eNB->ulsch_stats[i].round_trials[1], - (double)eNB->ulsch_stats[i].round_trials[2]/eNB->ulsch_stats[i].round_trials[0], - eNB->ulsch_stats[i].round_trials[2], - (double)eNB->ulsch_stats[i].round_trials[3]/eNB->ulsch_stats[i].round_trials[0], - eNB->ulsch_stats[i].round_trials[3]); - stroff+=sprintf(output+stroff,"ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset %d, total_bytes RX/SCHED %d/%d\n", - eNB->ulsch_stats[i].rnti, - eNB->ulsch_stats[i].current_Qm, - eNB->ulsch_stats[i].current_G, - eNB->ulsch_stats[i].current_TBS, - (double)eNB->ulsch_stats[i].current_G/eNB->ulsch_stats[i].current_TBS, - eNB->ulsch_stats[i].current_RI, - eNB->ulsch_stats[i].timing_offset, - eNB->ulsch_stats[i].total_bytes_rx, - eNB->ulsch_stats[i].total_bytes_tx); + char *str = output; + for (eNB_SCH_STATS_t *st = eNB->ulsch_stats; st < eNB->ulsch_stats + sizeofArray(eNB->ulsch_stats); st++) + if (st->rnti > 0 && st->round_trials[0] > 100) { + for (int aa = 0; aa < eNB->frame_parms.nb_antennas_rx; aa++) + str += sprintf(str, + "ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n", + st->rnti, + aa, + st->ulsch_power[aa], + aa, + st->ulsch_noise_power[aa]); + AssertFatal((str - output) < (STATSTRLEN - 1000), "Increase STATSTRLEN\n"); + str += sprintf(str, + "ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n", + st->rnti, + st->round_trials[0], + (double)st->round_trials[1] / st->round_trials[0], + st->round_trials[1], + (double)st->round_trials[2] / st->round_trials[0], + st->round_trials[2], + (double)st->round_trials[3] / st->round_trials[0], + st->round_trials[3]); + str += sprintf(str, + "ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset " + "%d, total_bytes RX/SCHED %d/%d\n", + st->rnti, + st->current_Qm, + st->current_G, + st->current_TBS, + (double)st->current_G / st->current_TBS, + st->current_RI, + st->timing_offset, + st->total_bytes_rx, + st->total_bytes_tx); } fprintf(fd,"%s",output); } diff --git a/openair1/PHY/NR_REFSIG/nr_refsig.h b/openair1/PHY/NR_REFSIG/nr_refsig.h index 7996db109a..c79d0b70aa 100644 --- a/openair1/PHY/NR_REFSIG/nr_refsig.h +++ b/openair1/PHY/NR_REFSIG/nr_refsig.h @@ -44,12 +44,10 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms, const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params, const int slot, const csi_mapping_parms_t *phy_csi_parms); +void init_byte2m128i(void); -void init_scrambling_luts(void); void nr_generate_modulation_table(void); -extern simde__m64 byte2m64_re[256]; -extern simde__m64 byte2m64_im[256]; extern simde__m128i byte2m128i[256]; int nr_pusch_lowpaprtype1_dmrs_rx(PHY_VARS_gNB *gNB, diff --git a/openair1/PHY/NR_REFSIG/scrambling_luts.c b/openair1/PHY/NR_REFSIG/scrambling_luts.c index 39130b5696..f6b1207838 100644 --- a/openair1/PHY/NR_REFSIG/scrambling_luts.c +++ b/openair1/PHY/NR_REFSIG/scrambling_luts.c @@ -22,40 +22,13 @@ /* Lookup tables for 3GPP scrambling/unscrambling */ /* Author R. Knopp / EURECOM / OpenAirInterface.org */ -#ifndef __SCRAMBLING_LUTS__C__ -#define __SCRAMBLING_LUTS__C__ #include "PHY/impl_defs_nr.h" #include "PHY/sse_intrin.h" #include -simde__m64 byte2m64_re[256]; -simde__m64 byte2m64_im[256]; - simde__m128i byte2m128i[256]; -void init_byte2m64(void) { - - for (int s=0;s<256;s++) { - byte2m64_re[s] = simde_mm_insert_pi16(byte2m64_re[s],(1-2*(s&1)),0); - byte2m64_im[s] = simde_mm_insert_pi16(byte2m64_im[s],(1-2*((s>>1)&1)),0); - byte2m64_re[s] = simde_mm_insert_pi16(byte2m64_re[s],(1-2*((s>>2)&1)),1); - byte2m64_im[s] = simde_mm_insert_pi16(byte2m64_im[s],(1-2*((s>>3)&1)),1); - byte2m64_re[s] = simde_mm_insert_pi16(byte2m64_re[s],(1-2*((s>>4)&1)),2); - byte2m64_im[s] = simde_mm_insert_pi16(byte2m64_im[s],(1-2*((s>>5)&1)),2); - byte2m64_re[s] = simde_mm_insert_pi16(byte2m64_re[s],(1-2*((s>>6)&1)),3); - byte2m64_im[s] = simde_mm_insert_pi16(byte2m64_im[s],(1-2*((s>>7)&1)),3); - LOG_T(PHY,"init_scrambling_luts: s %x (%d) ((%d,%d),(%d,%d),(%d,%d),(%d,%d))\n", - ((uint16_t*)&s)[0], - (1-2*(s&1)), - ((int16_t*)&byte2m64_re[s])[0],((int16_t*)&byte2m64_im[s])[0], - ((int16_t*)&byte2m64_re[s])[1],((int16_t*)&byte2m64_im[s])[1], - ((int16_t*)&byte2m64_re[s])[2],((int16_t*)&byte2m64_im[s])[2], - ((int16_t*)&byte2m64_re[s])[3],((int16_t*)&byte2m64_im[s])[3]); - - } -} - void init_byte2m128i(void) { for (int s=0;s<256;s++) { @@ -70,10 +43,3 @@ void init_byte2m128i(void) { } } -void init_scrambling_luts(void) { - - init_byte2m64(); - init_byte2m128i(); -} - -#endif diff --git a/radio/rfsimulator/stored_node.c b/radio/rfsimulator/stored_node.c index ef56ae999c..51db5bfea1 100644 --- a/radio/rfsimulator/stored_node.c +++ b/radio/rfsimulator/stored_node.c @@ -44,42 +44,6 @@ int fullread(int fd, void *_buf, int count) { return ret; } -#define shift 4 -int32_t signal_energy(int32_t *input,uint32_t length) { - int32_t i; - int32_t temp,temp2; - register simde__m64 mm0, mm1, mm2, mm3; - simde__m64 *in = (simde__m64 *)input; - mm0 = simde_mm_setzero_si64(); // pxor(mm0,mm0); - mm3 = simde_mm_setzero_si64(); // pxor(mm3,mm3); - - for (i=0; i>1; i++) { - mm1 = in[i]; - mm2 = mm1; - mm1 = _m_pmaddwd(mm1,mm1); - mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift - mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes - // mm2 = _m_psrawi(mm2,shift_DC); - mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes - } - - mm1 = mm0; - mm0 = _m_psrlqi(mm0,32); - mm0 = _m_paddd(mm0,mm1); - temp = _m_to_int(mm0); - temp/=length; - temp<<=shift; // this is the average of x^2 - // now remove the DC component - mm2 = _m_psrlqi(mm3,32); - mm2 = _m_paddw(mm2,mm3); - mm2 = _m_pmaddwd(mm2,mm2); - temp2 = _m_to_int(mm2); - temp2/=(length*length); - // temp2<<=(2*shift_DC); - temp -= temp2; - return((temp>0)?temp:1); -} - void fullwrite(int fd, void *_buf, int count) { char *buf = _buf; @@ -238,8 +202,8 @@ int main(int argc, char *argv[]) { ((int16_t *)buff)[i]/=16; usleep(1000); - printf("sending at ts: %lu, number of samples: %d, energy: %d\n", - header.timestamp, header.size, signal_energy(buff, header.size)); + printf("sending at ts: %lu, number of samples: %d\n", + header.timestamp, header.size); fullwrite(serviceSock, buff, dataSize); // Purge incoming samples setblocking(serviceSock, notBlocking);