some hardcoding removed in pbch detection still some left
This commit is contained in:
@@ -27,6 +27,59 @@ uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3,
|
|||||||
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32};
|
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32};
|
||||||
|
|
||||||
|
|
||||||
|
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp, uint8_t i_ssb, uint8_t half_frame_index)
|
||||||
|
{
|
||||||
|
|
||||||
|
int mu = fp->numerology_index;
|
||||||
|
int symbol = 0;
|
||||||
|
uint8_t n, n_temp;
|
||||||
|
nr_ssb_type_e type = fp->ssb_type;
|
||||||
|
int case_AC[2] = {2,8};
|
||||||
|
int case_BD[4] = {4,8,16,20};
|
||||||
|
int case_E[8] = {8, 12, 16, 20, 32, 36, 40, 44};
|
||||||
|
|
||||||
|
switch(mu) {
|
||||||
|
|
||||||
|
case NR_MU_0: // case A
|
||||||
|
n = i_ssb >> 1;
|
||||||
|
symbol = case_AC[i_ssb % 2] + 14*n;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_MU_1:
|
||||||
|
if (type == 1){ // case B
|
||||||
|
n = i_ssb >> 2;
|
||||||
|
symbol = case_BD[i_ssb % 4] + 28*n;
|
||||||
|
}
|
||||||
|
if (type == 2){ // case C
|
||||||
|
n = i_ssb >> 1;
|
||||||
|
symbol = case_AC[i_ssb % 2] + 14*n;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_MU_3: // case D
|
||||||
|
n_temp = i_ssb >> 2;
|
||||||
|
n = n_temp + (n_temp >> 2);
|
||||||
|
symbol = case_BD[i_ssb % 4] + 28*n;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NR_MU_4: // case E
|
||||||
|
n_temp = i_ssb >> 3;
|
||||||
|
n = n_temp + (n_temp >> 2);
|
||||||
|
symbol = case_E[i_ssb % 8] + 56*n;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (half_frame_index)
|
||||||
|
symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe);
|
||||||
|
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
|
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
|
||||||
int mu,
|
int mu,
|
||||||
int Ncp,
|
int Ncp,
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ void phy_config_request(PHY_Config_t *phy_config);
|
|||||||
|
|
||||||
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
|
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
|
||||||
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
|
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
|
||||||
|
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp, uint8_t i_ssb, uint8_t half_frame_index);
|
||||||
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
|
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
|
||||||
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset);
|
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset);
|
||||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
|
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned char symbol)
|
unsigned char symbol,
|
||||||
|
int dmrss)
|
||||||
{
|
{
|
||||||
int pilot[200] __attribute__((aligned(16)));
|
int pilot[200] __attribute__((aligned(16)));
|
||||||
unsigned char aarx;
|
unsigned char aarx;
|
||||||
@@ -44,7 +45,6 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
unsigned int pilot_cnt;
|
unsigned int pilot_cnt;
|
||||||
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
|
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
|
||||||
int ch_offset,symbol_offset;
|
int ch_offset,symbol_offset;
|
||||||
int dmrss;
|
|
||||||
|
|
||||||
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
|
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
|
||||||
|
|
||||||
@@ -59,18 +59,14 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||||
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size;
|
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size;
|
||||||
|
|
||||||
if (ue->is_synchronized ==0 ) dmrss = symbol-1;
|
|
||||||
else dmrss = symbol-5;
|
|
||||||
|
|
||||||
if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
|
if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage
|
||||||
ch_offset = ue->frame_parms.ofdm_symbol_size ;
|
ch_offset = ue->frame_parms.ofdm_symbol_size ;
|
||||||
else
|
else
|
||||||
ch_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
ch_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
||||||
|
|
||||||
AssertFatal((symbol > 0 && symbol < 4 && ue->is_synchronized == 0) ||
|
AssertFatal(dmrss >= 0 && dmrss < 3,
|
||||||
(symbol > 4 && symbol < 8 && ue->is_synchronized == 1),
|
"symbol %d is illegal for PBCH DM-RS \n",
|
||||||
"symbol %d is illegal for PBCH DM-RS (is_synchronized %d)\n",
|
dmrss);
|
||||||
symbol,ue->is_synchronized);
|
|
||||||
|
|
||||||
symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned char symbol);
|
unsigned char symbol,
|
||||||
|
int dmrss);
|
||||||
|
|
||||||
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mod
|
|||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
#endif
|
#endif
|
||||||
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
||||||
nr_pbch_channel_estimation(ue,0,0,i);
|
nr_pbch_channel_estimation(ue,0,0,i,i-pbch_initial_symbol);
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "PHY/phy_extern_nr_ue.h"
|
#include "PHY/phy_extern_nr_ue.h"
|
||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||||
|
#include "PHY/INIT/phy_init.h"
|
||||||
|
|
||||||
//#define DEBUG_PBCH 1
|
//#define DEBUG_PBCH 1
|
||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
@@ -442,7 +443,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
|||||||
int symbol_offset=1;
|
int symbol_offset=1;
|
||||||
|
|
||||||
if (ue->is_synchronized > 0)
|
if (ue->is_synchronized > 0)
|
||||||
symbol_offset=4;
|
symbol_offset=2;
|
||||||
else
|
else
|
||||||
symbol_offset=0;
|
symbol_offset=0;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "SCHED/fapi_l1.h"
|
#include "SCHED/fapi_l1.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
|
#include "PHY/INIT/phy_init.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
@@ -77,60 +78,6 @@ int return_ssb_type(nfapi_config_request_t *cfg)
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// First SSB starting symbol candidate is used and type B is chosen for 30kHz SCS
|
|
||||||
|
|
||||||
int nr_get_ssb_start_symbol(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp, uint8_t i_ssb)
|
|
||||||
{
|
|
||||||
|
|
||||||
int mu = cfg->subframe_config.numerology_index_mu.value;
|
|
||||||
int symbol = 0;
|
|
||||||
uint8_t n, n_temp;
|
|
||||||
nr_ssb_type_e type = fp->ssb_type;
|
|
||||||
int case_AC[2] = {2,8};
|
|
||||||
int case_BD[4] = {4,8,16,20};
|
|
||||||
int case_E[8] = {8, 12, 16, 20, 32, 36, 40, 44};
|
|
||||||
|
|
||||||
|
|
||||||
switch(mu) {
|
|
||||||
|
|
||||||
case NR_MU_0: // case A
|
|
||||||
n = i_ssb >> 1;
|
|
||||||
symbol = case_AC[i_ssb % 2] + 14*n;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_MU_1:
|
|
||||||
if (type == 1){ // case B
|
|
||||||
n = i_ssb >> 2;
|
|
||||||
symbol = case_BD[i_ssb % 4] + 28*n;
|
|
||||||
}
|
|
||||||
if (type == 2){ // case C
|
|
||||||
n = i_ssb >> 1;
|
|
||||||
symbol = case_AC[i_ssb % 2] + 14*n;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_MU_3: // case D
|
|
||||||
n_temp = i_ssb >> 2;
|
|
||||||
n = n_temp + (n_temp >> 2);
|
|
||||||
symbol = case_BD[i_ssb % 4] + 28*n;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_MU_4: // case E
|
|
||||||
n_temp = i_ssb >> 3;
|
|
||||||
n = n_temp + (n_temp >> 2);
|
|
||||||
symbol = case_E[i_ssb % 8] + 56*n;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
|
||||||
AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cfg->sch_config.half_frame_index.value)
|
|
||||||
symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe);
|
|
||||||
|
|
||||||
return symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp) {
|
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp) {
|
||||||
fp->ssb_start_subcarrier = (12 * cfg->sch_config.n_ssb_crb.value + cfg->sch_config.ssb_subcarrier_offset.value)/(1<<cfg->subframe_config.numerology_index_mu.value);
|
fp->ssb_start_subcarrier = (12 * cfg->sch_config.n_ssb_crb.value + cfg->sch_config.ssb_subcarrier_offset.value)/(1<<cfg->subframe_config.numerology_index_mu.value);
|
||||||
@@ -158,7 +105,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
|||||||
ssb_index = i + 2*rel_slot; // computing the ssb_index
|
ssb_index = i + 2*rel_slot; // computing the ssb_index
|
||||||
if ((fp->L_ssb >> ssb_index) & 0x01) { // generating the ssb only if the bit of L_ssb at current ssb index is 1
|
if ((fp->L_ssb >> ssb_index) & 0x01) { // generating the ssb only if the bit of L_ssb at current ssb index is 1
|
||||||
|
|
||||||
int ssb_start_symbol_abs = nr_get_ssb_start_symbol(cfg, fp, ssb_index); // computing the starting symbol for current ssb
|
int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp, ssb_index, n_hf); // computing the starting symbol for current ssb
|
||||||
ssb_start_symbol = ssb_start_symbol_abs % 14; // start symbol wrt slot
|
ssb_start_symbol = ssb_start_symbol_abs % 14; // start symbol wrt slot
|
||||||
|
|
||||||
nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier
|
nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier
|
||||||
|
|||||||
@@ -5109,7 +5109,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
|
|||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
#endif
|
#endif
|
||||||
nr_pbch_channel_estimation(ue,0,0,5+i);
|
nr_pbch_channel_estimation(ue,0,0,5+i,i);
|
||||||
#if UE_TIMING_TRACE
|
#if UE_TIMING_TRACE
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -378,6 +378,8 @@ int main(int argc, char **argv)
|
|||||||
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||||
phy_init_nr_gNB(gNB,0,0);
|
phy_init_nr_gNB(gNB,0,0);
|
||||||
|
|
||||||
|
uint8_t n_hf = gNB_config->sch_config.half_frame_index.value;
|
||||||
|
|
||||||
double fs,bw,scs,eps;
|
double fs,bw,scs,eps;
|
||||||
|
|
||||||
switch (mu) {
|
switch (mu) {
|
||||||
@@ -494,7 +496,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
nr_common_signal_procedures (gNB,frame,slot);
|
nr_common_signal_procedures (gNB,frame,slot);
|
||||||
|
|
||||||
//TODO: loop over slots
|
|
||||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||||
if (gNB_config->subframe_config.dl_cyclic_prefix_type.value == 1) {
|
if (gNB_config->subframe_config.dl_cyclic_prefix_type.value == 1) {
|
||||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||||
@@ -605,8 +606,12 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UE->rx_offset=0;
|
UE->rx_offset=0;
|
||||||
|
|
||||||
|
uint8_t ssb_index = 0;
|
||||||
|
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
|
||||||
|
|
||||||
for (int i=5; i<8; i++) {
|
int start_symbol = nr_get_ssb_start_symbol(frame_parms, ssb_index, n_hf);
|
||||||
|
for (int i=start_symbol+1; i<start_symbol+4; i++) {
|
||||||
nr_slot_fep(UE,
|
nr_slot_fep(UE,
|
||||||
i,
|
i,
|
||||||
0,
|
0,
|
||||||
@@ -615,7 +620,7 @@ int main(int argc, char **argv)
|
|||||||
NR_PBCH_EST);
|
NR_PBCH_EST);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nr_pbch_detection(UE,5,0); // start pbch detection from symbol 5 and mode 0
|
ret = nr_pbch_detection(UE,start_symbol+1,0);
|
||||||
|
|
||||||
if (ret==0) {
|
if (ret==0) {
|
||||||
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
|
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
|
||||||
|
|||||||
Reference in New Issue
Block a user