|
|
@@ -247,7 +247,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
x_im[1] = table_5_2_2_2_2_Im[u[1]];
|
|
|
|
x_im[1] = table_5_2_2_2_2_Im[u[1]];
|
|
|
|
|
|
|
|
|
|
|
|
int16_t xr[2][24] __attribute__((aligned(32)));
|
|
|
|
int16_t xr[2][24] __attribute__((aligned(32)));
|
|
|
|
int32_t xrtmag=0;
|
|
|
|
int64_t xrtmag=0;
|
|
|
|
uint8_t maxpos=0;
|
|
|
|
uint8_t maxpos=0;
|
|
|
|
uint8_t index=0;
|
|
|
|
uint8_t index=0;
|
|
|
|
memset((void*)xr[0],0,24*sizeof(int16_t));
|
|
|
|
memset((void*)xr[0],0,24*sizeof(int16_t));
|
|
|
@@ -272,10 +272,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int32_t corr_re[2],corr_im[2],temp,no_corr=0;
|
|
|
|
int32_t corr_re[2],corr_im[2],no_corr=0;
|
|
|
|
int32_t av_corr=0;
|
|
|
|
|
|
|
|
int seq_index;
|
|
|
|
int seq_index;
|
|
|
|
|
|
|
|
int64_t temp,av_corr=0;
|
|
|
|
for(i=0;i<nr_sequences;i++){
|
|
|
|
for(i=0;i<nr_sequences;i++){
|
|
|
|
for (l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
|
|
|
for (l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
|
|
|
corr_re[l]=0;corr_im[l]=0;
|
|
|
|
corr_re[l]=0;corr_im[l]=0;
|
|
|
@@ -292,21 +291,21 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NR_PUCCH_RX
|
|
|
|
//#ifdef DEBUG_NR_PUCCH_RX
|
|
|
|
printf("PUCCH IDFT = (%d,%d)=>%f\n",corr_re[0],corr_im[0],10*log10(corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0]));
|
|
|
|
LOG_I(PHY,"PUCCH IDFT = (%d,%d)=>%f\n",corr_re[0],corr_im[0],10*log10((double)corr_re[0]*corr_re[0] + (double)corr_im[0]*corr_im[0]));
|
|
|
|
if (l>1) printf("PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[1],corr_im[1],10*log10(corr_re[1]*corr_re[1] + corr_im[1]*corr_im[1]));
|
|
|
|
if (l>1) LOG_I(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[1],corr_im[1],10*log10((double)corr_re[1]*corr_re[1] + (double)corr_im[1]*corr_im[1]));
|
|
|
|
#endif
|
|
|
|
//#endif
|
|
|
|
if (pucch_pdu->freq_hop_flag == 0 && l==1) // non-coherent correlation
|
|
|
|
if (pucch_pdu->freq_hop_flag == 0 && l==1) // non-coherent correlation
|
|
|
|
temp=corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0];
|
|
|
|
temp=(int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0];
|
|
|
|
else if (pucch_pdu->freq_hop_flag == 0 && l==2) {
|
|
|
|
else if (pucch_pdu->freq_hop_flag == 0 && l==2) {
|
|
|
|
int32_t corr_re2 = corr_re[0]+corr_re[1];
|
|
|
|
int64_t corr_re2 = (int64_t)corr_re[0]+corr_re[1];
|
|
|
|
int32_t corr_im2 = corr_im[0]+corr_im[1];
|
|
|
|
int64_t corr_im2 = (int64_t)corr_im[0]+corr_im[1];
|
|
|
|
// coherent combining of 2 symbols and then complex modulus for single-frequency case
|
|
|
|
// coherent combining of 2 symbols and then complex modulus for single-frequency case
|
|
|
|
temp=corr_re2*corr_re2 + corr_im2*corr_im2;
|
|
|
|
temp=corr_re2*corr_re2 + corr_im2*corr_im2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pucch_pdu->freq_hop_flag == 1)
|
|
|
|
else if (pucch_pdu->freq_hop_flag == 1)
|
|
|
|
// full non-coherent combining of 2 symbols for frequency-hopping case
|
|
|
|
// full non-coherent combining of 2 symbols for frequency-hopping case
|
|
|
|
temp = corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0] + corr_re[1]*corr_re[1] + corr_im[1]*corr_im[1];
|
|
|
|
temp = (int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0] + (int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1];
|
|
|
|
else AssertFatal(1==0,"shouldn't happen\n");
|
|
|
|
else AssertFatal(1==0,"shouldn't happen\n");
|
|
|
|
|
|
|
|
|
|
|
|
av_corr+=temp;
|
|
|
|
av_corr+=temp;
|
|
|
@@ -319,7 +318,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
no_corr=(av_corr-xrtmag)/(nr_sequences-1)/l;
|
|
|
|
no_corr=(av_corr-xrtmag)/(nr_sequences-1)/l;
|
|
|
|
av_corr/=nr_sequences/l;
|
|
|
|
av_corr/=nr_sequences/l;
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t xrtmag_dB = dB_fixed(xrtmag);
|
|
|
|
uint8_t xrtmag_dB = dB_fixed64(xrtmag);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NR_PUCCH_RX
|
|
|
|
#ifdef DEBUG_NR_PUCCH_RX
|
|
|
|
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
|
|
|
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
|
|
@@ -364,8 +363,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
|
|
|
|
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
|
|
|
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
|
|
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
|
|
|
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
|
|
|
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
|
|
|
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n",
|
|
|
|
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d\n",
|
|
|
|
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
|
|
|
|
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB);
|
|
|
|
if (pucch_pdu->sr_flag == 1) {
|
|
|
|
if (pucch_pdu->sr_flag == 1) {
|
|
|
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
|
|
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
|
|
|
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
|
|
|
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
|
|
@@ -379,8 +378,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|
|
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
|
|
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
|
|
|
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
|
|
|
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
|
|
|
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
|
|
|
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
|
|
|
LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n",
|
|
|
|
LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d\n",
|
|
|
|
slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
|
|
|
|
slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB);
|
|
|
|
if (pucch_pdu->sr_flag == 1) {
|
|
|
|
if (pucch_pdu->sr_flag == 1) {
|
|
|
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
|
|
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
|
|
|
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
|
|
|
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
|
|
|