Commit 628393ff authored by Matthieu Kanj's avatar Matthieu Kanj

NPUSCH update

parent 671309ef
...@@ -398,6 +398,16 @@ void descrambling_NPUSCH_ack_NB_IoT(LTE_DL_FRAME_PARMS *fp, ...@@ -398,6 +398,16 @@ void descrambling_NPUSCH_ack_NB_IoT(LTE_DL_FRAME_PARMS *fp,
uint8_t rx_subframe, uint8_t rx_subframe,
uint32_t rx_frame); uint32_t rx_frame);
uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB,
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT,
eNB_rxtx_proc_t *proc,
uint8_t npusch_format,
unsigned int G,
uint8_t rvdx,
uint8_t Qm,
uint32_t rx_frame,
uint8_t rx_subframe);
void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *fp, LTE_DL_FRAME_PARMS *fp,
eNB_rxtx_proc_t *proc, eNB_rxtx_proc_t *proc,
...@@ -411,6 +421,8 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -411,6 +421,8 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
uint8_t rx_subframe, uint8_t rx_subframe,
uint32_t rx_frame); uint32_t rx_frame);
void deinterleaving_NPUSCH_data_NB_IoT(NB_IoT_UL_eNB_HARQ_t *ulsch_harq, int16_t *y, unsigned int G);
uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc, eNB_rxtx_proc_t *proc,
......
...@@ -1500,101 +1500,20 @@ void descrambling_NPUSCH_ack_NB_IoT(LTE_DL_FRAME_PARMS *fp, ...@@ -1500,101 +1500,20 @@ void descrambling_NPUSCH_ack_NB_IoT(LTE_DL_FRAME_PARMS *fp,
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB,
void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT,
LTE_DL_FRAME_PARMS *fp,
eNB_rxtx_proc_t *proc, eNB_rxtx_proc_t *proc,
uint8_t npusch_format, uint8_t npusch_format,
uint16_t N_SF_per_word, unsigned int G,
uint16_t Nsc_RU, uint8_t rvdx,
uint16_t N_UL_slots,
uint8_t Qm, uint8_t Qm,
uint8_t pilots_slot, uint32_t rx_frame,
uint32_t rnti_tmp, uint8_t rx_subframe)
uint8_t rx_subframe,
uint32_t rx_frame)
{ {
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0]; // eNB->pusch_vars[UE_id];
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT = eNB->ulsch_NB_IoT[0];
NB_IoT_UL_eNB_HARQ_t *ulsch_harq = ulsch_NB_IoT->harq_process; NB_IoT_UL_eNB_HARQ_t *ulsch_harq = ulsch_NB_IoT->harq_process;
unsigned int A = (ulsch_harq->TBS)*8; int r = 0, Kr = 0;
uint8_t rvdx = ulsch_harq->rvidx;
unsigned int j,j2;
int iprime;
int r,Kr;
unsigned int G,H,Hprime,Hpp,Cmux,Rmux_prime; // Q_CQI,Q_RI=0
int16_t y[6*14*1200] __attribute__((aligned(32)));
uint8_t ytag[14*1200];
if (npusch_format == 0)
{
int16_t *ulsch_llr = eNB->pusch_vars[0]->llr; // eNB->pusch_vars[eNB_id]->llr; //UE_id=0
// NB-IoT ///////////////////////////////////////////////
// x1 is set in lte_gold_generic
// x2 should not reinitialized each subframe
// x2 should be reinitialized according to 36.211 Sections 10.1.3.1 and 10.1.3.6
// A = ulsch_harq->TBS; //88; // // only for msg3 , should be replace by generic one
// Qm = get_Qm_ul_NB_IoT(I_MCS,Nsc_RU); // (2,1) ///// ulsch_harq->mcs,ulsch_harq->N_sc_RU // G_UL ??
G = (7-pilots_slot) * Qm * N_UL_slots * Nsc_RU; //(1 * Q_m) * 6 * 16; // Vincent : see 36.212, Section 5.1.4.1.2 // 16 slot(total number of slots) * 6 symboles (7-pilots_slot) * Qm*1
//G = ulsch_harq->N_sc_RU * Q_m) * ulsch_harq->Nsymb_UL * ulsch_harq->Nslot_UL; (= number of RE * 2 - pilots)
if (ulsch_harq->round == 0)
{
// This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24;
lte_segmentation_NB_IoT(NULL,
NULL,
ulsch_harq->B,
&ulsch_harq->C,
&ulsch_harq->Cplus,
&ulsch_harq->Cminus,
&ulsch_harq->Kplus,
&ulsch_harq->Kminus,
&ulsch_harq->F);
}
ulsch_harq->G = G;
H = G ;
Hprime = H/Qm;
Hpp = Hprime;
Cmux = (7-pilots_slot) * N_UL_slots * Nsc_RU; // 6*16; /////(ulsch_harq->Nsymb_UL)*ulsch_harq->Nslot_UL;
Rmux_prime = Hpp/Cmux;
// Clear "tag" interleaving matrix to allow for CQI/DATA identification
memset(ytag,0,Cmux*Rmux_prime);
memset(y,LTE_NULL_NB_IoT,Qm*Hpp);
descrambling_NPUSCH_data_NB_IoT(fp,
ulsch_llr,
y,
Qm,
Cmux,
rnti_tmp,
ulsch_NB_IoT->Msg3_subframe,
ulsch_NB_IoT->Msg3_frame);
///////////////////////////////// desin multi-tone
//if multi-RU
/// deinterleaving
j = 0;
j2 = 0;
int16_t *yp,*ep;
for (iprime=0,yp=&y[j2],ep=&ulsch_harq->e[0]; iprime<G; iprime+=8,j2+=8,ep+=8,yp+=8)
{
ep[0] = yp[0];
ep[1] = yp[1];
ep[2] = yp[2];
ep[3] = yp[3];
ep[4] = yp[4];
ep[5] = yp[5];
ep[6] = yp[6];
ep[7] = yp[7];
}
/// turbo decoding
r=0;
Kr=0;
unsigned int r_offset=0,Kr_bytes,iind=0; unsigned int r_offset=0,Kr_bytes,iind=0;
uint8_t crc_type; uint8_t crc_type;
int offset = 0; int offset = 0;
...@@ -1650,7 +1569,6 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1650,7 +1569,6 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
} else { } else {
LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes); LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
//return(-1);
} }
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short)); memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
...@@ -1664,10 +1582,10 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1664,10 +1582,10 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
(uint8_t*) &dummy_w[r][0], (uint8_t*) &dummy_w[r][0],
ulsch_harq->e+r_offset, ulsch_harq->e+r_offset,
ulsch_harq->C, ulsch_harq->C,
1, //////////////////////////////// not used 1, ////// not used
0, //Uplink 0, //Uplink
1, 1,
rvdx,//ulsch_harq->rvidx, rvdx, //ulsch_harq->rvidx,
(ulsch_harq->round==0)?1:0, // clear (ulsch_harq->round==0)?1:0, // clear
Qm, //2 //get_Qm_ul(ulsch_harq->mcs), Qm, //2 //get_Qm_ul(ulsch_harq->mcs),
1, 1,
...@@ -1675,8 +1593,8 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1675,8 +1593,8 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
&E)==-1) &E)==-1)
{ {
LOG_E(PHY,"ulsch_decoding.c: Problem in rate matching\n"); LOG_E(PHY,"ulsch_decoding.c: Problem in rate matching\n");
//return(-1);
} }
r_offset += E; r_offset += E;
sub_block_deinterleaving_turbo(4+Kr, sub_block_deinterleaving_turbo(4+Kr,
...@@ -1695,7 +1613,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1695,7 +1613,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
Kr, Kr,
f1f2mat_old[iind*2], f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1], f1f2mat_old[(iind*2)+1],
ulsch_NB_IoT->max_turbo_iterations, //MAX_TURBO_ITERATIONS, ulsch_NB_IoT->max_turbo_iterations, // MAX_TURBO_ITERATIONS,
crc_type, crc_type,
(r==0) ? ulsch_harq->F : 0, (r==0) ? ulsch_harq->F : 0,
&eNB->ulsch_tc_init_stats, &eNB->ulsch_tc_init_stats,
...@@ -1705,7 +1623,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1705,7 +1623,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
&eNB->ulsch_tc_ext_stats, &eNB->ulsch_tc_ext_stats,
&eNB->ulsch_tc_intl1_stats, &eNB->ulsch_tc_intl1_stats,
&eNB->ulsch_tc_intl2_stats); &eNB->ulsch_tc_intl2_stats);
///////////////////end decoding ////////////////////////////////////////////// ///////////////end decoding /////////////
if (ret != (1+ulsch_NB_IoT->max_turbo_iterations)) if (ret != (1+ulsch_NB_IoT->max_turbo_iterations))
{ {
if (r<ulsch_harq->Cminus) if (r<ulsch_harq->Cminus)
...@@ -1738,7 +1656,113 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1738,7 +1656,113 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
} }
} //////////// r loop end //////////// } //////////// r loop end ////////////
} else { //////////////////////////////////// ACK ////////////////////////////// }
//////////////////////////////////////////////////////////////////////////////////////////
void deinterleaving_NPUSCH_data_NB_IoT(NB_IoT_UL_eNB_HARQ_t *ulsch_harq, int16_t *y, unsigned int G)
{
unsigned int j2=0;
int16_t *yp,*ep;
int iprime;
for (iprime=0,yp=&y[j2],ep=&ulsch_harq->e[0]; iprime<G; iprime+=8,j2+=8,ep+=8,yp+=8)
{
ep[0] = yp[0];
ep[1] = yp[1];
ep[2] = yp[2];
ep[3] = yp[3];
ep[4] = yp[4];
ep[5] = yp[5];
ep[6] = yp[6];
ep[7] = yp[7];
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *fp,
eNB_rxtx_proc_t *proc,
uint8_t npusch_format,
uint16_t N_SF_per_word,
uint16_t Nsc_RU,
uint16_t N_UL_slots,
uint8_t Qm,
uint8_t pilots_slot,
uint32_t rnti_tmp,
uint8_t rx_subframe,
uint32_t rx_frame)
{
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0]; // eNB->pusch_vars[UE_id];
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT = eNB->ulsch_NB_IoT[0];
NB_IoT_UL_eNB_HARQ_t *ulsch_harq = ulsch_NB_IoT->harq_process;
unsigned int A = (ulsch_harq->TBS)*8;
uint8_t rvdx = ulsch_harq->rvidx;
if (npusch_format == 0)
{
int16_t *ulsch_llr = eNB->pusch_vars[0]->llr; // eNB->pusch_vars[eNB_id]->llr; //UE_id=0
unsigned int G,H,Hprime,Hpp,Cmux,Rmux_prime;
int16_t y[6*14*1200] __attribute__((aligned(32)));
uint8_t ytag[14*1200];
G = (7-pilots_slot) * Qm * N_UL_slots * Nsc_RU; //(1 * Q_m) * 6 * 16; // Vincent : see 36.212, Section 5.1.4.1.2 // 16 slot(total number of slots) * 6 symboles (7-pilots_slot) * Qm*1
// x1 is set in lte_gold_generic
// x2 should not reinitialized each subframe
// x2 should be reinitialized according to 36.211 Sections 10.1.3.1 and 10.1.3.6
if (ulsch_harq->round == 0)
{
// This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24;
lte_segmentation_NB_IoT(NULL,
NULL,
ulsch_harq->B,
&ulsch_harq->C,
&ulsch_harq->Cplus,
&ulsch_harq->Cminus,
&ulsch_harq->Kplus,
&ulsch_harq->Kminus,
&ulsch_harq->F);
}
ulsch_harq->G = G;
H = G ;
Hprime = H/Qm;
Hpp = Hprime; // => Hprime = G/Qm
Cmux = (7-pilots_slot) * N_UL_slots * Nsc_RU;
Rmux_prime = Hpp/Cmux;
// Clear "tag" interleaving matrix to allow for CQI/DATA identification
memset(ytag,0,Cmux*Rmux_prime);
memset(y,LTE_NULL_NB_IoT,Qm*Hpp);
descrambling_NPUSCH_data_NB_IoT(fp,
ulsch_llr,
y,
Qm,
Cmux,
rnti_tmp,
ulsch_NB_IoT->Msg3_subframe,
ulsch_NB_IoT->Msg3_frame);
/// deinterleaving
deinterleaving_NPUSCH_data_NB_IoT(ulsch_harq,y,G);
/// turbo decoding NPUSCH data
turbo_decoding_NB_IoT(eNB,
ulsch_NB_IoT,
proc,
npusch_format,
G,
rvdx,
Qm,
rx_frame,
rx_subframe);
} else { //////////////////// ACK ///////////////////
int32_t llr_msg5[16]; int32_t llr_msg5[16];
int32_t y_msg5[16]; int32_t y_msg5[16];
...@@ -1752,7 +1776,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1752,7 +1776,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
{ {
llr_msg5[l] = llrp2[l<<1] + llrp2[(l<<1)+1]; llr_msg5[l] = llrp2[l<<1] + llrp2[(l<<1)+1];
} }
/////////////////////////////////////// descrambling + pre-decision /////////////////////////
descrambling_NPUSCH_ack_NB_IoT(fp, descrambling_NPUSCH_ack_NB_IoT(fp,
y_msg5, y_msg5,
llr_msg5, llr_msg5,
...@@ -1761,7 +1785,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1761,7 +1785,7 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
ulsch_NB_IoT->Msg3_subframe, ulsch_NB_IoT->Msg3_subframe,
ulsch_NB_IoT->Msg3_frame); ulsch_NB_IoT->Msg3_frame);
/// Decision ACK/NACK ///////////////////////////////// Decision ACK/NACK /////////////////////////////////////
printf("\n\n\n"); printf("\n\n\n");
if (counter_ack>8) //hard decision if (counter_ack>8) //hard decision
{ {
......
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