use common channel level for PBCH

This commit is contained in:
francescomani
2025-08-19 16:18:41 +02:00
parent 92dc641e98
commit a95a32c2f6
3 changed files with 14 additions and 35 deletions
+8 -30
View File
@@ -38,6 +38,7 @@
#include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h> #include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h>
#include <openair1/PHY/TOOLS/phy_scope_interface.h> #include <openair1/PHY/TOOLS/phy_scope_interface.h>
#include "openair1/PHY/NR_REFSIG/nr_refsig_common.h" #include "openair1/PHY/NR_REFSIG/nr_refsig_common.h"
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
#include "instrumentation.h" #include "instrumentation.h"
//#define DEBUG_PBCH //#define DEBUG_PBCH
//#define DEBUG_PBCH_ENCODING //#define DEBUG_PBCH_ENCODING
@@ -201,31 +202,6 @@ static uint16_t nr_pbch_extract(uint32_t rxdataF_sz,
return(0); return(0);
} }
//__m128i avg128;
//compute average channel_level on each (TX,RX) antenna pair
int nr_pbch_channel_level(struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
const NR_DL_FRAME_PARMS *frame_parms,
int nb_re)
{
int32_t avg2 = 0;
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
simde__m128i *dl_ch128 = (simde__m128i *)dl_ch_estimates_ext[aarx];
//compute average level
int32_t avg1 = simde_mm_average(dl_ch128, nb_re, 0, nb_re);
if (avg1>avg2)
avg2 = avg1;
//LOG_I(PHY,"Channel level : %d, %d\n",avg1, avg2);
}
return(avg2);
}
void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL], void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL],
struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL], struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
int nb_re, int nb_re,
@@ -346,7 +322,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
const struct complex16 rxdataF[][rxdataFSize]) const struct complex16 rxdataF[][rxdataFSize])
{ {
TracyCZone(ctx, true); TracyCZone(ctx, true);
int max_h=0;
int symbol; int symbol;
uint8_t Lmax=frame_parms->Lmax; uint8_t Lmax=frame_parms->Lmax;
int M = NR_POLAR_PBCH_E; int M = NR_POLAR_PBCH_E;
@@ -390,11 +365,14 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
LOG_I(PHY,"[PHY] PBCH starting channel_level\n"); LOG_I(PHY,"[PHY] PBCH starting channel_level\n");
#endif #endif
int max_h = 0;
if (symbol == 1) { if (symbol == 1) {
max_h = nr_pbch_channel_level(dl_ch_estimates_ext, int avg[frame_parms->nb_antennas_rx];
frame_parms, nr_channel_level(0, PBCH_MAX_RE_PER_SYMBOL, dl_ch_estimates_ext, frame_parms->nb_antennas_rx, 1, avg, nb_re);
nb_re); max_h = avg[0];
log2_maxh = 3+(log2_approx(max_h)/2); for (int i = 1; i < frame_parms->nb_antennas_rx; i++)
max_h = cmax(avg[i], max_h);
log2_maxh = 3 + (log2_approx(max_h) / 2);
} }
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
+6 -2
View File
@@ -25,6 +25,7 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/TOOLS/phy_scope_interface.h" #include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
// #define DEBUG_PSBCH // #define DEBUG_PSBCH
@@ -158,8 +159,11 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue,
int max_h = 0; int max_h = 0;
if (symbol == 0) { if (symbol == 0) {
max_h = nr_pbch_channel_level(dl_ch_estimates_ext, frame_parms, nb_re); int avg[frame_parms->nb_antennas_rx];
// log2_maxh = 3+(log2_approx(max_h)/2); nr_channel_level(0, PBCH_MAX_RE_PER_SYMBOL, dl_ch_estimates_ext, frame_parms->nb_antennas_rx, 1, avg, nb_re);
max_h = avg[0];
for (int i = 1; i < frame_parms->nb_antennas_rx; i++)
max_h = cmax(avg[i], max_h);
log2_maxh = 5 + (log2_approx(max_h) / 2); // LLR32 crc error. LLR 16 CRC works log2_maxh = 5 + (log2_approx(max_h) / 2); // LLR32 crc error. LLR 16 CRC works
} }
#ifdef DEBUG_PSBCH #ifdef DEBUG_PSBCH
@@ -346,9 +346,6 @@ void nr_tx_psbch(PHY_VARS_NR_UE *UE, uint32_t frame_tx, uint32_t slot_tx, sl_nr_
nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frames); nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frames);
// Reuse already existing PBCH functions // Reuse already existing PBCH functions
int nr_pbch_channel_level(struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
const NR_DL_FRAME_PARMS *frame_parms,
int nb_re);
void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL], void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL],
struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL], struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
int nb_re, int nb_re,