Commit cc64fef4 authored by Raymond Knopp's avatar Raymond Knopp

small change in ulsch_decoder to allow segment even if parity-check fails but CRC passes.

parent fdfd29a8
...@@ -55,7 +55,6 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_ ...@@ -55,7 +55,6 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_
t_nrLDPC_lut* p_lut = &lut; t_nrLDPC_lut* p_lut = &lut;
//printf("p_procBuf->cnProcBuf = %p\n", p_procBuf->cnProcBuf); //printf("p_procBuf->cnProcBuf = %p\n", p_procBuf->cnProcBuf);
// Initialize decoder core(s) with correct LUTs // Initialize decoder core(s) with correct LUTs
numLLR = nrLDPC_init(p_decParams, p_lut); numLLR = nrLDPC_init(p_decParams, p_lut);
...@@ -81,6 +80,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -81,6 +80,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
uint8_t numMaxIter = p_decParams->numMaxIter; uint8_t numMaxIter = p_decParams->numMaxIter;
e_nrLDPC_outMode outMode = p_decParams->outMode; e_nrLDPC_outMode outMode = p_decParams->outMode;
printf("nrLDCP_decoder_core: numMaxIter %d\n",numMaxIter);
// Minimum number of iterations is 1 // Minimum number of iterations is 1
// 0 iterations means hard-decision on input LLRs // 0 iterations means hard-decision on input LLRs
uint32_t i = 1; uint32_t i = 1;
...@@ -231,7 +231,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -231,7 +231,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
// First iteration finished // First iteration finished
while ( (i < (numMaxIter-1)) && (pcRes != 0) ) while ( (i < numMaxIter) && (pcRes != 0) )
{ {
// Increase iteration counter // Increase iteration counter
i++; i++;
...@@ -488,5 +488,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -488,5 +488,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
stop_meas(&p_profiler->llr2bit); stop_meas(&p_profiler->llr2bit);
#endif #endif
printf("num ldpc iterations %d\n",i);
return i; return i;
} }
...@@ -429,9 +429,10 @@ void nr_processULSegment(void* arg) { ...@@ -429,9 +429,10 @@ void nr_processULSegment(void* arg) {
if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY, "Segment %d CRC OK\n",r); LOG_I(PHY, "Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations);
#endif #endif
rdata->decodeIterations = no_iteration_ldpc; rdata->decodeIterations = no_iteration_ldpc;
if (rdata->decodeIterations > p_decoderParms->numMaxIter) rdata->decodeIterations--;
} else { } else {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY, "CRC NOK\n"); LOG_I(PHY, "CRC NOK\n");
......
...@@ -1318,8 +1318,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1318,8 +1318,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
start_meas(&gNB->ulsch_mrc_stats); start_meas(&gNB->ulsch_mrc_stats);
nr_ulsch_detection_mrc(frame_parms, nr_ulsch_detection_mrc(frame_parms,
gNB->pusch_vars[ulsch_id]->rxdataF_comp, gNB->pusch_vars[ulsch_id]->rxdataF_comp,
gNB->pusch_vars[ulsch_id]->ul_ch_mag, gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
gNB->pusch_vars[ulsch_id]->ul_ch_magb, gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
symbol, symbol,
rel15_ul->rb_size); rel15_ul->rb_size);
stop_meas(&gNB->ulsch_mrc_stats); stop_meas(&gNB->ulsch_mrc_stats);
......
...@@ -326,8 +326,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -326,8 +326,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]; temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0];
} }
LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0],corr_im[0],10*log10((double)corr_re[0]*corr_re[0] + (double)corr_im[0]*corr_im[0])); LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][0],corr_im[0][0],10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0]));
if (l>1) LOG_D(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])); if (l>1) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][1],corr_im[0][1],10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1]));
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=0; temp=0;
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
...@@ -1580,7 +1580,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1580,7 +1580,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
corr_re = ( corr32_re[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]); corr_re = ( corr32_re[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]);
corr_im = ( corr32_im[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]); corr_im = ( corr32_im[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]);
corr_tmp += corr_re*corr_re + corr_im*corr_im; corr_tmp += corr_re*corr_re + corr_im*corr_im;
/* /*
LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n", LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n",
half_prb,cw,cw&15,cw>>4,aa, half_prb,cw,cw&15,cw>>4,aa,
((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0], ((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0],
...@@ -1597,7 +1597,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1597,7 +1597,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
corr_re, corr_re,
corr_im, corr_im,
corr_tmp); corr_tmp);
*/
} }
corr16 = _mm_set1_epi16((int16_t)(corr_tmp>>8)); corr16 = _mm_set1_epi16((int16_t)(corr_tmp>>8));
......
...@@ -707,9 +707,9 @@ int main(int argc, char **argv) ...@@ -707,9 +707,9 @@ int main(int argc, char **argv)
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// common configuration // common configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 0, 0, NULL); rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,0, 0, NULL);
// UE dedicated configuration // UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
phy_init_nr_gNB(gNB,0,1); phy_init_nr_gNB(gNB,0,1);
N_RB_DL = gNB->frame_parms.N_RB_DL; N_RB_DL = gNB->frame_parms.N_RB_DL;
...@@ -752,7 +752,18 @@ int main(int argc, char **argv) ...@@ -752,7 +752,18 @@ int main(int argc, char **argv)
} }
*/ */
nr_l2_init_ue(NULL);
//Configure UE
NR_UE_RRC_INST_t rrcue;
memset(&rrcue,0,sizeof(NR_UE_RRC_INST_t));
rrc.carrier.MIB = (uint8_t*) malloc(4);
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
rrcue.mib = rrc.carrier.mib.message.choice.mib;
rrcue.scell_group_config=secondaryCellGroup;
nr_l2_init_ue(&rrcue);
NR_UE_MAC_INST_t* UE_mac = get_mac_inst(0); NR_UE_MAC_INST_t* UE_mac = get_mac_inst(0);
UE->if_inst = nr_ue_if_module_init(0); UE->if_inst = nr_ue_if_module_init(0);
...@@ -763,11 +774,7 @@ int main(int argc, char **argv) ...@@ -763,11 +774,7 @@ int main(int argc, char **argv)
UE_mac->if_module = nr_ue_if_module_init(0); UE_mac->if_module = nr_ue_if_module_init(0);
//Configure UE // nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
rrc.carrier.MIB = (uint8_t*) malloc(4);
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
nr_ue_phy_config_request(&UE_mac->phy_config); nr_ue_phy_config_request(&UE_mac->phy_config);
...@@ -1267,8 +1274,6 @@ int main(int argc, char **argv) ...@@ -1267,8 +1274,6 @@ int main(int argc, char **argv)
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) ((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0)))
{ {
/*if(errors_scrambling == 0)
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
errors_scrambling[round]++; errors_scrambling[round]++;
} }
} }
...@@ -1276,10 +1281,6 @@ int main(int argc, char **argv) ...@@ -1276,10 +1281,6 @@ int main(int argc, char **argv)
} // round } // round
if (n_trials == 1 && errors_scrambling[0] > 0) {
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in unscrambling = %u\n" "\x1B[0m", frame, trial, errors_scrambling[0]);
}
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7);
...@@ -1294,11 +1295,11 @@ int main(int argc, char **argv) ...@@ -1294,11 +1295,11 @@ int main(int argc, char **argv)
if (n_trials == 1) { if (n_trials == 1) {
for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++) for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++)
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) { for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
/*if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************");
printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i], i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i],
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);
} }
} }
if (errors_decoding > 0 && error_flag == 0) { if (errors_decoding > 0 && error_flag == 0) {
......
...@@ -540,6 +540,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ ...@@ -540,6 +540,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated; NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated;
if (dl_bwp_id==0) AssertFatal(mac->scc_SIB,"dl_bwp_id 0 (DL %d,UL %d) means mac->scc_SIB should exist here!\n",mac->DL_BWP_Id,mac->UL_BWP_Id);
NR_BWP_DownlinkCommon_t *bwp_Common = dl_bwp_id>0 ? scd->downlinkBWP_ToAddModList->list.array[dl_bwp_id - 1]->bwp_Common : NR_BWP_DownlinkCommon_t *bwp_Common = dl_bwp_id>0 ? scd->downlinkBWP_ToAddModList->list.array[dl_bwp_id - 1]->bwp_Common :
&mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP; &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP;
...@@ -655,6 +656,9 @@ int nr_rrc_mac_config_req_ue( ...@@ -655,6 +656,9 @@ int nr_rrc_mac_config_req_ue(
if(scell_group_config != NULL ){ if(scell_group_config != NULL ){
mac->cg = scell_group_config; mac->cg = scell_group_config;
mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex; mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex;
mac->DL_BWP_Id=mac->cg->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id ? *mac->cg->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id : 0;
mac->UL_BWP_Id=mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id ? *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id : 0;
config_control_ue(mac); config_control_ue(mac);
if (scell_group_config->spCellConfig->reconfigurationWithSync) { if (scell_group_config->spCellConfig->reconfigurationWithSync) {
if (scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) { if (scell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
......
...@@ -400,15 +400,22 @@ int rlc_module_init(int enb_flag) ...@@ -400,15 +400,22 @@ int rlc_module_init(int enb_flag)
{ {
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static int inited = 0; static int inited = 0;
static int inited_ue = 0;
if (pthread_mutex_lock(&lock)) abort(); if (pthread_mutex_lock(&lock)) abort();
if (inited) { if (enb_flag == 1 && inited) {
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (enb_flag == 0 && inited_ue) {
LOG_E(RLC, "%s:%d:%s: fatal, inited_ue already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
inited = 1; if (enb_flag == 1) inited = 1;
if (enb_flag == 0) inited_ue = 1;
nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag); nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag);
......
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