Commit 83503489 authored by Hongzhi Wang's avatar Hongzhi Wang

update nr segmentation

parent e0757069
...@@ -438,8 +438,7 @@ int32_t nr_segmentation(unsigned char *input_buffer, ...@@ -438,8 +438,7 @@ int32_t nr_segmentation(unsigned char *input_buffer,
unsigned char **output_buffers, unsigned char **output_buffers,
unsigned int B, unsigned int B,
unsigned int *C, unsigned int *C,
unsigned int *Kplus, unsigned int *K,
unsigned int *Kminus,
unsigned int *Zout, unsigned int *Zout,
unsigned int *F); unsigned int *F);
...@@ -452,7 +451,7 @@ uint32_t nr_compute_tbs(uint8_t mcs, ...@@ -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_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 nr_rate_matching_ldpc(uint8_t Ilbrm,
uint32_t Tbslbrm, uint32_t Tbslbrm,
......
...@@ -48,7 +48,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) ...@@ -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; uint32_t EQm;
......
...@@ -33,8 +33,7 @@ int32_t nr_segmentation(unsigned char *input_buffer, ...@@ -33,8 +33,7 @@ int32_t nr_segmentation(unsigned char *input_buffer,
unsigned char **output_buffers, unsigned char **output_buffers,
unsigned int B, unsigned int B,
unsigned int *C, unsigned int *C,
unsigned int *Kplus, unsigned int *K,
unsigned int *Kminus,
unsigned int *Zout, unsigned int *Zout,
unsigned int *F) unsigned int *F)
{ {
...@@ -59,13 +58,13 @@ int32_t nr_segmentation(unsigned char *input_buffer, ...@@ -59,13 +58,13 @@ int32_t nr_segmentation(unsigned char *input_buffer,
} }
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) { 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); return(-1);
} }
// Find K+ // Find K+
Bprime_by_C = Bprime/(*C); Bprime_by_C = Bprime/(*C);
/*if (Bprime <=192) { if (Bprime <=192) {
Kb = 6; Kb = 6;
} else if (Bprime <=560) { } else if (Bprime <=560) {
Kb = 8; Kb = 8;
...@@ -73,9 +72,9 @@ int32_t nr_segmentation(unsigned char *input_buffer, ...@@ -73,9 +72,9 @@ int32_t nr_segmentation(unsigned char *input_buffer,
Kb = 9; Kb = 9;
} else if (Bprime <=3840) { } else if (Bprime <=3840) {
Kb = 10;; Kb = 10;;
} else {*/ } else {
Kb = 22; Kb = 22;
//} }
if ((Bprime_by_C%Kb) > 0) if ((Bprime_by_C%Kb) > 0)
...@@ -88,97 +87,85 @@ else ...@@ -88,97 +87,85 @@ else
#endif #endif
if (Z <= 2) { if (Z <= 2) {
*Kplus = 2; *K = 2;
*Kminus = 0;
} else if (Z<=16) { // increase by 1 byte til here } else if (Z<=16) { // increase by 1 byte til here
*Kplus = Z; *K = Z;
*Kminus = Z-1;
} else if (Z <=32) { // increase by 2 bytes til here } else if (Z <=32) { // increase by 2 bytes til here
*Kplus = (Z>>1)<<1; *K = (Z>>1)<<1;
if (*Kplus < Z) if (*K < Z)
*Kplus = *Kplus + 2; *K = *K + 2;
*Kminus = (*Kplus - 2);
} else if (Z <= 64) { // increase by 4 bytes til here } else if (Z <= 64) { // increase by 4 bytes til here
*Kplus = (Z>>2)<<2; *K = (Z>>2)<<2;
if (*Kplus < Z) if (*K < Z)
*Kplus = *Kplus + 4; *K = *K + 4;
*Kminus = (*Kplus - 4);
} else if (Z <=128 ) { // increase by 8 bytes til here } else if (Z <=128 ) { // increase by 8 bytes til here
*Kplus = (Z>>3)<<3; *K = (Z>>3)<<3;
if (*Kplus < Z) if (*K < Z)
*Kplus = *Kplus + 8; *K = *K + 8;
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("Z_by_C %d , Kplus2 %d\n",Z,*Kplus); printf("Z_by_C %d , K2 %d\n",Z,*K);
#endif #endif
*Kminus = (*Kplus - 8);
} else if (Z <= 256) { // increase by 4 bytes til here } else if (Z <= 256) { // increase by 4 bytes til here
*Kplus = (Z>>4)<<4; *K = (Z>>4)<<4;
if (*Kplus < Z) if (*K < Z)
*Kplus = *Kplus + 16; *K = *K + 16;
*Kminus = (*Kplus - 16);
} else if (Z <= 384) { // increase by 4 bytes til here } else if (Z <= 384) { // increase by 4 bytes til here
*Kplus = (Z>>5)<<5; *K = (Z>>5)<<5;
if (*Kplus < Z) if (*K < Z)
*Kplus = *Kplus + 32; *K = *K + 32;
*Kminus = (*Kplus - 32);
} else { } else {
//msg("nr_segmentation.c: Illegal codeword size !!!\n"); //msg("nr_segmentation.c: Illegal codeword size !!!\n");
return(-1); return(-1);
} }
*Zout = *Kplus; *Zout = *K;
*Kplus = *Kplus*Kb; *K = *K*Kb;
*Kminus = *Kminus*Kb;
*F = ((*K) - Bprime_by_C);
*F = ((*C)*(*Kplus) - (Bprime));
#ifdef DEBUG_SEGMENTATION #ifdef DEBUG_SEGMENTATION
printf("final nr seg output Z %d Kplus %d F %d \n", *Zout, *Kplus, *F); printf("final nr seg output Z %d K %d F %d \n", *Zout, *K, *F);
printf("C %d, Kplus %d, Kminus %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*Kplus,*Kminus,Bprime>>3,Bprime,*F); printf("C %d, K %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*K,Bprime>>3,Bprime,*F);
#endif #endif
if ((input_buffer) && (output_buffers)) { if ((input_buffer) && (output_buffers)) {
for (k=0; k<*F>>3; k++) {
output_buffers[0][k] = 0;
}
s=0; s=0;
for (r=0; r<*C; r++) { for (r=0; r<*C; r++) {
//if (r<(B%(*C))) Kprime = Bprime_by_C;
Kprime = *Kplus;
//else
// Kprime = *Kminus;
while (k<((Kprime - L)>>3)) { while (k<((Kprime - L)>>3)) {
output_buffers[r][k] = input_buffer[s]; 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++; k++;
s++; s++;
} }
/* 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 if (*C > 1) { // add CRC
crc = crc24b(output_buffers[r],Kprime-24)>>8; crc = crc24b(output_buffers[r],Kprime-L)>>8;
output_buffers[r][(Kprime-24)>>3] = ((uint8_t*)&crc)[2]; output_buffers[r][(Kprime-L)>>3] = ((uint8_t*)&crc)[2];
output_buffers[r][1+((Kprime-24)>>3)] = ((uint8_t*)&crc)[1]; output_buffers[r][1+((Kprime-L)>>3)] = ((uint8_t*)&crc)[1];
output_buffers[r][2+((Kprime-24)>>3)] = ((uint8_t*)&crc)[0]; output_buffers[r][2+((Kprime-L)>>3)] = ((uint8_t*)&crc)[0];
} }
*/
k=0; k=0;
} }
} }
...@@ -192,12 +179,12 @@ else ...@@ -192,12 +179,12 @@ else
main() main()
{ {
unsigned int Kplus,Kminus,C,F,Bbytes; unsigned int K,C,F,Bbytes, Zout;
for (Bbytes=5; Bbytes<8; Bbytes++) { for (Bbytes=5; Bbytes<8; Bbytes++) {
nr_segmentation(0,0,Bbytes<<3,&C,&Kplus,&Kminus, &F); nr_segmentation(0,0,Bbytes<<3,&C,&K,&Zout, &F);
printf("Bbytes %d : C %d, Kplus %d, Kminus %d, F %d\n", printf("Bbytes %d : C %d, K %d, F %d\n",
Bbytes, C, Kplus, Kminus, F); Bbytes, C, K, F);
} }
} }
#endif #endif
...@@ -33,9 +33,15 @@ ...@@ -33,9 +33,15 @@
#ifndef __NR_TRANSPORT_COMMON_PROTO__H__ #ifndef __NR_TRANSPORT_COMMON_PROTO__H__
#define __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_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 // 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. /** \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.
......
...@@ -136,17 +136,17 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -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) { if (abstraction_flag == 0) {
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) { for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
dlsch->harq_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]) 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 else
exit_flag=2; 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]) 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 else
exit_flag=2; exit_flag=2;
} }
...@@ -187,9 +187,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -187,9 +187,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint32_t G; uint32_t G;
uint32_t ret,offset; uint32_t ret,offset;
int32_t no_iteration_ldpc; 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)];
short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)]; uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0;
uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0, Kr_int;
uint8_t crc_type; uint8_t crc_type;
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
...@@ -199,14 +198,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -199,14 +198,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
int8_t l [68*384]; int8_t l [68*384];
//__m128i l; //__m128i l;
int16_t inv_d [68*384]; int16_t inv_d [68*384];
int16_t *p_invd =&inv_d; // int16_t *p_invd =&inv_d;
uint8_t kb, kc; uint8_t kb, kc;
uint8_t Ilbrm = 0; uint8_t Ilbrm = 0;
uint32_t Tbslbrm = 950984; //to compute tbs uint32_t Tbslbrm = 950984; //to compute tbs
uint16_t nb_prb = 106; //to update uint16_t nb_prb = 106; //to update
uint32_t i,j; uint32_t i,j;
uint32_t k; // uint32_t k;
__m128i *pv = (__m128i*)&z; __m128i *pv = (__m128i*)&z;
__m128i *pl = (__m128i*)&l; __m128i *pl = (__m128i*)&l;
...@@ -269,18 +268,17 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -269,18 +268,17 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
NULL, NULL,
harq_process->B, harq_process->B,
&harq_process->C, &harq_process->C,
&harq_process->Kplus, &harq_process->K,
&harq_process->Kminus,
&harq_process->Z, &harq_process->Z,
&harq_process->F); &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); //printf("dlsch decoding nr segmentation Z %d\n", p_decParams->Z);
//if (!frame%100) //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){ if ( kb==22){
p_decParams->BG = 1; p_decParams->BG = 1;
p_decParams->R = 13; p_decParams->R = 13;
...@@ -303,15 +301,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -303,15 +301,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
unsigned char bw_scaling =1; unsigned char bw_scaling =1;
switch (frame_parms->N_RB_DL) { 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; bw_scaling =2;
break; break;
...@@ -320,25 +311,23 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -320,25 +311,23 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
break; break;
} }
if (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_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)); return((1+dlsch->max_ldpc_iterations));
} }
#ifdef DEBUG_DLSCH_DECODING #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 #endif
opp_enabled=1; opp_enabled=1;
Kr = harq_process->Kplus; Kr = harq_process->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
Tbslbrm = nr_compute_tbs(harq_process->mcs,nb_prb,frame_parms->symbols_per_slot,0,0, harq_process->Nl); Tbslbrm = nr_compute_tbs(harq_process->mcs,nb_prb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
Kr = harq_process->Kplus;
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(dlsch_rate_unmatching_stats); start_meas(dlsch_rate_unmatching_stats);
#endif #endif
...@@ -400,16 +389,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -400,16 +389,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
stop_meas(dlsch_deinterleaving_stats); stop_meas(dlsch_deinterleaving_stats);
#endif #endif
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
/*
if (r==0) { if (r==0) {
write_output("decoder_llr.m","decllr",dlsch_llr,G,1,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); printf("decoder input(segment %d) :",r);
int i; for (i=0;i<(3*8*Kr_bytes)+12;i++) int i; for (i=0;i<(3*8*Kr_bytes)+12;i++)
printf("%d : %d\n",i,harq_process->d[r][96+i]); printf("%d : %d\n",i,harq_process->d[r][i]);
printf("\n");*/ printf("\n");
#endif #endif
...@@ -440,7 +429,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -440,7 +429,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//if (A < 1000){ //if (A < 1000){
for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){ 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, ...@@ -589,6 +578,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// Reassembly of Transport block here // Reassembly of Transport block here
offset = 0; offset = 0;
Kr = harq_process->K;
Kr_bytes = Kr>>3;
/* /*
printf("harq_pid %d\n",harq_pid); printf("harq_pid %d\n",harq_pid);
...@@ -597,27 +588,21 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -597,27 +588,21 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
*/ */
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; 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], harq_process->c[r],
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->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; dlsch->last_iteration_cnt = ret;
......
...@@ -105,8 +105,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -105,8 +105,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
NR_UE_DLSCH_t **dlsch; NR_UE_DLSCH_t **dlsch;
int avg[4]; int avg[4];
int avg_0[2]; // int avg_0[2];
int avg_1[2]; // int avg_1[2];
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
uint8_t slot = 0; uint8_t slot = 0;
...@@ -115,7 +115,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -115,7 +115,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
unsigned char aatx,aarx; unsigned char aatx,aarx;
unsigned short nb_rb = 0, round; unsigned short nb_rb = 0, round;
int avgs = 0, rb; int avgs = 0;// rb;
NR_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; NR_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0;
uint8_t beamforming_mode; uint8_t beamforming_mode;
......
...@@ -816,7 +816,7 @@ uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, ...@@ -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 output_shift Rescaling for compensated output (should be energy-normalizing)
@param phy_measurements Pointer to UE PHY measurements @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_estimates_ext,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
int32_t **dl_ch_magb, int32_t **dl_ch_magb,
...@@ -937,7 +937,7 @@ void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms, ...@@ -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 pilots_flag Flag to indicate pilots in symbol
@param nb_rb Number of allocated RBs @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, NR_DL_FRAME_PARMS *frame_parms,
int32_t *avg, int32_t *avg,
uint8_t pilots_flag, uint8_t pilots_flag,
......
...@@ -34,10 +34,7 @@ ...@@ -34,10 +34,7 @@
#include <limits.h> #include <limits.h>
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
//#include "PHY/defs_nr_UE.h" //#include "PHY/defs_nr_UE.h"
//#include "../LTE_TRANSPORT/dci.h" #include "../NR_TRANSPORT/nr_transport_common_proto.h"
//#include "../LTE_TRANSPORT/mdci.h"
//#include "../LTE_TRANSPORT/uci_common.h"
//#include "../LTE_TRANSPORT/transport_common.h"
#ifndef STANDALONE_COMPILE #ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h" #include "UTIL/LISTS/list.h"
#endif #endif
...@@ -105,39 +102,31 @@ typedef struct { ...@@ -105,39 +102,31 @@ typedef struct {
uint8_t *b; uint8_t *b;
/// Pointers to transport block segments /// Pointers to transport block segments
uint8_t *c[MAX_NUM_ULSCH_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 /// Index of current HARQ round for this ULSCH
uint8_t round; uint8_t round;
/// MCS format of this ULSCH /// MCS format of this ULSCH
uint8_t mcs; uint8_t mcs;
/// Redundancy-version of the current sub-frame /// Redundancy-version of the current sub-frame
uint8_t rvidx; uint8_t rvidx;
/// Turbo-code outputs (36-212 V8.6 2009-03, p.12 /// LDPC-code outputs
uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))]; uint8_t d[MAX_NUM_ULSCH_SEGMENTS][3*8448];
/// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) /// Interleaver outputs
uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144]; uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*8448];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) /// Number of code segments
uint32_t C; uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) /// Number of bits in code segments
uint32_t Cminus; uint32_t K;
/// 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;
/// Total number of bits across all segments /// Total number of bits across all segments
uint32_t sumKr; 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; 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; 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; 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; 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; uint8_t n_DMRS2;
/// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU) /// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU)
uint8_t control_only; uint8_t control_only;
...@@ -243,9 +232,7 @@ typedef struct { ...@@ -243,9 +232,7 @@ typedef struct {
/// Pointer to the payload /// Pointer to the payload
uint8_t *b; uint8_t *b;
/// Pointers to transport block segments /// Pointers to transport block segments
uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; uint8_t *c[MAX_NUM_NR_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];
/// Index of current HARQ round for this DLSCH /// Index of current HARQ round for this DLSCH
uint8_t round; uint8_t round;
/// MCS format for this DLSCH /// MCS format for this DLSCH
...@@ -257,26 +244,20 @@ typedef struct { ...@@ -257,26 +244,20 @@ typedef struct {
/// MIMO mode for this DLSCH /// MIMO mode for this DLSCH
MIMO_mode_t mimo_mode; MIMO_mode_t mimo_mode;
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) /// 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) /// 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) /// 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]; int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) /// Number of code segments
uint32_t C; uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) /// Number of bits in code segments
uint32_t Cminus; uint32_t K;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) /// Number of "Filler" bits
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)
uint32_t F; uint32_t F;
/// LDPC lifting factor /// LDPC lifting factor
uint32_t Z; 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; uint8_t Nl;
/// current delta_pucch /// current delta_pucch
int8_t delta_PUCCH; int8_t delta_PUCCH;
...@@ -333,8 +314,6 @@ typedef struct { ...@@ -333,8 +314,6 @@ typedef struct {
uint32_t cqi_alloc2; uint32_t cqi_alloc2;
/// saved subband PMI allocation from last PUSCH/PUCCH report /// saved subband PMI allocation from last PUSCH/PUCCH report
uint16_t pmi_alloc; uint16_t pmi_alloc;
//#if defined(UPGRADE_RAT_NR)
#if 1
/// Pointers to up to HARQ processes /// Pointers to up to HARQ processes
NR_DL_UE_HARQ_t *harq_processes[NR_MAX_DLSCH_HARQ_PROCESSES]; NR_DL_UE_HARQ_t *harq_processes[NR_MAX_DLSCH_HARQ_PROCESSES];
// DL number of harq processes // DL number of harq processes
...@@ -343,7 +322,6 @@ typedef struct { ...@@ -343,7 +322,6 @@ typedef struct {
uint8_t Number_MCS_HARQ_DL_DCI; uint8_t Number_MCS_HARQ_DL_DCI;
/* spatial bundling of PUCCH */ /* spatial bundling of PUCCH */
uint8_t HARQ_ACK_spatial_bundling_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 /// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq; uint8_t Mdlharq;
/// 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 (for definition see 36-212 V8.6 2009-03, p.17)
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "defs_nr_common.h" #include "defs_nr_common.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
typedef struct { typedef struct {
uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3]; uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
...@@ -66,7 +66,7 @@ typedef struct { ...@@ -66,7 +66,7 @@ typedef struct {
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; //SCH_status_t status;
/// Transport block size /// Transport block size
uint32_t TBS; uint32_t TBS;
...@@ -77,9 +77,7 @@ typedef struct { ...@@ -77,9 +77,7 @@ typedef struct {
/// Pointer to the payload /// Pointer to the payload
uint8_t *b; uint8_t *b;
/// Pointers to transport block segments /// Pointers to transport block segments
uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; uint8_t *c[MAX_NUM_NR_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];
/// Frame where current HARQ round was sent /// Frame where current HARQ round was sent
uint32_t frame; uint32_t frame;
/// Subframe where current HARQ round was sent /// Subframe where current HARQ round was sent
...@@ -114,46 +112,38 @@ typedef struct { ...@@ -114,46 +112,38 @@ typedef struct {
uint8_t dl_power_off; uint8_t dl_power_off;
/// start symbold of pdsch /// start symbold of pdsch
uint8_t pdsch_start; uint8_t pdsch_start;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) /// Concatenated sequences
uint8_t e[MAX_NUM_CHANNEL_BITS] __attribute__((aligned(32))); uint8_t e[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32)));
/// Turbo-code outputs (36-212 V8.6 2009-03, p.12 /// LDPC-code outputs
uint8_t *d[MAX_NUM_DLSCH_SEGMENTS];//[(96+3+(3*6144))]; uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
/// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) /// Interleaver outputs
uint8_t w[MAX_NUM_DLSCH_SEGMENTS][3*6144]; uint8_t f[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32)));
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) /// Number of code segments
uint32_t C; uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) /// Number of bits in "small" code segments
uint32_t Cminus; uint32_t K;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) /// Number of "Filler" bits
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)
uint32_t F; 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; uint8_t Nl;
/// Number of layers for this PDSCH transmission (TM8-10) /// Number of layers for this PDSCH transmission (TM8-10)
uint8_t Nlayers; uint8_t Nlayers;
/// First layer for this PSCH transmission /// First layer for this PSCH transmission
uint8_t first_layer; uint8_t first_layer;
/// codeword this transport block is mapped to /// codeword this transport block is mapped to
uint8_t codeword;*/ uint8_t codeword;
} NR_DL_gNB_HARQ_t; } NR_DL_gNB_HARQ_t;
typedef struct { typedef struct {
/// Pointers to 8 HARQ processes for the DLSCH /// 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; nfapi_nr_pdsch_time_domain_alloc_type_e time_alloc_type;
uint8_t time_alloc_list_flag; uint8_t time_alloc_list_flag;
uint8_t rbg_list[NR_MAX_NB_RBG]; uint8_t rbg_list[NR_MAX_NB_RBG];
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
//LTE remainders to be removed
/* /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8]; int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? /// 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];
...@@ -175,16 +165,15 @@ typedef struct { ...@@ -175,16 +165,15 @@ typedef struct {
uint8_t ra_window_size; uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation /// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold; uint8_t error_threshold;
/// Number of soft channel bits /// Number of soft channel bits
uint32_t G; uint32_t G;
/// Codebook index for this dlsch (0,1,2,3) /// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index; 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; uint8_t Mdlharq;
/// Maximum number of HARQ rounds /// Maximum number of HARQ rounds
uint8_t Mlimit; 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; uint8_t Kmimo;
/// Nsoft parameter related to UE Category /// Nsoft parameter related to UE Category
uint32_t Nsoft; uint32_t Nsoft;
...@@ -192,13 +181,6 @@ typedef struct { ...@@ -192,13 +181,6 @@ typedef struct {
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b; 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; } NR_gNB_DLSCH_t;
......
...@@ -3980,13 +3980,10 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t ...@@ -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->B = current_harq_processes->B ;
harq_processes_dest->C = current_harq_processes->C ; 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->DCINdi = current_harq_processes->DCINdi ;
harq_processes_dest->F = current_harq_processes->F ; harq_processes_dest->F = current_harq_processes->F ;
harq_processes_dest->G = current_harq_processes->G ; harq_processes_dest->G = current_harq_processes->G ;
harq_processes_dest->Kminus = current_harq_processes->Kminus ; harq_processes_dest->K = current_harq_processes->K ;
harq_processes_dest->Kplus = current_harq_processes->Kplus ;
harq_processes_dest->Nl = current_harq_processes->Nl ; harq_processes_dest->Nl = current_harq_processes->Nl ;
harq_processes_dest->Qm = current_harq_processes->Qm ; harq_processes_dest->Qm = current_harq_processes->Qm ;
harq_processes_dest->TBS = current_harq_processes->TBS ; harq_processes_dest->TBS = current_harq_processes->TBS ;
......
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