Commit 0fdc095d authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix-simplify-prach-nrue' into integration_2026_w03 (!3791)

fix array lenght errors, k variable wrapping threshold. Make the code smaller and more efficient

generate_nr_prach() has several errors coming from replace int16_t by
c16_t, and also older error in k wrapping at the end of the symbol

the code is also ridiculously complex, wasting memory and cpu time in
intermediate useless buffers and headache usage of memmove()
parents 815a5719 ae8319db
...@@ -874,6 +874,7 @@ void get_samplerate_and_bw(int mu, ...@@ -874,6 +874,7 @@ void get_samplerate_and_bw(int mu,
switch(n_rb) { switch(n_rb) {
case 270: case 270:
if (threequarter_fs) { if (threequarter_fs) {
warn_higher_threequarter_fs(n_rb, mu);
*sample_rate=92.16e6; *sample_rate=92.16e6;
*samples_per_frame = 921600; *samples_per_frame = 921600;
*tx_bw = 50e6; *tx_bw = 50e6;
...@@ -973,6 +974,7 @@ void get_samplerate_and_bw(int mu, ...@@ -973,6 +974,7 @@ void get_samplerate_and_bw(int mu,
case 273: case 273:
if (threequarter_fs) { if (threequarter_fs) {
warn_higher_threequarter_fs(n_rb, mu);
*sample_rate=184.32e6; *sample_rate=184.32e6;
*samples_per_frame = 1843200; *samples_per_frame = 1843200;
*tx_bw = 100e6; *tx_bw = 100e6;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "assertions.h" #include "assertions.h"
#include "common/utils/utils.h" #include "common/utils/utils.h"
#include "common/utils/LOG/log.h"
#define MAX_SI_GROUPS 3 #define MAX_SI_GROUPS 3
#define NR_MAX_PDSCH_TBS 3824 #define NR_MAX_PDSCH_TBS 3824
...@@ -272,6 +273,19 @@ static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t ...@@ -272,6 +273,19 @@ static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t
return count_bits64(v & mask); return count_bits64(v & mask);
} }
static inline void warn_higher_threequarter_fs(const int n_rb, const int mu)
{
LOG_W(PHY,
"3/4 sampling is not possible for current PRB size: %d and numerology: %d.\n "
"So 6/4 sampling is chosen to support x3xx type USRPs.\n "
"Note that this sampling rate increases fronthaul traffic, FFT buffer size and processing time by a factor of two compared "
"to 3/4 sampling rate.\n "
"Some PRACH configuration might not be supported with 6/4 FFT size.\n "
"Consider reducing the PRB size that would fit within the FFT size of 3/4 sampling\n",
n_rb,
mu);
}
uint64_t reverse_bits(uint64_t in, int n_bits); uint64_t reverse_bits(uint64_t in, int n_bits);
void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out); void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out);
......
...@@ -199,14 +199,26 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) ...@@ -199,14 +199,26 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL)
AssertFatal(1==0,"Invalid numerology index %d", mu); AssertFatal(1==0,"Invalid numerology index %d", mu);
} }
if(fp->threequarter_fs) // Start with FFT size 512
fp->ofdm_symbol_size = 3 * 128; fp->ofdm_symbol_size = 512;
else
fp->ofdm_symbol_size = 4 * 128;
while(fp->ofdm_symbol_size < N_RB_DL * 12) // Choose the right FFT size for the BW
while(fp->ofdm_symbol_size < N_RB_DL * NR_NB_SC_PER_RB)
fp->ofdm_symbol_size <<= 1; fp->ofdm_symbol_size <<= 1;
// Do 3/4 sampling
if (fp->threequarter_fs) {
const uint16_t threeq_fft_size = fp->ofdm_symbol_size * 3 / 4;
if (threeq_fft_size < (N_RB_DL * NR_NB_SC_PER_RB)) {
// 3/4 sampling FFT size not enough
warn_higher_threequarter_fs(N_RB_DL, fp->numerology_index);
// Choose 2 times 3/4 sampling
fp->ofdm_symbol_size = threeq_fft_size << 1;
} else {
fp->ofdm_symbol_size = threeq_fft_size;
}
}
fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2); fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2);
fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9; fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9;
fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu)); fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu));
......
This diff is collapsed.
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