From 865fdb98e3358504ed921fb0776d5eb98b108589 Mon Sep 17 00:00:00 2001 From: Sagar Parsawar Date: Wed, 2 Mar 2022 17:59:00 +0100 Subject: [PATCH] Adding DFT & IDFT for 768 size --- openair1/PHY/MODULATION/slot_fep_nr.c | 3 + .../nr_dl_channel_estimation.c | 8 ++ openair1/PHY/NR_UE_TRANSPORT/pss_nr.c | 4 + openair1/PHY/TOOLS/oai_dfts.c | 103 ++++++++++++++++++ openair1/PHY/TOOLS/tools_defs.h | 5 +- 5 files changed, 121 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index eb26dfc02b..0dad107da5 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -46,6 +46,9 @@ dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size) case 512: return DFT_512; + case 768: + return DFT_768; + case 1024: return DFT_1024; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 8e122d9a63..a4c5345f86 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -361,6 +361,10 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, idftsizeidx = IDFT_512; break; + case 768: + idftsizeidx = IDFT_768; + break; + case 1024: idftsizeidx = IDFT_1024; break; @@ -829,6 +833,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, idftsizeidx = IDFT_512; break; + case 768: + idftsizeidx = IDFT_768; + break; + case 1024: idftsizeidx = IDFT_1024; break; diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 28b6677b2c..857d9a1d45 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -78,6 +78,10 @@ idft_size_idx_t get_idft(int ofdm_symbol_size) return IDFT_512; break; + case 768: + return IDFT_768; + break; + case 1024: return IDFT_1024; break; diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 83207426fd..2d9bb1adb3 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -9059,6 +9059,7 @@ static int16_t twc768[191*2*4]; void dft768(int16_t *x,int16_t *y,unsigned char scale_flag) { // 192x 4; +#if 1 int i,j; simd_q15_t *x128=(simd_q15_t *)x; simd_q15_t *y128=(simd_q15_t *)y; @@ -9108,7 +9109,109 @@ void dft768(int16_t *x,int16_t *y,unsigned char scale_flag) { // 192x 4; _mm_empty(); _m_empty(); +#else + int i,i2,j; + uint32_t tmp[3][256]__attribute__((aligned(32))); + uint32_t tmpo[3][256] __attribute__((aligned(32))); + simd_q15_t *y128p=(simd_q15_t*)y; + simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15); + + for (i=0,j=0; i<256; i++) { + tmp[0][i] = ((uint32_t *)x)[j++]; + tmp[1][i] = ((uint32_t *)x)[j++]; + tmp[2][i] = ((uint32_t *)x)[j++]; + } + + dft256((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); + dft256((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); + dft256((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); + + for (i=0,i2=0; i<512; i+=8,i2+=4) { + bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), + (simd_q15_t*)(y+i),(simd_q15_t*)(y+512+i),(simd_q15_t*)(y+1024+i), + (simd_q15_t*)(twa768+i),(simd_q15_t*)(twb768+i)); + } + + + if (scale_flag==1) { + for (i=0; i<12; i++) { + y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128); + y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128); + y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128); + y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128); + y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128); + y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128); + y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128); + y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128); + y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128); + y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128); + y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128); + y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128); + y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128); + y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128); + y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128); + y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128); + y128p+=16; + } + } + + _mm_empty(); + _m_empty(); +#endif + +} + +// 256 x 3 +void idft768(int16_t *input, int16_t *output, unsigned char scale) +{ + int i,i2,j; + uint32_t tmp[3][256]__attribute__((aligned(32))); + uint32_t tmpo[3][256] __attribute__((aligned(32))); + simd_q15_t *y128p=(simd_q15_t*)output; + simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15); + + for (i=0,j=0; i<256; i++) { + tmp[0][i] = ((uint32_t *)input)[j++]; + tmp[1][i] = ((uint32_t *)input)[j++]; + tmp[2][i] = ((uint32_t *)input)[j++]; + } + + idft256((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); + idft256((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); + idft256((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); + + for (i=0,i2=0; i<512; i+=8,i2+=4) { + ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), + (simd_q15_t*)(output+i),(simd_q15_t*)(output+512+i),(simd_q15_t*)(output+1024+i), + (simd_q15_t*)(twa768+i),(simd_q15_t*)(twb768+i)); + } + + + if (scale==1) { + for (i=0; i<12; i++) { + y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128); + y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128); + y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128); + y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128); + y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128); + y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128); + y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128); + y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128); + y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128); + y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128); + y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128); + y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128); + y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128); + y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128); + y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128); + y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128); + y128p+=16; + } + } + + _mm_empty(); + _m_empty(); } diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 966e93440e..3899e8d3d2 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -263,6 +263,7 @@ void idft64(int16_t *x,int16_t *y,uint8_t scale_flag); void idft128(int16_t *x,int16_t *y,uint8_t scale_flag); void idft256(int16_t *x,int16_t *y,uint8_t scale_flag); void idft512(int16_t *x,int16_t *y,uint8_t scale_flag); +void idft768(int16_t *x,int16_t *y,uint8_t scale_flag); void idft1024(int16_t *x,int16_t *y,uint8_t scale_flag); void idft1536(int16_t *sigF,int16_t *sig,uint8_t scale_flag); void idft2048(int16_t *x,int16_t *y,uint8_t scale_flag); @@ -323,14 +324,14 @@ adftfunc_t dft_ftab[]={ #endif typedef enum idft_size_idx { - IDFT_128, IDFT_256, IDFT_512, IDFT_1024, IDFT_1536, IDFT_2048, IDFT_3072, IDFT_4096, + IDFT_128, IDFT_256, IDFT_512, IDFT_768, IDFT_1024, IDFT_1536, IDFT_2048, IDFT_3072, IDFT_4096, IDFT_6144, IDFT_8192, IDFT_9216, IDFT_12288, IDFT_18432, IDFT_24576, IDFT_36864, IDFT_49152, IDFT_73728, IDFT_98304, IDFT_SIZE_IDXTABLESIZE } idft_size_idx_t; #ifdef OAIDFTS_MAIN aidftfunc_t idft_ftab[]={ - idft128, idft256, idft512, idft1024, idft1536, idft2048, idft3072, idft4096, + idft128, idft256, idft512, idft768, idft1024, idft1536, idft2048, idft3072, idft4096, idft6144, idft8192, idft9216, idft12288, idft18432, idft24576, idft36864, idft49152, idft73728, idft98304 };