Commit 1bdf31c5 authored by Raymond Knopp's avatar Raymond Knopp

some more additions for TM3

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6264 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 5c154c15
...@@ -880,7 +880,7 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, ...@@ -880,7 +880,7 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
LTE_UE_PDCCH **ue_pdcch_vars = phy_vars_ue->lte_ue_pdcch_vars; LTE_UE_PDCCH **ue_pdcch_vars = phy_vars_ue->lte_ue_pdcch_vars;
LTE_UE_PRACH **ue_prach_vars = phy_vars_ue->lte_ue_prach_vars; LTE_UE_PRACH **ue_prach_vars = phy_vars_ue->lte_ue_prach_vars;
int i,j; int i,j,k;
unsigned char eNB_id; unsigned char eNB_id;
msg("Initializing UE vars (abstraction %d) for eNB TXant %d, UE RXant %d\n",abstraction_flag,frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx); msg("Initializing UE vars (abstraction %d) for eNB TXant %d, UE RXant %d\n",abstraction_flag,frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);
...@@ -908,11 +908,7 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, ...@@ -908,11 +908,7 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
ue_common_vars->txdata[i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int)); ue_common_vars->txdata[i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
bzero(ue_common_vars->txdata[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int)); bzero(ue_common_vars->txdata[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
#else //USER_MODE #else //USER_MODE
#ifdef IFFT_FPGA
ue_common_vars->txdata[i] = NULL;
#else //IFFT_FPGA
ue_common_vars->txdata[i] = TX_DMA_BUFFER[0][i]; ue_common_vars->txdata[i] = TX_DMA_BUFFER[0][i];
#endif //IFFT_FPGA
#endif //USER_MODE #endif //USER_MODE
} }
...@@ -922,12 +918,8 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, ...@@ -922,12 +918,8 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
#else //USER_MODE #else //USER_MODE
#ifdef IFFT_FPGA
ue_common_vars->txdataF[i] = (mod_sym_t*) TX_DMA_BUFFER[0][i];
#else //IFFT_FPGA
ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
#endif //IFFT_FPGA
#endif //USER_MODE #endif //USER_MODE
} }
...@@ -1112,11 +1104,13 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, ...@@ -1112,11 +1104,13 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
ue_pdsch_vars[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14)); ue_pdsch_vars[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
ue_pdsch_vars[eNB_id]->rxdataF_comp0 = (int **)malloc16(8*sizeof(int*)); ue_pdsch_vars[eNB_id]->rxdataF_comp0 = (int **)malloc16(8*sizeof(int*));
ue_pdsch_vars[eNB_id]->rxdataF_comp1 = (int **)malloc16(8*sizeof(int*)); for (k=0;k<8;k++)
ue_pdsch_vars[eNB_id]->rxdataF_comp1[k] = (int **)malloc16(8*sizeof(int*));
for (i=0; i<frame_parms->nb_antennas_rx; i++) for (i=0; i<frame_parms->nb_antennas_rx; i++)
for (j=0; j<4;j++){ for (j=0; j<4;j++){
ue_pdsch_vars[eNB_id]->rxdataF_comp0[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14)); ue_pdsch_vars[eNB_id]->rxdataF_comp0[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
ue_pdsch_vars[eNB_id]->rxdataF_comp1[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14)); for (k=0;k<8;k++)
ue_pdsch_vars[eNB_id]->rxdataF_comp1[(j<<1)+i][k] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
} }
// printf("rxdataF_comp[0] %p\n",ue_pdsch_vars[eNB_id]->rxdataF_comp[0]); // printf("rxdataF_comp[0] %p\n",ue_pdsch_vars[eNB_id]->rxdataF_comp[0]);
...@@ -1601,11 +1595,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1601,11 +1595,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB,
eNB_common_vars->txdata[eNB_id][i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int)); eNB_common_vars->txdata[eNB_id][i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
bzero(eNB_common_vars->txdata[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int)); bzero(eNB_common_vars->txdata[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
#else // USER_MODE #else // USER_MODE
#ifdef IFFT_FPGA
eNB_common_vars->txdata[eNB_id][i] = NULL;
#else //IFFT_FPGA
eNB_common_vars->txdata[eNB_id][i] = TX_DMA_BUFFER[eNB_id][i]; eNB_common_vars->txdata[eNB_id][i] = TX_DMA_BUFFER[eNB_id][i];
#endif //IFFT_FPGA
#endif //USER_MODE #endif //USER_MODE
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]); msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]);
...@@ -1629,12 +1619,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1629,12 +1619,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB,
eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
#else //USER_MODE #else //USER_MODE
#ifdef IFFT_FPGA
eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)TX_DMA_BUFFER[eNB_id][i];
#else
eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
#endif //IFFT_FPGA
#endif //USER_MODE #endif //USER_MODE
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n",
......
...@@ -3611,9 +3611,10 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe, ...@@ -3611,9 +3611,10 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe,
if ((ndi!=dlsch0_harq->DCINdi)|| // DCI has been toggled or this is the first transmission if ((ndi!=dlsch0_harq->DCINdi)|| // DCI has been toggled or this is the first transmission
(dlsch0_harq->first_tx==1)) { (dlsch0_harq->first_tx==1)) {
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
if (dlsch0_harq->first_tx==1) if (dlsch0_harq->first_tx==1) {
LOG_D(PHY,"[PDSCH %x/%d] Format 1A DCI First TX: Clearing flag\n"); LOG_D(PHY,"[PDSCH %x/%d] Format 1A DCI First TX: Clearing flag\n");
dlsch0_harq->first_tx = 0; dlsch0_harq->first_tx = 0;
}
} }
dlsch0_harq->DCINdi = ndi; dlsch0_harq->DCINdi = ndi;
...@@ -3740,12 +3741,14 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe, ...@@ -3740,12 +3741,14 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe,
if ((ndi!=dlsch0_harq->DCINdi)|| if ((ndi!=dlsch0_harq->DCINdi)||
(dlsch0_harq->first_tx==1)) { (dlsch0_harq->first_tx==1)) {
// printf("Rate: setting round to zero (ndi %d, DCINdi %d,first_tx %d)\n",ndi,dlsch0_harq->DCINdi,dlsch0_harq->first_tx);
dlsch0_harq->round=0; dlsch0_harq->round=0;
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
dlsch0_harq->DCINdi = ndi; dlsch0_harq->DCINdi = ndi;
if (dlsch0_harq->first_tx==1) if (dlsch0_harq->first_tx==1) {
LOG_D(PHY,"[PDSCH %x/%d] Format 1 DCI First TX: Clearing flag\n"); LOG_D(PHY,"[PDSCH %x/%d] Format 1 DCI First TX: Clearing flag\n");
dlsch0_harq->first_tx = 0; dlsch0_harq->first_tx = 0;
}
} }
else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process, else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same // this happens if either another harq process in the same
...@@ -4449,11 +4452,14 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe, ...@@ -4449,11 +4452,14 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe,
if (dlsch0->active == 1) { if (dlsch0->active == 1) {
if ((ndi1!=dlsch0_harq->DCINdi)|| if ((ndi1!=dlsch0_harq->DCINdi)||
(dlsch0_harq->first_tx==1)) { (dlsch0_harq->first_tx==1)) {
// printf("Rate: setting round to zero (ndi %d, DCINdi %d,first_tx %d)\n",ndi,dlsch0_harq->DCINdi,dlsch0_harq->first_tx);
dlsch0_harq->round=0; dlsch0_harq->round=0;
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
dlsch0_harq->DCINdi = ndi1; dlsch0_harq->DCINdi = ndi1;
if (dlsch0_harq->first_tx==1) if (dlsch0_harq->first_tx==1) {
LOG_D(PHY,"[PDSCH %x/%d] Format 2A DCI First TX0: Clearing flag\n"); LOG_D(PHY,"[PDSCH %x/%d] Format 2A DCI First TX0: Clearing flag\n");
dlsch0_harq->first_tx = 0;
}
} }
else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process, else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same // this happens if either another harq process in the same
...@@ -4474,8 +4480,11 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe, ...@@ -4474,8 +4480,11 @@ int generate_ue_dlsch_params_from_dci(uint8_t subframe,
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
dlsch1_harq->DCINdi = ndi2; dlsch1_harq->DCINdi = ndi2;
if (dlsch1_harq->first_tx==1) if (dlsch1_harq->first_tx==1) {
LOG_D(PHY,"[PDSCH %x/%d] Format 2A DCI First TX1: Clearing flag\n",rnti,harq_pid); LOG_D(PHY,"[PDSCH %x/%d] Format 2A DCI First TX1: Clearing flag\n",rnti,harq_pid);
dlsch1_harq->first_tx = 0;
}
} }
else if (dlsch1_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process, else if (dlsch1_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same // this happens if either another harq process in the same
...@@ -5498,7 +5507,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ...@@ -5498,7 +5507,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT100[rballoc]; ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT100[rballoc];
ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT100[rballoc]; ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT100[rballoc];
printf("rb_alloc (20 MHz dci) %d\n",rballoc); // printf("rb_alloc (20 MHz dci) %d\n",rballoc);
break; break;
default: default:
......
...@@ -291,13 +291,15 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -291,13 +291,15 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
(r==0) ? harq_process->F : 0); (r==0) ? harq_process->F : 0);
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
msg("HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d)...\n", msg("HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
harq_pid,r, G, harq_pid,r, G,
Kr*3, Kr*3,
harq_process->TBS, harq_process->TBS,
get_Qm(harq_process->mcs), get_Qm(harq_process->mcs),
harq_process->nb_rb, harq_process->nb_rb,
harq_process->Nl); harq_process->Nl,
harq_process->rvidx,
harq_process->round);
#endif #endif
...@@ -410,7 +412,8 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -410,7 +412,8 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
dlsch->harq_ack[subframe].harq_id = harq_pid; dlsch->harq_ack[subframe].harq_id = harq_pid;
dlsch->harq_ack[subframe].send_harq_status = 1; dlsch->harq_ack[subframe].send_harq_status = 1;
harq_process->round++; harq_process->round++;
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); // LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if (harq_process->round >= dlsch->Mdlharq) { if (harq_process->round >= dlsch->Mdlharq) {
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
} }
......
...@@ -394,7 +394,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -394,7 +394,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
eNB_id, eNB_id,
symbol, symbol,
get_Qm(dlsch0_harq->mcs), get_Qm(dlsch0_harq->mcs),
get_Qm(dlsch1_harq->mcs), get_Qm(dlsch1_harq->mcs),
dlsch0_harq->round,
nb_rb, nb_rb,
lte_ue_pdsch_vars[eNB_id]->log2_maxh); lte_ue_pdsch_vars[eNB_id]->log2_maxh);
// compute correlation between signal and interference channels // compute correlation between signal and interference channels
...@@ -524,7 +525,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -524,7 +525,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
if (frame_parms->nb_antennas_tx_eNB == 2) { if (frame_parms->nb_antennas_tx_eNB == 2) {
dlsch_detection_mrc(frame_parms, dlsch_detection_mrc(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[dlsch0_harq->round],
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext,
lte_ue_pdsch_vars[eNB_id]->rho, lte_ue_pdsch_vars[eNB_id]->rho,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
...@@ -640,7 +641,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -640,7 +641,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
*/ */
dlsch_qpsk_qpsk_llr(frame_parms, dlsch_qpsk_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[dlsch0_harq->round],
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
symbol,first_symbol_flag,nb_rb, symbol,first_symbol_flag,nb_rb,
...@@ -650,7 +651,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -650,7 +651,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
else if (get_Qm(dlsch1_harq->mcs) == 4) { else if (get_Qm(dlsch1_harq->mcs) == 4) {
dlsch_qpsk_16qam_llr(frame_parms, dlsch_qpsk_16qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[dlsch0_harq->round],
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
...@@ -661,7 +662,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -661,7 +662,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
else { else {
dlsch_qpsk_64qam_llr(frame_parms, dlsch_qpsk_64qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[dlsch0_harq->round],
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
...@@ -1368,6 +1369,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1368,6 +1369,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char symbol, unsigned char symbol,
unsigned char mod_order0, unsigned char mod_order0,
unsigned char mod_order1, unsigned char mod_order1,
int round,
unsigned short nb_rb, unsigned short nb_rb,
unsigned char output_shift) { unsigned char output_shift) {
...@@ -1383,7 +1385,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1383,7 +1385,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms,
int **dl_ch_magb0 = lte_ue_pdsch_vars->dl_ch_magb0; int **dl_ch_magb0 = lte_ue_pdsch_vars->dl_ch_magb0;
int **dl_ch_magb1 = lte_ue_pdsch_vars->dl_ch_magb1; int **dl_ch_magb1 = lte_ue_pdsch_vars->dl_ch_magb1;
int **rxdataF_comp0 = lte_ue_pdsch_vars->rxdataF_comp0; int **rxdataF_comp0 = lte_ue_pdsch_vars->rxdataF_comp0;
int **rxdataF_comp1 = lte_ue_pdsch_vars->rxdataF_comp1; int **rxdataF_comp1 = lte_ue_pdsch_vars->rxdataF_comp1[0];
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp0_128,QAM_amp0_128b,QAM_amp1_128,QAM_amp1_128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp0_128,QAM_amp0_128b,QAM_amp1_128,QAM_amp1_128b;
...@@ -3350,35 +3352,35 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, ...@@ -3350,35 +3352,35 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
#ifdef USER_MODE #ifdef USER_MODE
void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword) { void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int round) {
unsigned int nsymb = (phy_vars_ue->lte_frame_parms.Ncp == 0) ? 14 : 12; unsigned int nsymb = (phy_vars_ue->lte_frame_parms.Ncp == 0) ? 14 : 12;
char fname[32],vname[32]; char fname[32],vname[32];
int N_RB_DL=phy_vars_ue->lte_frame_parms.N_RB_DL; int N_RB_DL=phy_vars_ue->lte_frame_parms.N_RB_DL;
sprintf(fname,"dlsch%d_rxF_ext0.m",eNB_id); sprintf(fname,"dlsch%d_rxF_r%d_ext0.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_ext0",eNB_id); sprintf(vname,"dl%d_rxF_r%d_ext0",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1);
if (phy_vars_ue->lte_frame_parms.nb_antennas_rx >1) { if (phy_vars_ue->lte_frame_parms.nb_antennas_rx >1) {
sprintf(fname,"dlsch%d_rxF_ext1.m",eNB_id); sprintf(fname,"dlsch%d_rxF_r%d_ext1.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_ext1",eNB_id); sprintf(vname,"dl%d_rxF_r%d_ext1",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1);
} }
sprintf(fname,"dlsch%d_ch_ext00.m",eNB_id); sprintf(fname,"dlsch%d_ch_r%d_ext00.m",eNB_id,round);
sprintf(vname,"dl%d_ch_ext00",eNB_id); sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1);
if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) { if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) {
sprintf(fname,"dlsch%d_ch_ext01.m",eNB_id); sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round);
sprintf(vname,"dl%d_ch_ext01",eNB_id); sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1);
} }
if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) { if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) {
sprintf(fname,"dlsch%d_ch_ext10.m",eNB_id); sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round);
sprintf(vname,"dl%d_ch_ext10",eNB_id); sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1);
if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) { if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) {
sprintf(fname,"dlsch%d_ch_ext11.m",eNB_id); sprintf(fname,"dlsch%d_ch_r%d_ext11.m",eNB_id,round);
sprintf(vname,"dl%d_ch_ext11",eNB_id); sprintf(vname,"dl%d_ch_r%d_ext11",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1);
} }
} }
...@@ -3387,31 +3389,31 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per ...@@ -3387,31 +3389,31 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per
write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1);
write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1);
*/ */
sprintf(fname,"dlsch%d_rho.m",eNB_id); sprintf(fname,"dlsch%d_r%d_rho.m",eNB_id,round);
sprintf(vname,"dl_rho%d",eNB_id); sprintf(vname,"dl_rho_r%d_%d",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0],12*N_RB_DL*nsymb,1,1);
sprintf(fname,"dlsch%d_rxF_comp0.m",eNB_id); sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_comp0",eNB_id); sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1);
if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) { if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) {
sprintf(fname,"dlsch%d_rxF_comp1.m",eNB_id); sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_comp1",eNB_id); sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[0][round],12*N_RB_DL*nsymb,1,1);
} }
sprintf(fname,"dlsch%d_rxF_llr.m",eNB_id); sprintf(fname,"dlsch%d_rxF_r%d_llr.m",eNB_id,round);
sprintf(vname,"dl%d_llr",eNB_id); sprintf(vname,"dl%d_r%d_llr",eNB_id,round);
write_output(fname,vname, phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->llr[0],coded_bits_per_codeword,1,0); write_output(fname,vname, phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
sprintf(fname,"dlsch%d_mag1.m",eNB_id); sprintf(fname,"dlsch%d_r%d_mag1.m",eNB_id,round);
sprintf(vname,"dl%d_mag1",eNB_id); sprintf(vname,"dl%d_r%d_mag1",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb,1,1);
sprintf(fname,"dlsch%d_mag2.m",eNB_id); sprintf(fname,"dlsch%d_r%d_mag2.m",eNB_id,round);
sprintf(vname,"dl%d_mag2",eNB_id); sprintf(vname,"dl%d_r%d_mag2",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb,1,1);
printf("log2_maxh = %d\n",phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->log2_maxh); // printf("log2_maxh = %d\n",phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->log2_maxh);
} }
#endif #endif
......
...@@ -545,8 +545,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -545,8 +545,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam64_table_offset_im0+=1; qam64_table_offset_im0+=1;
*jj=*jj+1; *jj=*jj+1;
xx0_re = qam_table_s0[qam16_table_offset_re0]; xx0_re = qam_table_s0[qam64_table_offset_re0];
xx0_im = qam_table_s0[qam16_table_offset_im0]; xx0_im = qam_table_s0[qam64_table_offset_im0];
break; break;
...@@ -594,7 +594,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -594,7 +594,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam64_table_offset_im1 = 0; qam64_table_offset_im1 = 0;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam64_table_offset_re0+=4; qam64_table_offset_re1+=4;
*jj2 = *jj2 + 1; *jj2 = *jj2 + 1;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam64_table_offset_im1+=4; qam64_table_offset_im1+=4;
...@@ -612,8 +612,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -612,8 +612,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam64_table_offset_im1+=1; qam64_table_offset_im1+=1;
*jj2 = *jj2 + 1; *jj2 = *jj2 + 1;
xx1_re = qam_table_s1[qam16_table_offset_re1]; xx1_re = qam_table_s1[qam64_table_offset_re1];
xx1_im = qam_table_s1[qam16_table_offset_im1]; xx1_im = qam_table_s1[qam64_table_offset_im1];
break; break;
...@@ -1054,7 +1054,7 @@ int dlsch_modulation(mod_sym_t **txdataF, ...@@ -1054,7 +1054,7 @@ int dlsch_modulation(mod_sym_t **txdataF,
qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
} }
else if (mod_order0 == 6) else if (mod_order1 == 6)
for (i=0;i<8;i++) { for (i=0;i<8;i++) {
qam64_table_a1[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_a)>>15); qam64_table_a1[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_a)>>15);
qam64_table_b1[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15); qam64_table_b1[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15);
......
...@@ -963,6 +963,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -963,6 +963,7 @@ void dlsch_channel_compensation_TM3(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char symbol, unsigned char symbol,
unsigned char mod_order0, unsigned char mod_order0,
unsigned char mod_order1, unsigned char mod_order1,
int round,
unsigned short nb_rb, unsigned short nb_rb,
unsigned char output_shift); unsigned char output_shift);
...@@ -1406,7 +1407,7 @@ void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t ...@@ -1406,7 +1407,7 @@ void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t
void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe); void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe);
void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe); void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe);
void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword); void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int round);
#endif #endif
int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci); int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci);
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#include "UTIL/OCG/OCG.h" #include "UTIL/OCG/OCG.h"
#include "UTIL/OCG/OCG_extern.h" #include "UTIL/OCG/OCG_extern.h"
#endif #endif
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_ULSCH_DECODING //#define DEBUG_ULSCH_DECODING
...@@ -250,6 +250,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -250,6 +250,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
int off; int off;
int status[20]; int status[20];
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx; int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
LTE_UL_eNB_HARQ_t *ulsch_harq;
uint8_t (*tc)(int16_t *y, uint8_t (*tc)(int16_t *y,
uint8_t *, uint8_t *,
...@@ -274,6 +275,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -274,6 +275,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// harq_pid = (ulsch->RRCConnRequest_flag == 0) ? subframe2harq_pid_tdd(frame_parms->tdd_config,subframe) : 0; // harq_pid = (ulsch->RRCConnRequest_flag == 0) ? subframe2harq_pid_tdd(frame_parms->tdd_config,subframe) : 0;
harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe); harq_pid = subframe2harq_pid(frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
ulsch_harq = ulsch->harq_processes[harq_pid];
if (harq_pid==255) { if (harq_pid==255) {
LOG_E(PHY, "ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n"); LOG_E(PHY, "ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n");
...@@ -285,49 +287,49 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -285,49 +287,49 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
else else
tc = phy_threegpplte_turbo_decoder8; tc = phy_threegpplte_turbo_decoder8;
nb_rb = ulsch->harq_processes[harq_pid]->nb_rb; nb_rb = ulsch_harq->nb_rb;
A = ulsch->harq_processes[harq_pid]->TBS; A = ulsch_harq->TBS;
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs); Q_m = get_Qm_ul(ulsch_harq->mcs);
G = nb_rb * (12 * Q_m) * ulsch->harq_processes[harq_pid]->Nsymb_pusch; G = nb_rb * (12 * Q_m) * ulsch_harq->Nsymb_pusch;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, subframe %d\n", msg("ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, subframe %d\n",
frame_parms->Nid_cell,ulsch->rnti,x2, frame_parms->Nid_cell,ulsch->rnti,x2,
ulsch->harq_processes[harq_pid]->round, ulsch_harq->round,
ulsch->harq_processes[harq_pid]->rvidx, ulsch_harq->rvidx,
ulsch->harq_processes[harq_pid]->mcs, ulsch_harq->mcs,
ulsch->harq_processes[harq_pid]->O_RI, ulsch_harq->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK, ulsch_harq->O_ACK,
G, G,
subframe); subframe);
#endif #endif
if (ulsch->harq_processes[harq_pid]->round == 0) { if (ulsch_harq->round == 0) {
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
ulsch->harq_processes[harq_pid]->B = A+24; ulsch_harq->B = A+24;
lte_segmentation(NULL, lte_segmentation(NULL,
NULL, NULL,
ulsch->harq_processes[harq_pid]->B, ulsch_harq->B,
&ulsch->harq_processes[harq_pid]->C, &ulsch_harq->C,
&ulsch->harq_processes[harq_pid]->Cplus, &ulsch_harq->Cplus,
&ulsch->harq_processes[harq_pid]->Cminus, &ulsch_harq->Cminus,
&ulsch->harq_processes[harq_pid]->Kplus, &ulsch_harq->Kplus,
&ulsch->harq_processes[harq_pid]->Kminus, &ulsch_harq->Kminus,
&ulsch->harq_processes[harq_pid]->F); &ulsch_harq->F);
// CLEAR LLR's HERE for first packet in process // CLEAR LLR's HERE for first packet in process
} }
sumKr = 0; sumKr = 0;
for (r=0;r<ulsch->harq_processes[harq_pid]->C;r++) { for (r=0;r<ulsch_harq->C;r++) {
if (r<ulsch->harq_processes[harq_pid]->Cminus) if (r<ulsch_harq->Cminus)
Kr = ulsch->harq_processes[harq_pid]->Kminus; Kr = ulsch_harq->Kminus;
else else
Kr = ulsch->harq_processes[harq_pid]->Kplus; Kr = ulsch_harq->Kplus;
sumKr += Kr; sumKr += Kr;
} }
if (sumKr==0) { if (sumKr==0) {
...@@ -335,11 +337,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -335,11 +337,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, subframe %d\n", LOG_D(PHY,"ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d, subframe %d\n",
frame_parms->Nid_cell,ulsch->rnti,x2, frame_parms->Nid_cell,ulsch->rnti,x2,
harq_pid, harq_pid,
ulsch->harq_processes[harq_pid]->round, ulsch_harq->round,
ulsch->harq_processes[harq_pid]->rvidx, ulsch_harq->rvidx,
ulsch->harq_processes[harq_pid]->mcs, ulsch_harq->mcs,
ulsch->harq_processes[harq_pid]->O_RI, ulsch_harq->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK, ulsch_harq->O_ACK,
G, G,
subframe); subframe);
mac_xface->macphy_exit("ulsch_decoding.c: FATAL sumKr is 0!"); mac_xface->macphy_exit("ulsch_decoding.c: FATAL sumKr is 0!");
...@@ -347,7 +349,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -347,7 +349,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
// Compute Q_ri // Compute Q_ri
Qprime = ulsch->harq_processes[harq_pid]->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8; Qprime = ulsch_harq->O_RI*ulsch_harq->Msc_initial*ulsch_harq->Nsymb_initial * ulsch->beta_offset_ri_times8;
if (Qprime > 0 ) { if (Qprime > 0 ) {
if ((Qprime % (8*sumKr)) > 0) if ((Qprime % (8*sumKr)) > 0)
...@@ -365,7 +367,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -365,7 +367,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// Compute Q_ack // Compute Q_ack
Qprime = ulsch->harq_processes[harq_pid]->O_ACK*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_harqack_times8; Qprime = ulsch_harq->O_ACK*ulsch_harq->Msc_initial*ulsch_harq->Nsymb_initial * ulsch->beta_offset_harqack_times8;
if (Qprime > 0) { if (Qprime > 0) {
if ((Qprime % (8*sumKr)) > 0) if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr)); Qprime = 1+(Qprime/(8*sumKr));
...@@ -379,16 +381,16 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -379,16 +381,16 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// Q_ACK = Qprime * Q_m; // Q_ACK = Qprime * Q_m;
Qprime_ACK = Qprime; Qprime_ACK = Qprime;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: Qprime_ACK %d, Msc_initial %d, Nsymb_initial %d, sumKr %d\n", msg("ulsch_decoding.c: Qprime_ACK %d, Msc_initial %d, Nsymb_initial %d, sumKr %d\n",
Qprime_ACK,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,sumKr); Qprime_ACK,ulsch_harq->Msc_initial,ulsch_harq->Nsymb_initial,sumKr);
#endif #endif
// Compute Q_cqi // Compute Q_cqi
if (ulsch->harq_processes[harq_pid]->Or1 < 12) if (ulsch_harq->Or1 < 12)
L=0; L=0;
else else
L=8; L=8;
if (ulsch->harq_processes[harq_pid]->Or1 > 0) if (ulsch_harq->Or1 > 0)
Qprime = (ulsch->harq_processes[harq_pid]->Or1 + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8; Qprime = (ulsch_harq->Or1 + L) * ulsch_harq->Msc_initial*ulsch_harq->Nsymb_initial * ulsch->beta_offset_cqi_times8;
else else
Qprime=0; Qprime=0;
...@@ -399,17 +401,17 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -399,17 +401,17 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Qprime = Qprime/(8*sumKr); Qprime = Qprime/(8*sumKr);
} }
G = nb_rb * (12 * Q_m) * (ulsch->harq_processes[harq_pid]->Nsymb_pusch); G = nb_rb * (12 * Q_m) * (ulsch_harq->Nsymb_pusch);
if (Qprime > (G - ulsch->harq_processes[harq_pid]->O_RI)) if (Qprime > (G - ulsch_harq->O_RI))
Qprime = G - ulsch->harq_processes[harq_pid]->O_RI; Qprime = G - ulsch_harq->O_RI;
Q_CQI = Q_m * Qprime; Q_CQI = Q_m * Qprime;
//#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch->harq_processes[harq_pid]->Or1,ulsch->harq_processes[harq_pid]->O_ACK); msg("ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch_harq->Or1,ulsch_harq->O_ACK);
//#endif #endif
Qprime_CQI = Qprime; Qprime_CQI = Qprime;
G = G - Q_RI - Q_CQI; G = G - Q_RI - Q_CQI;
...@@ -425,12 +427,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -425,12 +427,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// Demultiplexing/Deinterleaving of PUSCH/ACK/RI/CQI // Demultiplexing/Deinterleaving of PUSCH/ACK/RI/CQI
Hpp = Hprime + Qprime_RI; Hpp = Hprime + Qprime_RI;
Cmux = ulsch->harq_processes[harq_pid]->Nsymb_pusch; Cmux = ulsch_harq->Nsymb_pusch;
// Rmux = Hpp*Q_m/Cmux; // Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Hpp/Cmux; Rmux_prime = Hpp/Cmux;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: G raw %d (%d symb), Hpp %d, Cmux %d, Rmux_prime %d\n",G,ulsch->Nsymb_pusch,Hpp,Cmux,Rmux_prime); msg("ulsch_decoding.c: G raw %d (%d symb), Hpp %d, Cmux %d, Rmux_prime %d\n",G,ulsch_harq->Nsymb_pusch,Hpp,Cmux,Rmux_prime);
#endif #endif
// Clear "tag" interleaving matrix to allow for CQI/DATA identification // Clear "tag" interleaving matrix to allow for CQI/DATA identification
memset(ytag,0,Cmux*Rmux_prime); memset(ytag,0,Cmux*Rmux_prime);
...@@ -472,7 +474,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -472,7 +474,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
// 1-bit ACK/NAK // 1-bit ACK/NAK
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) { if (ulsch_harq->O_ACK == 1) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
q_ACK[0] = 0; q_ACK[0] = 0;
...@@ -498,7 +500,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -498,7 +500,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
} }
// two-bit ACK/NAK // two-bit ACK/NAK
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) { if (ulsch_harq->O_ACK == 2) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
q_ACK[0] = 0; q_ACK[0] = 0;
...@@ -550,7 +552,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -550,7 +552,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
break; break;
} }
} }
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) { if (ulsch_harq->O_ACK > 2) {
LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n"); LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n");
return(-1); return(-1);
} }
...@@ -609,18 +611,18 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -609,18 +611,18 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
*/ */
off =((Rmux_prime*Q_m*columnset[j])+(r*Q_m)); off =((Rmux_prime*Q_m*columnset[j])+(r*Q_m));
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) { if (ulsch_harq->O_ACK == 1) {
if (ulsch->bundling==0) if (ulsch->bundling==0)
cseq[off+1] = cseq[off]; // PUSCH_y cseq[off+1] = cseq[off]; // PUSCH_y
for (q=2;q<Q_m;q++) for (q=2;q<Q_m;q++)
cseq[off+q] = -1; // PUSCH_x cseq[off+q] = -1; // PUSCH_x
} }
else if (ulsch->harq_processes[harq_pid]->O_ACK == 2) { else if (ulsch_harq->O_ACK == 2) {
for (q=2;q<Q_m;q++) for (q=2;q<Q_m;q++)
cseq[off+q] = -1; // PUSCH_x cseq[off+q] = -1; // PUSCH_x
} }
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: ACK i %d, r %d, j %d, ColumnSet[j] %d\n",i,r,j,columnset[j]); msg("ulsch_decoding.c: ACK i %d, r %d, j %d, ColumnSet[j] %d\n",i,r,j,columnset[j]);
#endif #endif
j=(j+3)&3; j=(j+3)&3;
} }
...@@ -732,7 +734,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -732,7 +734,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
j=0; j=0;
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) { if (ulsch_harq->O_ACK == 1) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
len_ACK = 2; len_ACK = 2;
...@@ -745,7 +747,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -745,7 +747,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
break; break;
} }
} }
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) { if (ulsch_harq->O_ACK == 2) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
len_ACK = 6; len_ACK = 6;
...@@ -758,23 +760,23 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -758,23 +760,23 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
break; break;
} }
} }
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) { if (ulsch_harq->O_ACK > 2) {
LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n"); LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n");
return(-1); return(-1);
} }
for (i=0;i<len_ACK;i++) for (i=0;i<len_ACK;i++)
ulsch->harq_processes[harq_pid]->q_ACK[i] = 0; ulsch_harq->q_ACK[i] = 0;
for (i=0;i<Qprime_ACK;i++) { for (i=0;i<Qprime_ACK;i++) {
r = Rmux_prime -1 - (i>>2); r = Rmux_prime -1 - (i>>2);
for (q=0;q<Q_m;q++) { for (q=0;q<Q_m;q++) {
if (y[q+(Q_m*((r*Cmux) + columnset[j]))]!=0) if (y[q+(Q_m*((r*Cmux) + columnset[j]))]!=0)
ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))]; ulsch_harq->q_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
// LOG_D(PHY,"ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]); // LOG_D(PHY,"ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch_harq->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
printf("ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]); printf("ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch_harq->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
#endif #endif
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
} }
...@@ -784,7 +786,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -784,7 +786,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// RI BITS // RI BITS
if (ulsch->harq_processes[harq_pid]->O_RI == 1) { if (ulsch_harq->O_RI == 1) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
len_RI=2; len_RI=2;
...@@ -798,13 +800,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -798,13 +800,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
} }
if (ulsch->harq_processes[harq_pid]->O_RI > 1) { if (ulsch_harq->O_RI > 1) {
LOG_E(PHY,"ulsch_decoding: FATAL, RI cannot be more than 1 bit yet\n"); LOG_E(PHY,"ulsch_decoding: FATAL, RI cannot be more than 1 bit yet\n");
return(-1); return(-1);
} }
for (i=0;i<len_RI;i++) for (i=0;i<len_RI;i++)
ulsch->harq_processes[harq_pid]->q_RI[i] = 0; ulsch_harq->q_RI[i] = 0;
if (frame_parms->Ncp == 0) if (frame_parms->Ncp == 0)
columnset = cs_ri_normal; columnset = cs_ri_normal;
...@@ -814,7 +816,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -814,7 +816,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (i=0;i<Qprime_RI;i++) { for (i=0;i<Qprime_RI;i++) {
r = Rmux_prime -1 - (i>>2); r = Rmux_prime -1 - (i>>2);
for (q=0;q<Q_m;q++) for (q=0;q<Q_m;q++)
ulsch->harq_processes[harq_pid]->q_RI[(q+(Q_m*i))%len_RI] += y[q+(Q_m*((r*Cmux) + columnset[j]))]; ulsch_harq->q_RI[(q+(Q_m*i))%len_RI] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
ytag[(r*Cmux) + columnset[j]] = LTE_NULL; ytag[(r*Cmux) + columnset[j]] = LTE_NULL;
j=(j+3)&3; j=(j+3)&3;
} }
...@@ -838,11 +840,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -838,11 +840,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (q=0;q<Q_m;q++) { for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))]; ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127) if (ys>127)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127; ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128) else if (ys<-128)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128; ulsch_harq->q[q+(Q_m*i)] = -128;
else else
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys; ulsch_harq->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys); msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys);
#endif #endif
...@@ -854,13 +856,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -854,13 +856,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// ys = y[q+(Q_m*((r*Cmux)+j))]; // ys = y[q+(Q_m*((r*Cmux)+j))];
ys = y[q+j2]; ys = y[q+j2];
if (ys>127) if (ys>127)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127; ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128) else if (ys<-128)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128; ulsch_harq->q[q+(Q_m*i)] = -128;
else else
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys; ulsch_harq->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: CQI %d, q %d, y[%d] %d\n",q+(Q_m*i),q,j2, q+j2,ys); msg("ulsch_decoding.c: CQI %d, q %d, y[%d] %d\n",q+(Q_m*i),q,j2, q+j2,ys);
#endif #endif
} }
j2+=Q_m; j2+=Q_m;
...@@ -873,8 +875,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -873,8 +875,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)<<1;) { for (iprime=0;iprime<(Hprime-Qprime_CQI)<<1;) {
while (ytag[j]==LTE_NULL) { j++;j2+=2; } while (ytag[j]==LTE_NULL) { j++;j2+=2; }
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]); // msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif #endif
...@@ -886,10 +888,10 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -886,10 +888,10 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)<<2;) { for (iprime=0;iprime<(Hprime-Qprime_CQI)<<2;) {
while (ytag[j]==LTE_NULL) { j++;j2+=4; } while (ytag[j]==LTE_NULL) { j++;j2+=4; }
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]); // msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif #endif
...@@ -900,12 +902,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -900,12 +902,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)*6;) { for (iprime=0;iprime<(Hprime-Qprime_CQI)*6;) {
while (ytag[j]==LTE_NULL) { j++;j2+=6; } while (ytag[j]==LTE_NULL) { j++;j2+=6; }
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++]; ulsch_harq->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]); // msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif #endif
...@@ -933,11 +935,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -933,11 +935,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (q=0;q<Q_m;q++) { for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))]; ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127) if (ys>127)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127; ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128) else if (ys<-128)
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128; ulsch_harq->q[q+(Q_m*i)] = -128;
else else
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys; ulsch_harq->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys); msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys);
#endif #endif
...@@ -965,89 +967,89 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -965,89 +967,89 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// HARQ-ACK // HARQ-ACK
wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3); wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3);
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: Bundling %d, Nbundled %d, wACK_idx %d\n", msg("ulsch_decoding.c: Bundling %d, Nbundled %d, wACK_idx %d\n",
ulsch->bundling,Nbundled,wACK_idx); ulsch->bundling,Nbundled,wACK_idx);
#endif #endif
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) { if (ulsch_harq->O_ACK == 1) {
ulsch->harq_processes[harq_pid]->q_ACK[0] *= wACK_RX[wACK_idx][0]; ulsch_harq->q_ACK[0] *= wACK_RX[wACK_idx][0];
ulsch->harq_processes[harq_pid]->q_ACK[0] += (ulsch->bundling==0) ? ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] : ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][1]; 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];
if (ulsch->harq_processes[harq_pid]->q_ACK[0] < 0) if (ulsch_harq->q_ACK[0] < 0)
ulsch->harq_processes[harq_pid]->o_ACK[0] = 0; ulsch_harq->o_ACK[0] = 0;
else else
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1; ulsch_harq->o_ACK[0] = 1;
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: ulsch_q_ACK[0] %d (%d,%d)\n",ulsch->harq_processes[harq_pid]->q_ACK[0],wACK_RX[wACK_idx][0],wACK_RX[wACK_idx][1]); msg("ulsch_decoding.c: ulsch_q_ACK[0] %d (%d,%d)\n",ulsch_harq->q_ACK[0],wACK_RX[wACK_idx][0],wACK_RX[wACK_idx][1]);
#endif #endif
} }
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) { if (ulsch_harq->O_ACK == 2) {
switch (Q_m) { switch (Q_m) {
case 2: case 2:
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[3]*wACK_RX[wACK_idx][1]; 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_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[4]*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_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[2]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[5]*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];
break; break;
case 4: case 4:
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[5]*wACK_RX[wACK_idx][1]; 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_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[8]*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_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[4]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[9]*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];
break; break;
case 6: case 6:
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[7]*wACK_RX[wACK_idx][1]; 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_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[12]*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_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[6]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[13]*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];
break; break;
} }
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1; ulsch_harq->o_ACK[0] = 1;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 1; ulsch_harq->o_ACK[1] = 1;
metric = ulsch->harq_processes[harq_pid]->q_ACK[0]+ulsch->harq_processes[harq_pid]->q_ACK[1]-ulsch->harq_processes[harq_pid]->q_ACK[2]; metric = ulsch_harq->q_ACK[0]+ulsch_harq->q_ACK[1]-ulsch_harq->q_ACK[2];
metric_new = -ulsch->harq_processes[harq_pid]->q_ACK[0]+ulsch->harq_processes[harq_pid]->q_ACK[1]+ulsch->harq_processes[harq_pid]->q_ACK[2]; metric_new = -ulsch_harq->q_ACK[0]+ulsch_harq->q_ACK[1]+ulsch_harq->q_ACK[2];
if (metric_new > metric) { if (metric_new > metric) {
ulsch->harq_processes[harq_pid]->o_ACK[0]=0; ulsch_harq->o_ACK[0]=0;
ulsch->harq_processes[harq_pid]->o_ACK[1]=1; ulsch_harq->o_ACK[1]=1;
metric = metric_new; metric = metric_new;
} }
metric_new = ulsch->harq_processes[harq_pid]->q_ACK[0]-ulsch->harq_processes[harq_pid]->q_ACK[1]+ulsch->harq_processes[harq_pid]->q_ACK[2]; metric_new = ulsch_harq->q_ACK[0]-ulsch_harq->q_ACK[1]+ulsch_harq->q_ACK[2];
if (metric_new > metric) { if (metric_new > metric) {
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1; ulsch_harq->o_ACK[0] = 1;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 0; ulsch_harq->o_ACK[1] = 0;
metric = metric_new; metric = metric_new;
} }
metric_new = -ulsch->harq_processes[harq_pid]->q_ACK[0]-ulsch->harq_processes[harq_pid]->q_ACK[1]-ulsch->harq_processes[harq_pid]->q_ACK[2]; metric_new = -ulsch_harq->q_ACK[0]-ulsch_harq->q_ACK[1]-ulsch_harq->q_ACK[2];
if (metric_new > metric) { if (metric_new > metric) {
ulsch->harq_processes[harq_pid]->o_ACK[0] = 0; ulsch_harq->o_ACK[0] = 0;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 0; ulsch_harq->o_ACK[1] = 0;
metric = metric_new; metric = metric_new;
} }
} }
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
for (i=0;i<ulsch->harq_processes[harq_pid]->harq_processes[harq_pid]->O_ACK;i++) for (i=0;i<ulsch_harq->O_ACK;i++)
LOG_D(PHY,"ulsch_decoding: O_ACK[%d] %d, q_ACK => (%d,%d,%d)\n",i,ulsch->harq_processes[harq_pid]->o_ACK[i],ulsch->harq_processes[harq_pid]->q_ACK[0],ulsch->harq_processes[harq_pid]->q_ACK[1],ulsch->harq_processes[harq_pid]->q_ACK[2]); msg("ulsch_decoding: O_ACK[%d] %d, q_ACK => (%d,%d,%d)\n",i,ulsch_harq->o_ACK[i],ulsch_harq->q_ACK[0],ulsch_harq->q_ACK[1],ulsch_harq->q_ACK[2]);
#endif #endif
// RI // RI
if ((ulsch->harq_processes[harq_pid]->O_RI == 1) && (Qprime_RI > 0)) { if ((ulsch_harq->O_RI == 1) && (Qprime_RI > 0)) {
ulsch->harq_processes[harq_pid]->o_RI[0] = ((ulsch->harq_processes[harq_pid]->q_RI[0] + ulsch->harq_processes[harq_pid]->q_RI[Q_m/2]) > 0) ? 0 : 1; ulsch_harq->o_RI[0] = ((ulsch_harq->q_RI[0] + ulsch_harq->q_RI[Q_m/2]) > 0) ? 0 : 1;
} }
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
if (Qprime_RI > 0) { if (Qprime_RI > 0) {
for (i=0;i<2*ulsch->harq_processes[harq_pid]->O_RI;i++) for (i=0;i<2*ulsch_harq->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: q_RI[%d] %d\n",i,ulsch->harq_processes[harq_pid]->q_RI[i]); msg("ulsch_decoding: q_RI[%d] %d\n",i,ulsch_harq->q_RI[i]);
} }
if (Qprime_CQI > 0) { if (Qprime_CQI > 0) {
for (i=0;i<ulsch->harq_processes[harq_pid]->O_RI;i++) for (i=0;i<ulsch_harq->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: O_RI[%d] %d\n",i,ulsch->harq_processes[harq_pid]->o_RI[i]); LOG_D(PHY,"ulsch_decoding: O_RI[%d] %d\n",i,ulsch_harq->o_RI[i]);
} }
#endif #endif
...@@ -1055,58 +1057,58 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1055,58 +1057,58 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// CQI // CQI
if (Qprime_CQI>0) { if (Qprime_CQI>0) {
memset((void *)&dummy_w_cc[0],0,3*(ulsch->harq_processes[harq_pid]->Or1+8+32)); memset((void *)&dummy_w_cc[0],0,3*(ulsch_harq->Or1+8+32));
O_RCC = generate_dummy_w_cc(ulsch->harq_processes[harq_pid]->Or1+8, O_RCC = generate_dummy_w_cc(ulsch_harq->Or1+8,
&dummy_w_cc[0]); &dummy_w_cc[0]);
lte_rate_matching_cc_rx(O_RCC, lte_rate_matching_cc_rx(O_RCC,
Q_CQI, Q_CQI,
ulsch->harq_processes[harq_pid]->o_w, ulsch_harq->o_w,
dummy_w_cc, dummy_w_cc,
ulsch->harq_processes[harq_pid]->q); ulsch_harq->q);
sub_block_deinterleaving_cc((unsigned int)(ulsch->harq_processes[harq_pid]->Or1+8), sub_block_deinterleaving_cc((unsigned int)(ulsch_harq->Or1+8),
&ulsch->harq_processes[harq_pid]->o_d[96], &ulsch_harq->o_d[96],
&ulsch->harq_processes[harq_pid]->o_w[0]); &ulsch_harq->o_w[0]);
memset(o_flip,0,1+((8+ulsch->harq_processes[harq_pid]->Or1)/8)); memset(o_flip,0,1+((8+ulsch_harq->Or1)/8));
phy_viterbi_lte_sse2(ulsch->harq_processes[harq_pid]->o_d+96,o_flip,8+ulsch->harq_processes[harq_pid]->Or1); phy_viterbi_lte_sse2(ulsch_harq->o_d+96,o_flip,8+ulsch_harq->Or1);
if (extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1) == (crc8(o_flip,ulsch->harq_processes[harq_pid]->Or1)>>24)) if (extract_cqi_crc(o_flip,ulsch_harq->Or1) == (crc8(o_flip,ulsch_harq->Or1)>>24))
ulsch->harq_processes[harq_pid]->cqi_crc_status = 1; ulsch_harq->cqi_crc_status = 1;
else else
ulsch->harq_processes[harq_pid]->cqi_crc_status = 0; ulsch_harq->cqi_crc_status = 0;
//printf("crc(cqi) rx: %x\n",(crc8(o_flip,ulsch->Or1)>>24)); //printf("crc(cqi) rx: %x\n",(crc8(o_flip,ulsch->Or1)>>24));
if (ulsch->harq_processes[harq_pid]->Or1<=32) { if (ulsch->harq_processes[harq_pid]->Or1<=32) {
ulsch->harq_processes[harq_pid]->o[3] = o_flip[0] ; ulsch_harq->o[3] = o_flip[0] ;
ulsch->harq_processes[harq_pid]->o[2] = o_flip[1] ; ulsch_harq->o[2] = o_flip[1] ;
ulsch->harq_processes[harq_pid]->o[1] = o_flip[2] ; ulsch_harq->o[1] = o_flip[2] ;
ulsch->harq_processes[harq_pid]->o[0] = o_flip[3] ; ulsch_harq->o[0] = o_flip[3] ;
} }
else { else {
ulsch->harq_processes[harq_pid]->o[7] = o_flip[0] ; ulsch_harq->o[7] = o_flip[0] ;
ulsch->harq_processes[harq_pid]->o[6] = o_flip[1] ; ulsch_harq->o[6] = o_flip[1] ;
ulsch->harq_processes[harq_pid]->o[5] = o_flip[2] ; ulsch_harq->o[5] = o_flip[2] ;
ulsch->harq_processes[harq_pid]->o[4] = o_flip[3] ; ulsch_harq->o[4] = o_flip[3] ;
ulsch->harq_processes[harq_pid]->o[3] = o_flip[4] ; ulsch_harq->o[3] = o_flip[4] ;
ulsch->harq_processes[harq_pid]->o[2] = o_flip[5] ; ulsch_harq->o[2] = o_flip[5] ;
ulsch->harq_processes[harq_pid]->o[1] = o_flip[6] ; ulsch_harq->o[1] = o_flip[6] ;
ulsch->harq_processes[harq_pid]->o[0] = o_flip[7] ; ulsch_harq->o[0] = o_flip[7] ;
} }
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding: Or1=%d\n",ulsch->Or1); msg("ulsch_decoding: Or1=%d\n",ulsch_harq->Or1);
for (i=0;i<1+((8+ulsch->harq_processes[harq_pid]->Or1)/8);i++) for (i=0;i<1+((8+ulsch_harq->Or1)/8);i++)
msg("ulsch_decoding: O[%d] %d\n",i,ulsch->harq_processes[harq_pid]->o[i]); msg("ulsch_decoding: O[%d] %d\n",i,ulsch_harq->o[i]);
if (ulsch->harq_processes[harq_pid]->cqi_crc_status == 1) if (ulsch_harq->cqi_crc_status == 1)
msg("RX CQI CRC OK (%x)\n",extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1)); msg("RX CQI CRC OK (%x)\n",extract_cqi_crc(o_flip,ulsch_harq->Or1));
else else
msg("RX CQI CRC NOT OK (%x)\n",extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1)); msg("RX CQI CRC NOT OK (%x)\n",extract_cqi_crc(o_flip,ulsch_harq->Or1));
#endif #endif
} }
...@@ -1117,13 +1119,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1117,13 +1119,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
r_offset = 0; r_offset = 0;
for (r=0;r<ulsch->harq_processes[harq_pid]->C;r++) { for (r=0;r<ulsch_harq->C;r++) {
// Get Turbo interleaver parameters // Get Turbo interleaver parameters
if (r<ulsch->harq_processes[harq_pid]->Cminus) if (r<ulsch_harq->Cminus)
Kr = ulsch->harq_processes[harq_pid]->Kminus; Kr = ulsch_harq->Kminus;
else else
Kr = ulsch->harq_processes[harq_pid]->Kplus; Kr = ulsch_harq->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
if (Kr_bytes<=64) if (Kr_bytes<=64)
...@@ -1140,13 +1142,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1140,13 +1142,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
} }
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
msg("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? ulsch->harq_processes[harq_pid]->F : 0); msg("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? ulsch_harq->F : 0);
#endif #endif
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short)); memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
ulsch->harq_processes[harq_pid]->RTC[r] = generate_dummy_w(4+(Kr_bytes*8), ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
(uint8_t*)&dummy_w[r][0], (uint8_t*)&dummy_w[r][0],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0); (r==0) ? ulsch_harq->F : 0);
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
msg("Rate Matching Segment %d (coded bits (G) %d,unpunctured/repeated bits %d, Q_m %d, nb_rb %d, Nl %d)...\n", msg("Rate Matching Segment %d (coded bits (G) %d,unpunctured/repeated bits %d, Q_m %d, nb_rb %d, Nl %d)...\n",
...@@ -1154,23 +1156,23 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1154,23 +1156,23 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Kr*3, Kr*3,
Q_m, Q_m,
nb_rb, nb_rb,
ulsch->harq_processes[harq_pid]->Nl); ulsch_harq->Nl);
#endif #endif
start_meas(&phy_vars_eNB->ulsch_rate_unmatching_stats); start_meas(&phy_vars_eNB->ulsch_rate_unmatching_stats);
if (lte_rate_matching_turbo_rx(ulsch->harq_processes[harq_pid]->RTC[r], if (lte_rate_matching_turbo_rx(ulsch_harq->RTC[r],
G, G,
ulsch->harq_processes[harq_pid]->w[r], ulsch_harq->w[r],
(uint8_t*) &dummy_w[r][0], (uint8_t*) &dummy_w[r][0],
ulsch->harq_processes[harq_pid]->e+r_offset, ulsch_harq->e+r_offset,
ulsch->harq_processes[harq_pid]->C, ulsch_harq->C,
NSOFT, NSOFT,
ulsch->Mdlharq, ulsch->Mdlharq,
1, 1,
ulsch->harq_processes[harq_pid]->rvidx, ulsch_harq->rvidx,
(ulsch->harq_processes[harq_pid]->round==0)?1:0, // clear (ulsch_harq->round==0)?1:0, // clear
get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs), get_Qm_ul(ulsch_harq->mcs),
1, 1,
r, r,
&E)==-1) { &E)==-1) {
...@@ -1181,19 +1183,19 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1181,19 +1183,19 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
r_offset += E; r_offset += E;
/* /*
msg("Subblock deinterleaving, d %p w %p\n", msg("Subblock deinterleaving, d %p w %p\n",
ulsch->harq_processes[harq_pid]->d[r], ulsch_harq->d[r],
ulsch->harq_processes[harq_pid]->w); ulsch_harq->w);
*/ */
start_meas(&phy_vars_eNB->ulsch_deinterleaving_stats); start_meas(&phy_vars_eNB->ulsch_deinterleaving_stats);
sub_block_deinterleaving_turbo(4+Kr, sub_block_deinterleaving_turbo(4+Kr,
&ulsch->harq_processes[harq_pid]->d[r][96], &ulsch_harq->d[r][96],
ulsch->harq_processes[harq_pid]->w[r]); ulsch_harq->w[r]);
stop_meas(&phy_vars_eNB->ulsch_deinterleaving_stats); stop_meas(&phy_vars_eNB->ulsch_deinterleaving_stats);
/* /*
#ifdef DEBUG_ULSCH_DECODING #ifdef DEBUG_ULSCH_DECODING
msg("decoder input(segment %d) :",r); msg("decoder input(segment %d) :",r);
for (i=0;i<(3*8*Kr_bytes)+12;i++) for (i=0;i<(3*8*Kr_bytes)+12;i++)
msg("%d : %d\n",i,ulsch->harq_processes[harq_pid]->d[r][96+i]); msg("%d : %d\n",i,ulsch_harq->d[r][96+i]);
msg("\n"); msg("\n");
#endif #endif
*/ */
...@@ -1204,11 +1206,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1204,11 +1206,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
{ {
#pragma omp for nowait #pragma omp for nowait
#endif #endif
for (r=0;r<ulsch->harq_processes[harq_pid]->C;r++) { for (r=0;r<ulsch_harq->C;r++) {
// msg("Clearing c, %p\n",ulsch->harq_processes[harq_pid]->c[r]); // msg("Clearing c, %p\n",ulsch_harq->c[r]);
// memset(ulsch->harq_processes[harq_pid]->c[r],0,16);//block_length); // memset(ulsch_harq->c[r],0,16);//block_length);
// msg("done\n"); // msg("done\n");
if (ulsch->harq_processes[harq_pid]->C == 1) if (ulsch_harq->C == 1)
crc_type = CRC24_A; crc_type = CRC24_A;
else else
crc_type = CRC24_B; crc_type = CRC24_B;
...@@ -1216,22 +1218,22 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1216,22 +1218,22 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
/* /*
msg("decoder input(segment %d)\n",r); msg("decoder input(segment %d)\n",r);
for (i=0;i<(3*8*Kr_bytes)+12;i++) for (i=0;i<(3*8*Kr_bytes)+12;i++)
if ((ulsch->harq_processes[harq_pid]->d[r][96+i]>7) || if ((ulsch_harq->d[r][96+i]>7) ||
(ulsch->harq_processes[harq_pid]->d[r][96+i] < -8)) (ulsch_harq->d[r][96+i] < -8))
msg("%d : %d\n",i,ulsch->harq_processes[harq_pid]->d[r][96+i]); msg("%d : %d\n",i,ulsch_harq->d[r][96+i]);
msg("\n"); msg("\n");
*/ */
start_meas(&phy_vars_eNB->ulsch_turbo_decoding_stats); start_meas(&phy_vars_eNB->ulsch_turbo_decoding_stats);
ret = tc(&ulsch->harq_processes[harq_pid]->d[r][96], ret = tc(&ulsch_harq->d[r][96],
ulsch->harq_processes[harq_pid]->c[r], ulsch_harq->c[r],
Kr, Kr,
f1f2mat_old[iind*2], f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1], f1f2mat_old[(iind*2)+1],
ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS, ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS,
crc_type, crc_type,
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0, (r==0) ? ulsch_harq->F : 0,
&phy_vars_eNB->ulsch_tc_init_stats, &phy_vars_eNB->ulsch_tc_init_stats,
&phy_vars_eNB->ulsch_tc_alpha_stats, &phy_vars_eNB->ulsch_tc_alpha_stats,
&phy_vars_eNB->ulsch_tc_beta_stats, &phy_vars_eNB->ulsch_tc_beta_stats,
...@@ -1249,7 +1251,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1249,7 +1251,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
#endif #endif
/* /*
for (i=0;i<Kr_bytes;i++) for (i=0;i<Kr_bytes;i++)
printf("segment %d : byte %d => %d\n",r,i,ulsch->harq_processes[harq_pid]->c[r][i]); printf("segment %d : byte %d => %d\n",r,i,ulsch_harq->c[r][i]);
return(ret); return(ret);
*/ */
} }
...@@ -1264,31 +1266,31 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1264,31 +1266,31 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
#endif #endif
// Reassembly of Transport block here // Reassembly of Transport block here
offset = 0; offset = 0;
// msg("F %d, Fbytes %d\n",ulsch->harq_processes[harq_pid]->F,ulsch->harq_processes[harq_pid]->F>>3); // msg("F %d, Fbytes %d\n",ulsch_harq->F,ulsch_harq->F>>3);
ret = 1; ret = 1;
for (r=0;r<ulsch->harq_processes[harq_pid]->C;r++) { for (r=0;r<ulsch_harq->C;r++) {
if (status[r] != (1+ulsch->max_turbo_iterations)) { if (status[r] != (1+ulsch->max_turbo_iterations)) {
if (r<ulsch->harq_processes[harq_pid]->Cminus) if (r<ulsch_harq->Cminus)
Kr = ulsch->harq_processes[harq_pid]->Kminus; Kr = ulsch_harq->Kminus;
else else
Kr = ulsch->harq_processes[harq_pid]->Kplus; Kr = ulsch_harq->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
if (r==0) { if (r==0) {
memcpy(ulsch->harq_processes[harq_pid]->b, memcpy(ulsch_harq->b,
&ulsch->harq_processes[harq_pid]->c[0][(ulsch->harq_processes[harq_pid]->F>>3)], &ulsch_harq->c[0][(ulsch_harq->F>>3)],
Kr_bytes - (ulsch->harq_processes[harq_pid]->F>>3) - ((ulsch->harq_processes[harq_pid]->C>1)?3:0)); Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0));
offset = Kr_bytes - (ulsch->harq_processes[harq_pid]->F>>3) - ((ulsch->harq_processes[harq_pid]->C>1)?3:0); offset = Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0);
// msg("copied %d bytes to b sequence\n", // msg("copied %d bytes to b sequence\n",
// Kr_bytes - (ulsch->harq_processes[harq_pid]->F>>3)); // Kr_bytes - (ulsch_harq->F>>3));
} }
else { else {
memcpy(ulsch->harq_processes[harq_pid]->b+offset, memcpy(ulsch_harq->b+offset,
ulsch->harq_processes[harq_pid]->c[r], ulsch_harq->c[r],
Kr_bytes - ((ulsch->harq_processes[harq_pid]->C>1)?3:0)); Kr_bytes - ((ulsch_harq->C>1)?3:0));
offset += (Kr_bytes- ((ulsch->harq_processes[harq_pid]->C>1)?3:0)); offset += (Kr_bytes- ((ulsch_harq->C>1)?3:0));
} }
if (ret != (1+ulsch->max_turbo_iterations)) if (ret != (1+ulsch->max_turbo_iterations))
ret = status[r]; ret = status[r];
......
...@@ -412,6 +412,9 @@ typedef struct ...@@ -412,6 +412,9 @@ typedef struct
LTE_UE_DLSCH_t *ulsch_ue_col[NUMBER_OF_CONNECTED_eNB_MAX]; LTE_UE_DLSCH_t *ulsch_ue_col[NUMBER_OF_CONNECTED_eNB_MAX];
LTE_UE_DLSCH_t *dlsch_ue_SI[NUMBER_OF_CONNECTED_eNB_MAX],*dlsch_ue_ra[NUMBER_OF_CONNECTED_eNB_MAX]; LTE_UE_DLSCH_t *dlsch_ue_SI[NUMBER_OF_CONNECTED_eNB_MAX],*dlsch_ue_ra[NUMBER_OF_CONNECTED_eNB_MAX];
LTE_UE_DLSCH_t *dlsch_ue_MCH[NUMBER_OF_CONNECTED_eNB_MAX]; LTE_UE_DLSCH_t *dlsch_ue_MCH[NUMBER_OF_CONNECTED_eNB_MAX];
// This is for SIC in the UE, to store the reencoded data
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_CONNECTED_eNB_MAX];
// For abstraction-purposes only // For abstraction-purposes only
uint8_t sr[10]; uint8_t sr[10];
uint8_t pucch_sel[10]; uint8_t pucch_sel[10];
...@@ -555,6 +558,9 @@ typedef struct ...@@ -555,6 +558,9 @@ typedef struct
time_stats_t dlsch_deinterleaving_stats; time_stats_t dlsch_deinterleaving_stats;
time_stats_t dlsch_llr_stats; time_stats_t dlsch_llr_stats;
time_stats_t dlsch_unscrambling_stats; time_stats_t dlsch_unscrambling_stats;
time_stats_t dlsch_rate_matching_stats;
time_stats_t dlsch_turbo_encoding_stats;
time_stats_t dlsch_interleaving_stats;
time_stats_t dlsch_tc_init_stats; time_stats_t dlsch_tc_init_stats;
time_stats_t dlsch_tc_alpha_stats; time_stats_t dlsch_tc_alpha_stats;
time_stats_t dlsch_tc_beta_stats; time_stats_t dlsch_tc_beta_stats;
......
...@@ -638,7 +638,7 @@ typedef struct { ...@@ -638,7 +638,7 @@ typedef struct {
/// Received frequency-domain signal after extraction and channel compensation /// Received frequency-domain signal after extraction and channel compensation
int32_t **rxdataF_comp0; int32_t **rxdataF_comp0;
/// Received frequency-domain signal after extraction and channel compensation /// Received frequency-domain signal after extraction and channel compensation
int32_t **rxdataF_comp1; int32_t **rxdataF_comp1[8];
/// Downlink channel estimates extracted in PRBS /// Downlink channel estimates extracted in PRBS
int32_t **dl_ch_estimates_ext; int32_t **dl_ch_estimates_ext;
/// Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS /// Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS
......
...@@ -270,6 +270,7 @@ int main(int argc, char **argv) { ...@@ -270,6 +270,7 @@ int main(int argc, char **argv) {
unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[4]={0,0,0,0},round_trials[4]={0,0,0,0},dci_errors=0,dlsch_active=0,num_layers; unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[4]={0,0,0,0},round_trials[4]={0,0,0,0},dci_errors=0,dlsch_active=0,num_layers;
int re_allocated; int re_allocated;
char fname[32],vname[32];
FILE *bler_fd; FILE *bler_fd;
char bler_fname[256]; char bler_fname[256];
FILE *time_meas_fd; FILE *time_meas_fd;
...@@ -344,6 +345,11 @@ int main(int argc, char **argv) { ...@@ -344,6 +345,11 @@ int main(int argc, char **argv) {
int TB0_active = 1; int TB0_active = 1;
LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
opp_enabled=1; // to enable the time meas opp_enabled=1; // to enable the time meas
cpu_freq_GHz = (double)get_cpu_freq_GHz(); cpu_freq_GHz = (double)get_cpu_freq_GHz();
...@@ -890,6 +896,8 @@ int main(int argc, char **argv) { ...@@ -890,6 +896,8 @@ int main(int argc, char **argv) {
PHY_vars_eNB->dlsch_eNB[k][i]->rnti = n_rnti+k; PHY_vars_eNB->dlsch_eNB[k][i]->rnti = n_rnti+k;
} }
} }
// structure for SIC at UE
PHY_vars_UE->dlsch_eNB[0] = new_eNB_dlsch(1,8,N_RB_DL,0);
for (i=0;i<2;i++) { for (i=0;i<2;i++) {
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,N_RB_DL,0); PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,N_RB_DL,0);
...@@ -1970,7 +1978,7 @@ int main(int argc, char **argv) { ...@@ -1970,7 +1978,7 @@ int main(int argc, char **argv) {
hold_channel = 1; hold_channel = 1;
} }
else else
hold_channel = 0; hold_channel = 0;//(round==0) ? 0 : 1;
PMI_FEEDBACK: PMI_FEEDBACK:
...@@ -2810,7 +2818,7 @@ int main(int argc, char **argv) { ...@@ -2810,7 +2818,7 @@ int main(int argc, char **argv) {
for (i=0;i<dci_cnt;i++) { for (i=0;i<dci_cnt;i++) {
// printf("Generating dlsch parameters for RNTI %x\n",dci_alloc_rx[i].rnti); // printf("Generating dlsch parameters for RNTI %x\n",dci_alloc_rx[i].rnti);
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->first_tx=1; if (round == 0) PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->first_tx=1;
if ((dci_alloc_rx[i].rnti == n_rnti) && if ((dci_alloc_rx[i].rnti == n_rnti) &&
(generate_ue_dlsch_params_from_dci(0, (generate_ue_dlsch_params_from_dci(0,
dci_alloc_rx[i].dci_pdu, dci_alloc_rx[i].dci_pdu,
...@@ -2860,7 +2868,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -2860,7 +2868,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
PHY_vars_UE->lte_ue_pdcch_vars[0]->crnti = n_rnti; PHY_vars_UE->lte_ue_pdcch_vars[0]->crnti = n_rnti;
PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols = num_pdcch_symbols; PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols = num_pdcch_symbols;
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx=1; if (round == 0) PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx=1;
switch (transmission_mode) { switch (transmission_mode) {
case 1: case 1:
case 2: case 2:
...@@ -2876,7 +2884,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -2876,7 +2884,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
P_RNTI); P_RNTI);
break; break;
case 3: case 3:
PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->first_tx=1; // printf("Rate: TM3 (before) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
generate_ue_dlsch_params_from_dci(0, generate_ue_dlsch_params_from_dci(0,
&DLSCH_alloc_pdu_1[0], &DLSCH_alloc_pdu_1[0],
(common_flag==0)? C_RNTI : SI_RNTI, (common_flag==0)? C_RNTI : SI_RNTI,
...@@ -2887,6 +2895,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -2887,6 +2895,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
SI_RNTI, SI_RNTI,
0, 0,
P_RNTI); P_RNTI);
// printf("Rate: TM3 (after) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
break; break;
case 4: case 4:
generate_ue_dlsch_params_from_dci(0, generate_ue_dlsch_params_from_dci(0,
...@@ -3018,24 +3027,24 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -3018,24 +3027,24 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
write_output("rxsigF1.m","rxsF1", PHY_vars_UE->lte_ue_common_vars.rxdataF[1],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); write_output("rxsigF1.m","rxsF1", PHY_vars_UE->lte_ue_common_vars.rxdataF[1],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
} }
write_output("dlsch00_ch0.m","dl00_ch0", write_output("dlsch00_r0.m","dl00_r0",
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1)
write_output("dlsch01_ch0.m","dl01_ch0", write_output("dlsch01_r0.m","dl01_r0",
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)
write_output("dlsch10_ch0.m","dl10_ch0", write_output("dlsch10_r0.m","dl10_r0",
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1))
write_output("dlsch11_ch0.m","dl11_ch0", write_output("dlsch11_r0.m","dl11_r0",
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
//pdsch_vars //pdsch_vars
dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword); dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword,round);
//dump_dlsch2(PHY_vars_UE,eNB_id_i,coded_bits_per_codeword); //dump_dlsch2(PHY_vars_UE,eNB_id_i,coded_bits_per_codeword);
write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4); write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
...@@ -3120,10 +3129,40 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -3120,10 +3129,40 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
avg_iter += ret; avg_iter += ret;
iter_trials++; iter_trials++;
if (n_frames==1) if (n_frames==1)
printf("No DLSCH errors found,uncoded ber %f\n",uncoded_ber); printf("No DLSCH errors found (round %d),uncoded ber %f\n",round,uncoded_ber);
PHY_vars_UE->total_TBS[eNB_id] = PHY_vars_UE->total_TBS[eNB_id] + PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS; PHY_vars_UE->total_TBS[eNB_id] = PHY_vars_UE->total_TBS[eNB_id] + PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS;
TB0_active = 0; TB0_active = 0;
if (PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode = LARGE_CDD) { //try to decode second stream
for (round = 0 ; round < PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->round ; round++) {
dlsch0_ue_harq = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid];
dlsch0_eNB_harq = PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid];
dlsch0_eNB_harq->mimo_mode = LARGE_CDD;
dlsch0_eNB_harq->rb_alloc[0] = dlsch0_ue_harq->rb_alloc[0];
dlsch0_eNB_harq->nb_rb = dlsch0_ue_harq->nb_rb;
dlsch0_eNB_harq->mcs = dlsch0_ue_harq->mcs;
dlsch0_eNB_harq->rvidx = dlsch0_ue_harq->rvidx;
dlsch0_eNB_harq->Nl = dlsch0_ue_harq->Nl;
dlsch0_eNB_harq->TBS = dlsch0_ue_harq->TBS;
dlsch0_eNB_harq->dl_power_off = dlsch0_ue_harq->dl_power_off;
dlsch0_eNB_harq->status = dlsch0_ue_harq->status;
PHY_vars_UE->dlsch_eNB[eNB_id]->active = PHY_vars_UE->dlsch_ue[eNB_id][0]->active;
PHY_vars_UE->dlsch_eNB[eNB_id]->rnti = PHY_vars_UE->dlsch_ue[eNB_id][0]->rnti;
dlsch_encoding(PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
&PHY_vars_UE->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_UE->dlsch_eNB[0],
0,subframe,
&PHY_vars_UE->dlsch_rate_matching_stats,
&PHY_vars_UE->dlsch_turbo_encoding_stats,
&PHY_vars_UE->dlsch_interleaving_stats
);
}
}
} }
else { else {
errs[round]++; errs[round]++;
...@@ -3133,7 +3172,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -3133,7 +3172,7 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
if (n_frames==1) { if (n_frames==1) {
//if ((n_frames==1) || (SNR>=30)) { //if ((n_frames==1) || (SNR>=30)) {
printf("DLSCH errors found, uncoded ber %f\n",uncoded_ber); printf("DLSCH errors found (round %d), uncoded ber %f\n",round,uncoded_ber);
for (s=0;s<PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->C;s++) { for (s=0;s<PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->Cminus) if (s<PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->Kminus; Kr = PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->Kminus;
...@@ -3146,43 +3185,61 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, ...@@ -3146,43 +3185,61 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
for (i=0;i<Kr_bytes;i++) for (i=0;i<Kr_bytes;i++)
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->c[s][i],PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->c[s][i]); printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->c[s][i],PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->c[s][i]);
} }
write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); sprintf(fname,"rxsig0_r%d.m",round);
write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],2*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,2,1); sprintf(vname,"rxs0_r%d.m",round);
write_output(fname,vname, &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1);
sprintf(fname,"rxsigF0_r%d.m",round);
sprintf(vname,"rxs0F_r%d.m",round);
write_output(fname,vname, &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],2*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,2,1);
if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) { if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) {
write_output("rxsig1.m","rxs1", PHY_vars_UE->lte_ue_common_vars.rxdata[1],PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); sprintf(fname,"rxsig1_r%d.m",round);
write_output("rxsigF1.m","rxsF1", PHY_vars_UE->lte_ue_common_vars.rxdataF[1],2*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,2,1); sprintf(vname,"rxs1_r%d.m",round);
write_output(fname,vname, PHY_vars_UE->lte_ue_common_vars.rxdata[1],PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1);
sprintf(fname,"rxsig1F_r%d.m",round);
sprintf(vname,"rxs1F_r%d.m",round);
write_output(fname,vname, PHY_vars_UE->lte_ue_common_vars.rxdataF[1],2*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,2,1);
} }
sprintf(fname,"dlsch00_r%d.m",round);
write_output("dlsch00_ch0.m","dl00_ch0", sprintf(vname,"dl00_r%d.m",round);
write_output(fname,vname,
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) {
write_output("dlsch01_ch0.m","dl01_ch0", sprintf(fname,"dlsch01_r%d.m",round);
sprintf(vname,"dl01_r%d.m",round);
write_output(fname,vname,
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) }
write_output("dlsch10_ch0.m","dl10_ch0", if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) {
sprintf(fname,"dlsch10_r%d.m",round);
sprintf(vname,"dl10_r%d.m",round);
write_output(fname,vname,
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) }
write_output("dlsch11_ch0.m","dl11_ch0", if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) {
sprintf(fname,"dlsch11_r%d.m",round);
sprintf(vname,"dl11_r%d.m",round);
write_output(fname,vname,
&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]), &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]),
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1);
}
//pdsch_vars //pdsch_vars
dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword); dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword,round);
/*
write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4); write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
write_output("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0); write_output("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
write_output("dlsch_eNB_w.m","w",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,4); write_output("dlsch_eNB_w.m","w",PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,4);
write_output("dlsch_UE_w.m","w",PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,0); write_output("dlsch_UE_w.m","w",PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,0);
*/
exit(-1); if (round == 3) exit(-1);
} }
// printf("round %d errors %d/%d\n",round,errs[round],trials); // printf("round %d errors %d/%d\n",round,errs[round],trials);
round++; round++;
// PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round++;
} }
#ifdef XFORMS #ifdef XFORMS
phy_scope_UE(form_ue, phy_scope_UE(form_ue,
......
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