From 835034894cc8293476d90581a4e987a6b23e1106 Mon Sep 17 00:00:00 2001 From: Hongzhi Wang Date: Tue, 18 Sep 2018 13:34:15 +0200 Subject: [PATCH] update nr segmentation --- openair1/PHY/CODING/coding_defs.h | 5 +- openair1/PHY/CODING/nr_rate_matching.c | 2 +- openair1/PHY/CODING/nr_segmentation.c | 105 ++++++++---------- .../NR_TRANSPORT/nr_transport_common_proto.h | 8 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 93 +++++++--------- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 6 +- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 4 +- .../PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 66 ++++------- openair1/PHY/defs_gNB.h | 58 ++++------ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 +- 10 files changed, 143 insertions(+), 209 deletions(-) diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index 1d7145e5cd..b767b8de18 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -438,8 +438,7 @@ int32_t nr_segmentation(unsigned char *input_buffer, unsigned char **output_buffers, unsigned int B, unsigned int *C, - unsigned int *Kplus, - unsigned int *Kminus, + unsigned int *K, unsigned int *Zout, unsigned int *F); @@ -452,7 +451,7 @@ uint32_t nr_compute_tbs(uint8_t mcs, void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f); -void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f); +void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f); uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, uint32_t Tbslbrm, diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 502fda3fa5..19df32c246 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -48,7 +48,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) } -void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) +void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) { uint32_t EQm; diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c index ad2e809815..b5299c3a79 100644 --- a/openair1/PHY/CODING/nr_segmentation.c +++ b/openair1/PHY/CODING/nr_segmentation.c @@ -33,8 +33,7 @@ int32_t nr_segmentation(unsigned char *input_buffer, unsigned char **output_buffers, unsigned int B, unsigned int *C, - unsigned int *Kplus, - unsigned int *Kminus, + unsigned int *K, unsigned int *Zout, unsigned int *F) { @@ -59,13 +58,13 @@ int32_t nr_segmentation(unsigned char *input_buffer, } if ((*C)>MAX_NUM_DLSCH_SEGMENTS) { - LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); return(-1); } // Find K+ Bprime_by_C = Bprime/(*C); - /*if (Bprime <=192) { + if (Bprime <=192) { Kb = 6; } else if (Bprime <=560) { Kb = 8; @@ -73,9 +72,9 @@ int32_t nr_segmentation(unsigned char *input_buffer, Kb = 9; } else if (Bprime <=3840) { Kb = 10;; - } else {*/ + } else { Kb = 22; - //} + } if ((Bprime_by_C%Kb) > 0) @@ -88,97 +87,85 @@ else #endif if (Z <= 2) { - *Kplus = 2; - *Kminus = 0; + *K = 2; } else if (Z<=16) { // increase by 1 byte til here - *Kplus = Z; - *Kminus = Z-1; + *K = Z; } else if (Z <=32) { // increase by 2 bytes til here - *Kplus = (Z>>1)<<1; + *K = (Z>>1)<<1; - if (*Kplus < Z) - *Kplus = *Kplus + 2; + if (*K < Z) + *K = *K + 2; - *Kminus = (*Kplus - 2); } else if (Z <= 64) { // increase by 4 bytes til here - *Kplus = (Z>>2)<<2; + *K = (Z>>2)<<2; - if (*Kplus < Z) - *Kplus = *Kplus + 4; + if (*K < Z) + *K = *K + 4; - *Kminus = (*Kplus - 4); } else if (Z <=128 ) { // increase by 8 bytes til here - *Kplus = (Z>>3)<<3; + *K = (Z>>3)<<3; - if (*Kplus < Z) - *Kplus = *Kplus + 8; + if (*K < Z) + *K = *K + 8; #ifdef DEBUG_SEGMENTATION - printf("Z_by_C %d , Kplus2 %d\n",Z,*Kplus); + printf("Z_by_C %d , K2 %d\n",Z,*K); #endif - *Kminus = (*Kplus - 8); } else if (Z <= 256) { // increase by 4 bytes til here - *Kplus = (Z>>4)<<4; + *K = (Z>>4)<<4; - if (*Kplus < Z) - *Kplus = *Kplus + 16; + if (*K < Z) + *K = *K + 16; - *Kminus = (*Kplus - 16); } else if (Z <= 384) { // increase by 4 bytes til here - *Kplus = (Z>>5)<<5; + *K = (Z>>5)<<5; - if (*Kplus < Z) - *Kplus = *Kplus + 32; + if (*K < Z) + *K = *K + 32; - *Kminus = (*Kplus - 32); } else { //msg("nr_segmentation.c: Illegal codeword size !!!\n"); return(-1); } - *Zout = *Kplus; - *Kplus = *Kplus*Kb; - *Kminus = *Kminus*Kb; + *Zout = *K; + *K = *K*Kb; - - - *F = ((*C)*(*Kplus) - (Bprime)); + *F = ((*K) - Bprime_by_C); #ifdef DEBUG_SEGMENTATION - printf("final nr seg output Z %d Kplus %d F %d \n", *Zout, *Kplus, *F); - printf("C %d, Kplus %d, Kminus %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*Kplus,*Kminus,Bprime>>3,Bprime,*F); + printf("final nr seg output Z %d K %d F %d \n", *Zout, *K, *F); + printf("C %d, K %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*K,Bprime>>3,Bprime,*F); #endif if ((input_buffer) && (output_buffers)) { - for (k=0; k<*F>>3; k++) { - output_buffers[0][k] = 0; - } - s=0; for (r=0; r<*C; r++) { - //if (r<(B%(*C))) - Kprime = *Kplus; - //else - // Kprime = *Kminus; + Kprime = Bprime_by_C; while (k<((Kprime - L)>>3)) { output_buffers[r][k] = input_buffer[s]; - // printf("encoding segment %d : byte %d (%d) => %d\n",r,k,Kr>>3,input_buffer[s]); + //printf("encoding segment %d : byte %d (%d) => %d\n",r,k,(Kprime-L)>>3,input_buffer[s]); k++; s++; } - /* - if (*C > 1) { // add CRC - crc = crc24b(output_buffers[r],Kprime-24)>>8; - output_buffers[r][(Kprime-24)>>3] = ((uint8_t*)&crc)[2]; - output_buffers[r][1+((Kprime-24)>>3)] = ((uint8_t*)&crc)[1]; - output_buffers[r][2+((Kprime-24)>>3)] = ((uint8_t*)&crc)[0]; + if (*F>0) + for (k=Kprime>>3; k<(*K)>>3; k++) { + output_buffers[r][k] = NR_NULL; + //printf("r %d filler bits [%d] = %d Kprime %d \n", r,k, output_buffers[r][k], Kprime); } - */ + + if (*C > 1) { // add CRC + crc = crc24b(output_buffers[r],Kprime-L)>>8; + output_buffers[r][(Kprime-L)>>3] = ((uint8_t*)&crc)[2]; + output_buffers[r][1+((Kprime-L)>>3)] = ((uint8_t*)&crc)[1]; + output_buffers[r][2+((Kprime-L)>>3)] = ((uint8_t*)&crc)[0]; + } + k=0; } } @@ -192,12 +179,12 @@ else main() { - unsigned int Kplus,Kminus,C,F,Bbytes; + unsigned int K,C,F,Bbytes, Zout; for (Bbytes=5; Bbytes<8; Bbytes++) { - nr_segmentation(0,0,Bbytes<<3,&C,&Kplus,&Kminus, &F); - printf("Bbytes %d : C %d, Kplus %d, Kminus %d, F %d\n", - Bbytes, C, Kplus, Kminus, F); + nr_segmentation(0,0,Bbytes<<3,&C,&K,&Zout, &F); + printf("Bbytes %d : C %d, K %d, F %d\n", + Bbytes, C, K, F); } } #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h index 69d8aedf51..3c318874ac 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h @@ -33,9 +33,15 @@ #ifndef __NR_TRANSPORT_COMMON_PROTO__H__ #define __NR_TRANSPORT_COMMON_PROTO__H__ -#define MAX_NUM_NR_DLSCH_SEGMENTS 30 +#define MAX_NUM_NR_DLSCH_SEGMENTS 32 #define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS +#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) +#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) + +#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*6) // 14 symbols, 273 RB +#define MAX_NUM_NR_RE (14*273*12) + // Functions below implement minor procedures from 38-214 /** \brief Computes Q based on I_MCS PDSCH and when 'MCS-Table-PDSCH' is set to "256QAM". Implements Table 5.1.3.1-2 from 38.214. diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 245f7dcaad..ec7c01031c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -136,17 +136,17 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint if (abstraction_flag == 0) { for (r=0; rharq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 1056); + dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(1056); if (dlsch->harq_processes[i]->c[r]) - memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 1056); + memset(dlsch->harq_processes[i]->c[r],0,1056); else exit_flag=2; - dlsch->harq_processes[i]->d[r] = (short*)malloc16(((3*8*8448)+12+96)*sizeof(short)); + dlsch->harq_processes[i]->d[r] = (short*)malloc16((3*8448)*sizeof(short)); if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,((3*8*8448)+12+96)*sizeof(short)); + memset(dlsch->harq_processes[i]->d[r],0,(3*8448)*sizeof(short)); else exit_flag=2; } @@ -187,9 +187,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, uint32_t G; uint32_t ret,offset; int32_t no_iteration_ldpc; - // uint8_t dummy_channel_output[(3*8*block_length)+12]; - short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)]; - uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0, Kr_int; + //short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)]; + uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0; uint8_t crc_type; t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params* p_decParams = &decParams; @@ -199,14 +198,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int8_t l [68*384]; //__m128i l; int16_t inv_d [68*384]; - int16_t *p_invd =&inv_d; +// int16_t *p_invd =&inv_d; uint8_t kb, kc; uint8_t Ilbrm = 0; uint32_t Tbslbrm = 950984; //to compute tbs uint16_t nb_prb = 106; //to update uint32_t i,j; - uint32_t k; +// uint32_t k; __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; @@ -269,18 +268,17 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, NULL, harq_process->B, &harq_process->C, - &harq_process->Kplus, - &harq_process->Kminus, - &harq_process->Z, + &harq_process->K, + &harq_process->Z, &harq_process->F); - p_decParams->Z = harq_process->Z; + p_decParams->Z = harq_process->Z; //printf("dlsch decoding nr segmentation Z %d\n", p_decParams->Z); //if (!frame%100) - //printf("Kplus %d C %d Z %d nl %d \n", harq_process->Kplus, harq_process->C, p_decParams->Z, harq_process->Nl); + //printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); } - kb = harq_process->Kplus/harq_process->Z; + kb = harq_process->K/harq_process->Z; if ( kb==22){ p_decParams->BG = 1; p_decParams->R = 13; @@ -303,15 +301,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, unsigned char bw_scaling =1; switch (frame_parms->N_RB_DL) { - case 6: - bw_scaling =16; - break; - case 25: - bw_scaling =4; - break; - - case 50: + case 106: bw_scaling =2; break; @@ -320,25 +311,23 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, break; } - if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) { - LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling); + if (harq_process->C > MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling) { + LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling); return((1+dlsch->max_ldpc_iterations)); } #ifdef DEBUG_DLSCH_DECODING - printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus); + printf("Segmentation: C %d, Cminus %d, Kminus %d, K %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->K); #endif opp_enabled=1; - Kr = harq_process->Kplus; + Kr = harq_process->K; Kr_bytes = Kr>>3; Tbslbrm = nr_compute_tbs(harq_process->mcs,nb_prb,frame_parms->symbols_per_slot,0,0, harq_process->Nl); for (r=0; rC; r++) { - Kr = harq_process->Kplus; - #if UE_TIMING_TRACE start_meas(dlsch_rate_unmatching_stats); #endif @@ -400,16 +389,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, stop_meas(dlsch_deinterleaving_stats); #endif #ifdef DEBUG_DLSCH_DECODING - /* + if (r==0) { write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); - write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0); + write_output("decoder_in.m","dec",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,0); } printf("decoder input(segment %d) :",r); int i; for (i=0;i<(3*8*Kr_bytes)+12;i++) - printf("%d : %d\n",i,harq_process->d[r][96+i]); - printf("\n");*/ + printf("%d : %d\n",i,harq_process->d[r][i]); + printf("\n"); #endif @@ -440,7 +429,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, //if (A < 1000){ for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){ - inv_d[cnt] = (-1)*harq_process->d[r][96+cnt]; + inv_d[cnt] = (-1)*harq_process->d[r][cnt]; } //} @@ -589,6 +578,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // Reassembly of Transport block here offset = 0; + Kr = harq_process->K; + Kr_bytes = Kr>>3; /* printf("harq_pid %d\n",harq_pid); @@ -597,27 +588,21 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, */ for (r=0; rC; r++) { - Kr = harq_process->Kplus; - Kr_bytes = Kr>>3; - - // printf("Segment %d : Kr= %d bytes\n",r,Kr_bytes); - if (r==0) { - memcpy(harq_process->b, - &harq_process->c[0][(harq_process->F>>3)], - Kr_bytes - (harq_process->F>>3)- ((harq_process->C>1)?3:0)); - offset = Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0); - // printf("copied %d bytes to b sequence (harq_pid %d)\n", - // Kr_bytes - (harq_process->F>>3),harq_pid); - // printf("b[0] = %x,c[%d] = %x\n", - // harq_process->b[0], - // harq_process->F>>3, - // harq_process->c[0][(harq_process->F>>3)]); - } else { - memcpy(harq_process->b+offset, + memcpy(harq_process->b+offset, harq_process->c[r], - Kr_bytes- ((harq_process->C>1)?3:0)); - offset += (Kr_bytes - ((harq_process->C>1)?3:0)); - } + Kr_bytes- - (harq_process->F>>3) -((harq_process->C>1)?3:0)); + offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); + +#ifdef DEBUG_DLSCH_DECODING + printf("Segment %d : Kr= %d bytes\n",r,Kr_bytes); + printf("copied %d bytes to b sequence (harq_pid %d)\n", + (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); + printf("b[0] = %x,c[%d] = %x\n", + harq_process->b[offset], + harq_process->F>>3, + harq_process->c[r]); +#endif + } dlsch->last_iteration_cnt = ret; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 4bcd8400aa..ccbee1feee 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -105,8 +105,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t **dlsch; int avg[4]; - int avg_0[2]; - int avg_1[2]; +// int avg_0[2]; +// int avg_1[2]; #if UE_TIMING_TRACE uint8_t slot = 0; @@ -115,7 +115,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, unsigned char aatx,aarx; unsigned short nb_rb = 0, round; - int avgs = 0, rb; + int avgs = 0;// rb; NR_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; uint8_t beamforming_mode; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 865658e941..b274f822a3 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -816,7 +816,7 @@ uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, @param output_shift Rescaling for compensated output (should be energy-normalizing) @param phy_measurements Pointer to UE PHY measurements */ -void dlsch_channel_compensation(int32_t **rxdataF_ext, +void nr_dlsch_channel_compensation(int32_t **rxdataF_ext, int32_t **dl_ch_estimates_ext, int32_t **dl_ch_mag, int32_t **dl_ch_magb, @@ -937,7 +937,7 @@ void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms, @param pilots_flag Flag to indicate pilots in symbol @param nb_rb Number of allocated RBs */ -void dlsch_channel_level(int32_t **dl_ch_estimates_ext, +void nr_dlsch_channel_level(int32_t **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, int32_t *avg, uint8_t pilots_flag, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 25f21000e6..eccde44c22 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -34,10 +34,7 @@ #include #include "PHY/impl_defs_top.h" //#include "PHY/defs_nr_UE.h" -//#include "../LTE_TRANSPORT/dci.h" -//#include "../LTE_TRANSPORT/mdci.h" -//#include "../LTE_TRANSPORT/uci_common.h" -//#include "../LTE_TRANSPORT/transport_common.h" +#include "../NR_TRANSPORT/nr_transport_common_proto.h" #ifndef STANDALONE_COMPILE #include "UTIL/LISTS/list.h" #endif @@ -105,39 +102,31 @@ typedef struct { uint8_t *b; /// Pointers to transport block segments uint8_t *c[MAX_NUM_ULSCH_SEGMENTS]; - /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) - uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS]; /// Index of current HARQ round for this ULSCH uint8_t round; /// MCS format of this ULSCH uint8_t mcs; /// Redundancy-version of the current sub-frame uint8_t rvidx; - /// Turbo-code outputs (36-212 V8.6 2009-03, p.12 - uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))]; - /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) - uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144]; - /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) + /// LDPC-code outputs + uint8_t d[MAX_NUM_ULSCH_SEGMENTS][3*8448]; + /// Interleaver outputs + uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*8448]; + /// Number of code segments uint32_t C; - /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cminus; - /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kplus; + /// Number of bits in code segments + uint32_t K; /// Total number of bits across all segments uint32_t sumKr; - /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) + /// Number of "Filler" bits uint32_t F; - /// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27) + /// Msc_initial, Initial number of subcarriers for ULSCH uint16_t Msc_initial; - /// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27) + /// Nsymb_initial, Initial number of symbols for ULSCH uint8_t Nsymb_initial; - /// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) + /// n_DMRS for cyclic shift of DMRS uint8_t n_DMRS; - /// n_DMRS2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1) + /// n_DMRS2 for cyclic shift of DMRS uint8_t n_DMRS2; /// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU) uint8_t control_only; @@ -243,9 +232,7 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; - /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) - uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS]; + uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; /// Index of current HARQ round for this DLSCH uint8_t round; /// MCS format for this DLSCH @@ -257,26 +244,20 @@ typedef struct { /// MIMO mode for this DLSCH MIMO_mode_t mimo_mode; /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; + int16_t w[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - double w_abs[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; + double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *d[MAX_NUM_DLSCH_SEGMENTS]; - /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) + int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; + /// Number of code segments uint32_t C; - /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cminus; - /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kplus; - /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) + /// Number of bits in code segments + uint32_t K; + /// Number of "Filler" bits uint32_t F; /// LDPC lifting factor uint32_t Z; - /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17) + /// Number of MIMO layers (streams) uint8_t Nl; /// current delta_pucch int8_t delta_PUCCH; @@ -333,8 +314,6 @@ typedef struct { uint32_t cqi_alloc2; /// saved subband PMI allocation from last PUSCH/PUCCH report uint16_t pmi_alloc; -//#if defined(UPGRADE_RAT_NR) -#if 1 /// Pointers to up to HARQ processes NR_DL_UE_HARQ_t *harq_processes[NR_MAX_DLSCH_HARQ_PROCESSES]; // DL number of harq processes @@ -343,7 +322,6 @@ typedef struct { uint8_t Number_MCS_HARQ_DL_DCI; /* spatial bundling of PUCCH */ uint8_t HARQ_ACK_spatial_bundling_PUCCH; -#endif /// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17 uint8_t Mdlharq; /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index b089cfb60f..49f4d94305 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -37,7 +37,7 @@ #include "defs_nr_common.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" - +#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" typedef struct { uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3]; @@ -66,7 +66,7 @@ typedef struct { typedef struct { -/* /// Status Flag indicating for this DLSCH (idle,active,disabled) + /// Status Flag indicating for this DLSCH (idle,active,disabled) //SCH_status_t status; /// Transport block size uint32_t TBS; @@ -77,9 +77,7 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; - /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) - uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS]; + uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; /// Frame where current HARQ round was sent uint32_t frame; /// Subframe where current HARQ round was sent @@ -114,49 +112,41 @@ typedef struct { uint8_t dl_power_off; /// start symbold of pdsch uint8_t pdsch_start; - /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) - uint8_t e[MAX_NUM_CHANNEL_BITS] __attribute__((aligned(32))); - /// Turbo-code outputs (36-212 V8.6 2009-03, p.12 - uint8_t *d[MAX_NUM_DLSCH_SEGMENTS];//[(96+3+(3*6144))]; - /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) - uint8_t w[MAX_NUM_DLSCH_SEGMENTS][3*6144]; - /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) + /// Concatenated sequences + uint8_t e[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32))); + /// LDPC-code outputs + uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; + /// Interleaver outputs + uint8_t f[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32))); + /// Number of code segments uint32_t C; - /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cminus; - /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kplus; - /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) + /// Number of bits in "small" code segments + uint32_t K; + /// Number of "Filler" bits uint32_t F; - /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17, TM3-4) + /// Number of MIMO layers (streams) uint8_t Nl; /// Number of layers for this PDSCH transmission (TM8-10) uint8_t Nlayers; /// First layer for this PSCH transmission uint8_t first_layer; /// codeword this transport block is mapped to - uint8_t codeword;*/ + uint8_t codeword; } NR_DL_gNB_HARQ_t; typedef struct { /// Pointers to 8 HARQ processes for the DLSCH - LTE_DL_eNB_HARQ_t *harq_processes[8]; + NR_DL_gNB_HARQ_t *harq_processes[8]; nfapi_nr_pdsch_time_domain_alloc_type_e time_alloc_type; uint8_t time_alloc_list_flag; uint8_t rbg_list[NR_MAX_NB_RBG]; - -//LTE remainders to be removed -/* /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) + /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) int32_t *txdataF[8]; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? - int32_t **ue_spec_bf_weights[4]; + int32_t **ue_spec_bf_weights[4]; /// dl channel estimates (estimated from ul channel estimates) int32_t **calib_dl_ch_estimates; /// Allocated RNTI (0 means DLSCH_t is not currently used) @@ -175,16 +165,15 @@ typedef struct { uint8_t ra_window_size; /// First-round error threshold for fine-grain rate adaptation uint8_t error_threshold; - /// Number of soft channel bits uint32_t G; /// Codebook index for this dlsch (0,1,2,3) uint8_t codebook_index; - /// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17) + /// Maximum number of HARQ processes uint8_t Mdlharq; /// Maximum number of HARQ rounds uint8_t Mlimit; - /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) + /// MIMO transmission mode indicator for this sub-frame uint8_t Kmimo; /// Nsoft parameter related to UE Category uint32_t Nsoft; @@ -192,13 +181,6 @@ typedef struct { int16_t sqrt_rho_a; /// amplitude of PDSCH (compared to RS) in symbols containing pilots int16_t sqrt_rho_b; -#ifdef Rel14 - /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling - uint8_t sib1_br_flag; - /// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling - uint16_t i0; - CEmode_t CEmode; -#endif*/ } NR_gNB_DLSCH_t; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 3885ee93e6..93cea42bce 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -3980,13 +3980,10 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t { harq_processes_dest->B = current_harq_processes->B ; harq_processes_dest->C = current_harq_processes->C ; - harq_processes_dest->Cminus = current_harq_processes->Cminus ; - harq_processes_dest->Cplus = current_harq_processes->Cplus ; harq_processes_dest->DCINdi = current_harq_processes->DCINdi ; harq_processes_dest->F = current_harq_processes->F ; harq_processes_dest->G = current_harq_processes->G ; - harq_processes_dest->Kminus = current_harq_processes->Kminus ; - harq_processes_dest->Kplus = current_harq_processes->Kplus ; + harq_processes_dest->K = current_harq_processes->K ; harq_processes_dest->Nl = current_harq_processes->Nl ; harq_processes_dest->Qm = current_harq_processes->Qm ; harq_processes_dest->TBS = current_harq_processes->TBS ;