phy: use fftshift'ed buffer for txdataF

So far txdataF buffer has DC RE as the first element. This was prefered
most likely to avoid memcpy before iFFT but comes with a small
complexity in RE mapping functions.

Instead, we use a flat buffer that holds freq domain data starting from
first negative SC. After resource mapping is done on all channels, each
OFDM symbol is shifted before iFFT so that the buffer start with DC RE.

This reduces complexity in mapping functions and later on when passing
beam IDs to 7.2 split RU especially when a beam is associated to
interleaved RB and/or REs.

There is already a memcpy in place to copy txdataF from gNB stuct to RU
struct. So this change does not introduce new memcpy.
This commit is contained in:
Sakthivel Velumani
2026-03-09 18:27:27 +00:00
parent d7512bdc8b
commit 044ca835d6
16 changed files with 185 additions and 217 deletions
+34 -14
View File
@@ -288,6 +288,7 @@ void do_OFDM_mod(c16_t **txdataF, c16_t **txdata, uint32_t frame,uint16_t next_s
void apply_nr_rotation_TX(const NR_DL_FRAME_PARMS *fp,
c16_t *txdataF,
bool is_flat_buff,
const c16_t *symbol_rotation,
int slot,
int nb_rb,
@@ -309,20 +310,39 @@ void apply_nr_rotation_TX(const NR_DL_FRAME_PARMS *fp,
this_rotation->r,
this_rotation->i);
if (nb_rb & 1) {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
(nb_rb + 1) * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset - 6,
this_rotation,
this_symbol + fp->first_carrier_offset - 6,
(nb_rb + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
nb_rb * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset,
this_rotation,
this_symbol + fp->first_carrier_offset,
nb_rb * 6, 15);
if (is_flat_buff)
rotate_cpx_vector(this_symbol, this_rotation, this_symbol, nb_rb * NR_NB_SC_PER_RB, 15);
else {
c16_t *this_symbol_neg = this_symbol + fp->first_carrier_offset;
if (nb_rb & 1) {
this_symbol_neg -= 6;
nb_rb += 1;
}
rotate_cpx_vector(this_symbol, this_rotation, this_symbol, nb_rb * 6, 15);
rotate_cpx_vector(this_symbol_neg, this_rotation, this_symbol_neg, nb_rb * 6, 15);
}
}
}
/* Do FFT-shift for symbols in the provided in buffer and writes to out buffer. */
void fft_shift(const c16_t *in,
uint32_t in_symb_sz,
uint16_t num_prb,
c16_t *out,
uint16_t fft_size_out,
uint16_t start_symb,
uint16_t num_symb)
{
const int num_samp_half = num_prb * NR_NB_SC_PER_RB / 2;
const int first_carrier_offset = fft_size_out - num_samp_half;
for (int s = start_symb; s < start_symb + num_symb; s++) {
// Copy negative freq component
uint16_t out_offset = s * fft_size_out + first_carrier_offset;
uint16_t in_offset = s * in_symb_sz;
memcpy(out + out_offset, in + in_offset, num_samp_half * sizeof(int32_t));
// Copy positive freq component
out_offset = s * fft_size_out;
in_offset = s * in_symb_sz + num_samp_half;
memcpy(out + out_offset, in + in_offset, num_samp_half * sizeof(int32_t));
}
}