Commit cf4a005e authored by Xiwen JIANG's avatar Xiwen JIANG

Beamforming channel estimation based on UE specific reference signal

parent 5adc20ca
......@@ -948,8 +948,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
pdsch->rxdataF_uespec_pilots[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * frame_parms->N_RB_DL*12);
pdsch->rxdataF_comp0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_bf_ch_estimates[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->symbols_per_tti*(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
pdsch->dl_bf_ch_estimates[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * frame_parms->ofdm_symbol_size*7*2);
pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_rho_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_mag0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
......
filter_length = 12;
filt_len = 16;
F = -3/4:1/4:7/4;
F_l = zeros(8,12);
F_r = zeros(8,12);
F_m = zeros(8,12);
F_l = zeros(8,filt_len);
F_r = zeros(8,filt_len);
F_m = zeros(8,filt_len);
F2 =-3/5:1/5:8/5;
for i=0:3
F_l(i+1,:) = floor(16384*[F(8+i:-1:4) zeros(1,7-i)]);
F_r(i+1,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]);
F_m(i+1,:) = floor(16384*[F(4-i:8) F(7:-1:1+i)]);
F_l(i+1,:) = floor(16384*[F(8+i:-1:4) zeros(1,7-i) zeros(1,4)]);
F_r(i+1,:) = floor(16384*[zeros(1,4+i) F(4:end-i) zeros(1,4)]);
F_m(i+1,:) = floor(16384*[F(4-i:8) F(7:-1:1+i) zeros(1,4)]);
end
for i=0:1
F_l(i+5,:) = floor(16384*[F(8:-1:4-i) zeros(1,7-i)]);
F_r(i+5,:) = floor(16384*[zeros(1,5+i) F2(5+i) F2(7:end-i)]);
F_m(i+5,:) = floor(16384*[F(4-i:8) F2(8-i) F2(6:-1:1+i)]);
F_l(i+5,:) = floor(16384*[F(8:-1:4-i) zeros(1,7-i) zeros(1,4)]);
F_r(i+5,:) = floor(16384*[zeros(1,5+i) F2(5+i) F2(7:end-i) zeros(1,4)]);
F_m(i+5,:) = floor(16384*[F(4-i:8) F2(8-i) F2(6:-1:1+i) zeros(1,4)]);
end
for i=2:3
F_l(i+5,:) = floor(16384*[F2(end:-1:7) F2(8-i) zeros(1,5)]);
F_r(i+5,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]);
F_m(i+5,:) = floor(16384*[F2(4-i:6) F2(4+i) F(8:-1:1+i)]);
F_l(i+5,:) = floor(16384*[F2(end:-1:7) F2(8-i) zeros(1,5) zeros(1,4)]);
F_r(i+5,:) = floor(16384*[zeros(1,4+i) F(4:end-i) zeros(1,4)]);
F_m(i+5,:) = floor(16384*[F2(4-i:6) F2(4+i) F(8:-1:1+i) zeros(1,4)]);
end
fd = fopen("filt12_32.h","w");
fd = fopen("filt16_32.h","w");
for i=0:3
fprintf(fd,"short filt12_l%d[12] = {\n",i);
fprintf(fd,"short filt%d_l%d[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_l(i+1,1:end-1));
fprintf(fd,"%d};\n\n",F_l(i+1,end));
fprintf(fd,"short filt12_r%d[12] = {\n",i);
fprintf(fd,"short filt%d_r%d[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_r(i+1,1:end-1));
fprintf(fd,"%d};\n\n",F_r(i+1,end));
fprintf(fd,"short filt12_m%d[12] = {\n",i);
fprintf(fd,"short filt%d_m%d[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_m(i+1,1:end-1));
fprintf(fd,"%d};\n\n",F_m(i+1,end));
end
for i=0:3
fprintf(fd,"short filt12_l%d_dc[12] = {\n",i);
fprintf(fd,"short filt%d_l%d_dc[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_l(i+5,1:end-1));
fprintf(fd,"%d};\n\n",F_l(i+5,end));
fprintf(fd,"short filt12_r%d_dc[12] = {\n",i);
fprintf(fd,"short filt%d_r%d_dc[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_r(i+5,1:end-1));
fprintf(fd,"%d};\n\n",F_r(i+5,end));
fprintf(fd,"short filt12_m%d_dc[12] = {\n",i);
fprintf(fd,"short filt%d_m%d_dc[%d] = {\n",filt_len,i,filt_len);
fprintf(fd,"%d,",F_m(i+5,1:end-1));
fprintf(fd,"%d};\n\n",F_m(i+5,end));
end
......
......@@ -123,7 +123,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
uint8_t l,
uint8_t symbol);
int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
module_id_t eNB_id,
uint8_t eNB_offset,
......
......@@ -70,3 +70,17 @@ short filt12_r3_dc[12] = {
short filt12_m3_dc[12] = {
-9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0};
short filt12_1[12] = {
16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384};
short filt12_2l0[12] = {
16384,12288,8192,4096,-4096,0,0,0,0,0,0,0};
short filt12_2r0[12] = {
0,4096,8192,12288,16384,20480,0,0,0,0,0,0};
short filt12_2l1[12] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0};
short filt12_2r1[12] = {
-4096,0,4096,8192,12288,16384,0,0,0,0,0,0};
......@@ -31,10 +31,9 @@
#endif
#include "defs.h"
#include "PHY/defs.h"
#include "filt12_32.h"
#include "filt16_32.h"
//#define DEBUG_CH
/*To be accomplished*/
int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id,
uint8_t eNB_offset,
......@@ -43,53 +42,670 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
unsigned char symbol)
{
unsigned char aarx;
int uespec_pilot[9][200];
short *pil, *rxF;
unsigned short rb,nb_rb=0;
unsigned char aarx,l,lprime,nsymb,skip_half=0,sss_symb,pss_symb=0,rb_alloc_ind,harq_pid,uespec_pilots=0;
int beamforming_mode, ch_offset;
uint8_t subframe;
int8_t uespec_nushift, uespec_poffset=0, pil_offset;
uint8_t pilot0,pilot1,pilot2,pilot3;
//LTE_UE_PDSCH *lte_ue_pdsch_vars = phy_vars_ue->lte_ue_pdsch_vars[eNB_id];
int **rxdataF = phy_vars_ue->lte_ue_common_vars.rxdataF;
int32_t **dl_bf_ch_estimates = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates;
short ch[2], *pil, *rxF, *dl_bf_ch, *dl_bf_ch_prev;
short *fl, *fm, *fr, *fl_dc, *fm_dc, *fr_dc, *f1, *f2l, *f2r;
int beamforming_mode = phy_vars_ue->transmission_mode>7?phy_vars_ue->transmission_mode : 0;
// define interpolation filters
//....
unsigned int *rb_alloc;
int **rxdataF;
int32_t **dl_bf_ch_estimates;
int uespec_pilot[300];
//ch_offset = phy_vars_ue->lte_frame_parms.ofdm_symbol_size*symbol;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms;
LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
LTE_DL_UE_HARQ_t *dlsch0_harq;
//generate ue specific pilots
if(beamforming_mode==7)
lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-5][0],Ns,p,0);
else if (beamforming_mode>7)
lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-6][0],Ns,p,0);
else if (beamforming_mode==0)
msg("No beamforming is performed.\n");
harq_pid = dlsch_ue[0]->current_harq_pid;
dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
rb_alloc = dlsch0_harq->rb_alloc;
rxdataF = phy_vars_ue->lte_ue_common_vars.rxdataF;
dl_bf_ch_estimates = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates;
beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0;
if (phy_vars_ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
ch_offset = frame_parms->ofdm_symbol_size;
else
msg("Beamforming mode not supported yet.\n");
ch_offset = frame_parms->ofdm_symbol_size*symbol;
uespec_nushift = frame_parms->Nid_cell%3;
subframe = Ns>>1;
if(beamforming_mode==7) {
if (beamforming_mode==7) {
//generate ue specific pilots
lprime = symbol/3-1;
lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb);
write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1);
if (frame_parms->Ncp==0){
if (symbol==3 || symbol==6 || symbol==9 || symbol==12)
uespec_pilots = 1;
} else{
if (symbol==4 || symbol==7 || symbol==10)
uespec_pilots = 1;
}
for (aarx=0; aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx;aarx++) {
if ((frame_parms->Ncp==0 && (symbol==6 ||symbol ==12)) || (frame_parms->Ncp==1 && symbol==7))
uespec_poffset = 2;
if (phy_vars_ue->lte_frame_parms.Ncp == 0) { // normal prefix
pilot0 = 3;
pilot1 = 6;
pilot2 = 9;
pilot3 = 12;
} else { // extended prefix
pilot0 = 4;
pilot1 = 7;
pilot2 = 10;
}
//define the filter
pil_offset = (uespec_nushift+uespec_poffset)%3;
// printf("symbol=%d,pil_offset=%d\n",symbol,pil_offset);
switch (pil_offset) {
case 0:
fl = filt16_l0;
fm = filt16_m0;
fr = filt16_r0;
fl_dc = filt16_l0;
fm_dc = filt16_m0;
fr_dc = filt16_r0;
f1 = filt16_1;
f2l = filt16_2l0;
f2r = filt16_2r0;
break;
case 1:
fl = filt16_l1;
fm = filt16_m1;
fr = filt16_r1;
fl_dc = filt16_l1;
fm_dc = filt16_m1;
fr_dc = filt16_r1;
f1 = filt16_1;
f2l = filt16_2l1;
f2r = filt16_2r1;
break;
/* pil = (short *)&uespec_pilot[0][0];
rxF = (short *)&rxdataF_uespec[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)];
dl_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset];
case 2:
fl = filt16_l2;
fm = filt16_m2;
fr = filt16_r2;
fl_dc = filt16_l2;
fm_dc = filt16_m2;
fr_dc = filt16_r2;
f1 = filt16_1;
f2l = filt16_2l0;
f2r = filt16_2r0;
break;
memset(dl_ch,0,4*(phy_vars_ue->lte_frame_parms.ofdm_symbol_size));
//estimation and interpolation */
case 3:
fl = filt16_l3;
fm = filt16_m3;
fr = filt16_r3;
fl_dc = filt16_l3;
fm_dc = filt16_m3;
fr_dc = filt16_r3;
f1 = filt16_1;
f2l = filt16_2l1;
f2r = filt16_2r1;
break;
}
}
else if (beamforming_mode==0)
msg("lte_dl_bf_channel_estimation:No beamforming is performed.\n");
else
msg("lte_dl_bf_channel_estimation:Beamforming mode not supported yet.\n");
} else if (beamforming_mode==0){
msg("No beamforming is performed.\n");
return(-1);
l=symbol;
nsymb = (frame_parms->Ncp==NORMAL) ? 14:12;
if (frame_parms->frame_type == TDD) { //TDD
sss_symb = nsymb-1;
pss_symb = 2;
} else {
msg("Beamforming mode is not supported yet.\n");
return(-1);
sss_symb = (nsymb>>1)-2;
pss_symb = (nsymb>>1)-1;
}
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
rxF = (short *)&rxdataF[aarx][pil_offset + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size];
pil = (short*)uespec_pilot;
dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset];
memset(dl_bf_ch,0,4*(frame_parms->ofdm_symbol_size));
//memset(dl_bf_ch,0,2*(frame_parms->ofdm_symbol_size));
if (phy_vars_ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha
if (frame_parms->Ncp==0)
multadd_complex_vector_real_scalar(dl_bf_ch-(frame_parms->ofdm_symbol_size<<1),
phy_vars_ue->ch_est_alpha,dl_bf_ch-(frame_parms->ofdm_symbol_size<<1),
1,frame_parms->ofdm_symbol_size);
else
msg("lte_dl_bf_channel_estimation: beamforming channel estimation not supported for TM7 Extended CP.\n"); // phy_vars_ue->ch_est_beta should be defined equaling 1/3
//estimation and interpolation
if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
// For second half of RBs skip DC carrier
if (rb==(frame_parms->N_RB_DL>>1)) {
rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))];
}
if (rb_alloc_ind==1) {
if (uespec_pilots==1) {
if (beamforming_mode==7) {
if (frame_parms->Ncp==0) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
//printf("rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
exit(-1);
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c): transmission mode not supported.\n");
}
nb_rb++;
}
rxF+=24;
dl_bf_ch+=24;
}
else { // Odd number of RBs
for (rb=0; rb<frame_parms->N_RB_DL>>1; rb++) {
skip_half=0;
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
// PBCH
if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3
if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=1;
else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=2;
//SSS
if (((subframe==0)||(subframe==5)) &&
(rb>((frame_parms->N_RB_DL>>1)-3)) &&
(rb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==sss_symb) ) {
rb_alloc_ind = 0;
}
//SSS
if (((subframe==0)||(subframe==5)) &&
(rb==((frame_parms->N_RB_DL>>1)-3)) &&
(l==sss_symb))
skip_half=1;
else if (((subframe==0)||(subframe==5)) &&
(rb==((frame_parms->N_RB_DL>>1)+3)) &&
(l==sss_symb))
skip_half=2;
//PSS in subframe 0/5 if FDD
if (frame_parms->frame_type == FDD) { //FDD
if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
if ((frame_parms->frame_type == TDD) &&
(subframe==6)) { //TDD Subframe 6
if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
//printf("symbol=%d,pil_offset=%d\ni,rb_alloc_ind=%d,uespec_pilots=%d,beamforming_mode=%d,Ncp=%d,skip_half=%d\n",symbol,pil_offset,rb_alloc_ind,uespec_pilots,beamforming_mode,frame_parms->Ncp,skip_half);
if (rb_alloc_ind==1) {
if (uespec_pilots==1) {
if (beamforming_mode==7) {
if (frame_parms->Ncp==0) {
if (skip_half==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
}
} else if (skip_half==2) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
} else {
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
}
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
exit(-1);
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n");
}
}
nb_rb++;
}
rxF+=24;
dl_bf_ch+=24;
} // first half loop
// Do middle RB (around DC)
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
// PBCH
if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//SSS
if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) {
rb_alloc_ind = 0;
}
if (frame_parms->frame_type == FDD) {
//PSS
if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
if ((frame_parms->frame_type == TDD) && (subframe==6)) {
//PSS
if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
//printf("DC rb %d (%p)\n",rb,rxF);
if (rb_alloc_ind==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)];
ch[0] = (short)(((int)pil[0]*rxF[6] - (int)pil[1]*rxF[7])>>15);
ch[1] = (short)(((int)pil[0]*rxF[7] + (int)pil[1]*rxF[6])>>15);
multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[6],rxF[7],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)];
ch[0] = (short)(((int)pil[0]*rxF[2] - (int)pil[1]*rxF[3])>>15);
ch[1] = (short)(((int)pil[0]*rxF[3] + (int)pil[1]*rxF[2])>>15);
multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[2],rxF[3],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
ch[0] = (short)(((int)pil[0]*rxF[10] - (int)pil[1]*rxF[11])>>15);
ch[1] = (short)(((int)pil[0]*rxF[11] + (int)pil[1]*rxF[10])>>15);
multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16);
//printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[10],rxF[11],pil[0],pil[1],ch[0],ch[1]);
pil+=2;;
}
} // rballoc==1
else {
rxF = (short *)&rxdataF[aarx][pil_offset+((symbol*(frame_parms->ofdm_symbol_size)))];
}
rxF+=14+2*pil_offset;
dl_bf_ch+=24;
rb++;
for (; rb<frame_parms->N_RB_DL; rb++) {
skip_half=0;
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
// PBCH
if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3
if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=1;
else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=2;
//SSS
if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) {
rb_alloc_ind = 0;
}
//SSS
if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb))
skip_half=1;
else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb))
skip_half=2;
if (frame_parms->frame_type == FDD) {
//PSS
if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
//PSS
if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
if ((frame_parms->frame_type == TDD) &&
(subframe==6)) { //TDD Subframe 6
if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
if (rb_alloc_ind==1) {
if (uespec_pilots==1) {
if (beamforming_mode==7) {
if (frame_parms->Ncp==0) {
if (skip_half==1) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
}
} else if (skip_half==2) {
if (pil_offset<2) {
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16);
pil+=2;
} else {
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16);
pil+=2;
}
} else {
ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16);
// printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15);
ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15);
multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16);
// printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15);
ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15);
multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16);
// printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]);
pil+=2;
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n");
exit(-1);
}
} else {
msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n");
}
}
nb_rb++;
}
rxF+=24;
dl_bf_ch+=24;
} // second half of RBs
} // odd number of RBs
// Temporal Interpolation
if (phy_vars_ue->perfect_ce == 0) {
dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset];
printf("dlsch_bf_ch_est.c:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]);
if (phy_vars_ue->high_speed_flag == 0) {
multadd_complex_vector_real_scalar(dl_bf_ch,
32767-phy_vars_ue->ch_est_alpha,
dl_bf_ch-(frame_parms->ofdm_symbol_size<<1),0,frame_parms->ofdm_symbol_size);
printf("dlsch_bf_ch_est.c:symbol %d,dl_bf_ch (%d,%d)\n",symbol,*(dl_bf_ch-512*2),*(dl_bf_ch-512*2+1));
} else { // high_speed_flag == 1
if (beamforming_mode==7) {
if (frame_parms->Ncp==0) {
if (symbol == pilot0) {
// printf("Interpolating %d->0\n",4-phy_vars_ue->lte_frame_parms.Ncp);
// dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][(4-phy_vars_ue->lte_frame_parms.Ncp)*(frame_parms->ofdm_symbol_size)];
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot3*(frame_parms->ofdm_symbol_size)];
// pilot spacing 5 symbols (1/5,2/5,3/5,4/5 combination)
multadd_complex_vector_real_scalar(dl_bf_ch_prev,26214,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,6554,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,19661,dl_bf_ch-(3*2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,13107,dl_bf_ch-(3*2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,13107,dl_bf_ch-(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,19661,dl_bf_ch-(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,6554,dl_bf_ch-(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,26214,dl_bf_ch-(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
} else if (symbol == pilot1) {
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot0*(frame_parms->ofdm_symbol_size)];
// pilot spacing 3 symbols (1/3,2/3 combination)
multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size);
} else if (symbol == pilot2) {
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot1*(frame_parms->ofdm_symbol_size)];
multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size);
} else { // symbol == pilot3
// printf("Interpolating 0->%d\n",4-phy_vars_ue->lte_frame_parms.Ncp);
dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot2*(frame_parms->ofdm_symbol_size)];
// pilot spacing 3 symbols (1/3,2/3 combination)
multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size);
multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size);
}
} else {
msg("lte_dl_bf_channel_estimation:temporal interpolation not supported for TM7 extented CP.\n");
}
} else {
msg("lte_dl_bf_channel_estimation:temporal interpolation not supported for this beamforming mode.\n");
}
}
}
} //aarx
//temporal interpolation
//printf("[dlsch bf ch est]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]);
return(0);
......
......@@ -54,6 +54,8 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti);
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL UE-specific reference signals for antenna ports 7..14.
@param frame_parms LTE DL Frame parameters
@param lte_gold_uespec_table pointer to table where sequences are stored
......@@ -96,7 +98,7 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB,
uint8_t Ns,
uint8_t lprime,
uint8_t p,
int SS_flag );
int SS_flag);
/*! \brief This function generates the MBSFN reference signal sequence (36-211, Sec 6.10.1.2)
@param phy_vars_eNB Pointer to eNB variables
......@@ -130,7 +132,9 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue,
mod_sym_t *output,
unsigned char Ns,
unsigned char p,
int SS_flag);
int lprime,
int SS_flag,
uint16_t nRB_PDSCH);
int lte_dl_mbsfn_rx(PHY_VARS_UE *phy_vars_ue,
int *output,
......
......@@ -59,12 +59,12 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB,
uint8_t Ns,
uint8_t lprime,
uint8_t p,
int SS_flag )
int SS_flag)
{
mod_sym_t qpsk[4],nqpsk[4];
/* mod_sym_t qpsk[4],nqpsk[4];
int16_t k=0,a;
int mprime,mprime_dword,mprime_qpsk_symb;
int mprime,ind,ind_dword,ind_qpsk_symb;
unsigned nushift,kprime;
// LTE_eNB_DLSCH_t *dlsch = phy_vars_eNB->dlsch_eNB[UE_id][0];
......@@ -103,12 +103,13 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB,
k = kprime+phy_vars_eNB->lte_frame_parms.first_carrier_offset;
printf("lte_dl_ue_spec:k=%d\n",k);
for (mprime=0;mprime<3*phy_vars_eNB->lte_frame_parms.N_RB_DL-1;mprime++) {
mprime_dword = mprime>>4;
mprime_qpsk_symb = mprime&0xf;
for (mprime=0;mprime<3*nRB_PDSCH-1;mprime++) {
ind = 3*lprime*nRB_PDSCH+mprime;
ind_dword = ind>>4;
ind_qpsk_symb = ind&0xf;
//output[k] = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3];
output[k] = 0xffffffff;
output[k] = qpsk[(phy_vars_UE->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3];
//output[k] = 0xffffffff;
k += 4;
if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) {
......@@ -125,19 +126,21 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB,
LOG_E(PHY,"Illegal p %d UE specific pilots\n",p);
}
return(0);
return(0);*/
}
int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue,
mod_sym_t *output,
unsigned char Ns,
unsigned char p,
int SS_flag)
mod_sym_t *output,
unsigned char Ns,
unsigned char p,
int lprime,
int SS_flag,
uint16_t nRB_PDSCH)
{
mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p;
int16_t a;
int w,lprime,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB;
int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB;
short pamp;
// Compute the correct pilot amplitude, sqrt_rho_b = Q3.13
......@@ -169,7 +172,7 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue,
output_p = output;
for (lprime=0; lprime<2; lprime++) {
//for (lprime=0; lprime<2; lprime++) {
ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL;
l = lprime + ((Ns&1)<<1);
......@@ -288,25 +291,29 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue,
output_p++;
ind++;
}
}
// }
} else {
LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n");
}
}
} else if (p==5) {
if (SS_flag==0) {
if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) {
for (lprime=0;lprime<2;lprime++) {
ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL;
for (mprime=0;mprime<3*phy_vars_ue->lte_frame_parms.N_RB_DL-1;mprime++) {
ind_dword = ind>>4;
ind_qpsk_symb = ind&0xf;
*output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3];
*output_p++;
}
output_p = output;
if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) {
//for (lprime=0;lprime<4;lprime++) {
for (mprime=0;mprime<3*nRB_PDSCH;mprime++) {
ind = 3*lprime*nRB_PDSCH+mprime;
ind_dword = ind>>4;
ind_qpsk_symb = ind&0xf;
*output_p = qpsk[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3];
//printf("lprime=%d,ind=%d,Ns=%d,output_p=(%d,%d)\n",lprime,ind,Ns,((short *)&output_p[0])[0],((short *)&output_p[0])[1]);
*output_p++;
}
// }
}
}
} else {
......@@ -343,44 +350,44 @@ main()
lte_gold(Nid_cell,Ncp);
lte_dl_ue_spec(output00,
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
0,
0,
0);
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
0,
0,
0);
lte_dl_ue_spec(output10,
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
1,
0,
0);
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
1,
0,
0);
lte_dl_ue_spec(output01,
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
0,
1,
0);
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
0,
1,
0);
lte_dl_ue_spec(output11,
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
1,
1,
0);
ONE_OVER_SQRT2_Q15,
50,
Nid_cell,
Ncp,
0,
1,
1,
0);
write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1);
......
......@@ -142,7 +142,7 @@ void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_t
}
}
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][2][21],uint16_t Nid_cell, uint16_t n_rnti)
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti)
{
unsigned char ns,l;
......@@ -151,36 +151,36 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][2][21],uint
for (ns=0; ns<20; ns++) {
for (l=0; l<2; l++) {
//for (l=0; l<2; l++) {
x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti;
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
x1 = 1+ (1<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti;
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
x1 = 1+ (1<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
//printf("n=0 : x1 %x, x2 %x\n",x1,x2);
for (n=1; n<50; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
// printf("x1 : %x, x2 : %x\n",x1,x2);
}
for (n=0; n<14; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
lte_gold_uespec_port5_table[ns][l][n] = x1^x2;
// printf("n=%d : c %x\n",n,x1^x2);
}
// skip first 50 double words (1600 bits)
//printf("n=0 : x1 %x, x2 %x\n",x1,x2);
for (n=1; n<50; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
// printf("x1 : %x, x2 : %x\n",x1,x2);
}
for (n=0; n<38; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
lte_gold_uespec_port5_table[ns][n] = x1^x2;
// printf("n=%d : c %x\n",n,x1^x2);
}
// }
}
}
......
......@@ -246,15 +246,16 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
}
} else if (beamforming_mode==7) { //else n_tx>1
nb_rb = dlsch_extract_rbs_TM7(lte_ue_common_vars->rxdataF,
lte_ue_common_vars->dl_ch_estimates[eNB_id],
lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates,
lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
dlsch0_harq->rb_alloc,
symbol,
subframe,
phy_vars_ue->high_speed_flag,
frame_parms);
printf("dlsch extract: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]);
} else if(beamforming_mode>7) {
LOG_W(PHY,"dlsch_demodulation:beamforming mode not supported yet.\n");
......@@ -275,11 +276,19 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
nb_rb);
*/
if (first_symbol_flag==1) {
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
symbol,
nb_rb);
if (beamforming_mode==0)
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
symbol,
nb_rb);
else
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
frame_parms,
avg,
symbol,
nb_rb);
#ifdef DEBUG_PHY
LOG_D(PHY,"[DLSCH] avg[0] %d\n",avg[0]);
#endif
......@@ -329,6 +338,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
aarx = frame_parms->nb_antennas_rx;
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
printf("dlsch compensation: symbol %d, dl_estimates_ext[0][300] %d \n",symbol, *(short*)&lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][300]);
printf("dlsch compensation: symbol %d, dl_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][2400]);
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
......@@ -546,9 +557,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
1);
}
} else if (dlsch0_harq->mimo_mode==TM7) { //TM7
printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, *(short*)&lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]);
printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][2400]);
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......@@ -558,6 +571,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
first_symbol_flag,
get_Qm(dlsch0_harq->mcs),
nb_rb,
//9,
lte_ue_pdsch_vars[eNB_id]->log2_maxh,
phy_measurements); // log2_maxh+I0_shift
}
......@@ -4209,9 +4223,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
}
unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
int **dl_ch_estimates,
int **dl_bf_ch_estimates,
int **rxdataF_ext,
int **dl_ch_estimates_ext,
int **dl_bf_ch_estimates_ext,
unsigned int *rb_alloc,
unsigned char symbol,
unsigned char subframe,
......@@ -4240,7 +4254,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
uespec_pilots = 1;
}
if (frame_parms->frame_type == TDD) { // TDD
if (frame_parms->frame_type == TDD) {// TDD
sss_symb = nsymb-1;
pss_symb = 2;
} else {
......@@ -4257,15 +4271,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (high_speed_flag == 1)
dl_ch0 = &dl_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))];
//dl_ch0 = &dl_bf_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))];
dl_ch0 = &dl_bf_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)];
else
dl_ch0 = &dl_ch_estimates[aarx][5];
//dl_ch0 = &dl_bf_ch_estimates[aarx][5];
dl_ch0 = &dl_bf_ch_estimates[aarx][0];
dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)];
dl_ch0_ext = &dl_bf_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)];
rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)];
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))];
printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3);
//printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3);
//rxF_uespec = &rxdataF_uespec_pilots[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)];
//printf("symbol, rxF_uespec offset:%d\n",symbol,(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp));
......@@ -4291,7 +4307,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (rb_alloc_ind==1) {
//*pmi_ext = (pmi>>((rb>>2)<<1))&3;
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
//memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
/*
printf("rb %d\n",rb);
......@@ -4300,11 +4316,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
printf("\n");
*/
if (pilots==0 && uespec_pilots==0) {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i];
/*
printf("%d : (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),
((short*)&rxF[i])[0],((short*)&rxF[i])[1]);*/
}
dl_ch0_ext+=12;
......@@ -4316,9 +4331,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
dl_ch0_ext[j++]=dl_ch0[i];
}
}
......@@ -4432,7 +4445,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (rb_alloc_ind==1) {
// printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
//printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half);
if (pilots==0 && uespec_pilots==0) {
// printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
......@@ -4493,8 +4506,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
//printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
dl_ch0_ext[j++]=dl_ch0[i];
//printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i]));
}
}
......@@ -4558,6 +4572,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){
rxF_ext[j] = rxF[i];
dl_ch0_ext[j++] = dl_ch0[i];
//printf("symbol %d, extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
//printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
}
} else{
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){
......@@ -4676,13 +4692,13 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++] = rxF[i];
//printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
//printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
//printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
}
} else {
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++] = rxF[i];
// printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
}
}
}
......@@ -4694,7 +4710,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++]=rxF[(1+i-6)];
// printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
// printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
}
} else {
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){
......@@ -4814,6 +4831,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
} else {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
//printf("symbol %d, extract rb %d, => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
for (i=0; i<12; i++)
rxF_ext[i]=rxF[i];
......@@ -4854,6 +4872,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
rxF_ext[j]=rxF[i];
//printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
dl_ch0_ext[j++]=dl_ch0[i];
//printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i]));
}
}
......@@ -4914,6 +4933,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){
rxF_ext[j] = rxF[i];
dl_ch0_ext[j++]=dl_ch0[i];
// printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i]));
}
} else{
if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){
......@@ -4972,6 +4992,17 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per
sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1);
if (phy_vars_ue->transmission_mode[eNB_id]==7){
sprintf(fname,"dlsch%d_bf_ch_r%d.m",eNB_id,round);
sprintf(vname,"dl%d_bf_ch_r%d",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1);
//write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512,1,1);
sprintf(fname,"dlsch%d_bf_ch_r%d_ext00.m",eNB_id,round);
sprintf(vname,"dl%d_bf_ch_r%d_ext00",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1);
}
if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) {
sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round);
sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round);
......
......@@ -71,13 +71,13 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd
}
//uint8_t is_not_UEspecRS(int first_layer,int re)
uint8_t is_not_UEspecRS(uint8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode)
uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode)
{
uint8_t offset = (lprime==2)?2:0;
if(lprime==0)
uint8_t offset = (lprime==1||lprime==3)?2:0;
if (lprime==-1)
return(1);
switch(beamforming_mode){
switch (beamforming_mode) {
case 7:
if (Ncp == NORMAL){
if ((re!=nushift+offset) && (re!=((nushift+4+offset)%12)) && (re!=((nushift+8+offset)%12)))
......@@ -225,7 +225,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB,
uint8_t layer;
int s=1;
uint8_t mprime2 = mprime,mprime_dword,mprime_qpsk_symb;
int mprime2 = mprime,ind,ind_dword,ind_qpsk_symb;
mod_sym_t qpsk[4];
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
......@@ -1022,12 +1022,13 @@ break;
//printf("precoding UE spec RS\n");
for (aa=0; aa<nb_antennas_tx_phy; aa++) {
mprime_dword = mprime2>>4;
mprime_qpsk_symb = mprime2&0xf;
ind = 3*lprime*dlsch0_harq->nb_rb+mprime2;
ind_dword = ind>>4;
ind_qpsk_symb = ind&0xf;
tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]);
//printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]);
tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3];
//printf("lprime=%d,nb_rb=%d,mprime2=%d,ind=%d,Ns=%d,tmp_sample1=(%d,%d)\n",lprime,dlsch0_harq->nb_rb,mprime2,ind,Ns,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]);
((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15);
((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15);
......@@ -1037,8 +1038,11 @@ break;
// ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff;
// ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff;
//printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]);
//printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]);
//printf("txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]);
mprime2 = mprime2++;
//printf("**txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]);
}
}
......@@ -1291,7 +1295,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode;
uint8_t beamforming_mode = 0;
int32_t **beamforming_weights_RB = beamforming_weights;
uint8_t lprime, mprime=0,Ns;
uint8_t mprime=0,Ns;
int8_t lprime=-1;
#ifdef DEBUG_DLSCH_MODULATION
uint8_t Nl0 = dlsch0_harq->Nl;
......@@ -1375,19 +1380,25 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
beamforming_mode = 7;
mprime = 0;
if (frame_parms->Ncp==0) { // normal prefix
if ((l==6)||(l==12))
lprime=2; // pilots in nushift+3, nushift+9
else if ((l==3)||(l==9))
lprime=1; // pilots in nushift, nushift+6
if (l==12)
lprime=3; // pilots in nushift+3, nushift+9
else if (l==9)
lprime=2; // pilots in nushift, nushift+6
else if (l==6)
lprime=1; // pilots in nushift+3, nushift+9
else if (l==3)
lprime=0; // pilots in nushift, nushift+6
else
lprime=0;
lprime=-1;
} else {
if ((l==7))
if (l==10)
lprime=2;
else if ((l==4)||(l==10))
else if (l==7)
lprime=1;
else
else if (l==4)
lprime=0;
else
lprime=-1;
}
}else if(mimo_mode==TM8){
beamforming_mode = 8;
......@@ -1395,10 +1406,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
beamforming_mode = 9;
}
if(l<=(nsymb>>2))
Ns=0;
else
Ns=1;
Ns = 2*subframe_offset+(l>=(nsymb>>1));
re_offset = frame_parms->first_carrier_offset;
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
......@@ -1566,7 +1574,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
qam_table_s1 = NULL;
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(phy_vars_eNB,
txdataF,
&jj,
......@@ -1588,12 +1596,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
Ns,
beamforming_weights_RB);
if(mimo_mode==TM7){
if(frame_parms->Ncp==0&&(l==3||l==6||l==9||l==12))
mprime +=3;
else if(frame_parms->Ncp==1&&(l==4||l==7||l==10))
mprime +=4;
}
if(mimo_mode==TM7 && lprime>=0)
mprime +=3+frame_parms->Ncp;
}
......
......@@ -48,7 +48,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
uint8_t beamforming_mode)
{
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
/*LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
uint8_t second_pilot,aa;
......@@ -123,7 +123,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
default:
msg("[generate_ue_spec_pilots(in uespec_pilots.c)]ERROR:beamforming mode %d is not supported\n",beamforming_mode);
}
}*/
}
/*int generate_ue_spec_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
......
......@@ -1756,6 +1756,8 @@ int is_pmch_subframe(frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parm
uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots);
uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode);
uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB,
LTE_DL_FRAME_PARMS *lte_frame_parms,
LTE_UE_DLSCH_t *dlsch,
......
......@@ -64,6 +64,11 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
unsigned int rx_offset;
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
int uespec_pilot[9][1200];*/
void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[256]; // This is for misalignment issues for 6 and 15 PRBs
......@@ -241,15 +246,18 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
}
}
// printf("slot_fep:transmission_mode[%d] = %d\n", eNB_id, phy_vars_ue->transmission_mode[eNB_id]);
if(phy_vars_ue->transmission_mode[eNB_id] == 7)
if(frame_parms->Ncp==0 && (symbol==3) || (symbol==6) || (symbol==9) || (symbol==12))
lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol);
else if(frame_parms->Ncp==1 && (symbol==4) || (symbol==7) || (symbol==10))
msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n");
else if(phy_vars_ue->transmission_mode[eNB_id] > 7)
msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n");
if(phy_vars_ue->transmission_mode[eNB_id] == 7) {
if(frame_parms->Ncp==0 && ((symbol==3) || (symbol==6) || (symbol==9) || (symbol==12)))
lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol);
else if(frame_parms->Ncp==1 && ((symbol==4) || (symbol==7) || (symbol==10)))
msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n");
} else if(phy_vars_ue->transmission_mode[eNB_id] > 7) {
msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n");
}
}
#ifdef DEBUG_FEP
......
......@@ -243,7 +243,7 @@ typedef struct PHY_VARS_eNB_s {
uint32_t lte_gold_table[20][2][14];
/// UE-specific reference symbols (p=5), TM 7
uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][2][21];
uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][38];
/// UE-specific reference symbols (p=7...14), TM 8/9/10
uint32_t lte_gold_uespec_table[2][20][2][21];
......@@ -510,7 +510,7 @@ typedef struct {
uint32_t lte_gold_table[7][20][2][14];
/// UE-specific reference symbols (p=5), TM 7
uint32_t lte_gold_uespec_port5_table[20][2][21];
uint32_t lte_gold_uespec_port5_table[20][38];
/// ue-specific reference symbols
uint32_t lte_gold_uespec_table[2][20][2][21];
......
......@@ -172,7 +172,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
......@@ -746,6 +745,7 @@ int main(int argc, char **argv)
if (transmission_mode==7){
lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti);
lte_gold_ue_spec_port5(PHY_vars_UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti);
beamforming_weights = (int32_t **)malloc(12*N_RB_DL*sizeof(int32_t*));
for(re=0;re<12*N_RB_DL;re++){
beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t));
......@@ -3064,10 +3064,12 @@ PMI_FEEDBACK:
pilot2 = 6;
pilot3 = 9;
}
start_meas(&PHY_vars_UE->phy_proc_rx);
// Inner receiver scheduling for 3 slots
for (Ns=(2*subframe); Ns<((2*subframe)+3); Ns++) {
for (l=0; l<pilot2; l++) {
if (n_frames==1)
......@@ -3085,14 +3087,15 @@ PMI_FEEDBACK:
no_prefix if 1 prefix is removed by HW
*/
start_meas(&PHY_vars_UE->ofdm_demod_stats);
slot_fep(PHY_vars_UE,
l,
Ns%20,
0,
0);
stop_meas(&PHY_vars_UE->ofdm_demod_stats);
if(Ns==(2*subframe) || Ns==(2*subframe+1)) {
start_meas(&PHY_vars_UE->ofdm_demod_stats);
slot_fep(PHY_vars_UE,
l,
Ns%20,
0,
0);
stop_meas(&PHY_vars_UE->ofdm_demod_stats);
}
//write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1);
if (PHY_vars_UE->perfect_ce==1) {
......@@ -3120,6 +3123,11 @@ PMI_FEEDBACK:
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0/2;
if (transmission_mode == 7){
((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(short)(AMP);
((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=0/2;
}
}
}
}
......
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