Commit 2dfe84a7 authored by Florian Kaltenberger's avatar Florian Kaltenberger

bugfixing for UL. Remaining problems: CCE allocations in subframe 5 lead to...

bugfixing for UL. Remaining problems: CCE allocations in subframe 5 lead to occasional illegal DCI allocations (affects UL DCI which is missed by UE). waveform compliance with CQI in ULSCH.
parent 15cd4ab0
......@@ -7127,10 +7127,10 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms,
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe),
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe));
// printf("eNB: sched_subframe %d, subframe %d, frame_tx %d\n",sched_subframe,subframe,phy_vars_eNB->proc[sched_subframe].frame_tx);
switch (frame_parms->N_RB_DL) {
......@@ -7598,9 +7598,9 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
break;
}
} else {
ulsch->harq_processes[harq_pid]->O_RI = 0;//1;
ulsch->harq_processes[harq_pid]->O_RI = 0;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = 0;//sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->Or1 = 0;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
......
......@@ -1466,7 +1466,6 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
nseq_PHICH = ((ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) +
ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH);
//#ifdef DEBUG_PHICH
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d dci_alloc %d)\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
......@@ -1474,7 +1473,6 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb,
ulsch_eNB[UE_id]->harq_processes[harq_pid]->dci_alloc);
//#endif
if (ulsch_eNB[UE_id]->Msg3_active == 1) {
LOG_D(PHY,"[eNB %d][PUSCH %d][RAPROC] Frame %d, subframe %d: Generating Msg3 PHICH for UE %d, ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,
......@@ -1509,12 +1507,10 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d, subframe %d : PHICH NACK / (no format0 DCI) Setting subframe_scheduling_flag\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->Ndi = 0;
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->round++; //this is already done in phy_procedures
ulsch_eNB[UE_id]->harq_processes[harq_pid]->rvidx = rv_table[ulsch_eNB[UE_id]->harq_processes[harq_pid]->round&3];
ulsch_eNB[UE_id]->harq_processes[harq_pid]->O_RI = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->Or2 = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->Or1 = 0;//sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->Or1 = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
} else {
......
......@@ -1058,21 +1058,24 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
}
//__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_energy_list, uint16_t *preamble_delay_list, uint16_t Nf, uint8_t tdd_mapindex)
void rx_prach(PHY_VARS_eNB *phy_vars_eNB,
uint8_t subframe,
uint16_t *preamble_energy_list,
uint16_t *preamble_delay_list,
uint16_t Nf,
uint8_t tdd_mapindex)
{
int i;
lte_frame_type_t frame_type = phy_vars_eNB->lte_frame_parms.frame_type;
//uint8_t tdd_config = phy_vars_eNB->lte_frame_parms.tdd_config;
uint16_t rootSequenceIndex = phy_vars_eNB->lte_frame_parms.prach_config_common.rootSequenceIndex;
uint8_t prach_ConfigIndex = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t Ncs_config = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
uint8_t restricted_set = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag;
//uint8_t n_ra_prboffset = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
int16_t *prachF = phy_vars_eNB->lte_eNB_prach_vars.prachF;
int16_t **rxsigF = phy_vars_eNB->lte_eNB_prach_vars.rxsigF;
int16_t **prach_ifft = phy_vars_eNB->lte_eNB_prach_vars.prach_ifft;
lte_frame_type_t frame_type = phy_vars_eNB->lte_frame_parms.frame_type;
uint16_t rootSequenceIndex = phy_vars_eNB->lte_frame_parms.prach_config_common.rootSequenceIndex;
uint8_t prach_ConfigIndex = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t Ncs_config = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
uint8_t restricted_set = phy_vars_eNB->lte_frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag;
int16_t *prachF = phy_vars_eNB->lte_eNB_prach_vars.prachF;
int16_t **rxsigF = phy_vars_eNB->lte_eNB_prach_vars.rxsigF;
int16_t **prach_ifft = phy_vars_eNB->lte_eNB_prach_vars.prach_ifft;
int16_t *prach[4];
int16_t *prach2;
uint8_t n_ra_prb;
......@@ -1086,12 +1089,8 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
uint16_t numshift=0;
uint16_t *prach_root_sequence_map;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
//uint8_t Nsp=2;
//uint8_t f_ra,t1_ra;
uint16_t N_ZC = (prach_fmt <4)?839:139;
uint8_t not_found;
// LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
// uint16_t subframe_offset;
int k;
uint16_t u;
int16_t *Xu;
......@@ -1107,7 +1106,6 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
for (aa=0; aa<nb_ant_rx; aa++) {
prach[aa] = (int16_t*)&phy_vars_eNB->lte_eNB_common_vars.rxdata[0][aa][subframe*phy_vars_eNB->lte_frame_parms.samples_per_tti-phy_vars_eNB->N_TA_offset];
// remove_625_Hz(phy_vars_eNB,prach[aa]);
}
// First compute physical root sequence
......@@ -1134,37 +1132,6 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
n_ra_prb = get_prach_prb_offset(&(phy_vars_eNB->lte_frame_parms),tdd_mapindex,Nf);
prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
/*
// this code is now part of get_prach_prb_offset
if (frame_type == TDD) { // TDD
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
if (prach_fmt < 4) {
if ((f_ra&1) == 0) {
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
} else {
n_ra_prb = phy_vars_eNB->lte_frame_parms.N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
}
} else {
if ((tdd_config >2) && (tdd_config<6))
Nsp = 2;
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
n_ra_prb = 6*f_ra;
} else {
n_ra_prb = phy_vars_eNB->lte_frame_parms.N_RB_UL - 6*(f_ra+1);
}
}
}
*/
// printf("NCS %d\n",NCS);
// PDP is oversampled, e.g. 1024 sample instead of 839
// Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839
NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139);
......@@ -1217,9 +1184,6 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
break;
}
// nsymb = (frame_parms->Ncp==0) ? 14:12;
// subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
preamble_offset_old = 99;
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
......
......@@ -246,7 +246,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
uint8_t *columnset;
unsigned int sumKr=0;
unsigned int Qprime,L,G,Q_CQI,Q_RI,H,Hprime,Hpp,Cmux,Rmux_prime,O_RCC;
unsigned int Qprime_ACK,Qprime_CQI,Qprime_RI,len_ACK=0,len_RI=0;
unsigned int Qprime_ACK,Qprime_RI,len_ACK=0,len_RI=0;
// uint8_t q_ACK[MAX_ACK_PAYLOAD],q_RI[MAX_RI_PAYLOAD];
int metric,metric_new;
uint8_t o_flip[8];
......@@ -410,12 +410,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
else
L=8;
// NOTE: we have to handle the case where we have a very small number of bits (condition on pg. 26 36.212)
if (ulsch_harq->Or1 > 0)
Qprime = (ulsch_harq->Or1 + L) * ulsch_harq->Msc_initial*ulsch_harq->Nsymb_initial * ulsch->beta_offset_cqi_times8;
else
Qprime=0;
if (Qprime > 0) {
if (Qprime > 0) { // check if ceiling is larger than floor in Q' expression
if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr));
else
......@@ -426,14 +427,10 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
if (Qprime > (G - ulsch_harq->O_RI))
Qprime = G - ulsch_harq->O_RI;
Q_CQI = Q_m * Qprime;
#ifdef DEBUG_ULSCH_DECODING
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
Qprime_CQI = Qprime;
G = G - Q_RI - Q_CQI;
......@@ -452,9 +449,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Hpp/Cmux;
#ifdef DEBUG_ULSCH_DECODING
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
// Clear "tag" interleaving matrix to allow for CQI/DATA identification
memset(ytag,0,Cmux*Rmux_prime);
......@@ -462,128 +456,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
i=0;
memset(y,LTE_NULL,Q_m*Hpp);
/*
// Do RI coding
if (ulsch->O_RI == 1) {
switch (Q_m) {
case 2:
q_RI[0] = 0;
q_RI[1] = PUSCH_y;
len_RI=2;
break;
case 4:
q_RI[0] = 0;
q_RI[1] = PUSCH_y;//1;
q_RI[2] = PUSCH_x;//o_RI[0];
q_RI[3] = PUSCH_x;//1;
len_RI=4;
break;
case 6:
q_RI[0] = 0;
q_RI[1] = PUSCH_y;//1;
q_RI[2] = PUSCH_x;//1;
q_RI[3] = PUSCH_x;//ulsch->o_RI[0];
q_RI[4] = PUSCH_x;//1;
q_RI[5] = PUSCH_x;//1;
len_RI=6;
break;
}
}
else if (ulsch->O_RI > 1){
LOG_E(PHY,"ulsch_decoding: FATAL, RI cannot be more than 1 bit yet\n");
return(-1);
}
// 1-bit ACK/NAK
if (ulsch_harq->O_ACK == 1) {
switch (Q_m) {
case 2:
q_ACK[0] = 0;
q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : 0;
len_ACK = 2;
break;
case 4:
q_ACK[0] = 0;
q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : 0;
q_ACK[2] = PUSCH_x;
q_ACK[3] = PUSCH_x;
len_ACK = 4;
break;
case 6:
q_ACK[0] = 0;
q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : 0;
q_ACK[2] = PUSCH_x;
q_ACK[3] = PUSCH_x;
q_ACK[4] = PUSCH_x;
q_ACK[6] = PUSCH_x;
len_ACK = 6;
break;
}
}
// two-bit ACK/NAK
if (ulsch_harq->O_ACK == 2) {
switch (Q_m) {
case 2:
q_ACK[0] = 0;
q_ACK[1] = 0;
q_ACK[2] = 0;
q_ACK[3] = 0;
q_ACK[4] = 0;
q_ACK[5] = 0;
len_ACK = 6;
break;
case 4:
q_ACK[0] = 0;
q_ACK[1] = 0;
q_ACK[2] = PUSCH_x;
q_ACK[3] = PUSCH_x;//1;
q_ACK[4] = 0;
q_ACK[5] = 0;
q_ACK[6] = PUSCH_x;
q_ACK[7] = PUSCH_x;//1;
q_ACK[8] = 0;
q_ACK[9] = 0;
q_ACK[10] = PUSCH_x;
q_ACK[11] = PUSCH_x;//1;
len_ACK = 12;
break;
case 6:
q_ACK[0] = 0;
q_ACK[1] = 0;
q_ACK[2] = PUSCH_x;
q_ACK[3] = PUSCH_x;
q_ACK[4] = PUSCH_x;
q_ACK[5] = PUSCH_x;
q_ACK[6] = 0;
q_ACK[7] = 0;
q_ACK[8] = PUSCH_x;
q_ACK[9] = PUSCH_x;
q_ACK[10] = PUSCH_x;
q_ACK[11] = PUSCH_x;
q_ACK[12] = 0;
q_ACK[13] = 0;
q_ACK[14] = PUSCH_x;
q_ACK[15] = PUSCH_x;
q_ACK[16] = PUSCH_x;
q_ACK[17] = PUSCH_x;
len_ACK = 18;
break;
}
}
if (ulsch_harq->O_ACK > 2) {
LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n");
return(-1);
}
// RI BITS
// memset(ytag2,0,Q_m*Hpp);
*/
// read in buffer and unscramble llrs for everything but placeholder bits
// llrs stored per symbol correspond to columns of interleaving matrix
......@@ -724,40 +597,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
}
// for (q=0;q<Q_m;q++) {
/*
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
// msg("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
c = (uint8_t)((s>>(i&0x1f))&1);
// if bits are tagged as placeholders (RI,ACK)
if (ytag2[q+(Q_m*((r*Cmux)+j))] == PUSCH_y) {
c=c_prev;
}
else if (ytag2[q+(Q_m*((r*Cmux)+j))] == PUSCH_x) {
c = 0;
#ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: PUSCH_x in row %d, col %d: llr %d\n",r,j,ulsch_llr[i]);
#endif
}
c_prev = c;
#ifdef DEBUG_ULSCH_DECODING
// msg("llr[%d] = %d (c %d, ytag2 %d) ==> ",i,ulsch_llr[i],c,ytag2[q+(Q_m*((r*Cmux)+j))]);
#endif
// note flipped here for reverse polarity in 3GPP bit mapping
y[q+(Q_m*((r*Cmux)+j))] = (c==0) ? -ulsch_llr[i] : ulsch_llr[i];
i++;
#ifdef DEBUG_ULSCH_DECODING
// msg("%d\n",y[q+(Q_m*((r*Cmux)+j))]);
#endif
*/
stop_meas(&phy_vars_eNB->ulsch_demultiplexing_stats);
if (i!=(H+Q_RI))
......@@ -819,11 +658,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (q=0; q<Q_m; q++) {
if (y[q+(Q_m*((r*Cmux) + columnset[j]))]!=0)
ulsch_harq->q_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
#ifdef DEBUG_ULSCH_DECODING
// 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->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
#endif
y[q+(Q_m*((r*Cmux) + columnset[j]))]=0; // NULL LLRs in ACK positions
}
......@@ -879,173 +713,129 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
j2=0;
// r=0;
for (i=0; i<Qprime_CQI; i++) {
/*
while (ytag[(r*Cmux)+j]==LTE_NULL) {
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: r %d, j %d: LTE_NULL\n",r,j);
#endif
j++;
if (j==Cmux) {
j=0;
r++;
if (Q_RI>0) {
for (i=0; i<(Q_CQI/Q_m); i++) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=Q_m;
}
}
for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127)
ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch_harq->q[q+(Q_m*i)] = -128;
else
ulsch_harq->q[q+(Q_m*i)] = ys;
#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);
#endif
}
*/
while (ytag[j]==LTE_NULL) {
j++;
for (q=0; q<Q_m; q++) {
// ys = y[q+(Q_m*((r*Cmux)+j))];
ys = y[q+j2];
if (ys>127)
ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch_harq->q[q+(Q_m*i)] = -128;
else
ulsch_harq->q[q+(Q_m*i)] = ys;
}
j2+=Q_m;
}
for (q=0; q<Q_m; q++) {
// ys = y[q+(Q_m*((r*Cmux)+j))];
ys = y[q+j2];
if (ys>127)
ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch_harq->q[q+(Q_m*i)] = -128;
else
ulsch_harq->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: CQI %d, q %d, y[%d] %d\n",q+(Q_m*i),q,j2, q+j2,ys);
#endif
}
j2+=Q_m;
}
// j2=j*Q_m;
switch (Q_m) {
case 2:
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<1;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=2;
switch (Q_m) {
case 2:
for (iprime=0; iprime<G<<1;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=2;
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
#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))]);
#endif
}
// write_output("/tmp/ulsch_e.m","ulsch_e",ulsch->e,iprime,1,0);
break;
case 4:
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<2;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=4;
break;
case 4:
for (iprime=0; iprime<G<<2;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=4;
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
#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))]);
#endif
}
break;
case 6:
for (iprime=0; iprime<(Hprime-Qprime_CQI)*6;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=6;
break;
case 6:
for (iprime=0; iprime<G*6;) {
while (ytag[j]==LTE_NULL) {
j++;
j2+=6;
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
#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))]);
#endif
break;
}
break;
}
/*
for (i=0,iprime=-Qprime_CQI;i<Hprime;i++,iprime++) {
while (ytag[(r*Cmux)+j]==LTE_NULL) {
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: r %d, j %d: LTE_NULL\n",r,j);
#endif
j++;
if (j==Cmux) {
j=0;
r++;
else {
for (i=0; i<(Q_CQI/Q_m); i++) {
for (q=0; q<Q_m; q++) {
ys = y[q+j2];
if (ys>127)
ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch_harq->q[q+(Q_m*i)] = -128;
else
ulsch_harq->q[q+(Q_m*i)] = ys;
}
j2+=Q_m;
}
if (i<Qprime_CQI) {
for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127)
ulsch_harq->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch_harq->q[q+(Q_m*i)] = -128;
else
ulsch_harq->q[q+(Q_m*i)] = ys;
#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);
#endif
switch (Q_m) {
case 2:
for (iprime=0; iprime<G<<1;) {
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
}
else {
for (q=0;q<Q_m;q++) {
g = q+(Q_m*iprime);
ulsch->e[g] = y[q+(Q_m*((r*Cmux)+j))];
#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))]);
#endif
break;
case 4:
for (iprime=0; iprime<G<<2;) {
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
}
j++;
if (j==Cmux) {
j=0;
r++;
break;
case 6:
for (iprime=0; iprime<G*6;) {
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
ulsch_harq->e[iprime++] = y[j2++];
}
break;
}
}
*/
// Do CQI/RI/HARQ-ACK Decoding first and pass to MAC
// HARQ-ACK
wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3);
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: Bundling %d, Nbundled %d, wACK_idx %d\n",
ulsch->bundling,Nbundled,wACK_idx);
#endif
if (ulsch_harq->O_ACK == 1) {
ulsch_harq->q_ACK[0] *= wACK_RX[wACK_idx][0];
......@@ -1055,10 +845,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
ulsch_harq->o_ACK[0] = 0;
else
ulsch_harq->o_ACK[0] = 1;
#ifdef DEBUG_ULSCH_DECODING
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
}
if (ulsch_harq->O_ACK == 2) {
......@@ -1068,16 +854,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
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->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->q_ACK[2] = ulsch_harq->q_ACK[2]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[5]*wACK_RX[wACK_idx][1];
break;
case 4:
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->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->q_ACK[2] = ulsch_harq->q_ACK[4]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[9]*wACK_RX[wACK_idx][1];
break;
case 6:
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->q_ACK[1] = ulsch_harq->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch_harq->q_ACK[12]*wACK_RX[wACK_idx][1];
......@@ -1114,37 +896,15 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
}
}
#ifdef DEBUG_ULSCH_DECODING
for (i=0; i<ulsch_harq->O_ACK; i++)
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
// RI
if ((ulsch_harq->O_RI == 1) && (Qprime_RI > 0)) {
ulsch_harq->o_RI[0] = ((ulsch_harq->q_RI[0] + ulsch_harq->q_RI[Q_m/2]) > 0) ? 0 : 1;
}
#ifdef DEBUG_ULSCH_DECODING