rename a global "ru" in root_unit and include correctly the .h file, that leads to mistakes fixes

This commit is contained in:
Laurent THOMAS
2025-08-20 09:36:48 +02:00
committed by Robert Schmidt
parent 4b47d26ea2
commit 2bda52b054
7 changed files with 34 additions and 56 deletions
+3 -4
View File
@@ -69,8 +69,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint32_t preamble_shift2;
uint16_t preamble_index0=0,n_shift_ra=0,n_shift_ra_bar;
uint16_t d_start=0;
uint16_t numshift=0;
uint16_t *prach_root_sequence_map;
uint16_t numshift = 0;
uint8_t not_found;
int k=0;
uint16_t u;
@@ -221,7 +220,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (eNB) start_meas(&eNB->rx_prach);
prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
const uint16_t *prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
// PDP is oversampled, e.g. 1024 sample instead of 839
// Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839
NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139);
@@ -495,7 +494,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
new_dft = 0;
if (br_flag == 1) {
Xu=(c16_t *)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx];
Xu = eNB->X_u_br[ce_level][preamble_offset - first_nonzero_root_idx];
prach_ifft = prach_ifftp[prach_ifft_cnt++];
if (eNB->prach_vars_br.repetition_number[ce_level]==1) memset(prach_ifft,0,((N_ZC==839)?2048:256)*sizeof(int32_t));
+7 -6
View File
@@ -35,12 +35,13 @@
#include "PHY/phy_extern_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/lte/prach_utils.h"
#include "openair1/PHY/LTE_TRANSPORT/prach_extern.h"
const uint16_t NCS_unrestricted[16] = {0, 13, 15, 18, 22, 26, 32, 38, 46, 59, 76, 93, 119, 167, 279, 419};
const uint16_t NCS_restricted[15] = {15, 18, 22, 26, 32, 38, 46, 55, 68, 82, 100, 128, 158, 202, 237}; // high-speed case
const uint16_t NCS_4[7] = {2, 4, 6, 8, 10, 12, 15};
int16_t ru[2*839]; // quantized roots of unity
c16_t root_unit[839]; // quantized roots of unity
static uint32_t ZC_inv[839]; // multiplicative inverse for roots u
uint16_t du[838];
@@ -367,13 +368,13 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t s
return(prach_mask);
}
void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
frame_type_t frame_type,
uint32_t X_u[64][839]) {
c16_t X_u[64][839])
{
// Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
unsigned int k,inv_u,i,NCS=0,num_preambles;
int N_ZC;
@@ -495,7 +496,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
for (k=0; k<N_ZC; k++) {
// 420 is the multiplicative inverse of 2 (required since ru is exp[j 2\pi n])
X_u[i][k] = ((uint32_t *)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC];
X_u[i][k] = root_unit[(((k * (1 + (inv_u * k))) % N_ZC) * 420) % N_ZC];
}
}
@@ -525,8 +526,8 @@ void init_prach_tables(int N_ZC) {
// Compute quantized roots of unity
for (i=0; i<N_ZC; i++) {
ru[i<<1] = (int16_t)(floor(32767.0*cos(2*M_PI*(double)i/N_ZC)));
ru[1+(i<<1)] = (int16_t)(floor(32767.0*sin(2*M_PI*(double)i/N_ZC)));
root_unit[i].r = (int16_t)(floor(32767.0 * cos(2 * M_PI * (double)i / N_ZC)));
root_unit[i].i = (int16_t)(floor(32767.0 * sin(2 * M_PI * (double)i / N_ZC)));
#ifdef PRACH_DEBUG
if (i<16)
+3 -11
View File
@@ -43,22 +43,14 @@
extern const uint16_t NCS_unrestricted[16];
extern const uint16_t NCS_restricted[15];
extern const uint16_t NCS_4[7];
extern int16_t ru[2 * 839]; // quantized roots of unity
extern c16_t root_unit[839]; // quantized roots of unity
extern uint16_t du[838];
// This is table 5.7.1-4 from 36.211
extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7];
extern const uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138];
extern const uint16_t prach_root_sequence_map4[138];
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
+17 -30
View File
@@ -63,7 +63,6 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
int16_t Ncp;
uint8_t n_ra_prb;
uint16_t NCS;
uint16_t *prach_root_sequence_map;
uint16_t preamble_offset,preamble_shift;
uint16_t preamble_index0,n_shift_ra,n_shift_ra_bar;
uint16_t d_start=-1,numshift;
@@ -72,11 +71,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
//uint8_t f_ra,t1_ra;
uint16_t N_ZC = (prach_fmt<4)?839:139;
uint8_t not_found;
int k;
int16_t *Xu;
uint16_t u;
int32_t Xu_re,Xu_im;
uint16_t offset,offset2;
int prach_start;
int i, prach_len;
uint16_t first_nonzero_root_idx=0;
@@ -109,7 +104,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex, Nf);
prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
const uint16_t *prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
/*
// this code is not part of get_prach_prb_offset
if (frame_type == TDD) { // TDD
@@ -215,20 +210,6 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#endif
// nsymb = (frame_parms->Ncp==0) ? 14:12;
// subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL;
if (k<0)
k+=ue->frame_parms.ofdm_symbol_size;
k*=12;
k+=13;
Xu = (int16_t *)ue->X_u[preamble_offset-first_nonzero_root_idx];
/*
k+=(12*ue->frame_parms.first_carrier_offset);
if (k>(12*ue->frame_parms.ofdm_symbol_size))
k-=(12*ue->frame_parms.ofdm_symbol_size);
*/
k*=2;
switch (ue->frame_parms.N_RB_UL) {
case 6:
@@ -259,20 +240,26 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
break;
}
{
int k = (12 * n_ra_prb) - 6 * ue->frame_parms.N_RB_UL;
for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
if (offset2 >= N_ZC)
offset2 -= N_ZC;
if (k < 0)
k += ue->frame_parms.ofdm_symbol_size;
Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15;
prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15;
k *= 12;
k += 13;
c16_t *Xu_ue = ue->X_u[preamble_offset - first_nonzero_root_idx];
c16_t *complex_prachF = (c16_t *)prachF;
for (int offset = 0, offset2 = 0; offset < N_ZC; offset++, offset2 += preamble_shift) {
if (offset2 >= N_ZC)
offset2 -= N_ZC;
c16_t Xu = c16mulRealShift(*Xu_ue++, amp, 15);
complex_prachF[k++] = c16mulShift(Xu, root_unit[offset2], 15);
if (k==(12*2*ue->frame_parms.ofdm_symbol_size))
k=0;
if (k == 12 * ue->frame_parms.ofdm_symbol_size)
k = 0;
}
}
switch (prach_fmt) {
case 0:
Ncp = 3168;
@@ -1649,8 +1649,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
frame_type_t frame_type,
uint32_t X_u[64][839]);
c16_t X_u[64][839]);
void init_prach_tables(int N_ZC);
+1 -1
View File
@@ -640,7 +640,7 @@ typedef struct {
/// mbsfn reference symbols
uint32_t lte_gold_mbsfn_khz_1dot25_table[10][150];
uint32_t X_u[64][839];
c16_t X_u[64][839];
uint32_t high_speed_flag;
uint32_t perfect_ce;
+2 -2
View File
@@ -600,8 +600,8 @@ typedef struct PHY_VARS_eNB_s {
// PUCCH1a/b energy detection parameters for eMTC per CE-level
int pucch1ab_DTX_threshold_emtc[4];
uint32_t X_u[64][839];
uint32_t X_u_br[4][64][839];
c16_t X_u[64][839];
c16_t X_u_br[4][64][839];
uint8_t pbch_configured;
uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
char eNB_generate_rar;