Commit d54fe24f authored by knopp's avatar knopp

acceleration of dlsch_modulation

parent 2176299a
......@@ -53,7 +53,7 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
{
uint32_t RTC = (D>>5), ND, ND3;
uint32_t row,col,Kpi,index;
uint32_t row,col,Kpi;
uint32_t index3,k,k2;
#ifdef RM_DEBUG
uint32_t nulled=0;
......@@ -84,7 +84,6 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
#ifdef RM_DEBUG
printf("Col %d\n",col);
#endif
index = bitrev[col];
index3 = bitrev_x3[col];//3*index;
for (row=0; row<RTC; row++) {
......@@ -108,10 +107,7 @@ uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
#endif
index3+=96;
index+=32;
k++;
k2++;
k2++;
k++;k2+=2;
}
}
......
......@@ -861,7 +861,7 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
len_mod4 =len&3;
len2=len>>2; // length in quad words (4 REs)
len2+=(len_mod4?0:1);
len2+=((len_mod4==0)?0:1);
for (i=0; i<len2; i++) {
......
......@@ -136,6 +136,334 @@ void layer1prec2A(int32_t *antenna0_sample, int32_t *antenna1_sample, uint8_t pr
((int16_t *)antenna1_sample)[1] = (int16_t)((((int16_t *)antenna1_sample)[1]*ONE_OVER_SQRT2_Q15)>>15); */
}
uint32_t FOUR[2]={0,4};
uint32_t TWO[2]={0,2};
int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
int *P1_SHIFT,
int *P2_SHIFT)
{
uint8_t *x0 = dlsch0_harq->e;
uint32_t qam16_table_offset_re = 0;
uint32_t qam16_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<12;
re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
}
}
else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<6;
re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
}
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7;
re<12;
re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
}
}
*re_allocated = *re_allocated + 12;
*jj=*jj + 48;
return(0);
}
int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
int *P1_SHIFT,
int *P2_SHIFT)
{
uint8_t *x0 = dlsch0_harq->e;
uint32_t qam16_table_offset_re = 0;
uint32_t qam16_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12;
x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
// printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<6;
x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6];
re<12;
x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2];
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
*re_allocated = *re_allocated + 10;
*jj=*jj + 40;
return(0);
}
int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
int *P1_SHIFT,
int *P2_SHIFT)
{
uint8_t *x0 = dlsch0_harq->e;
uint32_t qam64_table_offset_re = 0;
uint32_t qam64_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<12;
re++,x0p+=6,tti_offset++) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
}
}
else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<6;
re++,x0p+=6,tti_offset++) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
}
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7;
re<12;
re++,x0p+=6,tti_offset++) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
}
}
*re_allocated = *re_allocated + 12;
*jj=*jj + 72;
return(0);
}
int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
int *P1_SHIFT,
int *P2_SHIFT)
{
uint8_t *x0 = dlsch0_harq->e;
uint32_t qam64_table_offset_re = 0;
uint32_t qam64_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12;
x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
// printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<6;
x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6];
re<12;
x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]];
qam64_table_offset_im+=TWO[x0p[3]];
qam64_table_offset_re+=x0p[4];
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
*re_allocated = *re_allocated + 10;
*jj=*jj + 60;
return(0);
}
int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
......@@ -151,7 +479,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half)
uint8_t skip_half,
int *P1_SHIFT,
int *P2_SHIFT)
{
......@@ -209,27 +539,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
/*
switch (mod_order) {
case 2:
// QPSK single stream
break;
case 4:
//16QAM Single stream
gain_lin_16QAM1 = (int16_t)(((int32_t)amp*QAM16_n1)>>15);
gain_lin_16QAM2 = (int16_t)(((int32_t)amp*QAM16_n2)>>15);
break;
case 6:
//64QAM Single stream
break;
default:
break;
}
*/
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
#endif
......@@ -242,6 +551,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
else if (skip_half==2)
first_re=6;
for (re=first_re; re<last_re; re++) {
......@@ -350,8 +660,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
*jj=*jj+1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];
}
break;
......@@ -970,7 +1280,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
}
} else if (mimo_mode>=TM9_10) {
msg("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
printf("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
return(-1);
}
}
......@@ -1191,7 +1501,7 @@ int dlsch_modulation(mod_sym_t **txdataF,
uint8_t harq_pid = dlsch0->current_harq_pid;
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,jj2,re_allocated,symbol_offset;
uint32_t i,i2,jj,jj2,re_allocated,symbol_offset;
uint16_t l,rb,re_offset;
uint32_t rb_alloc_ind;
uint32_t *rb_alloc = dlsch0_harq->rb_alloc;
......@@ -1202,7 +1512,28 @@ int dlsch_modulation(mod_sym_t **txdataF,
int16_t amp_rho_a, amp_rho_b;
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];
int16_t *qam_table_s0,*qam_table_s1;
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
int (*allocate_REs)(LTE_DL_FRAME_PARMS *,
mod_sym_t **,
uint32_t*,
uint32_t*,
uint16_t,
uint32_t,
LTE_DL_eNB_HARQ_t *,
LTE_DL_eNB_HARQ_t *,
uint8_t,
int16_t,
uint8_t,
int16_t *,
int16_t *,
uint32_t *,
uint8_t,
uint8_t,
int *,
int *);
int P1_SHIFT[13],P2_SHIFT[13];
int offset,nushiftmod3;
#ifdef DEBUG_DLSCH_MODULATION
uint8_t Nl0 = dlsch0_harq->Nl;
uint8_t Nl1;
......@@ -1255,7 +1586,7 @@ int dlsch_modulation(mod_sym_t **txdataF,
for (l=num_pdcch_symbols; l<nsymb; l++) {
#ifdef DEBUG_DLSCH_MODULATION
msg("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %llx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %llx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
harq_pid,
dlsch0_harq->mimo_mode,
pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),
......@@ -1281,6 +1612,32 @@ int dlsch_modulation(mod_sym_t **txdataF,
pilots=0;
}
offset = (pilots==2)?3:0;
nushiftmod3 = frame_parms->nushift%3;
if (pilots>0) { // compute pilot arrays, could be done statically if performance suffers
if (frame_parms->mode1_flag == 1) {
// printf("l %d, nushift %d, offset %d\n",l,frame_parms->nushift,offset);
for (i=0,i2=0;i<12;i++) {
if ((i!=(frame_parms->nushift+offset)) && (i!=((frame_parms->nushift+6+offset)%12)))
P1_SHIFT[i2++]=1;
else
P1_SHIFT[i2++]=2;
}
P1_SHIFT[0]--;
}
else {
for (i=0,i2=0;i<12;i++) {
if ((i!=nushiftmod3) && (i!=nushiftmod3+6) && (i!=nushiftmod3+3) && (i!=nushiftmod3+9))
P2_SHIFT[i2++]=1;
else
P2_SHIFT[i2++]=2;
}
P2_SHIFT[0]--;
}
}
P1_SHIFT[12]=1;P2_SHIFT[12]=1;
re_offset = frame_parms->first_carrier_offset;
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
......@@ -1421,50 +1778,100 @@ int dlsch_modulation(mod_sym_t **txdataF,
}
if (dlsch0_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
printf("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
}
if (dlsch1) {
if (dlsch1_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
printf("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
}
}
if (mod_order0 == 4)
qam_table_s0 = ((pilots) ? qam16_table_b0 : qam16_table_a0);
else if (mod_order0 == 6)
qam_table_s0 = ((pilots) ? qam64_table_b0 : qam64_table_a0);
else
qam_table_s0 = NULL;
allocate_REs = allocate_REs_in_RB;
switch (mod_order0) {
case 2:
qam_table_s0 = NULL;
break;
case 4:
if (pilots) {
qam_table_s0 = qam16_table_b0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_pilots_16QAM_siso :
allocate_REs_in_RB;
}
else {
qam_table_s0 = qam16_table_a0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_no_pilots_16QAM_siso :
allocate_REs_in_RB;
}
break;
case 6:
if (pilots) {
qam_table_s0 = qam64_table_b0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_pilots_64QAM_siso :
allocate_REs_in_RB;
}
else {
qam_table_s0 = qam64_table_a0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_no_pilots_64QAM_siso :
allocate_REs_in_RB;
}
break;
}
if (mod_order1 == 4)
qam_table_s1 = ((pilots) ? qam16_table_b1 : qam16_table_a1);
else if (mod_order1 == 6)
qam_table_s1 = ((pilots) ? qam64_table_b1 : qam64_table_a1);
else
qam_table_s1 = NULL;
switch (mod_order1) {
case 2:
qam_table_s1 = NULL;
allocate_REs = allocate_REs_in_RB;
break;
case 4:
if (pilots) {
qam_table_s1 = qam16_table_b1;
}
else {
qam_table_s1 = qam16_table_a1;
}
break;
case 6:
if (pilots) {
qam_table_s1 = qam64_table_b1;
}
else {
qam_table_s1 = qam64_table_a1;
}
break;
}
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);
allocate_REs_in_RB(frame_parms,
txdataF,
&jj,
&jj2,
re_offset,
symbol_offset,
dlsch0->harq_processes[harq_pid],
(dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid],
pilots,
((pilots) ? amp_rho_b : amp_rho_a),
get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid],rb),
qam_table_s0,
qam_table_s1,
&re_allocated,
skip_dc,
skip_half);
// 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(frame_parms,
txdataF,
&jj,
&jj2,
re_offset,
symbol_offset,
dlsch0->harq_processes[harq_pid],
(dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid],
pilots,
((pilots) ? amp_rho_b : amp_rho_a),
get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid],rb),
qam_table_s0,
qam_table_s1,
&re_allocated,
skip_dc,
skip_half,
P1_SHIFT,
P2_SHIFT);
}
re_offset+=12; // go to next RB
......@@ -1484,7 +1891,7 @@ int dlsch_modulation(mod_sym_t **txdataF,
#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));
printf("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
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
......@@ -1583,7 +1990,7 @@ int mch_modulation(mod_sym_t **txdataF,
#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));
printf("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
return (re_allocated);
......
......@@ -56,10 +56,11 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t Ns)
{
int i,j,k=0;
int i;
// uint8_t reset;
uint32_t x1, x2, s=0;
uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
uint8_t *dlsch_e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
uint8_t *e=dlsch_e;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
......@@ -78,24 +79,56 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
for (i=0; i<(1+(G>>5)); i++) {
for (j=0; j<32; j++,k++) {
#ifdef DEBUG_SCRAMBLING
printf("scrambling %d : %d => ",k,e[k]);
printf("scrambling %d : %d => ",k,e[k]);
#endif
e[k] = (e[k]&1) ^ ((s>>j)&1);
e[0] = (e[0]&1) ^ (s&1);
e[1] = (e[1]&1) ^ ((s>>1)&1);
e[2] = (e[2]&1) ^ ((s>>2)&1);
e[3] = (e[3]&1) ^ ((s>>3)&1);
e[4] = (e[4]&1) ^ ((s>>4)&1);
e[5] = (e[5]&1) ^ ((s>>5)&1);
e[6] = (e[6]&1) ^ ((s>>6)&1);