Commit aa69c550 authored by lukashov's avatar lukashov

A bit of clean-up.

parent b8e9e188
...@@ -687,15 +687,15 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -687,15 +687,15 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15 int32_t **sic_buffer, //Q15
int32_t **rho_i, int32_t **rho_i,
short *dlsch_llr, short *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0) LTE_UE_DLSCH_t *dlsch0)
{ {
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12]; int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
...@@ -749,10 +749,10 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -749,10 +749,10 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
len_acc+=len; //accumulated length; this is done because in sic_buffer we have only data symbols len_acc+=len; //accumulated length; this is done because in sic_buffer we have only data symbols
multadd_complex_vector_real_scalar((int16_t *)sic_data, multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp, amp_tmp,
(int16_t *)rho_amp_x0, //this is in Q13 (int16_t *)rho_amp_x0, //this is in Q13
1, 1,
len); len);
// printf ("Got x0*rho_a\n"); // printf ("Got x0*rho_a\n");
...@@ -763,12 +763,12 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -763,12 +763,12 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
len, len,
13); 13);
/* write_output("rho_for_multipl.m","rho_for_multipl", rho_1,len,1, /* write_output("rho_for_multipl.m","rho_for_multipl", rho_1,len,1,
symbol==num_pdcch_symbols ? 15 : symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13); symbol==nsymb-1 ? 14 : 13);
write_output("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1, write_output("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1,
symbol==num_pdcch_symbols ? 15 : symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13); symbol==nsymb-1 ? 14 : 13);
// printf ("Computed rho*rho_a*x0\n");*/ // printf ("Computed rho*rho_a*x0\n");*/
...@@ -776,21 +776,21 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -776,21 +776,21 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
sub_cpx_vector16((int16_t *)rxF, sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0, (int16_t *)rho_rho_amp_x0,
//(int16_t *)clean_x1, //(int16_t *)clean_x1,
(int16_t *)rxF, (int16_t *)rxF,
len*2); len*2);
// write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1); // write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1);
// write_output("clean_x1.m","x1", clean_x1,len,1,1); // write_output("clean_x1.m","x1", clean_x1,len,1,1);
// printf ("Interference removed \n"); // printf ("Interference removed \n");
/* write_output("clean_x1.m","x1", clean_x1,len,1, /* write_output("clean_x1.m","x1", clean_x1,len,1,
symbol==num_pdcch_symbols ? 15 : symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13); symbol==nsymb-1 ? 14 : 13);
write_output("rxF_comp1.m","rxF_1_comp", rxF,len,1, write_output("rxF_comp1.m","rxF_1_comp", rxF,len,1,
symbol==num_pdcch_symbols ? 15 : symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13);*/ symbol==nsymb-1 ? 14 : 13);*/
// printf("dlsch_qpsk_llr_SIC: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); // printf("dlsch_qpsk_llr_SIC: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
...@@ -937,17 +937,17 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -937,17 +937,17 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15 int32_t **sic_buffer, //Q15
int32_t **rho_i, int32_t **rho_i,
int16_t *dlsch_llr, int16_t *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0 LTE_UE_DLSCH_t *dlsch0
) )
{ {
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12]; int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12]; int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12];
...@@ -995,10 +995,10 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, ...@@ -995,10 +995,10 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
len_acc+=len; len_acc+=len;
multadd_complex_vector_real_scalar((int16_t *)sic_data, multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp, amp_tmp,
(int16_t *)rho_amp_x0, //this is in Q13 (int16_t *)rho_amp_x0, //this is in Q13
1, 1,
len); len);
mult_cpx_vector((int16_t *)rho_1, //Q15 mult_cpx_vector((int16_t *)rho_1, //Q15
(int16_t *)rho_amp_x0, //Q13 (int16_t *)rho_amp_x0, //Q13
...@@ -1007,10 +1007,10 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1007,10 +1007,10 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
13); 13);
sub_cpx_vector16((int16_t *)rxF, sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0, (int16_t *)rho_rho_amp_x0,
//(int16_t *)clean_x1, //(int16_t *)clean_x1,
(int16_t *)rxF, (int16_t *)rxF,
len*2); len*2);
len_mod4 = len&3; len_mod4 = len&3;
len>>=2; // length in quad words (4 REs) len>>=2; // length in quad words (4 REs)
...@@ -1200,18 +1200,18 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1200,18 +1200,18 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
//#if 0 //#if 0
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15 int32_t **sic_buffer, //Q15
int32_t **rho_i, int32_t **rho_i,
int16_t *dlsch_llr, int16_t *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
int32_t **dl_ch_magb, int32_t **dl_ch_magb,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0 LTE_UE_DLSCH_t *dlsch0
) )
{ {
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12]; int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12]; int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12];
...@@ -1227,7 +1227,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1227,7 +1227,7 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t *llr2; uint16_t *llr2;
__m128i *ch_mag,*ch_magb; __m128i *ch_mag,*ch_magb;
nsymb = (frame_parms->Ncp==0) ? 14:12; nsymb = (frame_parms->Ncp==0) ? 14:12;
for (symbol=num_pdcch_symbols; symbol<nsymb; symbol++) { for (symbol=num_pdcch_symbols; symbol<nsymb; symbol++) {
uint16_t *rxF = (uint16_t*)(&rxdataF_comp[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); uint16_t *rxF = (uint16_t*)(&rxdataF_comp[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
...@@ -1240,17 +1240,17 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1240,17 +1240,17 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
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))) { 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) if (frame_parms->mode1_flag==0)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
} else { } else {
amp_tmp = dlsch0->sqrt_rho_a; amp_tmp = dlsch0->sqrt_rho_a;
len = nb_rb*12 - pbch_pss_sss_adjust; len = nb_rb*12 - pbch_pss_sss_adjust;
} }
if (mod_order_0==6) if (mod_order_0==6)
...@@ -1259,10 +1259,10 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1259,10 +1259,10 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
len_acc+=len; len_acc+=len;
multadd_complex_vector_real_scalar((int16_t *)sic_data, multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp, amp_tmp,
(int16_t *)rho_amp_x0, //this is in Q13 (int16_t *)rho_amp_x0, //this is in Q13
1, 1,
len); len);
mult_cpx_vector((int16_t *)rho_1, //Q15 mult_cpx_vector((int16_t *)rho_1, //Q15
(int16_t *)rho_amp_x0, //Q13 (int16_t *)rho_amp_x0, //Q13
...@@ -1271,10 +1271,10 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1271,10 +1271,10 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
13); 13);
sub_cpx_vector16((int16_t *)rxF, sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0, (int16_t *)rho_rho_amp_x0,
//(int16_t *)clean_x1, //(int16_t *)clean_x1,
(int16_t *)rxF, (int16_t *)rxF,
len*2); len*2);
llr2 = llr32; llr2 = llr32;
llr32 += (len*6); llr32 += (len*6);
...@@ -1442,7 +1442,7 @@ void qpsk_qpsk(short *stream0_in, ...@@ -1442,7 +1442,7 @@ void qpsk_qpsk(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
...@@ -1702,7 +1702,7 @@ void qpsk_qam16(int16_t *stream0_in, ...@@ -1702,7 +1702,7 @@ void qpsk_qam16(int16_t *stream0_in,
int16_t *stream0_out, int16_t *stream0_out,
int16_t *rho01, int16_t *rho01,
int32_t length int32_t length
) )
{ {
/* /*
This function computes the LLRs of stream 0 (s_0) in presence of the interfering stream 1 (s_1) assuming that both symbols are QPSK. It can be used for both MU-MIMO interference-aware receiver or for SU-MIMO receivers. This function computes the LLRs of stream 0 (s_0) in presence of the interfering stream 1 (s_1) assuming that both symbols are QPSK. It can be used for both MU-MIMO interference-aware receiver or for SU-MIMO receivers.
...@@ -1987,7 +1987,7 @@ void qpsk_qam64(short *stream0_in, ...@@ -1987,7 +1987,7 @@ void qpsk_qam64(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
...@@ -2239,7 +2239,7 @@ void qam16_qpsk(short *stream0_in, ...@@ -2239,7 +2239,7 @@ void qam16_qpsk(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
...@@ -2749,7 +2749,7 @@ void qam16_qam16(short *stream0_in, ...@@ -2749,7 +2749,7 @@ void qam16_qam16(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
...@@ -3308,7 +3308,7 @@ void qam16_qam64(int16_t *stream0_in, ...@@ -3308,7 +3308,7 @@ void qam16_qam64(int16_t *stream0_in,
int16_t *stream0_out, int16_t *stream0_out,
int16_t *rho01, int16_t *rho01,
int32_t length int32_t length
) )
{ {
/* /*
...@@ -3984,7 +3984,7 @@ void qam64_qpsk(int16_t *stream0_in, ...@@ -3984,7 +3984,7 @@ void qam64_qpsk(int16_t *stream0_in,
int16_t *stream0_out, int16_t *stream0_out,
int16_t *rho01, int16_t *rho01,
int32_t length int32_t length
) )
{ {
/* /*
...@@ -5507,7 +5507,7 @@ void qam64_qam16(short *stream0_in, ...@@ -5507,7 +5507,7 @@ void qam64_qam16(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
...@@ -7052,7 +7052,7 @@ void qam64_qam64(short *stream0_in, ...@@ -7052,7 +7052,7 @@ void qam64_qam64(short *stream0_in,
short *stream0_out, short *stream0_out,
short *rho01, short *rho01,
int length int length
) )
{ {
/* /*
......
...@@ -242,19 +242,17 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -242,19 +242,17 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
first_re=6; first_re=6;
for (re=first_re; re<last_re; re++) { for (re=first_re; re<last_re; re++) {
// printf("element %d precoder_index for allocation %d\n",re, precoder_index ); // printf("element %d precoder_index for allocation %d\n",re, precoder_index );
if ((skip_dc == 1) && (re==6)) if ((skip_dc == 1) && (re==6))
re_off=re_off - frame_parms->ofdm_symbol_size+1; re_off=re_off - frame_parms->ofdm_symbol_size+1;
tti_offset = symbol_offset + re_off + re; tti_offset = symbol_offset + re_off + re;
// check that RE is not from Cell-specific RS //check that RE is not from Cell-specific RS
if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) { if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) {
// printf("re %d (jj %d)\n",re,*jj); //printf("re %d (jj %d)\n",re,*jj);
if (mimo_mode == SISO) { //SISO mapping if (mimo_mode == SISO) { //SISO mapping
...@@ -263,7 +261,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -263,7 +261,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
switch (mod_order0) { switch (mod_order0) {
case 2: //QPSK case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
} }
...@@ -276,7 +274,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -276,7 +274,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
*jj = *jj + 1; *jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break; break;
case 4: //16QAM case 4: //16QAM
...@@ -308,8 +306,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -308,8 +306,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); //((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); //((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
} }
break; break;
...@@ -382,602 +380,598 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -382,602 +380,598 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; ((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1; *jj=*jj+1;
// normalization for 2 tx antennas // normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
break; break;
case 4: //16QAM case 4: //16QAM
// Antenna 0 position n // Antenna 0 position n
qam16_table_offset_re = 0;
qam16_table_offset_re = 0; qam16_table_offset_im = 0;
qam16_table_offset_im = 0;
if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_re+=2;
qam16_table_offset_re+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_im+=2;
qam16_table_offset_im+=2; *jj=*jj+1;
*jj=*jj+1;
if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_re+=1;
qam16_table_offset_re+=1; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_im+=1;
qam16_table_offset_im+=1; *jj=*jj+1;
*jj=*jj+1;
((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
// Antenna 1 position n Real part -> -x1*
// Antenna 1 position n Real part -> -x1*
qam16_table_offset_re = 0;
qam16_table_offset_re = 0; qam16_table_offset_im = 0;
qam16_table_offset_im = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=2; qam16_table_offset_re+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=1; qam16_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
break;
break;
case 6: // 64-QAM case 6: // 64-QAM
// Antenna 0 // Antenna 0
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=4; qam64_table_offset_re+=4;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=4; qam64_table_offset_im+=4;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=2; qam64_table_offset_re+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=2; qam64_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=1; qam64_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
// Antenna 1 => -x1* // Antenna 1 => -x1*
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=4; qam64_table_offset_re+=4;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=4; qam64_table_offset_im+=4;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=2; qam64_table_offset_re+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=2; qam64_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re+=1; qam64_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
break; break;
} }
// fill in the rest of the ALAMOUTI precoding // fill in the rest of the ALAMOUTI precoding
if (is_not_pilot(pilots,re + 1,frame_parms->nushift,use2ndpilots)==1) { if (is_not_pilot(pilots,re + 1,frame_parms->nushift,use2ndpilots)==1) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1 ((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1]; ((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0* ((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1]; ((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} }
else { else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1 ((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1]; ((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0* ((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1]; ((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} }
} }
else if (mimo_mode == LARGE_CDD) { else if (mimo_mode == LARGE_CDD) {
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
switch (mod_order0) { switch (mod_order0) {
default:
LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0); default:
xx0_re=xx0_im=0; LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0);
break; xx0_re=xx0_im=0;
case 2: //QPSK break;
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; case 2: //QPSK
*jj = *jj + 1; //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1; *jj = *jj + 1;
xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); break;
break;
case 4: //16QAM
case 4: //16QAM
qam16_table_offset_re0 = 0;
qam16_table_offset_re0 = 0; qam16_table_offset_im0 = 0;
qam16_table_offset_im0 = 0; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_re0+=2;
qam16_table_offset_re0+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_im0+=2;
qam16_table_offset_im0+=2; *jj=*jj+1;
*jj=*jj+1;
if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_re0+=1;
qam16_table_offset_re0+=1; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_im0+=1;
qam16_table_offset_im0+=1; *jj=*jj+1;
*jj=*jj+1;
xx0_re = qam_table_s0[qam16_table_offset_re0];
xx0_re = qam_table_s0[qam16_table_offset_re0]; xx0_im = qam_table_s0[qam16_table_offset_im0];
xx0_im = qam_table_s0[qam16_table_offset_im0];
break;
break;
case 6: //64QAM
case 6: //64QAM
qam64_table_offset_re0 = 0;
qam64_table_offset_re0 = 0; qam64_table_offset_im0 = 0;
qam64_table_offset_im0 = 0;
if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re0+=4;
qam64_table_offset_re0+=4; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im0+=4;
qam64_table_offset_im0+=4; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re0+=2;
qam64_table_offset_re0+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im0+=2;
qam64_table_offset_im0+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re0+=1;
qam64_table_offset_re0+=1; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im0+=1;
qam64_table_offset_im0+=1; *jj=*jj+1;
*jj=*jj+1;
xx0_re = qam_table_s0[qam64_table_offset_re0];
xx0_re = qam_table_s0[qam64_table_offset_re0]; xx0_im = qam_table_s0[qam64_table_offset_im0];
xx0_im = qam_table_s0[qam64_table_offset_im0];
break;
break; }
} switch (mod_order1) {
switch (mod_order1) {
default: default:
LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1); LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1);
xx1_re=xx1_im=0; xx1_re=xx1_im=0;
break; break;
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); case 2: //QPSK
xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
*jj2 = *jj2 + 1; xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj2 = *jj2 + 1;
*jj2 = *jj2 + 1; xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); *jj2 = *jj2 + 1;
break; //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
case 4: //16QAM
qam16_table_offset_re1 = 0;
qam16_table_offset_im1 = 0; qam16_table_offset_re1 = 0;
if (x1[*jj2] == 1) qam16_table_offset_im1 = 0;
qam16_table_offset_re1+=2; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam16_table_offset_re1+=2;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam16_table_offset_im1+=2; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam16_table_offset_im1+=2;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam16_table_offset_re1+=1; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam16_table_offset_re1+=1;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam16_table_offset_im1+=1; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam16_table_offset_im1+=1;
*jj2 = *jj2 + 1;
xx1_re = qam_table_s1[qam16_table_offset_re1];
xx1_im = qam_table_s1[qam16_table_offset_im1]; xx1_re = qam_table_s1[qam16_table_offset_re1];
xx1_im = qam_table_s1[qam16_table_offset_im1];
break;
break;
case 6: //64QAM
case 6: //64QAM
qam64_table_offset_re1 = 0;
qam64_table_offset_im1 = 0; qam64_table_offset_re1 = 0;
qam64_table_offset_im1 = 0;
if (x1[*jj2] == 1)
qam64_table_offset_re1+=4; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_re1+=4;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam64_table_offset_im1+=4; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_im1+=4;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam64_table_offset_re1+=2; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_re1+=2;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam64_table_offset_im1+=2; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_im1+=2;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam64_table_offset_re1+=1; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_re1+=1;
if (x1[*jj2] == 1) *jj2 = *jj2 + 1;
qam64_table_offset_im1+=1; if (x1[*jj2] == 1)
*jj2 = *jj2 + 1; qam64_table_offset_im1+=1;
*jj2 = *jj2 + 1;
xx1_re = qam_table_s1[qam64_table_offset_re1];
xx1_im = qam_table_s1[qam64_table_offset_im1]; xx1_re = qam_table_s1[qam64_table_offset_re1];
xx1_im = qam_table_s1[qam64_table_offset_im1];
break; break;
} }
// This implements the Large CDD precoding for 2 TX antennas // This implements the Large CDD precoding for 2 TX antennas
// - - - - - - - - - - - - // - - - - - - - - - - - -
//| y0 | | 1 0 || 1 0 || 1 1 || x0 | | x0 + x1 | //| y0 | | 1 0 || 1 0 || 1 1 || x0 | | x0 + x1 |
//| y1 | = .5 | 0 1 || 0 (-1)^i || 1 -1 || x1 | = .5| (-1)^i(x0 - x1)| //| y1 | = .5 | 0 1 || 0 (-1)^i || 1 -1 || x1 | = .5| (-1)^i(x0 - x1)|
// - - - - - - - - - - - // - - - - - - - - - - -
// Note: Factor .5 is accounted for in amplitude when calling this function // Note: Factor .5 is accounted for in amplitude when calling this function
((int16_t *)&txdataF[0][tti_offset])[0]+=((xx0_re+xx1_re)>>1); ((int16_t *)&txdataF[0][tti_offset])[0]+=((xx0_re+xx1_re)>>1);
((int16_t *)&txdataF[1][tti_offset])[0]+=(s*((xx0_re-xx1_re)>>1)); ((int16_t *)&txdataF[1][tti_offset])[0]+=(s*((xx0_re-xx1_re)>>1));
((int16_t *)&txdataF[0][tti_offset])[1]+=((xx0_im+xx1_im)>>1); ((int16_t *)&txdataF[0][tti_offset])[1]+=((xx0_im+xx1_im)>>1);
((int16_t *)&txdataF[1][tti_offset])[1]+=(s*((xx0_im-xx1_im)>>1)); ((int16_t *)&txdataF[1][tti_offset])[1]+=(s*((xx0_im-xx1_im)>>1));
/* /*
printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n", printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n",
xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1], xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1],
((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]); ((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]);
*/ */
// s alternates +1/-1 for each RE // s alternates +1/-1 for each RE
s = -s; s = -s;
} }
} }
else if ((mimo_mode >= UNIFORM_PRECODING11)&&(mimo_mode <= PUSCH_PRECODING1)) { else if ((mimo_mode >= UNIFORM_PRECODING11)&&(mimo_mode <= PUSCH_PRECODING1)) {
// this is for transmission modes 5-6 (1 layer) // this is for transmission modes 5-6 (1 layer)
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15); amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
switch (mod_order0) { switch (mod_order0) {
case 2: //QPSK case 2:
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1; *jj = *jj + 1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1; *jj = *jj + 1;
// normalization for 2 tx antennas //normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
} }
break; break;
case 4: //16QAM case 4:
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=2; qam16_table_offset_re+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=1; qam16_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
} }
break; break;
case 6: //64QAM case 6:
qam64_table_offset_re = 0;
qam64_table_offset_re = 0; qam64_table_offset_im = 0;
qam64_table_offset_im = 0; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re+=4;
qam64_table_offset_re+=4; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im+=4;
qam64_table_offset_im+=4; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re+=2;
qam64_table_offset_re+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im+=2;
qam64_table_offset_im+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_re+=1;
qam64_table_offset_re+=1; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam64_table_offset_im+=1;
qam64_table_offset_im+=1; *jj=*jj+1;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) {
if (frame_parms->nb_antennas_tx == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); }
}
break;
break; }
}
} }
else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) { else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) {
// this is for transmission mode 4 (1 layer) // this is for transmission mode 4 (1 layer)
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
if (precoder_index==0) {
if (precoder_index==0) { precoder_index0 = 0; //[1 1]
precoder_index0 = 0; //[1 1] precoder_index1 = 1; //[1 -1]
precoder_index1 = 1; //[1 -1] }
} else if (precoder_index==1) {
else if (precoder_index==1) { precoder_index0 = 2; //[1 j]
precoder_index0 = 2; //[1 j] precoder_index1 = 3; //[1 -j]
precoder_index1 = 3; //[1 -j] }
} else {
else { printf("problem with precoder in TM4\n");
printf("problem with precoder in TM4\n"); return(-1);
return(-1); }
}
switch (mod_order0) {
switch (mod_order0) { case 2:
case 2: //QPSK
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1;
*jj = *jj + 1; ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1;
*jj = *jj + 1;
//normalization for 2 tx antennas
// normalization for 2 tx antennas ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
if (frame_parms->nb_antennas_tx == 2) {
if (frame_parms->nb_antennas_tx == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15); }
}
break;
break;
case 4:
case 4: //16QAM
qam16_table_offset_re = 0;
qam16_table_offset_re = 0; qam16_table_offset_im = 0;
qam16_table_offset_im = 0;
if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_re+=2;
qam16_table_offset_re+=2; *jj=*jj+1;
*jj=*jj+1; if (x0[*jj] == 1)
if (x0[*jj] == 1) qam16_table_offset_im+=2;
qam16_table_offset_im+=2; *jj=*jj+1;
*jj=*jj+1;
if (x0[*jj] == 1)
qam16_table_offset_re+=1;
if (x0[*jj] == 1) *jj=*jj+1;
qam16_table_offset_re+=1; if (x0[*jj] == 1)
*jj=*jj+1; qam16_table_offset_im+=1;
if (x0[*jj] == 1) *jj=*jj+1;
qam16_table_offset_im+=1;
*jj=*jj+1; ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im]));
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re])); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im])); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
if (frame_parms->nb_antennas_tx == 2) { ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); }
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
} break;
break; case 6:
case 6: //64QAM qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
qam64_table_offset_re = 0; if (x0[*jj] == 1)
qam64_table_offset_im = 0; qam64_table_offset_re+=4;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_re+=4; if (x0[*jj] == 1)
*jj=*jj+1; qam64_table_offset_im+=4;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_im+=4; if (x0[*jj] == 1)
*jj=*jj+1; qam64_table_offset_re+=2;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_re+=2; if (x0[*jj] == 1)
*jj=*jj+1; qam64_table_offset_im+=2;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_im+=2; if (x0[*jj] == 1)
*jj=*jj+1; qam64_table_offset_re+=1;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_re+=1; if (x0[*jj] == 1)
*jj=*jj+1; qam64_table_offset_im+=1;
if (x0[*jj] == 1) *jj=*jj+1;
qam64_table_offset_im+=1;
*jj=*jj+1; ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im]));
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re])); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im])); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
if (frame_parms->nb_antennas_tx == 2) { ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); }
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
} break;
break; }
} if (dlsch1_harq) {
switch (mod_order1) {
if (dlsch1_harq) {
switch (mod_order1) { case 2:
case 2: //QPSK
((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj2 = *jj2 + 1;
*jj2 = *jj2 + 1; ((int16_t*)&tmp_sample1)[1] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&tmp_sample1)[1] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj2 = *jj2 + 1;
*jj2 = *jj2 + 1;
//normalization for 2 tx antennas
// normalization for 2 tx antennas ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) {
if (frame_parms->nb_antennas_tx == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15); }
}
break;
break;
case 4:
case 4: //16QAM
qam16_table_offset_re = 0;
qam16_table_offset_re = 0; qam16_table_offset_im = 0;
qam16_table_offset_im = 0;
if (x1[*jj2] == 1)
if (x1[*jj2] == 1) qam16_table_offset_re+=2;
qam16_table_offset_re+=2; *jj2=*jj2+1;
*jj2=*jj2+1; if (x1[*jj2] == 1)
if (x1[*jj2] == 1) qam16_table_offset_im+=2;
qam16_table_offset_im+=2; *jj2=*jj2+1;
*jj2=*jj2+1;
if (x1[*jj2] == 1)
if (x1[*jj2] == 1) qam16_table_offset_re+=1;
qam16_table_offset_re+=1; *jj2=*jj2+1;
*jj2=*jj2+1; if (x1[*jj2] == 1)
if (x1[*jj2] == 1) qam16_table_offset_im+=1;
qam16_table_offset_im+=1; *jj2=*jj2+1;
*jj2=*jj2+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam16_table_offset_re])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam16_table_offset_im]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam16_table_offset_im])); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) {
if (frame_parms->nb_antennas_tx == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15); }
}
break;
break;
case 6:
case 6: //64QAM
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
qam64_table_offset_re = 0; if (x1[*jj2] == 1)
qam64_table_offset_im = 0; qam64_table_offset_re+=4;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_re+=4; if (x1[*jj2] == 1)
*jj2=*jj2+1; qam64_table_offset_im+=4;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_im+=4; if (x1[*jj2] == 1)
*jj2=*jj2+1; qam64_table_offset_re+=2;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_re+=2; if (x1[*jj2] == 1)
*jj2=*jj2+1; qam64_table_offset_im+=2;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_im+=2; if (x1[*jj2] == 1)
*jj2=*jj2+1; qam64_table_offset_re+=1;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_re+=1; if (x1[*jj2] == 1)
*jj2=*jj2+1; qam64_table_offset_im+=1;
if (x1[*jj2] == 1) *jj2=*jj2+1;
qam64_table_offset_im+=1;
*jj2=*jj2+1; ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam64_table_offset_im]));
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam64_table_offset_re])); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam64_table_offset_im])); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1);
if (frame_parms->nb_antennas_tx == 2) { ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); }
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
} break;
break; }
}
}
}
} }
...@@ -1042,7 +1036,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1042,7 +1036,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 6: //64QAM case 6: //64QAM
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
...@@ -1090,10 +1083,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1090,10 +1083,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
return(-1); return(-1);
} }
} }
} }
return(0); return(0);
} }
...@@ -1145,14 +1135,14 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, ...@@ -1145,14 +1135,14 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
tti_offset = symbol_offset + re_off + re; tti_offset = symbol_offset + re_off + re;
// printf("re %d (jj %d)\n",re,*jj); //printf("re %d (jj %d)\n",re,*jj);
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
switch (mod_order) { switch (mod_order) {
case 2: //QPSK case 2:
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
...@@ -1163,10 +1153,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, ...@@ -1163,10 +1153,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
*jj = *jj + 1; *jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break; break;
case 4: //16QAM case 4:
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -1195,14 +1185,13 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, ...@@ -1195,14 +1185,13 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re]; ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im]; ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); //((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); //((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
} }
break; break;
case 6: //64QAM case 6:
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
...@@ -1374,13 +1363,13 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1374,13 +1363,13 @@ int dlsch_modulation(int32_t **txdataF,
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n", printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
harq_pid, harq_pid,
dlsch0_harq->mimo_mode, dlsch0_harq->mimo_mode,
pmi2hex_2Ar2(dlsch0_harq->pmi_alloc), pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
mod_order0, mod_order0,
mod_order1, mod_order1,
rb_alloc[0], rb_alloc[0],
len); len);
#endif #endif
if (frame_parms->Ncp==0) { // normal prefix if (frame_parms->Ncp==0) { // normal prefix
...@@ -1403,7 +1392,7 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1403,7 +1392,7 @@ int dlsch_modulation(int32_t **txdataF,
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
//for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) //for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
// memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2); //memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots); //printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
for (rb=0; rb<frame_parms->N_RB_DL; rb++) { for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
...@@ -1567,28 +1556,27 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1567,28 +1556,27 @@ int dlsch_modulation(int32_t **txdataF,
if (rb_alloc_ind > 0) { if (rb_alloc_ind > 0) {
// printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
allocate_REs_in_RB(frame_parms, allocate_REs_in_RB(frame_parms,
txdataF, txdataF,
&jj, &jj,
&jj2, &jj2,
re_offset, re_offset,
symbol_offset, symbol_offset,
dlsch0->harq_processes[harq_pid], dlsch0->harq_processes[harq_pid],
(dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid], (dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid],
pilots, pilots,
((pilots) ? amp_rho_b : amp_rho_a), ((pilots) ? amp_rho_b : amp_rho_a),
get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid]->mimo_mode,dlsch0->harq_processes[harq_pid]->pmi_alloc,rb), get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid]->mimo_mode,dlsch0->harq_processes[harq_pid]->pmi_alloc,rb),
qam_table_s0, qam_table_s0,
qam_table_s1, qam_table_s1,
&re_allocated, &re_allocated,
skip_dc, skip_dc,
skip_half); skip_half);
} }
re_offset+=12; // go to next RB re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC // check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) { if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC) if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
...@@ -1597,11 +1585,8 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1597,11 +1585,8 @@ int dlsch_modulation(int32_t **txdataF,
re_offset=7; // odd number of RBs re_offset=7; // odd number of RBs
} }
} }
} }
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset)); msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
#endif #endif
...@@ -1618,7 +1603,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -1618,7 +1603,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0, LTE_eNB_DLSCH_t *dlsch0,
LTE_eNB_DLSCH_t *dlsch1, LTE_eNB_DLSCH_t *dlsch1,
int G) int G)
{ {
uint8_t nsymb; uint8_t nsymb;
...@@ -1644,113 +1629,111 @@ int dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -1644,113 +1629,111 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
amp=1; //we do full scale here for SIC amp=1; //we do full scale here for SIC
gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15)); gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15));
// printf("gain=%d\n", gain_lin_QPSK); //printf("gain=%d\n", gain_lin_QPSK);
jj = 0; jj = 0;
i = 0; i = 0;
while (jj <= G-1) { while (jj <= G-1) {
re_allocated = re_allocated + 1; re_allocated = re_allocated + 1;
switch (mod_order0) { switch (mod_order0) {
case 2: //QPSK case 2: //QPSK
/* TODO: handle more than 1 antenna */ /* TODO: handle more than 1 antenna */
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&sic_buffer[0][i])[0] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i ((int16_t*)&sic_buffer[0][i])[0] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
jj = jj + 1; jj = jj + 1;
((int16_t*)&sic_buffer[0][i])[1] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} ((int16_t*)&sic_buffer[0][i])[1] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
jj = jj + 1; jj = jj + 1;
// printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]); //printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
i++;
i++;
break; break;
case 4: //16QAM
qam16_table_offset_re = 0; case 4: //16QAM
qam16_table_offset_im = 0;
if (x0[jj] == 1) qam16_table_offset_re = 0;
qam16_table_offset_re+=2; qam16_table_offset_im = 0;
jj=jj+1; if (x0[jj] == 1)
qam16_table_offset_re+=2;
if (x0[jj] == 1) jj=jj+1;
qam16_table_offset_im+=2;
jj=jj+1; if (x0[jj] == 1)
qam16_table_offset_im+=2;
jj=jj+1;
if (x0[jj] == 1)
qam16_table_offset_re+=1;
jj=jj+1; if (x0[jj] == 1)
qam16_table_offset_re+=1;
if (x0[jj] == 1) jj=jj+1;
qam16_table_offset_im+=1;
jj=jj+1; if (x0[jj] == 1)
qam16_table_offset_im+=1;
jj=jj+1;
((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_re];
((int16_t *)&sic_buffer[0][i])[1]+=qam16_table[qam16_table_offset_im];
i++;
break; ((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_re];
((int16_t *)&sic_buffer[0][i])[1]+=qam16_table[qam16_table_offset_im];
i++;
case 6: //64QAM break;
case 6:
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_re+=4; qam64_table_offset_re+=4;
jj=jj+1; jj=jj+1;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_im+=4; qam64_table_offset_im+=4;
jj=jj+1; jj=jj+1;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_re+=2; qam64_table_offset_re+=2;
jj=jj+1; jj=jj+1;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_im+=2; qam64_table_offset_im+=2;
jj=jj+1; jj=jj+1;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_re+=1; qam64_table_offset_re+=1;
jj=jj+1; jj=jj+1;
if (x0[jj] == 1) if (x0[jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
jj=jj+1; jj=jj+1;
((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])[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); ((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++; i++;
break; break;
} }
} }
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
...@@ -1807,14 +1790,13 @@ int mch_modulation(int32_t **txdataF, ...@@ -1807,14 +1790,13 @@ int mch_modulation(int32_t **txdataF,
if ((frame_parms->N_RB_DL&1) == 1) { // ODD N_RB_DL if ((frame_parms->N_RB_DL&1) == 1) { // ODD N_RB_DL
if (rb==(frame_parms->N_RB_DL>>1)) if (rb==(frame_parms->N_RB_DL>>1))
skip_dc = 1; skip_dc = 1;
else else
skip_dc = 0; skip_dc = 0;
} }
if (mod_order == 4) if (mod_order == 4)
qam_table_s = qam16_table_a; qam_table_s = qam16_table_a;
else if (mod_order == 6) else if (mod_order == 6)
...@@ -1822,7 +1804,7 @@ int mch_modulation(int32_t **txdataF, ...@@ -1822,7 +1804,7 @@ int mch_modulation(int32_t **txdataF,
else else
qam_table_s = NULL; qam_table_s = NULL;
// printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp); //printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH(txdataF, allocate_REs_in_RB_MCH(txdataF,
&jj, &jj,
re_offset, re_offset,
...@@ -1838,7 +1820,6 @@ int mch_modulation(int32_t **txdataF, ...@@ -1838,7 +1820,6 @@ int mch_modulation(int32_t **txdataF,
re_offset+=12; // go to next RB re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC // check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) { if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC) if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
...@@ -1849,10 +1830,6 @@ int mch_modulation(int32_t **txdataF, ...@@ -1849,10 +1830,6 @@ int mch_modulation(int32_t **txdataF,
} }
} }
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset)); msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset));
#endif #endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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