mod: refactor PHY multiplications
This commit is contained in:
@@ -35,10 +35,6 @@ extern int16_t *s75e_kHz_7_5;
|
||||
extern int16_t *s100n_kHz_7_5;
|
||||
extern int16_t *s100e_kHz_7_5;
|
||||
|
||||
static const short conjugate75[8] __attribute__((aligned(16))) = {-1, 1, -1, 1, -1, 1, -1, 1};
|
||||
static const short conjugate75_2[8] __attribute__((aligned(16))) = {1, -1, 1, -1, 1, -1, 1, -1};
|
||||
static const short negate[8] __attribute__((aligned(16))) = {-1, -1, -1, -1, -1, -1, -1, -1};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -27,15 +27,12 @@
|
||||
void remove_7_5_kHz(RU_t *ru,uint8_t slot)
|
||||
{
|
||||
|
||||
|
||||
int32_t **rxdata=ru->common.rxdata;
|
||||
int32_t **rxdata_7_5kHz=ru->common.rxdata_7_5kHz;
|
||||
uint16_t len;
|
||||
uint32_t *kHz7_5ptr;
|
||||
simde__m128i *rxptr128, *rxptr128_7_5kHz, *kHz7_5ptr128, kHz7_5_2, mmtmp_re, mmtmp_im, mmtmp_re2, mmtmp_im2;
|
||||
uint32_t slot_offset,slot_offset2;
|
||||
uint8_t aa;
|
||||
uint32_t i;
|
||||
|
||||
simde__m128i *rxptr128, *rxptr128_7_5kHz, *kHz7_5ptr128;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms=ru->frame_parms;
|
||||
|
||||
switch (frame_parms->N_RB_UL) {
|
||||
@@ -69,36 +66,20 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t slot_offset = ((uint32_t)slot * frame_parms->samples_per_tti/2)-ru->N_TA_offset;
|
||||
uint32_t slot_offset2 = (uint32_t)(slot&1) * frame_parms->samples_per_tti/2;
|
||||
|
||||
slot_offset = ((uint32_t)slot * frame_parms->samples_per_tti/2)-ru->N_TA_offset;
|
||||
slot_offset2 = (uint32_t)(slot&1) * frame_parms->samples_per_tti/2;
|
||||
uint16_t len = frame_parms->samples_per_tti/2;
|
||||
|
||||
len = frame_parms->samples_per_tti/2;
|
||||
|
||||
for (aa=0; aa<ru->nb_rx; aa++) {
|
||||
for (uint8_t aa=0; aa<ru->nb_rx; aa++) {
|
||||
rxptr128 = (simde__m128i *)&rxdata[aa][slot_offset];
|
||||
rxptr128_7_5kHz = (simde__m128i *)&rxdata_7_5kHz[aa][slot_offset2];
|
||||
kHz7_5ptr128 = (simde__m128i *)kHz7_5ptr;
|
||||
// apply 7.5 kHz
|
||||
|
||||
// if (((slot>>1)&1) == 0) { // apply the sinusoid from the table directly
|
||||
for (i=0; i<(len>>2); i++) {
|
||||
kHz7_5_2 = simde_mm_sign_epi16(*kHz7_5ptr128, *(simde__m128i *)&conjugate75_2[0]);
|
||||
mmtmp_re = simde_mm_madd_epi16(*rxptr128, kHz7_5_2);
|
||||
// Real part of complex multiplication (note: 7_5kHz signal is conjugated for this to work)
|
||||
mmtmp_im = simde_mm_shufflelo_epi16(kHz7_5_2, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmp_im = simde_mm_shufflehi_epi16(mmtmp_im, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmp_im = simde_mm_sign_epi16(mmtmp_im, *(simde__m128i *)&conjugate75[0]);
|
||||
mmtmp_im = simde_mm_madd_epi16(mmtmp_im, rxptr128[0]);
|
||||
mmtmp_re = simde_mm_srai_epi32(mmtmp_re, 15);
|
||||
mmtmp_im = simde_mm_srai_epi32(mmtmp_im, 15);
|
||||
mmtmp_re2 = simde_mm_unpacklo_epi32(mmtmp_re, mmtmp_im);
|
||||
mmtmp_im2 = simde_mm_unpackhi_epi32(mmtmp_re, mmtmp_im);
|
||||
|
||||
rxptr128_7_5kHz[0] = simde_mm_packs_epi32(mmtmp_re2, mmtmp_im2);
|
||||
rxptr128++;
|
||||
rxptr128_7_5kHz++;
|
||||
kHz7_5ptr128++;
|
||||
for (uint32_t i=0; i<(len>>2); i++) {
|
||||
rxptr128_7_5kHz[i] = oai_mm_cpx_mult(kHz7_5ptr128[i], rxptr128[i], 15);
|
||||
}
|
||||
// undo 7.5 kHz offset for symbol 3 in case RU is slave (for OTA synchronization)
|
||||
if (ru->is_slave == 1 && slot == 2){
|
||||
@@ -110,7 +91,6 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
|
||||
(2*frame_parms->nb_prefix_samples)+
|
||||
frame_parms->nb_prefix_samples0],
|
||||
(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)*sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,9 @@
|
||||
void apply_7_5_kHz(PHY_VARS_UE *ue,int32_t*txdata,uint8_t slot)
|
||||
{
|
||||
|
||||
|
||||
uint16_t len;
|
||||
uint32_t *kHz7_5ptr;
|
||||
simde__m128i *txptr128, *kHz7_5ptr128, mmtmp_re, mmtmp_im, mmtmp_re2, mmtmp_im2;
|
||||
uint32_t slot_offset;
|
||||
// uint8_t aa;
|
||||
uint32_t i;
|
||||
simde__m128i *txptr128, *kHz7_5ptr128;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||
|
||||
switch (frame_parms->N_RB_UL) {
|
||||
@@ -68,31 +64,17 @@ void apply_7_5_kHz(PHY_VARS_UE *ue,int32_t*txdata,uint8_t slot)
|
||||
break;
|
||||
}
|
||||
|
||||
slot_offset = (uint32_t)slot * frame_parms->samples_per_tti/2;
|
||||
len = frame_parms->samples_per_tti/2;
|
||||
uint32_t slot_offset = (uint32_t)slot * frame_parms->samples_per_tti/2;
|
||||
uint16_t len = frame_parms->samples_per_tti/2;
|
||||
|
||||
txptr128 = (simde__m128i *)&txdata[slot_offset];
|
||||
kHz7_5ptr128 = (simde__m128i *)kHz7_5ptr;
|
||||
// apply 7.5 kHz
|
||||
|
||||
for (i = 0; i < (len >> 2); i++) {
|
||||
mmtmp_re = simde_mm_madd_epi16(*txptr128, *kHz7_5ptr128);
|
||||
for (uint32_t i = 0; i < (len >> 2); i++) {
|
||||
// Real part of complex multiplication (note: 7_5kHz signal is conjugated for this to work)
|
||||
mmtmp_im = simde_mm_shufflelo_epi16(*kHz7_5ptr128, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmp_im = simde_mm_shufflehi_epi16(mmtmp_im, SIMDE_MM_SHUFFLE(2, 3, 0, 1));
|
||||
mmtmp_im = simde_mm_sign_epi16(mmtmp_im, *(simde__m128i *)&conjugate75[0]);
|
||||
mmtmp_im = simde_mm_madd_epi16(mmtmp_im, txptr128[0]);
|
||||
mmtmp_re = simde_mm_srai_epi32(mmtmp_re, 15);
|
||||
mmtmp_im = simde_mm_srai_epi32(mmtmp_im, 15);
|
||||
mmtmp_re2 = simde_mm_unpacklo_epi32(mmtmp_re, mmtmp_im);
|
||||
mmtmp_im2 = simde_mm_unpackhi_epi32(mmtmp_re, mmtmp_im);
|
||||
|
||||
txptr128[0] = simde_mm_packs_epi32(mmtmp_re2, mmtmp_im2);
|
||||
txptr128++;
|
||||
kHz7_5ptr128++;
|
||||
txptr128[i] = oai_mm_cpx_mult_conja(kHz7_5ptr128[i], txptr128[i], 15);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user