Commit 51e8e0ad authored by lukashov's avatar lukashov

Fixing SIC receiver for all the combinations.

Introduced >>1 shift in SIC modulation for 64QAM to avoid overflow.
Shift is then compensated in llr computation.
parent c63abc08
......@@ -829,7 +829,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
}
else if ((rx_type==rx_IC_single_stream) || (rx_type==rx_IC_dual_stream)) {
else if (rx_type >= rx_IC_single_stream) {
if (dlsch1_harq->Qm == 2) {
dlsch_16qam_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......@@ -913,7 +913,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
}
else if ((rx_type==rx_IC_single_stream) || (rx_type==rx_IC_dual_stream)) {
else if (rx_type >= rx_IC_single_stream) {
if (dlsch1_harq->Qm == 2) {
dlsch_64qam_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......
......@@ -694,6 +694,7 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0)
{
......@@ -718,12 +719,19 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) //pilots=1
amp_tmp=dlsch0->sqrt_rho_b;
else //pilots=0
amp_tmp=dlsch0->sqrt_rho_a;
pbch_pss_sss_adjust=adjust_G2(frame_parms,rb_alloc,2,subframe,symbol);
if (mod_order_0==6)
amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation
pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,2,subframe,symbol);
// printf("amp_tmp=%d\n", amp_tmp);
......@@ -769,8 +777,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0,
(int16_t *)clean_x1,
//(int16_t *)rxF,
//(int16_t *)clean_x1,
(int16_t *)rxF,
len*2);
// write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1);
......@@ -789,7 +797,7 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
//this is for QPSK only!!!
for (i=0; i<len*2; i++) {
*llr16 =clean_x1[i];//(int16_t *)rxF[i]; //clean_x1[i];//(int16_t *)rxF[i];//clean_x1[i]; //(int16_t *)rxF[i];//; //rxF[i];
*llr16 =rxF[i]; //clean_x1[i];//(int16_t *)rxF[i];//clean_x1[i]; //(int16_t *)rxF[i];//; //rxF[i];
//printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
llr16++;
}
......@@ -937,6 +945,7 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0
)
{
......@@ -964,19 +973,25 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
pbch_pss_sss_adjust=adjust_G2(frame_parms,rb_alloc,4,subframe,symbol);
pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,4,subframe,symbol);
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
amp_tmp=dlsch0->sqrt_rho_b;
if (frame_parms->mode1_flag==0)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
} else {
amp_tmp=dlsch0->sqrt_rho_a;
len = nb_rb*12 - pbch_pss_sss_adjust;
}
if (mod_order_0==6)
amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation
len_acc+=len;
multadd_complex_vector_real_scalar((int16_t *)sic_data,
......@@ -993,9 +1008,10 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0,
// (int16_t *)clean_x1,
//(int16_t *)clean_x1,
(int16_t *)rxF,
len*2);
len_mod4 = len&3;
len>>=2; // length in quad words (4 REs)
len+=(len_mod4==0 ? 0 : 1);
......@@ -1193,6 +1209,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0
)
{
......@@ -1207,7 +1224,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t *sic_data;
uint16_t pbch_pss_sss_adjust;
unsigned char len_mod4=0;
int16_t *llr2;
uint16_t *llr2;
__m128i *ch_mag,*ch_magb;
nsymb = (frame_parms->Ncp==0) ? 14:12;
......@@ -1221,19 +1238,24 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
pbch_pss_sss_adjust=adjust_G2(frame_parms,rb_alloc,6,subframe,symbol);
pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,6,subframe,symbol);
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
amp_tmp=dlsch0->sqrt_rho_b;
amp_tmp = dlsch0->sqrt_rho_b;
if (frame_parms->mode1_flag==0)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
} else {
amp_tmp=dlsch0->sqrt_rho_a;
amp_tmp = dlsch0->sqrt_rho_a;
len = nb_rb*12 - pbch_pss_sss_adjust;
}
if (mod_order_0==6)
amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation
len_acc+=len;
multadd_complex_vector_real_scalar((int16_t *)sic_data,
......@@ -1250,7 +1272,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0,
// (int16_t *)clean_x1,
//(int16_t *)clean_x1,
(int16_t *)rxF,
len*2);
......
......@@ -1613,7 +1613,6 @@ int dlsch_modulation(int32_t **txdataF,
int dlsch_modulation_SIC(int32_t **sic_buffer,
int16_t amp,
uint32_t subframe_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
......@@ -1627,7 +1626,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
LTE_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid];
LTE_DL_eNB_HARQ_t *dlsch1_harq; //= dlsch1->harq_processes[harq_pid];
uint32_t i,jj,re_allocated=0;
uint16_t l,rb,re_offset;
uint16_t l,rb,re_offset, amp;
uint32_t *rb_alloc = dlsch0_harq->rb_alloc;
uint8_t mod_order0 = get_Qm(dlsch0_harq->mcs);
uint8_t *x0 = dlsch0_harq->e;
......@@ -1700,7 +1699,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_re];
((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_im];
((int16_t *)&sic_buffer[0][i])[1]+=qam16_table[qam16_table_offset_im];
i++;
......@@ -1743,8 +1742,8 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
jj=jj+1;
((int16_t *)&sic_buffer[0][i])[0]+=qam64_table[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&sic_buffer[0][i])[0]+=qam64_table[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
((int16_t *)&sic_buffer[0][i])[0]+=(qam64_table[qam64_table_offset_re])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&sic_buffer[0][i])[1]+=(qam64_table[qam64_table_offset_im])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
i++;
......
......@@ -212,7 +212,6 @@ int32_t dlsch_modulation(int32_t **txdataF,
LTE_eNB_DLSCH_t *dlsch1);
int32_t dlsch_modulation_SIC(int32_t **sic_buffer,
int16_t amp,
uint32_t sub_frame_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
......@@ -728,6 +727,7 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -761,6 +761,7 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -774,6 +775,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
......
......@@ -3675,6 +3675,7 @@ n(tikz_fname,"w");
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;
PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid = PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid;
dlsch_encoding(input_buffer0[0], //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,
......@@ -3703,7 +3704,6 @@ n(tikz_fname,"w");
subframe<<1);
re_allocated = dlsch_modulation_SIC(sic_buffer,
AMP,
subframe,
&PHY_vars_UE->lte_frame_parms,
num_pdcch_symbols,
......@@ -3716,7 +3716,9 @@ n(tikz_fname,"w");
// write_output("rxdataF_rho.m","rho", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
switch (get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)){
case 2:
dlsch_qpsk_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
sic_buffer,
......@@ -3726,9 +3728,12 @@ n(tikz_fname,"w");
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs),
PHY_vars_UE->dlsch_ue[eNB_id][0]);
break;
case 4:
dlsch_16qam_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
sic_buffer,
......@@ -3739,6 +3744,7 @@ n(tikz_fname,"w");
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs),
PHY_vars_UE->dlsch_ue[eNB_id][0]);
break;
case 6:
......@@ -3753,6 +3759,7 @@ n(tikz_fname,"w");
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs),
PHY_vars_UE->dlsch_ue[eNB_id][0]);
break;
}// round
......
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