First-level of support for new aarch64 machines
Testing on Neoverse N1 (Ampere 3GHz). Tested only on a subset of phy-simulators. - Changes: - use SIMDE consistently - adaptations of LDPC decoder generator for ARMv8 performance - SIMDe modifications of Intel CRC to allow for aarch64 build. optimizations for 128-bit to improve performance of LDPC encode/decode on aarch64 (Neoverse 1) - added BG2 files for 128-bit ldpc encoder (aarch64) - testing on Xeon - testing on x86 - minor changes to build/run on x86 - change in crc.h after returning to aarch64 - removed some warning in ldpc decoder generator for x86_64 - char - Delete irrelevant constants - Correctly declare variables - Define stdbool for all architectures - Remove definition of _MM_SHUFFLE and use SIMDE_MM_SHUFFLE - Remove commented code - Fix CMakeLists.txt - Include SIMDE avx2 functions in tools_defs.h
This commit is contained in:
committed by
Robert Schmidt
parent
79fd37b489
commit
a7bc282302
@@ -23,8 +23,8 @@
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
|
||||
// This is 4096/(1:4096) in __m128i format
|
||||
__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
|
||||
// This is 4096/(1:4096) in simde__m128i format
|
||||
simde__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
|
||||
256,256,256,256,256,256,256,256,
|
||||
170,170,170,170,170,170,170,170,
|
||||
128,128,128,128,128,128,128,128,
|
||||
@@ -283,7 +283,7 @@ __m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
|
||||
};*/
|
||||
|
||||
void init_fde() {
|
||||
for (int i=1;i<4096;i++) inv_ch[i] = _mm_set1_epi16(4096/i);
|
||||
for (int i=1;i<4096;i++) inv_ch[i] = simde_mm_set1_epi16(4096/i);
|
||||
}
|
||||
|
||||
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
@@ -296,17 +296,10 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
{
|
||||
uint16_t re;
|
||||
int16_t amp;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *ul_ch_mag128,*ul_ch_magb128,*rxdataF_comp128;
|
||||
rxdataF_comp128 = (__m128i *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_mag128 = (__m128i *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_magb128 = (__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int16x8_t *ul_ch_mag128,*ul_ch_magb128,*rxdataF_comp128;
|
||||
rxdataF_comp128 = (int16x8_t*)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_mag128 = (int16x8_t*)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_magb128 = (int16x8_t*)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
|
||||
#endif
|
||||
simde__m128i *ul_ch_mag128,*ul_ch_magb128,*rxdataF_comp128;
|
||||
rxdataF_comp128 = (simde__m128i *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_mag128 = (simde__m128i *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_magb128 = (simde__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
|
||||
|
||||
AssertFatal(symbol<frame_parms->symbols_per_tti,"symbol %d >= %d\n",
|
||||
symbol,frame_parms->symbols_per_tti);
|
||||
@@ -320,26 +313,16 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
if (amp>4095)
|
||||
amp=4095;
|
||||
|
||||
//printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
rxdataF_comp128[re] = _mm_srai_epi16(_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3);
|
||||
// printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d
|
||||
// (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,simde_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
|
||||
rxdataF_comp128[re] = simde_mm_srai_epi16(simde_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3);
|
||||
|
||||
if (Qm==4)
|
||||
ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10)
|
||||
ul_ch_mag128[re] = simde_mm_set1_epi16(324); // this is 512*2/sqrt(10)
|
||||
else {
|
||||
ul_ch_mag128[re] = _mm_set1_epi16(316); // this is 512*4/sqrt(42)
|
||||
ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42)
|
||||
ul_ch_mag128[re] = simde_mm_set1_epi16(316); // this is 512*4/sqrt(42)
|
||||
ul_ch_magb128[re] = simde_mm_set1_epi16(158); // this is 512*2/sqrt(42)
|
||||
}
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],inv_ch[amp]);
|
||||
|
||||
if (Qm==4)
|
||||
ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10)
|
||||
else {
|
||||
ul_ch_mag128[re] = vdupq_n_s16(316); // this is 512*4/sqrt(42)
|
||||
ul_ch_magb128[re] = vdupq_n_s16(158); // this is 512*2/sqrt(42)
|
||||
}
|
||||
#endif
|
||||
// printf("(%d,%d)\n",*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
|
||||
|
||||
}
|
||||
|
||||
@@ -28,68 +28,30 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i avg128F;
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int32x4_t avg128F;
|
||||
#endif
|
||||
|
||||
//compute average channel_level on each (TX,RX) antenna pair
|
||||
int dl_channel_level(c16_t *dl_ch, LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
int16_t rb;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *dl_ch128;
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int16x4_t *dl_ch128;
|
||||
#endif
|
||||
simde__m128i *dl_ch128;
|
||||
int avg;
|
||||
|
||||
//clear average level
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128F = _mm_setzero_si128();
|
||||
dl_ch128=(__m128i *)dl_ch;
|
||||
simde__m128i avg128F = simde_mm_setzero_si128();
|
||||
dl_ch128 = (simde__m128i *)dl_ch;
|
||||
|
||||
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
|
||||
|
||||
avg128F = _mm_add_epi32(avg128F,_mm_madd_epi16(dl_ch128[0],dl_ch128[0]));
|
||||
avg128F = _mm_add_epi32(avg128F,_mm_madd_epi16(dl_ch128[1],dl_ch128[1]));
|
||||
avg128F = _mm_add_epi32(avg128F,_mm_madd_epi16(dl_ch128[2],dl_ch128[2]));
|
||||
avg128F = simde_mm_add_epi32(avg128F, simde_mm_madd_epi16(dl_ch128[0], dl_ch128[0]));
|
||||
avg128F = simde_mm_add_epi32(avg128F, simde_mm_madd_epi16(dl_ch128[1], dl_ch128[1]));
|
||||
avg128F = simde_mm_add_epi32(avg128F, simde_mm_madd_epi16(dl_ch128[2], dl_ch128[2]));
|
||||
|
||||
dl_ch128+=3;
|
||||
|
||||
}
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
avg128F = vdupq_n_s32(0);
|
||||
dl_ch128=(int16x4_t *)dl_ch;
|
||||
|
||||
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
|
||||
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[0],dl_ch128[0]));
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[1],dl_ch128[1]));
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[2],dl_ch128[2]));
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[3],dl_ch128[3]));
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[4],dl_ch128[4]));
|
||||
avg128F = vqaddq_s32(avg128F,vmull_s16(dl_ch128[5],dl_ch128[5]));
|
||||
dl_ch128+=6;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
DevAssert( frame_parms->N_RB_DL );
|
||||
avg = (((int*)&avg128F)[0] +
|
||||
((int*)&avg128F)[1] +
|
||||
((int*)&avg128F)[2] +
|
||||
((int*)&avg128F)[3])/(frame_parms->N_RB_DL*12);
|
||||
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
return(avg);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,27 +40,24 @@
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include "pss6144.h"
|
||||
extern void print_shorts(char*,__m128i*);
|
||||
#endif
|
||||
extern void print_shorts(char *, simde__m128i *);
|
||||
|
||||
void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
UE_SCAN_INFO_t *scan_info = &ue->scan_info[band];
|
||||
int16_t spectrum[12288] __attribute__((aligned(32)));
|
||||
int16_t spectrum_p5ms[12288] __attribute__((aligned(32)));
|
||||
int i,f,band_idx;
|
||||
__m128i autocorr0[256/4],autocorr1[256/4],autocorr2[256/4];
|
||||
__m128i autocorr0_t[256/4],autocorr1_t[256/4],autocorr2_t[256/4];
|
||||
__m128i tmp_t[256/4];
|
||||
simde__m128i autocorr0[256 / 4], autocorr1[256 / 4], autocorr2[256 / 4];
|
||||
simde__m128i autocorr0_t[256 / 4], autocorr1_t[256 / 4], autocorr2_t[256 / 4];
|
||||
simde__m128i tmp_t[256 / 4];
|
||||
int32_t *rxp;
|
||||
int16_t *sp;
|
||||
__m128i *sp2 = NULL;
|
||||
__m128i s;
|
||||
simde__m128i *sp2 = NULL;
|
||||
simde__m128i s;
|
||||
int re,re256;
|
||||
__m128i mmtmp00,mmtmp01,mmtmp02,mmtmp10,mmtmp11,mmtmp12;
|
||||
simde__m128i mmtmp00, mmtmp01, mmtmp02, mmtmp10, mmtmp11, mmtmp12;
|
||||
int maxcorr[3],minamp,pos=0,pssind;
|
||||
int16_t *pss6144_0 = NULL, *pss6144_1 = NULL, *pss6144_2 = NULL;
|
||||
|
||||
@@ -104,28 +101,28 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
pss6144_0 = &pss6144_0_0[0];
|
||||
pss6144_1 = &pss6144_1_0[0];
|
||||
pss6144_2 = &pss6144_2_0[0];
|
||||
sp2 = (f<0) ? (__m128i*)&sp[12288+(f<<1)] : (__m128i*)&sp[(f<<1)];
|
||||
sp2 = (f < 0) ? (simde__m128i *)&sp[12288 + (f << 1)] : (simde__m128i *)&sp[(f << 1)];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pss6144_0 = &pss6144_0_1[0];
|
||||
pss6144_1 = &pss6144_1_1[0];
|
||||
pss6144_2 = &pss6144_2_1[0];
|
||||
sp2 = (f<0) ? (__m128i*)&sp[12286+(f<<1)] : (__m128i*)&sp[-2+(f<<1)];
|
||||
sp2 = (f < 0) ? (simde__m128i *)&sp[12286 + (f << 1)] : (simde__m128i *)&sp[-2 + (f << 1)];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pss6144_0 = &pss6144_0_2[0];
|
||||
pss6144_1 = &pss6144_1_2[0];
|
||||
pss6144_2 = &pss6144_2_2[0];
|
||||
sp2 = (f<0) ? (__m128i*)&sp[12284+(f<<1)] : (__m128i*)&sp[-4+(f<<1)];
|
||||
sp2 = (f < 0) ? (simde__m128i *)&sp[12284 + (f << 1)] : (simde__m128i *)&sp[-4 + (f << 1)];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pss6144_0 = &pss6144_0_3[0];
|
||||
pss6144_1 = &pss6144_1_3[0];
|
||||
pss6144_2 = &pss6144_2_3[0];
|
||||
sp2 = (f<0) ? (__m128i*)&sp[12282+(f<<1)] : (__m128i*)&sp[-6+(f<<1)];
|
||||
sp2 = (f < 0) ? (simde__m128i *)&sp[12282 + (f << 1)] : (simde__m128i *)&sp[-6 + (f << 1)];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -134,20 +131,23 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
for (re = 0; re<256/4; re++) { // loop over 256 points of upsampled PSS
|
||||
// printf("f %d, re %d\n",f,re);
|
||||
s = sp2[re];
|
||||
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
mmtmp00 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp01 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp02 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
|
||||
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
s = simde_mm_shufflelo_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_shufflehi_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_sign_epi16(s, *(simde__m128i *)&conjugate[0]);
|
||||
mmtmp10 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp11 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp12 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
|
||||
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
|
||||
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
|
||||
autocorr0[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp00, mmtmp10), simde_mm_unpackhi_epi32(mmtmp00, mmtmp10));
|
||||
autocorr1[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp01, mmtmp11), simde_mm_unpackhi_epi32(mmtmp01, mmtmp11));
|
||||
autocorr2[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp02, mmtmp12), simde_mm_unpackhi_epi32(mmtmp02, mmtmp12));
|
||||
|
||||
re256 = (re256+1)&0x3f;
|
||||
}
|
||||
@@ -160,28 +160,28 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
pss6144_0 = &pss6144_0_0[0];
|
||||
pss6144_1 = &pss6144_1_0[0];
|
||||
pss6144_2 = &pss6144_2_0[0];
|
||||
sp2 = (__m128i*)&sp[12288+(f<<1)];
|
||||
sp2 = (simde__m128i *)&sp[12288 + (f << 1)];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pss6144_0 = &pss6144_0_1[0];
|
||||
pss6144_1 = &pss6144_1_1[0];
|
||||
pss6144_2 = &pss6144_2_1[0];
|
||||
sp2 = (__m128i*)&sp[12286+(f<<1)];
|
||||
sp2 = (simde__m128i *)&sp[12286 + (f << 1)];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pss6144_0 = &pss6144_0_2[0];
|
||||
pss6144_1 = &pss6144_1_2[0];
|
||||
pss6144_2 = &pss6144_2_2[0];
|
||||
sp2 = (__m128i*)&sp[12284+(f<<1)];
|
||||
sp2 = (simde__m128i *)&sp[12284 + (f << 1)];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pss6144_0 = &pss6144_0_3[0];
|
||||
pss6144_1 = &pss6144_1_3[0];
|
||||
pss6144_2 = &pss6144_2_3[0];
|
||||
sp2 = (__m128i*)&sp[12282+(f<<1)];
|
||||
sp2 = (simde__m128i *)&sp[12282 + (f << 1)];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -191,22 +191,25 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
s = sp2[re];
|
||||
/* printf("re %d, %p\n",re,&sp2[re]);
|
||||
print_shorts("s",&s);
|
||||
print_shorts("pss",&((__m128i*)pss6144_0)[re]);*/
|
||||
print_shorts("pss",&((simde__m128i*)pss6144_0)[re]);*/
|
||||
|
||||
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
mmtmp00 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp01 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp02 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
|
||||
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
s = simde_mm_shufflelo_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_shufflehi_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_sign_epi16(s, *(simde__m128i *)&conjugate[0]);
|
||||
mmtmp10 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp11 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp12 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
|
||||
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
|
||||
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
|
||||
autocorr0[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp00, mmtmp10), simde_mm_unpackhi_epi32(mmtmp00, mmtmp10));
|
||||
autocorr1[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp01, mmtmp11), simde_mm_unpackhi_epi32(mmtmp01, mmtmp11));
|
||||
autocorr2[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp02, mmtmp12), simde_mm_unpackhi_epi32(mmtmp02, mmtmp12));
|
||||
|
||||
re256 = (re256+1)&0x3f;
|
||||
}
|
||||
@@ -214,7 +217,7 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
// This is the +ve frequencies
|
||||
|
||||
// align filters to 128-bit
|
||||
sp2 = (__m128i*)&sp[0];
|
||||
sp2 = (simde__m128i *)&sp[0];
|
||||
|
||||
switch (f&3) {
|
||||
case 0:
|
||||
@@ -246,21 +249,24 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
s = sp2[re];
|
||||
/* printf("re %d %p\n",re,&sp2[re]);
|
||||
print_shorts("s",&s);
|
||||
print_shorts("pss",&((__m128i*)pss6144_0)[re]);*/
|
||||
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
print_shorts("pss",&((simde__m128i*)pss6144_0)[re]);*/
|
||||
mmtmp00 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp01 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp02 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
|
||||
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
|
||||
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
|
||||
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
|
||||
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
|
||||
s = simde_mm_shufflelo_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_shufflehi_epi16(s, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
s = simde_mm_sign_epi16(s, *(simde__m128i *)&conjugate[0]);
|
||||
mmtmp10 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_0)[re], s), 15);
|
||||
mmtmp11 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_1)[re], s), 15);
|
||||
mmtmp12 = simde_mm_srai_epi32(simde_mm_madd_epi16(((simde__m128i *)pss6144_2)[re], s), 15);
|
||||
|
||||
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
|
||||
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
|
||||
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
|
||||
autocorr0[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp00, mmtmp10), simde_mm_unpackhi_epi32(mmtmp00, mmtmp10));
|
||||
autocorr1[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp01, mmtmp11), simde_mm_unpackhi_epi32(mmtmp01, mmtmp11));
|
||||
autocorr2[re256] =
|
||||
simde_mm_packs_epi32(simde_mm_unpacklo_epi32(mmtmp02, mmtmp12), simde_mm_unpackhi_epi32(mmtmp02, mmtmp12));
|
||||
|
||||
re256 = (re256+1)&0x3f;
|
||||
}
|
||||
@@ -284,18 +290,17 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
memset((void*)autocorr2_t,0,256*4);
|
||||
|
||||
for (re=0; re<(256/4); re++)
|
||||
autocorr0_t[re] = _mm_add_epi32(autocorr0_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
|
||||
autocorr0_t[re] = simde_mm_add_epi32(autocorr0_t[re], simde_mm_madd_epi16(tmp_t[re], tmp_t[re]));
|
||||
|
||||
idft(IDFT_256,(int16_t*)autocorr1,(int16_t*)tmp_t,1);
|
||||
|
||||
for (re=0; re<(256/4); re++)
|
||||
autocorr1_t[re] = _mm_add_epi32(autocorr1_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
|
||||
autocorr1_t[re] = simde_mm_add_epi32(autocorr1_t[re], simde_mm_madd_epi16(tmp_t[re], tmp_t[re]));
|
||||
|
||||
idft(IDFT_256,(int16_t*)autocorr2,(int16_t*)tmp_t,1);
|
||||
|
||||
for (re=0; re<(256/4); re++)
|
||||
autocorr2_t[re] = _mm_add_epi32(autocorr2_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
|
||||
|
||||
autocorr2_t[re] = simde_mm_add_epi32(autocorr2_t[re], simde_mm_madd_epi16(tmp_t[re], tmp_t[re]));
|
||||
|
||||
//compute max correlation over time window
|
||||
maxcorr[0] = 0;
|
||||
@@ -351,7 +356,4 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
|
||||
for (band_idx=0; band_idx<10; band_idx++)
|
||||
printf("pss 2: level %d dB, freq %u\n", dB_fixed(scan_info->amp[2][band_idx]),scan_info->freq_offset_Hz[2][band_idx]);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -461,26 +461,26 @@ void conjch0_mult_ch1(int *ch0,
|
||||
{
|
||||
//This function is used to compute multiplications in Hhermitian * H matrix
|
||||
unsigned short rb;
|
||||
__m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
|
||||
simde__m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
|
||||
|
||||
dl_ch0_128 = (__m128i *)ch0;
|
||||
dl_ch1_128 = (__m128i *)ch1;
|
||||
dl_ch0_128 = (simde__m128i *)ch0;
|
||||
dl_ch1_128 = (simde__m128i *)ch1;
|
||||
|
||||
ch0conj_ch1_128 = (__m128i *)ch0conj_ch1;
|
||||
ch0conj_ch1_128 = (simde__m128i *)ch0conj_ch1;
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
|
||||
mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
|
||||
mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]);
|
||||
mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch1_128[0]);
|
||||
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0);
|
||||
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0);
|
||||
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD0 = simde_mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
|
||||
mmtmpD1 = simde_mm_shufflelo_epi16(dl_ch0_128[0], SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = simde_mm_shufflehi_epi16(mmtmpD1, SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = simde_mm_sign_epi16(mmtmpD1,*(simde__m128i*)&conjugate[0]);
|
||||
mmtmpD1 = simde_mm_madd_epi16(mmtmpD1,dl_ch1_128[0]);
|
||||
mmtmpD0 = simde_mm_srai_epi32(mmtmpD0,output_shift0);
|
||||
mmtmpD1 = simde_mm_srai_epi32(mmtmpD1,output_shift0);
|
||||
mmtmpD2 = simde_mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD3 = simde_mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
|
||||
|
||||
ch0conj_ch1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
|
||||
ch0conj_ch1_128[0] = simde_mm_packs_epi32(mmtmpD2,mmtmpD3);
|
||||
|
||||
#ifdef DEBUG_RANK_EST
|
||||
printf("\n Computing conjugates \n");
|
||||
@@ -493,8 +493,8 @@ void conjch0_mult_ch1(int *ch0,
|
||||
dl_ch1_128+=1;
|
||||
ch0conj_ch1_128+=1;
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
void construct_HhH_elements(int *ch0conj_ch0, //00_00
|
||||
@@ -512,29 +512,30 @@ void construct_HhH_elements(int *ch0conj_ch0, //00_00
|
||||
unsigned short nb_rb)
|
||||
{
|
||||
unsigned short rb;
|
||||
__m128i *ch0conj_ch0_128, *ch1conj_ch1_128, *ch2conj_ch2_128, *ch3conj_ch3_128;
|
||||
__m128i *ch0conj_ch1_128, *ch1conj_ch0_128, *ch2conj_ch3_128, *ch3conj_ch2_128;
|
||||
__m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128;
|
||||
simde__m128i *ch0conj_ch0_128, *ch1conj_ch1_128, *ch2conj_ch2_128, *ch3conj_ch3_128;
|
||||
simde__m128i *ch0conj_ch1_128, *ch1conj_ch0_128, *ch2conj_ch3_128, *ch3conj_ch2_128;
|
||||
simde__m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128;
|
||||
|
||||
ch0conj_ch0_128 = (__m128i *)ch0conj_ch0;
|
||||
ch1conj_ch1_128 = (__m128i *)ch1conj_ch1;
|
||||
ch2conj_ch2_128 = (__m128i *)ch2conj_ch2;
|
||||
ch3conj_ch3_128 = (__m128i *)ch3conj_ch3;
|
||||
ch0conj_ch1_128 = (__m128i *)ch0conj_ch1;
|
||||
ch1conj_ch0_128 = (__m128i *)ch1conj_ch0;
|
||||
ch2conj_ch3_128 = (__m128i *)ch2conj_ch3;
|
||||
ch3conj_ch2_128 = (__m128i *)ch3conj_ch2;
|
||||
after_mf_00_128 = (__m128i *)after_mf_00;
|
||||
after_mf_01_128 = (__m128i *)after_mf_01;
|
||||
after_mf_10_128 = (__m128i *)after_mf_10;
|
||||
after_mf_11_128 = (__m128i *)after_mf_11;
|
||||
ch0conj_ch0_128 = (simde__m128i *)ch0conj_ch0;
|
||||
ch1conj_ch1_128 = (simde__m128i *)ch1conj_ch1;
|
||||
ch2conj_ch2_128 = (simde__m128i *)ch2conj_ch2;
|
||||
ch3conj_ch3_128 = (simde__m128i *)ch3conj_ch3;
|
||||
ch0conj_ch1_128 = (simde__m128i *)ch0conj_ch1;
|
||||
ch1conj_ch0_128 = (simde__m128i *)ch1conj_ch0;
|
||||
ch2conj_ch3_128 = (simde__m128i *)ch2conj_ch3;
|
||||
ch3conj_ch2_128 = (simde__m128i *)ch3conj_ch2;
|
||||
after_mf_00_128 = (simde__m128i *)after_mf_00;
|
||||
after_mf_01_128 = (simde__m128i *)after_mf_01;
|
||||
after_mf_10_128 = (simde__m128i *)after_mf_10;
|
||||
after_mf_11_128 = (simde__m128i *)after_mf_11;
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
|
||||
after_mf_00_128[0] =_mm_adds_epi16(ch0conj_ch0_128[0],ch3conj_ch3_128[0]);// _mm_adds_epi32(ch0conj_ch0_128[0], ch3conj_ch3_128[0]); //00_00 + 10_10
|
||||
after_mf_11_128[0] =_mm_adds_epi16(ch1conj_ch1_128[0], ch2conj_ch2_128[0]); //01_01 + 11_11
|
||||
after_mf_01_128[0] =_mm_adds_epi16(ch0conj_ch1_128[0], ch2conj_ch3_128[0]);//00_01 + 10_11
|
||||
after_mf_10_128[0] =_mm_adds_epi16(ch1conj_ch0_128[0], ch3conj_ch2_128[0]);//01_00 + 11_10
|
||||
after_mf_00_128[0] =
|
||||
simde_mm_adds_epi16(ch0conj_ch0_128[0],
|
||||
ch3conj_ch3_128[0]); // simde_mm_adds_epi32(ch0conj_ch0_128[0], ch3conj_ch3_128[0]); //00_00 + 10_10
|
||||
after_mf_11_128[0] =simde_mm_adds_epi16(ch1conj_ch1_128[0], ch2conj_ch2_128[0]); //01_01 + 11_11
|
||||
after_mf_01_128[0] =simde_mm_adds_epi16(ch0conj_ch1_128[0], ch2conj_ch3_128[0]);//00_01 + 10_11
|
||||
after_mf_10_128[0] =simde_mm_adds_epi16(ch1conj_ch0_128[0], ch3conj_ch2_128[0]);//01_00 + 11_10
|
||||
|
||||
#ifdef DEBUG_RANK_EST
|
||||
printf(" \n construct_HhH_elements \n");
|
||||
@@ -566,8 +567,8 @@ void construct_HhH_elements(int *ch0conj_ch0, //00_00
|
||||
after_mf_10_128+=1;
|
||||
after_mf_11_128+=1;
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -576,14 +577,14 @@ void squared_matrix_element(int32_t *Hh_h_00,
|
||||
unsigned short nb_rb)
|
||||
{
|
||||
unsigned short rb;
|
||||
__m128i *Hh_h_00_128,*Hh_h_00_sq_128;
|
||||
simde__m128i *Hh_h_00_128,*Hh_h_00_sq_128;
|
||||
|
||||
Hh_h_00_128 = (__m128i *)Hh_h_00;
|
||||
Hh_h_00_sq_128 = (__m128i *)Hh_h_00_sq;
|
||||
Hh_h_00_128 = (simde__m128i *)Hh_h_00;
|
||||
Hh_h_00_sq_128 = (simde__m128i *)Hh_h_00_sq;
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
|
||||
Hh_h_00_sq_128[0] = _mm_madd_epi16(Hh_h_00_128[0],Hh_h_00_128[0]);
|
||||
Hh_h_00_sq_128[0] = simde_mm_madd_epi16(Hh_h_00_128[0],Hh_h_00_128[0]);
|
||||
|
||||
#ifdef DEBUG_RANK_EST
|
||||
printf("\n Computing squared_matrix_element \n");
|
||||
@@ -594,8 +595,8 @@ void squared_matrix_element(int32_t *Hh_h_00,
|
||||
Hh_h_00_sq_128+=1;
|
||||
Hh_h_00_128+=1;
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -609,23 +610,23 @@ void det_HhH(int32_t *after_mf_00,
|
||||
|
||||
{
|
||||
unsigned short rb;
|
||||
__m128i *after_mf_00_128,*after_mf_01_128, *after_mf_11_128, ad_re_128, bc_re_128;
|
||||
simde__m128i *after_mf_00_128, *after_mf_01_128, *after_mf_11_128, ad_re_128, bc_re_128;
|
||||
//__m128i *after_mf_10_128; // the variable is only written, but leave it here for "symmetry" in the algorithm
|
||||
__m128i *det_fin_128, det_128;
|
||||
simde__m128i *det_fin_128, det_128;
|
||||
|
||||
after_mf_00_128 = (__m128i *)after_mf_00;
|
||||
after_mf_01_128 = (__m128i *)after_mf_01;
|
||||
after_mf_00_128 = (simde__m128i *)after_mf_00;
|
||||
after_mf_01_128 = (simde__m128i *)after_mf_01;
|
||||
//after_mf_10_128 = (__m128i *)after_mf_10;
|
||||
after_mf_11_128 = (__m128i *)after_mf_11;
|
||||
after_mf_11_128 = (simde__m128i *)after_mf_11;
|
||||
|
||||
det_fin_128 = (__m128i *)det_fin;
|
||||
det_fin_128 = (simde__m128i *)det_fin;
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
|
||||
ad_re_128 = _mm_madd_epi16(after_mf_00_128[0],after_mf_11_128[0]);
|
||||
bc_re_128 = _mm_madd_epi16(after_mf_01_128[0],after_mf_01_128[0]);
|
||||
det_128 = _mm_sub_epi32(ad_re_128, bc_re_128);
|
||||
det_fin_128[0] = _mm_abs_epi32(det_128);
|
||||
ad_re_128 = simde_mm_madd_epi16(after_mf_00_128[0],after_mf_11_128[0]);
|
||||
bc_re_128 = simde_mm_madd_epi16(after_mf_01_128[0],after_mf_01_128[0]);
|
||||
det_128 = simde_mm_sub_epi32(ad_re_128, bc_re_128);
|
||||
det_fin_128[0] = simde_mm_abs_epi32(det_128);
|
||||
|
||||
#ifdef DEBUG_RANK_EST
|
||||
printf("\n Computing denominator \n");
|
||||
@@ -636,7 +637,7 @@ void det_HhH(int32_t *after_mf_00,
|
||||
print_ints("ad_re_128:",(int32_t*)&ad_re_128);
|
||||
print_ints("bc_re_128:",(int32_t*)&bc_re_128);
|
||||
print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
det_fin_128+=1;
|
||||
after_mf_00_128+=1;
|
||||
@@ -644,8 +645,8 @@ void det_HhH(int32_t *after_mf_00,
|
||||
//after_mf_10_128+=1;
|
||||
after_mf_11_128+=1;
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
void numer(int32_t *Hh_h_00_sq,
|
||||
@@ -657,21 +658,21 @@ void numer(int32_t *Hh_h_00_sq,
|
||||
|
||||
{
|
||||
unsigned short rb;
|
||||
__m128i *h_h_00_sq_128, *h_h_01_sq_128, *h_h_10_sq_128, *h_h_11_sq_128;
|
||||
__m128i *num_fin_128, sq_a_plus_sq_d_128, sq_b_plus_sq_c_128;
|
||||
simde__m128i *h_h_00_sq_128, *h_h_01_sq_128, *h_h_10_sq_128, *h_h_11_sq_128;
|
||||
simde__m128i *num_fin_128, sq_a_plus_sq_d_128, sq_b_plus_sq_c_128;
|
||||
|
||||
h_h_00_sq_128 = (__m128i *)Hh_h_00_sq;
|
||||
h_h_01_sq_128 = (__m128i *)Hh_h_01_sq;
|
||||
h_h_10_sq_128 = (__m128i *)Hh_h_10_sq;
|
||||
h_h_11_sq_128 = (__m128i *)Hh_h_11_sq;
|
||||
h_h_00_sq_128 = (simde__m128i *)Hh_h_00_sq;
|
||||
h_h_01_sq_128 = (simde__m128i *)Hh_h_01_sq;
|
||||
h_h_10_sq_128 = (simde__m128i *)Hh_h_10_sq;
|
||||
h_h_11_sq_128 = (simde__m128i *)Hh_h_11_sq;
|
||||
|
||||
num_fin_128 = (__m128i *)num_fin;
|
||||
num_fin_128 = (simde__m128i *)num_fin;
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
|
||||
sq_a_plus_sq_d_128 = _mm_add_epi32(h_h_00_sq_128[0],h_h_11_sq_128[0]);
|
||||
sq_b_plus_sq_c_128 = _mm_add_epi32(h_h_01_sq_128[0],h_h_10_sq_128[0]);
|
||||
num_fin_128[0] = _mm_add_epi32(sq_a_plus_sq_d_128, sq_b_plus_sq_c_128);
|
||||
sq_a_plus_sq_d_128 = simde_mm_add_epi32(h_h_00_sq_128[0],h_h_11_sq_128[0]);
|
||||
sq_b_plus_sq_c_128 = simde_mm_add_epi32(h_h_01_sq_128[0],h_h_10_sq_128[0]);
|
||||
num_fin_128[0] = simde_mm_add_epi32(sq_a_plus_sq_d_128, sq_b_plus_sq_c_128);
|
||||
|
||||
#ifdef DEBUG_RANK_EST
|
||||
printf("\n Computing numerator \n");
|
||||
@@ -690,8 +691,8 @@ void numer(int32_t *Hh_h_00_sq,
|
||||
h_h_10_sq_128+=1;
|
||||
h_h_11_sq_128+=1;
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
void dlsch_channel_level_TM34_meas(int *ch00,
|
||||
@@ -703,39 +704,38 @@ void dlsch_channel_level_TM34_meas(int *ch00,
|
||||
unsigned short nb_rb)
|
||||
{
|
||||
|
||||
#if defined(__x86_64__)||defined(__i386__)
|
||||
|
||||
short rb;
|
||||
unsigned char nre=12;
|
||||
__m128i *ch00_128, *ch01_128, *ch10_128, *ch11_128;
|
||||
__m128i avg_0_row0_128D, avg_1_row0_128D, avg_0_row1_128D, avg_1_row1_128D;
|
||||
__m128i ch00_128_tmp, ch01_128_tmp, ch10_128_tmp, ch11_128_tmp;
|
||||
simde__m128i *ch00_128, *ch01_128, *ch10_128, *ch11_128;
|
||||
simde__m128i avg_0_row0_128D, avg_1_row0_128D, avg_0_row1_128D, avg_1_row1_128D;
|
||||
simde__m128i ch00_128_tmp, ch01_128_tmp, ch10_128_tmp, ch11_128_tmp;
|
||||
|
||||
avg_0[0] = 0;
|
||||
avg_0[1] = 0;
|
||||
avg_1[0] = 0;
|
||||
avg_1[1] = 0;
|
||||
|
||||
ch00_128 = (__m128i *)ch00;
|
||||
ch01_128 = (__m128i *)ch01;
|
||||
ch10_128 = (__m128i *)ch10;
|
||||
ch11_128 = (__m128i *)ch11;
|
||||
ch00_128 = (simde__m128i *)ch00;
|
||||
ch01_128 = (simde__m128i *)ch01;
|
||||
ch10_128 = (simde__m128i *)ch10;
|
||||
ch11_128 = (simde__m128i *)ch11;
|
||||
|
||||
avg_0_row0_128D = _mm_setzero_si128();
|
||||
avg_1_row0_128D = _mm_setzero_si128();
|
||||
avg_0_row1_128D = _mm_setzero_si128();
|
||||
avg_1_row1_128D = _mm_setzero_si128();
|
||||
avg_0_row0_128D = simde_mm_setzero_si128();
|
||||
avg_1_row0_128D = simde_mm_setzero_si128();
|
||||
avg_0_row1_128D = simde_mm_setzero_si128();
|
||||
avg_1_row1_128D = simde_mm_setzero_si128();
|
||||
|
||||
for (rb=0; rb<3*nb_rb; rb++) {
|
||||
ch00_128_tmp = _mm_load_si128(&ch00_128[0]);
|
||||
ch01_128_tmp = _mm_load_si128(&ch01_128[0]);
|
||||
ch10_128_tmp = _mm_load_si128(&ch10_128[0]);
|
||||
ch11_128_tmp = _mm_load_si128(&ch11_128[0]);
|
||||
ch00_128_tmp = simde_mm_load_si128(&ch00_128[0]);
|
||||
ch01_128_tmp = simde_mm_load_si128(&ch01_128[0]);
|
||||
ch10_128_tmp = simde_mm_load_si128(&ch10_128[0]);
|
||||
ch11_128_tmp = simde_mm_load_si128(&ch11_128[0]);
|
||||
|
||||
avg_0_row0_128D = _mm_add_epi32(avg_0_row0_128D,_mm_madd_epi16(ch00_128_tmp,ch00_128_tmp));
|
||||
avg_1_row0_128D = _mm_add_epi32(avg_1_row0_128D,_mm_madd_epi16(ch01_128_tmp,ch01_128_tmp));
|
||||
avg_0_row1_128D = _mm_add_epi32(avg_0_row1_128D,_mm_madd_epi16(ch10_128_tmp,ch10_128_tmp));
|
||||
avg_1_row1_128D = _mm_add_epi32(avg_1_row1_128D,_mm_madd_epi16(ch11_128_tmp,ch11_128_tmp));
|
||||
avg_0_row0_128D = simde_mm_add_epi32(avg_0_row0_128D,simde_mm_madd_epi16(ch00_128_tmp,ch00_128_tmp));
|
||||
avg_1_row0_128D = simde_mm_add_epi32(avg_1_row0_128D,simde_mm_madd_epi16(ch01_128_tmp,ch01_128_tmp));
|
||||
avg_0_row1_128D = simde_mm_add_epi32(avg_0_row1_128D,simde_mm_madd_epi16(ch10_128_tmp,ch10_128_tmp));
|
||||
avg_1_row1_128D = simde_mm_add_epi32(avg_1_row1_128D,simde_mm_madd_epi16(ch11_128_tmp,ch11_128_tmp));
|
||||
|
||||
ch00_128+=1;
|
||||
ch01_128+=1;
|
||||
@@ -768,12 +768,9 @@ void dlsch_channel_level_TM34_meas(int *ch00,
|
||||
avg_0[0] = min (avg_0[0], avg_1[0]);
|
||||
avg_1[0] = avg_0[0];
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t rank_estimation_tm3_tm4 (int *dl_ch_estimates_00, // please respect the order of channel estimates
|
||||
@@ -1019,11 +1016,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
|
||||
//int rx_power[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int i;
|
||||
unsigned int limit,subband;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *dl_ch0_128,*dl_ch1_128;
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int16x8_t *dl_ch0_128, *dl_ch1_128;
|
||||
#endif
|
||||
simde__m128i *dl_ch0_128, *dl_ch1_128;
|
||||
int *dl_ch0=NULL,*dl_ch1=NULL;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
@@ -1215,31 +1208,17 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
|
||||
//printf("aarx=%d", aarx);
|
||||
// skip the first 4 RE due to interpolation filter length of 5 (not possible to skip 5 due to 128i alignment, must be multiple of 128bit)
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1 /* ,mmtmpPMI2,mmtmpPMI3 */ ;
|
||||
simde__m128i pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1 /* ,mmtmpPMI2,mmtmpPMI3 */ ;
|
||||
|
||||
dl_ch0_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4];
|
||||
dl_ch1_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4];
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int32x4_t pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1,mmtmpPMI0b,mmtmpPMI1b;
|
||||
|
||||
dl_ch0_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4];
|
||||
dl_ch1_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4];
|
||||
|
||||
#endif
|
||||
dl_ch0_128 = (simde__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4];
|
||||
dl_ch1_128 = (simde__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4];
|
||||
for (subband=0; subband<nb_subbands; subband++) {
|
||||
|
||||
|
||||
// pmi
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
|
||||
pmi128_re = _mm_xor_si128(pmi128_re,pmi128_re);
|
||||
pmi128_im = _mm_xor_si128(pmi128_im,pmi128_im);
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
pmi128_re = vdupq_n_s32(0);
|
||||
pmi128_im = vdupq_n_s32(0);
|
||||
#endif
|
||||
pmi128_re = simde_mm_xor_si128(pmi128_re,pmi128_re);
|
||||
pmi128_im = simde_mm_xor_si128(pmi128_im,pmi128_im);
|
||||
// limit is the number of groups of 4 REs in a subband (12 = 4 RBs, 3 = 1 RB)
|
||||
// for 5 MHz channelization, there are 7 subbands, 6 of size 4 RBs and 1 of size 1 RB
|
||||
if ((N_RB_DL==6) || (subband<(nb_subbands-1)))
|
||||
@@ -1249,61 +1228,49 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
|
||||
|
||||
for (i=0; i<limit; i++) {
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
|
||||
mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
|
||||
mmtmpPMI0 = simde_mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
|
||||
mmtmpPMI1 = simde_mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
|
||||
|
||||
// For each RE in subband perform ch0 * conj(ch1)
|
||||
// multiply by conjugated channel
|
||||
// print_ints("ch0",&dl_ch0_128[0]);
|
||||
// print_ints("ch1",&dl_ch1_128[0]);
|
||||
|
||||
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
|
||||
mmtmpPMI0 = simde_mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
|
||||
// print_ints("re",&mmtmpPMI0);
|
||||
mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpPMI1 = simde_mm_shufflelo_epi16(dl_ch1_128[0], SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflelo_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpPMI1 = simde_mm_shufflehi_epi16(mmtmpPMI1, SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate[0]);
|
||||
mmtmpPMI1 = simde_mm_sign_epi16(mmtmpPMI1,*(simde__m128i*)&conjugate[0]);
|
||||
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[0]);
|
||||
mmtmpPMI1 = simde_mm_madd_epi16(mmtmpPMI1,dl_ch0_128[0]);
|
||||
// print_ints("mm_madd_epi16",&mmtmpPMI1);
|
||||
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0);
|
||||
pmi128_re = simde_mm_add_epi32(pmi128_re,mmtmpPMI0);
|
||||
// print_ints(" pmi128_re 0",&pmi128_re);
|
||||
pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1);
|
||||
pmi128_im = simde_mm_add_epi32(pmi128_im,mmtmpPMI1);
|
||||
// print_ints(" pmi128_im 0 ",&pmi128_im);
|
||||
|
||||
/* mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
|
||||
mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
|
||||
/* mmtmpPMI0 = simde_mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
|
||||
mmtmpPMI1 = simde_mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
|
||||
|
||||
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]);
|
||||
// print_ints("re",&mmtmpPMI0);
|
||||
mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[1],_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflelo_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate);
|
||||
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[1]);
|
||||
// print_ints("mm_madd_epi16",&mmtmpPMI1);
|
||||
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0);
|
||||
// print_ints(" pmi128_re 1",&pmi128_re);
|
||||
pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1);
|
||||
//print_ints(" pmi128_im 1 ",&pmi128_im);*/
|
||||
mmtmpPMI0 = simde_mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]);
|
||||
// print_ints("re",&mmtmpPMI0);
|
||||
mmtmpPMI1 = simde_mm_shufflelo_epi16(dl_ch1_128[1], SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflelo_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = simde_mm_shufflehi_epi16(mmtmpPMI1, SIMDE_MM_SHUFFLE(2,3,0,1));
|
||||
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = simde_mm_sign_epi16(mmtmpPMI1,*(simde__m128i*)&conjugate);
|
||||
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
|
||||
mmtmpPMI1 = simde_mm_madd_epi16(mmtmpPMI1,dl_ch0_128[1]);
|
||||
// print_ints("mm_madd_epi16",&mmtmpPMI1);
|
||||
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
pmi128_re = simde_mm_add_epi32(pmi128_re,mmtmpPMI0);
|
||||
// print_ints(" pmi128_re 1",&pmi128_re);
|
||||
pmi128_im = simde_mm_add_epi32(pmi128_im,mmtmpPMI1);
|
||||
//print_ints(" pmi128_im 1 ",&pmi128_im);*/
|
||||
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
mmtmpPMI0 = vmull_s16(((int16x4_t*)dl_ch0_128)[0], ((int16x4_t*)dl_ch1_128)[0]);
|
||||
mmtmpPMI1 = vmull_s16(((int16x4_t*)dl_ch0_128)[1], ((int16x4_t*)dl_ch1_128)[1]);
|
||||
pmi128_re = vqaddq_s32(pmi128_re,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0),vget_high_s32(mmtmpPMI0)),vpadd_s32(vget_low_s32(mmtmpPMI1),vget_high_s32(mmtmpPMI1))));
|
||||
|
||||
mmtmpPMI0b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[0]);
|
||||
mmtmpPMI1b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[1]);
|
||||
pmi128_im = vqaddq_s32(pmi128_im,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0b),vget_high_s32(mmtmpPMI0b)),vpadd_s32(vget_low_s32(mmtmpPMI1b),vget_high_s32(mmtmpPMI1b))));
|
||||
|
||||
#endif
|
||||
dl_ch0_128++;
|
||||
dl_ch1_128++;
|
||||
}
|
||||
@@ -1372,10 +1339,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
|
||||
// printf("in lte_ue_measurements: selected rx_antenna[eNB_id==0]:%u\n", ue->measurements.selected_rx_antennas[eNB_id][i]);
|
||||
} // eNB_id loop
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
simde_mm_empty();
|
||||
simde_m_empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,15 +98,10 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[Ns+(subframe<<1)];
|
||||
int symbol_offset,i;
|
||||
//debug_msg("lte_ul_channel_estimation: cyclic shift %d\n",cyclicShift);
|
||||
const int16_t alpha_re[12] = {32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384, -1, 16383, 28377};
|
||||
const int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
|
||||
const int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384};
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxdataF128,*ul_ref128,*ul_ch128;
|
||||
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int16x8_t *rxdataF128,*ul_ref128,*ul_ch128;
|
||||
int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im;
|
||||
#endif
|
||||
simde__m128i *rxdataF128, *ul_ref128, *ul_ch128;
|
||||
simde__m128i mmtmpU0, mmtmpU1, mmtmpU2, mmtmpU3;
|
||||
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
|
||||
if (ulsch->ue_type > 0) harq_pid = 0;
|
||||
@@ -142,96 +137,51 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
if (l == (3 - frame_parms->Ncp)) {
|
||||
symbol_offset = frame_parms->N_RB_UL*12*(l+((7-frame_parms->Ncp)*(Ns&1)));
|
||||
|
||||
for (aa=0; aa<nb_antennas_rx; aa++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
rxdataF128 = (__m128i *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (__m128i *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (__m128i *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
rxdataF128 = (int16x8_t *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (int16x8_t *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (int16x8_t *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
#endif
|
||||
for (aa = 0; aa < nb_antennas_rx; aa++) {
|
||||
rxdataF128 = (simde__m128i *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (simde__m128i *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (simde__m128i *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
|
||||
for (i=0; i<Msc_RS/12; i++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
for (i = 0; i < Msc_RS / 12; i++) {
|
||||
// multiply by conjugated channel
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[0],rxdataF128[0]);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[0], rxdataF128[0]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)&conjugate[0]);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[0], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)&conjugate[0]);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[0]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[0] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
// printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]);
|
||||
// multiply by conjugated channel
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[1],rxdataF128[1]);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[1], rxdataF128[1]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[1], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)conjugate);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[1]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]);
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[1] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[2], rxdataF128[2]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[2], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)conjugate);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[2]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
#endif
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[2] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
ul_ch128+=3;
|
||||
ul_ref128+=3;
|
||||
rxdataF128+=3;
|
||||
@@ -401,7 +351,7 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
// multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) ul_ch1,1,Msc_RS);
|
||||
// multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) ul_ch2,1,Msc_RS);
|
||||
} //if (Ns&1)
|
||||
} //for(aa=...
|
||||
} // for(aa=...
|
||||
} //if(l==...
|
||||
|
||||
return(0);
|
||||
@@ -434,15 +384,10 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16)));
|
||||
int symbol_offset,i;
|
||||
//debug_msg("lte_ul_channel_estimation_RRU: cyclic shift %d\n",cyclicShift);
|
||||
const int16_t alpha_re[12] = {32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384, -1, 16383, 28377};
|
||||
const int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
|
||||
const int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16384, -28378, -32768, -28378, -16384};
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxdataF128,*ul_ref128,*ul_ch128;
|
||||
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
int16x8_t *rxdataF128,*ul_ref128,*ul_ch128;
|
||||
int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im;
|
||||
#endif
|
||||
simde__m128i *rxdataF128, *ul_ref128, *ul_ch128;
|
||||
simde__m128i mmtmpU0, mmtmpU1, mmtmpU2, mmtmpU3;
|
||||
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
AssertFatal(l==pilot_pos1 || l==pilot_pos2,"%d is not a valid symbol for DMRS, should be %d or %d\n",
|
||||
l,pilot_pos1,pilot_pos2);
|
||||
@@ -470,96 +415,51 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#endif
|
||||
symbol_offset = frame_parms->N_RB_UL*12*l;
|
||||
|
||||
for (aa=0; aa<nb_antennas_rx; aa++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
rxdataF128 = (__m128i *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (__m128i *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (__m128i *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
rxdataF128 = (int16x8_t *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (int16x8_t *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (int16x8_t *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
#endif
|
||||
for (aa = 0; aa < nb_antennas_rx; aa++) {
|
||||
rxdataF128 = (simde__m128i *)&rxdataF_ext[aa][symbol_offset];
|
||||
ul_ch128 = (simde__m128i *)&ul_ch_estimates[aa][symbol_offset];
|
||||
ul_ref128 = (simde__m128i *)ul_ref_sigs_rx[u][v][Msc_RS_idx];
|
||||
|
||||
for (i=0; i<Msc_RS/12; i++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
for (i = 0; i < Msc_RS / 12; i++) {
|
||||
// multiply by conjugated channel
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[0],rxdataF128[0]);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[0], rxdataF128[0]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)&conjugate[0]);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[0], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)&conjugate[0]);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[0]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[0] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
// printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]);
|
||||
// multiply by conjugated channel
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[1],rxdataF128[1]);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[1], rxdataF128[1]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[1], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)conjugate);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[1]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]);
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[1] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
mmtmpU0 = simde_mm_madd_epi16(ul_ref128[2], rxdataF128[2]);
|
||||
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
|
||||
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]);
|
||||
mmtmpU1 = simde_mm_shufflelo_epi16(ul_ref128[2], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_shufflehi_epi16(mmtmpU1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpU1 = simde_mm_sign_epi16(mmtmpU1, *(simde__m128i *)conjugate);
|
||||
mmtmpU1 = simde_mm_madd_epi16(mmtmpU1, rxdataF128[2]);
|
||||
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
|
||||
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
|
||||
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
|
||||
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
|
||||
ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
|
||||
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
|
||||
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
|
||||
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
|
||||
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
|
||||
ul_ch128++;
|
||||
ul_ref128++;
|
||||
rxdataF128++;
|
||||
#endif
|
||||
mmtmpU0 = simde_mm_srai_epi32(mmtmpU0, 15);
|
||||
mmtmpU1 = simde_mm_srai_epi32(mmtmpU1, 15);
|
||||
mmtmpU2 = simde_mm_unpacklo_epi32(mmtmpU0, mmtmpU1);
|
||||
mmtmpU3 = simde_mm_unpackhi_epi32(mmtmpU0, mmtmpU1);
|
||||
ul_ch128[2] = simde_mm_packs_epi32(mmtmpU2, mmtmpU3);
|
||||
ul_ch128+=3;
|
||||
ul_ref128+=3;
|
||||
rxdataF128+=3;
|
||||
@@ -725,7 +625,7 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
N_rb_alloc);
|
||||
LOG_D(PHY,"delta_phase = %d\n",delta_phase);
|
||||
}
|
||||
} //for(aa=...
|
||||
} // for(aa=...
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -801,40 +701,38 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
return(0);
|
||||
}
|
||||
|
||||
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t *ul_ch_estimates,
|
||||
uint16_t nb_rb) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, int32_t *ul_ch_estimates, uint16_t nb_rb)
|
||||
{
|
||||
int k, rb;
|
||||
int a_idx = 64;
|
||||
uint8_t conj_flag = 0;
|
||||
uint8_t output_shift;
|
||||
int pilot_pos1 = 3 - frame_parms->Ncp;
|
||||
int pilot_pos2 = 10 - 2*frame_parms->Ncp;
|
||||
__m128i *ul_ch1 = (__m128i *)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12];
|
||||
__m128i *ul_ch2 = (__m128i *)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12];
|
||||
simde__m128i *ul_ch1 = (simde__m128i *)&ul_ch_estimates[pilot_pos1 * frame_parms->N_RB_UL * 12];
|
||||
simde__m128i *ul_ch2 = (simde__m128i *)&ul_ch_estimates[pilot_pos2 * frame_parms->N_RB_UL * 12];
|
||||
int32_t avg[2];
|
||||
int16_t Ravg[2];
|
||||
Ravg[0]=0;
|
||||
Ravg[1]=0;
|
||||
int16_t iv, rv, phase_idx = 0;
|
||||
__m128i R[3], mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
|
||||
__m128 avg128U1, avg128U2;
|
||||
simde__m128i R[3], mmtmpD0, mmtmpD1, mmtmpD2, mmtmpD3;
|
||||
simde__m128 avg128U1, avg128U2;
|
||||
|
||||
// round(tan((pi/4)*[1:1:N]/N)*pow2(15))
|
||||
int16_t alpha[128] = {201, 402, 603, 804, 1006, 1207, 1408, 1610, 1811, 2013, 2215, 2417, 2619, 2822, 3024, 3227, 3431, 3634, 3838, 4042, 4246, 4450, 4655, 4861, 5066, 5272, 5479, 5686, 5893, 6101, 6309, 6518, 6727, 6937, 7147, 7358, 7570, 7782, 7995, 8208, 8422, 8637, 8852, 9068, 9285, 9503, 9721, 9940, 10160, 10381, 10603, 10825, 11049, 11273, 11498, 11725, 11952, 12180, 12410, 12640, 12872, 13104, 13338, 13573, 13809, 14046, 14285, 14525, 14766, 15009, 15253, 15498, 15745, 15993, 16243, 16494, 16747, 17001, 17257, 17515, 17774, 18035, 18298, 18563, 18829, 19098, 19368, 19640, 19915, 20191, 20470, 20750, 21033, 21318, 21605, 21895, 22187, 22481, 22778, 23078, 23380, 23685, 23992, 24302, 24615, 24931, 25250, 25572, 25897, 26226, 26557, 26892, 27230, 27572, 27917, 28266, 28618, 28975, 29335, 29699, 30067, 30440, 30817, 31198, 31583, 31973, 32368, 32767};
|
||||
// compute log2_maxh (output_shift)
|
||||
avg128U1 = _mm_setzero_ps();
|
||||
avg128U2 = _mm_setzero_ps();
|
||||
avg128U1 = simde_mm_setzero_ps();
|
||||
avg128U2 = simde_mm_setzero_ps();
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
avg128U1 = _mm_add_ps(avg128U1,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch1[0],ul_ch1[0])));
|
||||
avg128U1 = _mm_add_ps(avg128U1,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch1[1],ul_ch1[1])));
|
||||
avg128U1 = _mm_add_ps(avg128U1,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch1[2],ul_ch1[2])));
|
||||
avg128U1 = simde_mm_add_ps(avg128U1, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch1[0], ul_ch1[0])));
|
||||
avg128U1 = simde_mm_add_ps(avg128U1, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch1[1], ul_ch1[1])));
|
||||
avg128U1 = simde_mm_add_ps(avg128U1, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch1[2], ul_ch1[2])));
|
||||
|
||||
avg128U2 = _mm_add_ps(avg128U2,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch2[0],ul_ch2[0])));
|
||||
avg128U2 = _mm_add_ps(avg128U2,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch2[1],ul_ch2[1])));
|
||||
avg128U2 = _mm_add_ps(avg128U2,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch2[2],ul_ch2[2])));
|
||||
avg128U2 = simde_mm_add_ps(avg128U2, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch2[0], ul_ch2[0])));
|
||||
avg128U2 = simde_mm_add_ps(avg128U2, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch2[1], ul_ch2[1])));
|
||||
avg128U2 = simde_mm_add_ps(avg128U2, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(ul_ch2[2], ul_ch2[2])));
|
||||
|
||||
ul_ch1+=3;
|
||||
ul_ch2+=3;
|
||||
@@ -856,43 +754,43 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
output_shift = cmax(0,avg[1]-10);
|
||||
//output_shift = (log2_approx(avg[0])/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+1;
|
||||
// msg("avg= %d, shift = %d\n",avg[0],output_shift);
|
||||
ul_ch1 = (__m128i *)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12];
|
||||
ul_ch2 = (__m128i *)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12];
|
||||
ul_ch1 = (simde__m128i *)&ul_ch_estimates[pilot_pos1 * frame_parms->N_RB_UL * 12];
|
||||
ul_ch2 = (simde__m128i *)&ul_ch_estimates[pilot_pos2 * frame_parms->N_RB_UL * 12];
|
||||
|
||||
// correlate and average the 2 channel estimates ul_ch1*ul_ch2
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
mmtmpD0 = _mm_madd_epi16(ul_ch1[0],ul_ch2[0]);
|
||||
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
|
||||
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[0]);
|
||||
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
|
||||
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
|
||||
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
|
||||
R[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
|
||||
mmtmpD0 = _mm_madd_epi16(ul_ch1[1],ul_ch2[1]);
|
||||
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[1],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
|
||||
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[1]);
|
||||
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
|
||||
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
|
||||
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
|
||||
R[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
|
||||
mmtmpD0 = _mm_madd_epi16(ul_ch1[2],ul_ch2[2]);
|
||||
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[2],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
|
||||
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[2]);
|
||||
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
|
||||
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
|
||||
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
|
||||
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
|
||||
R[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
|
||||
R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[1],1));
|
||||
R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[2],1));
|
||||
mmtmpD0 = simde_mm_madd_epi16(ul_ch1[0], ul_ch2[0]);
|
||||
mmtmpD1 = simde_mm_shufflelo_epi16(ul_ch1[0], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_shufflehi_epi16(mmtmpD1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_sign_epi16(mmtmpD1, *(simde__m128i *)&conjugate);
|
||||
mmtmpD1 = simde_mm_madd_epi16(mmtmpD1, ul_ch2[0]);
|
||||
mmtmpD0 = simde_mm_srai_epi32(mmtmpD0, output_shift);
|
||||
mmtmpD1 = simde_mm_srai_epi32(mmtmpD1, output_shift);
|
||||
mmtmpD2 = simde_mm_unpacklo_epi32(mmtmpD0, mmtmpD1);
|
||||
mmtmpD3 = simde_mm_unpackhi_epi32(mmtmpD0, mmtmpD1);
|
||||
R[0] = simde_mm_packs_epi32(mmtmpD2, mmtmpD3);
|
||||
mmtmpD0 = simde_mm_madd_epi16(ul_ch1[1], ul_ch2[1]);
|
||||
mmtmpD1 = simde_mm_shufflelo_epi16(ul_ch1[1], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_shufflehi_epi16(mmtmpD1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_sign_epi16(mmtmpD1, *(simde__m128i *)&conjugate);
|
||||
mmtmpD1 = simde_mm_madd_epi16(mmtmpD1, ul_ch2[1]);
|
||||
mmtmpD0 = simde_mm_srai_epi32(mmtmpD0, output_shift);
|
||||
mmtmpD1 = simde_mm_srai_epi32(mmtmpD1, output_shift);
|
||||
mmtmpD2 = simde_mm_unpacklo_epi32(mmtmpD0, mmtmpD1);
|
||||
mmtmpD3 = simde_mm_unpackhi_epi32(mmtmpD0, mmtmpD1);
|
||||
R[1] = simde_mm_packs_epi32(mmtmpD2, mmtmpD3);
|
||||
mmtmpD0 = simde_mm_madd_epi16(ul_ch1[2], ul_ch2[2]);
|
||||
mmtmpD1 = simde_mm_shufflelo_epi16(ul_ch1[2], SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_shufflehi_epi16(mmtmpD1, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmpD1 = simde_mm_sign_epi16(mmtmpD1, *(simde__m128i *)&conjugate);
|
||||
mmtmpD1 = simde_mm_madd_epi16(mmtmpD1, ul_ch2[2]);
|
||||
mmtmpD0 = simde_mm_srai_epi32(mmtmpD0, output_shift);
|
||||
mmtmpD1 = simde_mm_srai_epi32(mmtmpD1, output_shift);
|
||||
mmtmpD2 = simde_mm_unpacklo_epi32(mmtmpD0, mmtmpD1);
|
||||
mmtmpD3 = simde_mm_unpackhi_epi32(mmtmpD0, mmtmpD1);
|
||||
R[2] = simde_mm_packs_epi32(mmtmpD2, mmtmpD3);
|
||||
R[0] = simde_mm_add_epi16(simde_mm_srai_epi16(R[0], 1), simde_mm_srai_epi16(R[1], 1));
|
||||
R[0] = simde_mm_add_epi16(simde_mm_srai_epi16(R[0], 1), simde_mm_srai_epi16(R[2], 1));
|
||||
Ravg[0] += (((short *)&R)[0] +
|
||||
((short *)&R)[2] +
|
||||
((short *)&R)[4] +
|
||||
@@ -932,8 +830,5 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
if (Ravg[1]<0)
|
||||
phase_idx = -phase_idx;
|
||||
|
||||
return(phase_idx);
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
return(0);
|
||||
#endif
|
||||
return (phase_idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user