Commit b6d66003 authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4144 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 07b20ce0
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef NO_OPENAIR1 #ifndef NO_OPENAIR1
#include "PHY/defs.h" #include "PHY/defs.h"
#else #else
#include "PHY/TOOLS/time_meas.h"
#define u32 uint32_t #define u32 uint32_t
#define s32 int32_t #define s32 int32_t
#define u16 uint16_t #define u16 uint16_t
......
...@@ -1155,6 +1155,7 @@ int generate_eNB_dlsch_params_from_dci(uint8_t subframe, ...@@ -1155,6 +1155,7 @@ int generate_eNB_dlsch_params_from_dci(uint8_t subframe,
} }
#ifdef DEBUG_DCI #ifdef DEBUG_DCI
if (dlsch0) { if (dlsch0) {
msg("dlsch0 eNB: dlsch0 %p\n",dlsch0);
msg("dlsch0 eNB: rnti %x\n",dlsch0->rnti); msg("dlsch0 eNB: rnti %x\n",dlsch0->rnti);
msg("dlsch0 eNB: NBRB %d\n",dlsch0->nb_rb); msg("dlsch0 eNB: NBRB %d\n",dlsch0->nb_rb);
msg("dlsch0 eNB: rballoc %x\n",dlsch0->rb_alloc[0]); msg("dlsch0 eNB: rballoc %x\n",dlsch0->rb_alloc[0]);
......
...@@ -820,7 +820,7 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -820,7 +820,7 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
len2=len>>2; // length in quad words (4 REs) len2=len>>2; // length in quad words (4 REs)
len2+=(len_mod4?0:1); len2+=(len_mod4?0:1);
for (i=0;i<len;i++) { for (i=0;i<len2;i++) {
xmm1 = _mm_abs_epi16(rxF[i]); xmm1 = _mm_abs_epi16(rxF[i]);
xmm1 = _mm_subs_epi16(ch_mag[i],xmm1); xmm1 = _mm_subs_epi16(ch_mag[i],xmm1);
......
...@@ -58,7 +58,7 @@ u8 rv_table[4] = {0, 3, 1, 2}; ...@@ -58,7 +58,7 @@ u8 rv_table[4] = {0, 3, 1, 2};
uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
// for FDD // for FDD
if (frame_parms->frame_type == 0) if (frame_parms->frame_type == FDD)
return 1; return 1;
// for TDD // for TDD
...@@ -104,7 +104,7 @@ uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { ...@@ -104,7 +104,7 @@ uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
if (frame_parms->frame_type == 0) if (frame_parms->frame_type == FDD)
return(subframe&7); return(subframe&7);
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
...@@ -126,7 +126,7 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su ...@@ -126,7 +126,7 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su
} }
uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,uint8_t frame,uint8_t subframe) { uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,uint8_t frame,uint8_t subframe) {
if (frame_parms->frame_type == 0) { if (frame_parms->frame_type == FDD) {
return((subframe<4) ? (frame - 1) : frame); return((subframe<4) ? (frame - 1) : frame);
} }
else { else {
...@@ -137,7 +137,7 @@ uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,uint8_t frame,u ...@@ -137,7 +137,7 @@ uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,uint8_t frame,u
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
if (frame_parms->frame_type == 0) if (frame_parms->frame_type == FDD)
return(subframe<4 ? ((subframe+8)%10) : subframe-4); return(subframe<4 ? ((subframe+8)%10) : subframe-4);
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
...@@ -1013,7 +1013,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, ...@@ -1013,7 +1013,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue,
ngroup_PHICH = (ulsch->harq_processes[harq_pid]->first_rb + ngroup_PHICH = (ulsch->harq_processes[harq_pid]->first_rb +
ulsch->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH; ulsch->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH;
if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == 1) ) { if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) {
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe); pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
if ((pusch_subframe == 4) || (pusch_subframe == 9)) if ((pusch_subframe == 4) || (pusch_subframe == 9))
ngroup_PHICH += Ngroup_PHICH; ngroup_PHICH += Ngroup_PHICH;
...@@ -1351,7 +1351,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1351,7 +1351,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
ngroup_PHICH = (ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb + ngroup_PHICH = (ulsch_eNB[UE_id]->harq_processes[harq_pid]->first_rb +
ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH; ulsch_eNB[UE_id]->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH;
if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == 1) ) { if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) {
if ((pusch_subframe == 4) || (pusch_subframe == 9)) if ((pusch_subframe == 4) || (pusch_subframe == 9))
ngroup_PHICH += Ngroup_PHICH; ngroup_PHICH += Ngroup_PHICH;
......
...@@ -17,13 +17,16 @@ ...@@ -17,13 +17,16 @@
#define MBSFN_FDD_SF7 0x08 #define MBSFN_FDD_SF7 0x08
#define MBSFN_FDD_SF8 0x04 #define MBSFN_FDD_SF8 0x04
#ifndef __SSE3__ #ifndef __SSE3__
#warning SSE3 instruction set not preset
__m128i zeroM;//,tmp_over_sqrt_10,tmp_sum_4_over_sqrt_10,tmp_sign,tmp_sign_3_over_sqrt_10; __m128i zeroM;//,tmp_over_sqrt_10,tmp_sum_4_over_sqrt_10,tmp_sign,tmp_sign_3_over_sqrt_10;
//#define _mm_abs_epi16(xmmx) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zero,(xmmx))) //#define _mm_abs_epi16(xmmx) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zero,(xmmx)))
#define _mm_abs_epi16(xmmx) _mm_add_epi16(_mm_xor_si128((xmmx),_mm_cmpgt_epi16(zeroM,(xmmx))),_mm_srli_epi16(_mm_cmpgt_epi16(zeroM,(xmmx)),15)) #define _mm_abs_epi16(xmmx) _mm_add_epi16(_mm_xor_si128((xmmx),_mm_cmpgt_epi16(zeroM,(xmmx))),_mm_srli_epi16(_mm_cmpgt_epi16(zeroM,(xmmx)),15))
#define _mm_sign_epi16(xmmx,xmmy) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zeroM,(xmmy))) #define _mm_sign_epi16(xmmx,xmmy) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zeroM,(xmmy)))
#endif #endif
void dump_mch(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u16 coded_bits_per_codeword,int subframe) { void dump_mch(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u16 coded_bits_per_codeword,int subframe) {
unsigned int nsymb_pmch=12; unsigned int nsymb_pmch=12;
...@@ -62,7 +65,7 @@ void dump_mch(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u16 coded_bits_per_codeword,int ...@@ -62,7 +65,7 @@ void dump_mch(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u16 coded_bits_per_codeword,int
write_output("rxsig_mch.m","rxs_mch", write_output("rxsig_mch.m","rxs_mch",
&phy_vars_ue->lte_ue_common_vars.rxdata[0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti], &phy_vars_ue->lte_ue_common_vars.rxdata[0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti],
phy_vars_ue->lte_frame_parms.samples_per_tti,1,1); phy_vars_ue->lte_frame_parms.samples_per_tti,1,1);
if (PHY_vars_eNB_g)
write_output("txsig_mch.m","txs_mch", write_output("txsig_mch.m","txs_mch",
&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti], &PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti],
phy_vars_ue->lte_frame_parms.samples_per_tti,1,1); phy_vars_ue->lte_frame_parms.samples_per_tti,1,1);
...@@ -619,8 +622,9 @@ void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -619,8 +622,9 @@ void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char symbol, unsigned char symbol,
short **llr_save) { short **llr_save) {
__m128i xmm1,xmm2,*ch_mag,*ch_magb;
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; __m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
__m128i *ch_mag,*ch_magb,xmm1,xmm2;
int j=0,i,len,len2; int j=0,i,len,len2;
unsigned char len_mod4; unsigned char len_mod4;
short *llr; short *llr;
...@@ -649,24 +653,62 @@ void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -649,24 +653,62 @@ void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
len2=len>>2; // length in quad words (4 REs) len2=len>>2; // length in quad words (4 REs)
len2+=(len_mod4?0:1); len2+=(len_mod4?0:1);
for (i=0;i<len>>2;i++) {
for (i=0;i<len2;i++) {
xmm1 = _mm_abs_epi16(rxF[i]); xmm1 = _mm_abs_epi16(rxF[i]);
xmm1 = _mm_subs_epi16(ch_mag[i],xmm1); xmm1 = _mm_subs_epi16(ch_mag[i],xmm1);
xmm2 = _mm_abs_epi16(xmm1); xmm2 = _mm_abs_epi16(xmm1);
xmm2 = _mm_subs_epi16(ch_magb[i],xmm2); xmm2 = _mm_subs_epi16(ch_magb[i],xmm2);
/*
printf("pmch i: %d => mag (%d,%d) (%d,%d)\n",i,((short *)&ch_mag[i])[0],((short *)&ch_magb[i])[0],
((short *)&rxF[i])[0],((short *)&rxF[i])[1]);
*/
// loop over all LLRs in quad word (24 coded bits) // loop over all LLRs in quad word (24 coded bits)
/*
for (j=0;j<8;j+=2) { for (j=0;j<8;j+=2) {
llr2[0] = ((short *)&rxF[i])[j]; llr2[0] = ((short *)&rxF[i])[j];
llr2[1] = ((short *)&rxF[i])[j+1]; llr2[1] = ((short *)&rxF[i])[j+1];
llr2[2] = ((short *)&xmm1)[j]; llr2[2] = _mm_extract_epi16(xmm1,j);
llr2[3] = ((short *)&xmm1)[j+1]; llr2[3] = _mm_extract_epi16(xmm1,j+1);//((short *)&xmm1)[j+1];
llr2[4] = ((short *)&xmm2)[j]; llr2[4] = _mm_extract_epi16(xmm2,j);//((short *)&xmm2)[j];
llr2[5] = ((short *)&xmm2)[j+1]; llr2[5] = _mm_extract_epi16(xmm2,j+1);//((short *)&xmm2)[j+1];
llr2+=6; llr2+=6;
} }
*/
llr2[0] = ((short *)&rxF[i])[0];
llr2[1] = ((short *)&rxF[i])[1];
llr2[2] = _mm_extract_epi16(xmm1,0);
llr2[3] = _mm_extract_epi16(xmm1,1);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,0);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,1);//((short *)&xmm2)[j+1];
llr2+=6;
llr2[0] = ((short *)&rxF[i])[2];
llr2[1] = ((short *)&rxF[i])[3];
llr2[2] = _mm_extract_epi16(xmm1,2);
llr2[3] = _mm_extract_epi16(xmm1,3);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,2);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,3);//((short *)&xmm2)[j+1];
llr2+=6;
llr2[0] = ((short *)&rxF[i])[4];
llr2[1] = ((short *)&rxF[i])[5];
llr2[2] = _mm_extract_epi16(xmm1,4);
llr2[3] = _mm_extract_epi16(xmm1,5);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,4);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,5);//((short *)&xmm2)[j+1];
llr2+=6;
llr2[0] = ((short *)&rxF[i])[6];
llr2[1] = ((short *)&rxF[i])[7];
llr2[2] = _mm_extract_epi16(xmm1,6);
llr2[3] = _mm_extract_epi16(xmm1,7);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,6);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,7);//((short *)&xmm2)[j+1];
llr2+=6;
} }
*llr_save = llr; *llr_save = llr;
_mm_empty(); _mm_empty();
...@@ -685,6 +727,8 @@ int rx_pmch(PHY_VARS_UE *phy_vars_ue, ...@@ -685,6 +727,8 @@ int rx_pmch(PHY_VARS_UE *phy_vars_ue,
LTE_UE_DLSCH_t **dlsch_ue = &phy_vars_ue->dlsch_ue_MCH[eNB_id]; LTE_UE_DLSCH_t **dlsch_ue = &phy_vars_ue->dlsch_ue_MCH[eNB_id];
int avgs,aarx; int avgs,aarx;
//printf("*********************mch: symbol %d\n",symbol);
mch_extract_rbs(lte_ue_common_vars->rxdataF, mch_extract_rbs(lte_ue_common_vars->rxdataF,
lte_ue_common_vars->dl_ch_estimates[eNB_id], lte_ue_common_vars->dl_ch_estimates[eNB_id],
lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
......
This diff is collapsed.
...@@ -116,7 +116,7 @@ void get_Msg3_alloc_ret(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -116,7 +116,7 @@ void get_Msg3_alloc_ret(LTE_DL_FRAME_PARMS *frame_parms,
unsigned int current_frame, unsigned int current_frame,
unsigned int *frame, unsigned int *frame,
unsigned char *subframe) { unsigned char *subframe) {
if (frame_parms->frame_type == 0) { if (frame_parms->frame_type == FDD) {
// always retransmit in n+8 // always retransmit in n+8
*subframe = current_subframe+8; *subframe = current_subframe+8;
if (*subframe>9) { if (*subframe>9) {
...@@ -151,7 +151,7 @@ u8 get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -151,7 +151,7 @@ u8 get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,
u8 ul_subframe=0; u8 ul_subframe=0;
u32 ul_frame; u32 ul_frame;
if (frame_parms->frame_type ==0) { if (frame_parms->frame_type ==FDD) {
ul_subframe = (current_subframe>4) ? (current_subframe-4) : (current_subframe+6); ul_subframe = (current_subframe>4) ? (current_subframe-4) : (current_subframe+6);
ul_frame = (current_subframe>3) ? (frame+1) : frame; ul_frame = (current_subframe>3) ? (frame+1) : frame;
} }
...@@ -221,7 +221,7 @@ u8 get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -221,7 +221,7 @@ u8 get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe,unsigned char ACK_index) { unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe,unsigned char ACK_index) {
if (frame_parms->frame_type == 0) { if (frame_parms->frame_type == FDD) {
return((subframe<4) ? subframe+6 : subframe-4); return((subframe<4) ? subframe+6 : subframe-4);
} }
else { else {
...@@ -270,7 +270,7 @@ unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsig ...@@ -270,7 +270,7 @@ unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsig
unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
if (frame_parms->frame_type == 0) { if (frame_parms->frame_type == FDD) {
return(1); return(1);
} }
else { else {
...@@ -455,7 +455,7 @@ u16 get_Np(u8 N_RB_DL,u8 nCCE,u8 plus1) { ...@@ -455,7 +455,7 @@ u16 get_Np(u8 N_RB_DL,u8 nCCE,u8 plus1) {
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
// if FDD return dummy value // if FDD return dummy value
if (frame_parms->frame_type == 0) if (frame_parms->frame_type == FDD)
return(SF_DL); return(SF_DL);
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
...@@ -514,7 +514,7 @@ u8 phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,u32 frame,u8 subfr ...@@ -514,7 +514,7 @@ u8 phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,u32 frame,u8 subfr
unsigned int is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { unsigned int is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
if (frame_parms->frame_type == 0) { if (frame_parms->frame_type == FDD) {
return(1); return(1);
} }
else { else {
......
This diff is collapsed.
...@@ -915,9 +915,7 @@ int main(int argc, char **argv) { ...@@ -915,9 +915,7 @@ int main(int argc, char **argv) {
} // input_fd == NULL } // input_fd == NULL
tx_lev_dB = (unsigned int) dB_fixed(tx_lev); tx_lev_dB = (unsigned int) dB_fixed_times10(tx_lev);
if (n_frames==1)
printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
if (n_frames==1) { if (n_frames==1) {
write_output("txsig0UL.m","txs0", &txdata[0][PHY_vars_eNB->lte_frame_parms.samples_per_tti*subframe],2*frame_parms->samples_per_tti,1,1); write_output("txsig0UL.m","txs0", &txdata[0][PHY_vars_eNB->lte_frame_parms.samples_per_tti*subframe],2*frame_parms->samples_per_tti,1,1);
...@@ -931,6 +929,8 @@ int main(int argc, char **argv) { ...@@ -931,6 +929,8 @@ int main(int argc, char **argv) {
// compute tx_gain to achieve target SNR (per resource element!) // compute tx_gain to achieve target SNR (per resource element!)
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))*(nb_rb*12/(double)PHY_vars_UE->lte_frame_parms.ofdm_symbol_size)/(double)tx_lev); tx_gain = sqrt(pow(10.0,.1*(N0+SNR))*(nb_rb*12/(double)PHY_vars_UE->lte_frame_parms.ofdm_symbol_size)/(double)tx_lev);
if (n_frames==1)
printf("tx_lev = %d (%d.%d dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
// fill measurement symbol (19) with noise // fill measurement symbol (19) with noise
......
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