Merge branch 'develop' into ldpc-decoder-memory
This commit is contained in:
@@ -121,7 +121,7 @@ int test_ldpc(short max_iterations,
|
||||
sigma = 1.0/sqrt(2*SNR);
|
||||
opp_enabled=1;
|
||||
//short test_input[block_length];
|
||||
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
|
||||
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
|
||||
//short *c; //padded codeword
|
||||
unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length];
|
||||
memset(estimated_output, 0, sizeof(estimated_output));
|
||||
|
||||
@@ -72,10 +72,10 @@ unsigned int crcbit (unsigned char * inputptr,
|
||||
unsigned int i, crc = 0, c;
|
||||
|
||||
while (octetlen-- > 0) {
|
||||
c = (*inputptr++) << 24;
|
||||
c = ((unsigned int)(*inputptr++)) << 24;
|
||||
|
||||
for (i = 8; i != 0; i--) {
|
||||
if ((1 << 31) & (c ^ crc))
|
||||
if ((1U << 31) & (c ^ crc))
|
||||
crc = (crc << 1) ^ poly;
|
||||
else
|
||||
crc <<= 1;
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef struct {
|
||||
/// Number of "Filler" bits
|
||||
uint32_t F;
|
||||
/// LDPC-code outputs
|
||||
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS];
|
||||
} encoder_implemparams_t;
|
||||
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
||||
typedef void(*nrLDPC_initcallfunc_t)(t_nrLDPC_dec_params *p_decParams, int8_t *p_llr, int8_t *p_out);
|
||||
|
||||
@@ -63,11 +63,6 @@ int32_t nr_segmentation(unsigned char *input_buffer,
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((*C)>MAX_NUM_NR_DLSCH_SEGMENTS) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Find K+
|
||||
Kprime = Bprime/(*C);
|
||||
|
||||
|
||||
+31
-22
@@ -117,12 +117,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
|
||||
gNB->bad_pucch = 0;
|
||||
|
||||
// ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK)
|
||||
int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1;
|
||||
|
||||
for (int slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
|
||||
AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t));
|
||||
LOG_D(PHY,"pdcch_dmrs[%d][%d] %p\n",slot,symb,pdcch_dmrs[slot][symb]);
|
||||
AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
}
|
||||
@@ -136,16 +139,19 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
gNB->nr_gold_pdsch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
|
||||
uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs;
|
||||
|
||||
// ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK)
|
||||
int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1;
|
||||
for (int slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **));
|
||||
AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *));
|
||||
pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *));
|
||||
AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) {
|
||||
pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
for (int q=0; q<nb_codewords; q++) {
|
||||
pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q);
|
||||
}
|
||||
}
|
||||
@@ -158,6 +164,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
|
||||
uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs;
|
||||
|
||||
// ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK)
|
||||
int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1;
|
||||
for(int nscid=0; nscid<2; nscid++) {
|
||||
pusch_dmrs[nscid] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
|
||||
AssertFatal(pusch_dmrs[nscid]!=NULL, "NR init: pusch_dmrs for nscid %d - malloc failed\n", nscid);
|
||||
@@ -167,7 +175,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
AssertFatal(pusch_dmrs[nscid][slot]!=NULL, "NR init: pusch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(pusch_dmrs[nscid][slot][symb]!=NULL, "NR init: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
}
|
||||
}
|
||||
@@ -182,12 +190,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
|
||||
AssertFatal(csi_rs!=NULL, "NR init: csi reference signal malloc failed\n");
|
||||
|
||||
// ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32)
|
||||
int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1;
|
||||
|
||||
for (int slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
|
||||
AssertFatal(csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot);
|
||||
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
}
|
||||
}
|
||||
@@ -196,6 +207,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
|
||||
for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) {
|
||||
gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
|
||||
gNB->nr_srs_info[id]->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t));
|
||||
gNB->nr_srs_info[id]->srs_generated_signal = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
|
||||
gNB->nr_srs_info[id]->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t));
|
||||
gNB->nr_srs_info[id]->srs_received_signal = (int32_t **)malloc16(Prx*sizeof(int32_t*));
|
||||
@@ -314,9 +326,10 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(pdcch_dmrs);
|
||||
|
||||
uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs;
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
|
||||
for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
for (int q = 0; q < nb_codewords; q++)
|
||||
free_and_zero(pdsch_dmrs[slot][symb][q]);
|
||||
free_and_zero(pdsch_dmrs[slot][symb]);
|
||||
}
|
||||
@@ -351,6 +364,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]);
|
||||
}
|
||||
free_and_zero(gNB->nr_srs_info[id]->sc_list);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal);
|
||||
free_and_zero(gNB->nr_srs_info[id]->noise_power);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_received_signal);
|
||||
@@ -559,9 +573,10 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) {
|
||||
uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
msg->num_pdsch_slot = 0;
|
||||
|
||||
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
|
||||
for (int j=0; j<2; j++) {
|
||||
for (int j=0; j<num_cw; j++) {
|
||||
msg->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
|
||||
AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
|
||||
}
|
||||
@@ -573,9 +588,10 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
|
||||
const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++)
|
||||
for (int j=0; j<2; j++)
|
||||
free_gNB_dlsch(&msg->dlsch[i][j], grid_size);
|
||||
for (int j=0; j<num_cw; j++)
|
||||
free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp);
|
||||
}
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
@@ -600,22 +616,16 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
|
||||
|
||||
for (int j=0; j<2; j++) {
|
||||
// ULSCH for data
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL);
|
||||
|
||||
if (!gNB->ulsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get gNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
gNB->ulsch[i] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL);
|
||||
|
||||
if (!gNB->ulsch[i]) {
|
||||
LOG_E(PHY,"Can't get gNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gNB->rx_total_gain_dB=130;
|
||||
|
||||
|
||||
//fp->pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
}
|
||||
|
||||
@@ -630,6 +640,5 @@ void reset_nr_transport(PHY_VARS_gNB *gNB)
|
||||
free_gNB_srs(gNB->srs[i]);
|
||||
|
||||
for (int i=0; i<gNB->number_of_nr_ulsch_max; i++)
|
||||
for (int j=0; j<2; j++)
|
||||
free_gNB_ulsch(&gNB->ulsch[i][j], fp->N_RB_UL);
|
||||
free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ extern uint16_t beta_cqi[16];
|
||||
*/
|
||||
void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
|
||||
const NR_DL_FRAME_PARMS *const fp) {
|
||||
|
||||
AssertFatal( pdsch, "pdsch==0" );
|
||||
pdsch->pmi_ext = (uint8_t *)malloc16_clear( fp->N_RB_DL );
|
||||
pdsch->llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) );
|
||||
@@ -154,21 +155,6 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp
|
||||
free_and_zero(pdsch->dl_ch_ptrs_estimates_ext);
|
||||
}
|
||||
|
||||
void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
const NR_DL_FRAME_PARMS *const fp) {
|
||||
AssertFatal( pusch, "pusch==0" );
|
||||
|
||||
for (int i=0; i<NR_MAX_NB_LAYERS; i++) {
|
||||
pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(NR_MAX_PUSCH_ENCODED_LENGTH*sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
|
||||
void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch)
|
||||
{
|
||||
for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
|
||||
free_and_zero(pusch->txdataF_layers[i]);
|
||||
}
|
||||
|
||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
{
|
||||
// create shortcuts
|
||||
@@ -176,13 +162,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
NR_UE_COMMON *const common_vars = &ue->common_vars;
|
||||
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
||||
NR_UE_PRACH **const prach_vars = ue->prach_vars;
|
||||
int i,j,k,l,slot,symb;
|
||||
|
||||
NR_UE_SRS **const srs_vars = ue->srs_vars;
|
||||
|
||||
int i,j,k,l,slot,symb,q;
|
||||
int gNB_id;
|
||||
int th_id;
|
||||
uint32_t ****pusch_dmrs;
|
||||
|
||||
LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx);
|
||||
|
||||
phy_init_nr_top(ue);
|
||||
// many memory allocation sizes are hard coded
|
||||
AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
|
||||
@@ -210,15 +198,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
// init NR modulation lookup tables
|
||||
nr_generate_modulation_table();
|
||||
|
||||
/////////////////////////PUSCH init/////////////////////////
|
||||
///////////
|
||||
for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
ue->pusch_vars[th_id][gNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH));
|
||||
phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][gNB_id], fp );
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////PUCCH init/////////////////////////
|
||||
///////////
|
||||
for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
@@ -234,21 +213,21 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
|
||||
/////////////////////////PUSCH DMRS init/////////////////////////
|
||||
///////////
|
||||
ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
|
||||
pusch_dmrs = ue->nr_gold_pusch_dmrs;
|
||||
|
||||
// ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK)
|
||||
int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1;
|
||||
|
||||
ue->nr_gold_pusch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
|
||||
uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs;
|
||||
|
||||
for (slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
pusch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **));
|
||||
pusch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
|
||||
AssertFatal(pusch_dmrs[slot]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
for (symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pusch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *));
|
||||
pusch_dmrs[slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(pusch_dmrs[slot][symb]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
|
||||
for (q=0; q<NR_MAX_NB_CODEWORDS; q++) {
|
||||
pusch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
AssertFatal(pusch_dmrs[slot][symb][q]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +276,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
}
|
||||
}
|
||||
|
||||
// ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK)
|
||||
int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1;
|
||||
//PDCCH DMRS init (gNB offset = 0)
|
||||
ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
|
||||
uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0];
|
||||
@@ -307,11 +288,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
}
|
||||
}
|
||||
|
||||
// ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK)
|
||||
int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1;
|
||||
|
||||
//PDSCH DMRS init (eNB offset = 0)
|
||||
ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
|
||||
uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0];
|
||||
@@ -320,12 +304,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **));
|
||||
AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot);
|
||||
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *));
|
||||
pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *));
|
||||
AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) {
|
||||
pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
for (int q=0; q<nb_codewords; q++) {
|
||||
pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t));
|
||||
AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q);
|
||||
}
|
||||
}
|
||||
@@ -347,6 +332,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
|
||||
srs_vars[gNB_id]->active = false;
|
||||
ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
|
||||
ue->nr_srs_info->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t));
|
||||
ue->nr_srs_info->srs_generated_signal = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
|
||||
ue->nr_srs_info->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t));
|
||||
ue->nr_srs_info->srs_received_signal = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
@@ -445,29 +431,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
}
|
||||
}
|
||||
|
||||
// PBCH
|
||||
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
|
||||
// RACH
|
||||
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
|
||||
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
}
|
||||
}
|
||||
|
||||
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
|
||||
}
|
||||
|
||||
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
||||
@@ -502,16 +469,12 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
phy_term_nr_ue_PUSCH(ue->pusch_vars[th_id][gNB_id]);
|
||||
free_and_zero(ue->pusch_vars[th_id][gNB_id]);
|
||||
free_and_zero(ue->pucch_vars[th_id][gNB_id]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
|
||||
for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb][q]);
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot]);
|
||||
@@ -545,9 +508,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pdcch[0]);
|
||||
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
for (int slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
for (int q=0; q<nb_codewords; q++)
|
||||
free_and_zero(ue->nr_gold_pdsch[0][slot][symb][q]);
|
||||
free_and_zero(ue->nr_gold_pdsch[0][slot][symb]);
|
||||
}
|
||||
@@ -629,6 +593,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]);
|
||||
}
|
||||
free_and_zero(ue->nr_srs_info->sc_list);
|
||||
free_and_zero(ue->nr_srs_info->srs_generated_signal);
|
||||
free_and_zero(ue->nr_srs_info->noise_power);
|
||||
free_and_zero(ue->nr_srs_info->srs_received_signal);
|
||||
@@ -640,25 +605,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
|
||||
free_and_zero(ue->srs_vars[gNB_id]);
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext[i]);
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->llr);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->decoded_output);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]);
|
||||
|
||||
free_and_zero(ue->prach_vars[gNB_id]->prachF);
|
||||
@@ -683,7 +629,8 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||
for (int j = 0; j < 2; j++) {
|
||||
for (int k = 0; k < RX_NB_TH_MAX; k++) {
|
||||
free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL);
|
||||
free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL);
|
||||
if (j==0)
|
||||
free_nr_ue_ulsch(&ue->ulsch[k][i], N_RB_DL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,15 +641,19 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||
free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL);
|
||||
}
|
||||
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||
{
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue) {
|
||||
|
||||
int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1;
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||
for (int j=0; j<2; j++) {
|
||||
for (int j=0; j<num_codeword; j++) {
|
||||
for (int k=0; k<RX_NB_TH_MAX; k++) {
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n");
|
||||
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]);
|
||||
AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n");
|
||||
LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]);
|
||||
if (j==0) {
|
||||
AssertFatal((ue->ulsch[k][i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n");
|
||||
LOG_D(PHY,"ulsch[%d][%d] => %p\n",k,i,ue->ulsch[k][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,6 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
||||
|
||||
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
|
||||
|
||||
|
||||
if (Ncp == NFAPI_CP_EXTENDED)
|
||||
AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
|
||||
|
||||
|
||||
@@ -320,98 +320,16 @@ void nr_layer_mapping(int16_t **mod_symbs,
|
||||
}
|
||||
}
|
||||
|
||||
void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
|
||||
void nr_ue_layer_mapping(int16_t *mod_symbs,
|
||||
uint8_t n_layers,
|
||||
uint16_t n_symbs,
|
||||
int16_t **tx_layers)
|
||||
{
|
||||
int16_t *mod_symbs;
|
||||
int16_t **tx_layers) {
|
||||
|
||||
switch (n_layers) {
|
||||
|
||||
case 1:
|
||||
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
|
||||
for (int i=0; i<n_symbs; i++) {
|
||||
tx_layers[0][i<<1] = (mod_symbs[i<<1]*AMP)>>15;
|
||||
tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs/n_layers; i++) {
|
||||
for (int l=0; l<n_layers; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs>>1; i++)
|
||||
for (int l=0; l<2; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[((i<<1)+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<1)+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
|
||||
mod_symbs = (int16_t *)ulsch_ue[1]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs/3; i++)
|
||||
for (int l=2; l<5; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
for (int q=0; q<2; q++) {
|
||||
mod_symbs = (int16_t *)ulsch_ue[q]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs/3; i++)
|
||||
for (int l=0; l<3; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
mod_symbs = (int16_t *)ulsch_ue[1]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs/3; i++)
|
||||
for (int l=0; l<3; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
|
||||
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs/4; i++)
|
||||
for (int l=3; l<7; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (int q=0; q<2; q++) {
|
||||
mod_symbs = (int16_t *)ulsch_ue[q]->d_mod;
|
||||
|
||||
for (int i=0; i<n_symbs>>2; i++)
|
||||
for (int l=0; l<3; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid number of layers %d\n", n_layers);
|
||||
for (int i=0; i<n_symbs/n_layers; i++) {
|
||||
for (int l=0; l<n_layers; l++) {
|
||||
tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15;
|
||||
tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ void nr_layer_mapping(int16_t **mod_symbs,
|
||||
@param[out] tx_layers, modulated symbols for each layer
|
||||
*/
|
||||
|
||||
void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
|
||||
void nr_ue_layer_mapping(int16_t *mod_symbs,
|
||||
uint8_t n_layers,
|
||||
uint16_t n_symbs,
|
||||
int16_t **tx_layers);
|
||||
|
||||
@@ -184,7 +184,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
|
||||
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
int ch_offset = fp->ofdm_symbol_size * symbol;
|
||||
int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size;
|
||||
int N_RB_UL = gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu.rb_size;
|
||||
|
||||
rx_power_tot[ulsch_id] = 0;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
uint8_t reset;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
|
||||
int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1;
|
||||
|
||||
for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
@@ -67,7 +68,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
reset = 1;
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid<<1));
|
||||
LOG_D(PHY,"PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n",slot,symb,Nid,x2);
|
||||
for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
for (uint32_t n=0; n<pdcch_dmrs_init_length; n++) {
|
||||
pdcch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
@@ -81,11 +82,12 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
{
|
||||
|
||||
uint32_t x1, x2;
|
||||
uint8_t reset, q;
|
||||
uint8_t reset;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs;
|
||||
|
||||
uint16_t N_n_scid[NR_MAX_NB_CODEWORDS]={Nid, Nid}; // Not correct, appropriate scrambling IDs have to be updated to support DCI 1_1
|
||||
int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1;
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
uint16_t N_n_scid[2]={Nid, Nid};
|
||||
uint8_t n_scid=0; // again works only for 1_0
|
||||
for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
|
||||
@@ -93,13 +95,13 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
reset = 1;
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid));
|
||||
LOG_D(PHY,"PDSCH DMRS slot %d, symb %d x2 %x, N_n_scid %d,n_scid %d\n",slot,symb,x2,N_n_scid[n_scid],n_scid);
|
||||
for (uint32_t n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
for (uint32_t n=0; n<pdsch_dmrs_init_length; n++) {
|
||||
pdsch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
for (q = 1; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
memcpy(pdsch_dmrs[slot][symb][q],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD);
|
||||
if(nb_codewords>1)
|
||||
memcpy(pdsch_dmrs[slot][symb][1],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*pdsch_dmrs_init_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,6 +115,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) {
|
||||
unsigned int nid;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
unsigned short l;
|
||||
int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1;
|
||||
|
||||
for (nscid=0; nscid<2; nscid++) {
|
||||
nid = Nid[nscid];
|
||||
@@ -122,7 +125,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) {
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*ns+l+1) * ((nid<<1)+1) +((nid<<1)+nscid));
|
||||
LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n",ns,l,x2);
|
||||
|
||||
for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
for (n=0; n<pusch_dmrs_init_length; n++) {
|
||||
gNB->nr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
@@ -138,6 +141,7 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
|
||||
uint32_t x1, x2;
|
||||
uint8_t reset;
|
||||
int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1;
|
||||
|
||||
for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
@@ -145,7 +149,7 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
reset = 1;
|
||||
x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
|
||||
|
||||
for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) {
|
||||
for (uint32_t n=0; n<csi_dmrs_init_length; n++) {
|
||||
csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
|
||||
unsigned char ns,l;
|
||||
unsigned int n,x1,x2,x2tmp0;
|
||||
uint8_t reset;
|
||||
int pdcch_dmrs_init_length = (((ue->frame_parms.N_RB_DL<<1)*3)>>5)+1;
|
||||
|
||||
for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
|
||||
|
||||
@@ -64,9 +65,9 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
|
||||
|
||||
reset = 1;
|
||||
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
|
||||
x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit
|
||||
x2 = (x2tmp0+(nid<<1))%(1U<<31); //cinit
|
||||
|
||||
for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
for (n=0; n<pdcch_dmrs_init_length; n++) {
|
||||
ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
@@ -77,28 +78,28 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
|
||||
void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
|
||||
unsigned short *n_idDMRS)
|
||||
{
|
||||
unsigned char l;
|
||||
unsigned int n,x1,x2,x2tmp0,ns;
|
||||
int nscid;
|
||||
|
||||
unsigned int x1,x2,x2tmp0;
|
||||
unsigned int nid;
|
||||
uint8_t reset;
|
||||
|
||||
int pdsch_dmrs_init_length = ((ue->frame_parms.N_RB_DL*12)>>5)+1;
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
/// to be updated from higher layer
|
||||
//unsigned short lbar = 0;
|
||||
|
||||
for (nscid=0; nscid<2; nscid++) {
|
||||
for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
|
||||
for (int nscid=0; nscid<nb_codewords; nscid++) {
|
||||
for (int ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
|
||||
|
||||
nid = n_idDMRS[nscid];
|
||||
|
||||
for (l=0; l<ue->frame_parms.symbols_per_slot; l++) {
|
||||
for (int l=0; l<ue->frame_parms.symbols_per_slot; l++) {
|
||||
|
||||
reset = 1;
|
||||
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
|
||||
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
|
||||
x2 = (x2tmp0+(nid<<1)+nscid)%(1U<<31); //cinit
|
||||
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
|
||||
|
||||
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
for (int n=0; n<pdsch_dmrs_init_length; n++) {
|
||||
ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
@@ -112,9 +113,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
|
||||
uint8_t n_scid)
|
||||
{
|
||||
uint32_t x1, x2, n;
|
||||
uint8_t reset, slot, symb, q;
|
||||
uint8_t reset, slot, symb;
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
uint32_t ****pusch_dmrs = ue->nr_gold_pusch_dmrs;
|
||||
uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs;
|
||||
int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1;
|
||||
|
||||
for (slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
|
||||
@@ -123,13 +125,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
|
||||
reset = 1;
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid));
|
||||
|
||||
for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
pusch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
for (n=0; n<pusch_dmrs_init_length; n++) {
|
||||
pusch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
for (q = 1; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
memcpy(pusch_dmrs[slot][symb][q],pusch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB,
|
||||
int32_t **txdataF = gNB->common_vars.txdataF;
|
||||
int txdataF_offset = slot*frame_parms.samples_per_slot_wCP;
|
||||
uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot];
|
||||
int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));;
|
||||
//*8(max allocation per RB)*2(QPSK))
|
||||
int csi_rs_length = frame_parms.N_RB_DL<<4;
|
||||
int16_t mod_csi[frame_parms.symbols_per_slot][csi_rs_length>>1] __attribute__((aligned(16)));;
|
||||
uint16_t b = csi_params.freq_domain;
|
||||
uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length;
|
||||
uint8_t size, ports, kprime, lprime, i, gs;
|
||||
@@ -59,7 +61,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB,
|
||||
for (uint8_t symb=0; symb<frame_parms.symbols_per_slot; symb++) {
|
||||
reset = 1;
|
||||
x2 = ((1<<10) * (frame_parms.symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
|
||||
for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) {
|
||||
for (uint32_t n=0; n<(csi_rs_length>>5)+1; n++) {
|
||||
gold_csi_rs[symb][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
@@ -79,10 +79,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs;
|
||||
int16_t **tx_layers = (int16_t**)dlsch->txdataF;
|
||||
int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding;
|
||||
int8_t Wf[2], Wt[2], l0, l_prime, l_overline, delta;
|
||||
uint8_t dmrs_Type = rel15->dmrsConfigType;
|
||||
int nb_re_dmrs;
|
||||
@@ -100,6 +98,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers;
|
||||
uint8_t Qm = rel15->qamModOrder[0];
|
||||
uint32_t encoded_length = nb_re*Qm;
|
||||
uint32_t scrambled_output[rel15->NrOfCodewords][(encoded_length>>5)+1];
|
||||
int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16)));
|
||||
|
||||
/* PTRS */
|
||||
@@ -121,8 +120,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
|
||||
/// CRC, coding, interleaving and rate matching
|
||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
|
||||
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
||||
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(32)));
|
||||
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers);
|
||||
start_meas(dlsch_encoding_stats);
|
||||
|
||||
if (nr_dlsch_encoding(gNB,
|
||||
@@ -147,20 +146,18 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/// scrambling
|
||||
start_meas(dlsch_scrambling_stats);
|
||||
for (int q=0; q<rel15->NrOfCodewords; q++)
|
||||
memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t));
|
||||
for (int q=0; q<rel15->NrOfCodewords; q++)
|
||||
for (int q=0; q<rel15->NrOfCodewords; q++) {
|
||||
memset((void*)scrambled_output[q], 0, ((encoded_length>>5)+1)*sizeof(uint32_t));
|
||||
nr_pdsch_codeword_scrambling(output,
|
||||
encoded_length,
|
||||
q,
|
||||
rel15->dataScramblingId,
|
||||
rel15->rnti,
|
||||
scrambled_output[q]);
|
||||
}
|
||||
|
||||
stop_meas(dlsch_scrambling_stats);
|
||||
#ifdef DEBUG_DLSCH
|
||||
@@ -219,6 +216,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
start_sc -= frame_parms->ofdm_symbol_size;
|
||||
|
||||
int txdataF_offset = slot*frame_parms->samples_per_slot_wCP;
|
||||
int16_t **txdataF_precoding = (int16_t **)malloc16(rel15->nrOfLayers*sizeof(int16_t *));
|
||||
for (int layer = 0; layer<rel15->nrOfLayers; layer++)
|
||||
txdataF_precoding[layer] = (int16_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int16_t));
|
||||
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n",
|
||||
@@ -295,7 +295,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos);
|
||||
if(ptrs_symbol) {
|
||||
/* PTRS QPSK Modulation for each OFDM symbol in a slot */
|
||||
printf("Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs);
|
||||
LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs);
|
||||
nr_modulation(pdsch_dmrs[l][0], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs);
|
||||
}
|
||||
}
|
||||
@@ -535,6 +535,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
else {
|
||||
LOG_D(PHY,"beam index for PDSCH allocation already taken\n");
|
||||
}
|
||||
for (int layer = 0; layer<rel15->nrOfLayers; layer++)
|
||||
free16(txdataF_precoding[layer],2*14*frame_parms->ofdm_symbol_size);
|
||||
free16(txdataF_precoding,rel15->nrOfLayers);
|
||||
}// dlsch loop
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
|
||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
||||
|
||||
|
||||
@@ -50,10 +50,14 @@
|
||||
//#define DEBUG_DLSCH_FREE 1
|
||||
|
||||
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||
int r;
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,
|
||||
uint16_t N_RB,
|
||||
const NR_DL_FRAME_PARMS* frame_parms) {
|
||||
|
||||
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers;
|
||||
|
||||
if (N_RB != 273) {
|
||||
a_segments = a_segments*N_RB;
|
||||
@@ -65,26 +69,30 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||
free16(harq->b, a_segments * 1056);
|
||||
harq->b = NULL;
|
||||
}
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
for (int r = 0; r < a_segments; r++) {
|
||||
free(harq->c[r]);
|
||||
harq->c[r] = NULL;
|
||||
}
|
||||
free(harq->c);
|
||||
free(harq->pdu);
|
||||
|
||||
for (int aa = 0; aa < 64; aa++)
|
||||
free(dlsch->calib_dl_ch_estimates[aa]);
|
||||
free(dlsch->calib_dl_ch_estimates);
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
for (int q=0; q<nb_codewords; q++)
|
||||
free(dlsch->mod_symbs[q]);
|
||||
free(dlsch->mod_symbs);
|
||||
|
||||
for (int layer = 0; layer < NR_MAX_NB_LAYERS; layer++) {
|
||||
free(dlsch->txdataF_precoding[layer]);
|
||||
for (int layer = 0; layer < max_layers; layer++) {
|
||||
free(dlsch->txdataF[layer]);
|
||||
for (int aa = 0; aa < 64; aa++)
|
||||
free(dlsch->ue_spec_bf_weights[layer][aa]);
|
||||
free(dlsch->ue_spec_bf_weights[layer]);
|
||||
}
|
||||
free(dlsch->txdataF);
|
||||
free(dlsch->ue_spec_bf_weights);
|
||||
|
||||
free(dlsch);
|
||||
*dlschptr = NULL;
|
||||
@@ -96,9 +104,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t Nsoft,
|
||||
uint8_t abstraction_flag,
|
||||
uint16_t N_RB) {
|
||||
unsigned char i,r,aa,layer;
|
||||
int re;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
||||
|
||||
if (N_RB != 273) {
|
||||
a_segments = a_segments*N_RB;
|
||||
@@ -114,31 +122,36 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
dlsch->Mlimit = 4;
|
||||
dlsch->Nsoft = Nsoft;
|
||||
|
||||
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
|
||||
int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer
|
||||
|
||||
dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *));
|
||||
|
||||
dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **));
|
||||
for (int layer=0; layer<max_layers; layer++) {
|
||||
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||
|
||||
for (aa=0; aa<64; aa++) {
|
||||
for (int aa=0; aa<64; aa++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
|
||||
for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||
}
|
||||
}
|
||||
|
||||
dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH
|
||||
dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t));
|
||||
dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t));
|
||||
}
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t));
|
||||
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
dlsch->mod_symbs = (int32_t **)malloc16(nb_codewords*sizeof(int32_t *));
|
||||
for (int q=0; q<nb_codewords; q++)
|
||||
dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t));
|
||||
|
||||
dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||
|
||||
for (aa=0; aa<64; aa++) {
|
||||
for (int aa=0; aa<64; aa++) {
|
||||
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
}
|
||||
|
||||
for (i=0; i<20; i++) {
|
||||
for (int i=0; i<20; i++) {
|
||||
dlsch->harq_ids[0][i] = 0;
|
||||
dlsch->harq_ids[1][i] = 0;
|
||||
}
|
||||
@@ -153,7 +166,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3);
|
||||
bzero(harq->b, dlsch_bytes);
|
||||
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
for (int r = 0; r < a_segments; r++) {
|
||||
// account for filler in first segment and CRCs for multiple segment case
|
||||
// [hna] 8448 is the maximum CB size in NR
|
||||
// 68*348 = 68*(maximum size of Zc)
|
||||
@@ -316,6 +330,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
stats->current_Qm = rel15->qamModOrder[0];
|
||||
}
|
||||
|
||||
int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056;
|
||||
if (A > 3824) {
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,A)>>8;
|
||||
@@ -326,11 +341,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
||||
harq->B = A+24;
|
||||
// harq->b = a;
|
||||
AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||
AssertFatal((A / 8) + 4 <= max_bytes,
|
||||
"A %d is too big (A/8+4 = %d > %d)\n",
|
||||
A,
|
||||
(A / 8) + 4,
|
||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||
max_bytes);
|
||||
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
||||
} else {
|
||||
// Add 16-bit crc (polynomial A) to payload
|
||||
@@ -341,11 +356,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
||||
harq->B = A+16;
|
||||
// harq->b = a;
|
||||
AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||
AssertFatal((A / 8) + 3 <= max_bytes,
|
||||
"A %d is too big (A/8+3 = %d > %d)\n",
|
||||
A,
|
||||
(A / 8) + 3,
|
||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||
max_bytes);
|
||||
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
||||
}
|
||||
|
||||
@@ -363,6 +378,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG);
|
||||
stop_meas(dlsch_segmentation_stats);
|
||||
|
||||
if (impp.n_segments>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",impp.n_segments,harq->B);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for (int r=0; r<impp.n_segments; r++) {
|
||||
//d_tmp[r] = &harq->d[r][0];
|
||||
//channel_input[r] = &harq->d[r][0];
|
||||
|
||||
@@ -40,7 +40,7 @@ void nr_codeword_scrambling(uint8_t *in,
|
||||
__m256i c = ((__m256i*)in)[i];
|
||||
uint32_t in32 = _mm256_movemask_epi8(_mm256_slli_epi16(c,7));
|
||||
out[i]=(in32^s);
|
||||
//printf("in[%d] %x => %x\n",i,in32,out[i]);
|
||||
LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]);
|
||||
s=lte_gold_generic(&x1, &x2, 0);
|
||||
}
|
||||
#elif defined(__SSE4__)
|
||||
|
||||
@@ -106,7 +106,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t abstraction_flag,
|
||||
uint16_t N_RB);
|
||||
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, const NR_DL_FRAME_PARMS* frame_parms);
|
||||
|
||||
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
|
||||
- RB extraction (signal and channel estimates)
|
||||
@@ -146,7 +146,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
|
||||
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
NR_gNB_ULSCH_t **ulsch_gNB,
|
||||
NR_gNB_ULSCH_t *ulsch_gNB,
|
||||
uint8_t symbol,
|
||||
uint8_t start_symbol,
|
||||
uint16_t nb_rb,
|
||||
|
||||
@@ -42,15 +42,14 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<gNB->number_of_nr_ulsch_max; i++) {
|
||||
AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i);
|
||||
AssertFatal(gNB->ulsch[i][0]!=NULL,"gNB->ulsch[%d][0] is null\n",i);
|
||||
LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i][0]->harq_mask,gNB->ulsch[i][0]->rnti,first_free_index);
|
||||
if ((gNB->ulsch[i][0]->harq_mask >0) &&
|
||||
(gNB->ulsch[i][0]->rnti==rnti)) return i;
|
||||
else if ((gNB->ulsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
||||
LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i]->harq_mask,gNB->ulsch[i]->rnti,first_free_index);
|
||||
if ((gNB->ulsch[i]->harq_mask >0) &&
|
||||
(gNB->ulsch[i]->rnti==rnti)) return i;
|
||||
else if ((gNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
if (first_free_index != -1)
|
||||
gNB->ulsch[first_free_index][0]->rnti = 0;
|
||||
gNB->ulsch[first_free_index]->rnti = 0;
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||
AssertFatal( (ulsch_id>=0) && (ulsch_id<gNB->number_of_nr_ulsch_max),
|
||||
"illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id);
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id][0];
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id];
|
||||
int harq_pid = ulsch_pdu->pusch_data.harq_process_id;
|
||||
ulsch->rnti = ulsch_pdu->rnti;
|
||||
//ulsch->rnti_type;
|
||||
|
||||
@@ -172,7 +172,7 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
|
||||
//t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS];
|
||||
ulsch->harq_processes[i]->Z=0;
|
||||
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
//int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
|
||||
//int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
|
||||
ulsch->harq_processes[i]->E=0;
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
#endif
|
||||
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id][0];
|
||||
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id];
|
||||
NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id];
|
||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
||||
|
||||
@@ -528,6 +528,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
&harq_process->F,
|
||||
p_decParams->BG);
|
||||
|
||||
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*n_layers) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z);
|
||||
if (!frame%100)
|
||||
|
||||
@@ -403,7 +403,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
|
||||
void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
NR_gNB_ULSCH_t **ulsch_gNB,
|
||||
NR_gNB_ULSCH_t *ulsch_gNB,
|
||||
uint8_t symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
unsigned short nb_rb,
|
||||
@@ -418,7 +418,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
|
||||
// Determine scaling amplitude based the symbol
|
||||
|
||||
ch_amp = 1024*8; //((pilots) ? (ulsch_gNB[0]->sqrt_rho_b) : (ulsch_gNB[0]->sqrt_rho_a));
|
||||
ch_amp = 1024*8; //((pilots) ? (ulsch_gNB->sqrt_rho_b) : (ulsch_gNB->sqrt_rho_a));
|
||||
|
||||
LOG_D(PHY,"Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, is_dmrs_symbol, nb_rb, frame_parms->Ncp, symbol);
|
||||
// printf("Scaling PUSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
|
||||
@@ -1177,7 +1177,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
int avgs = 0;
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers];
|
||||
|
||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE;
|
||||
|
||||
@@ -457,7 +457,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
uci_pdu->harq->harq_list[1].harq_value = !(index&0x01);
|
||||
uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01);
|
||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
|
||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos);
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
module_id_t gNB_id,
|
||||
const int estimateSz, struct complex16 dl_ch_estimates_time[][estimateSz],
|
||||
uint8_t frame,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
@@ -60,8 +61,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
int j = (i < 0) ? (i + frame_parms->ofdm_symbol_size) : i;
|
||||
for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
|
||||
int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(j<<1)];
|
||||
int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(j<<1)];
|
||||
int Re = dl_ch_estimates_time[aa][j].r;
|
||||
int Im = dl_ch_estimates_time[aa][j].i;
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
|
||||
#include "filt16a_32.h"
|
||||
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
|
||||
|
||||
//#define DEBUG_PDSCH
|
||||
//#define DEBUG_PDCCH
|
||||
@@ -43,7 +44,6 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_SSB *current_ssb)
|
||||
{
|
||||
int pilot[200] __attribute__((aligned(16)));
|
||||
unsigned char aarx;
|
||||
unsigned short k;
|
||||
unsigned int pilot_cnt;
|
||||
int16_t ch[2],*pil,*rxF;
|
||||
@@ -77,7 +77,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
|
||||
// generate pilot
|
||||
nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]);
|
||||
|
||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
|
||||
int re_offset = ssb_offset;
|
||||
pil = (int16_t *)&pilot[0];
|
||||
@@ -197,6 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
|
||||
|
||||
|
||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
int estimateSz,
|
||||
struct complex16 dl_ch_estimates [][estimateSz],
|
||||
struct complex16 dl_ch_estimates_time [][estimateSz],
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id,
|
||||
unsigned char Ns,
|
||||
@@ -206,16 +209,14 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
uint8_t n_hf)
|
||||
{
|
||||
int pilot[200] __attribute__((aligned(16)));
|
||||
unsigned char aarx,p;
|
||||
unsigned short k;
|
||||
unsigned int pilot_cnt;
|
||||
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
|
||||
int16_t *pil,*rxF,*dl_ch,*fl,*fm,*fr;
|
||||
int ch_offset,symbol_offset;
|
||||
//int slot_pbch;
|
||||
|
||||
uint8_t nushift;
|
||||
int **dl_ch_estimates =ue->pbch_vars[gNB_id]->dl_ch_estimates;
|
||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
|
||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
|
||||
|
||||
nushift = ue->frame_parms.Nid_cell%4;
|
||||
ue->frame_parms.nushift = nushift;
|
||||
@@ -269,17 +270,57 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
break;
|
||||
}
|
||||
|
||||
idft_size_idx_t idftsizeidx;
|
||||
|
||||
switch (ue->frame_parms.ofdm_symbol_size) {
|
||||
case 128:
|
||||
idftsizeidx = IDFT_128;
|
||||
break;
|
||||
|
||||
case 256:
|
||||
idftsizeidx = IDFT_256;
|
||||
break;
|
||||
|
||||
case 512:
|
||||
idftsizeidx = IDFT_512;
|
||||
break;
|
||||
|
||||
case 1024:
|
||||
idftsizeidx = IDFT_1024;
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
idftsizeidx = IDFT_1536;
|
||||
break;
|
||||
|
||||
case 2048:
|
||||
idftsizeidx = IDFT_2048;
|
||||
break;
|
||||
|
||||
case 3072:
|
||||
idftsizeidx = IDFT_3072;
|
||||
break;
|
||||
|
||||
case 4096:
|
||||
idftsizeidx = IDFT_4096;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unsupported ofdm symbol size \n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
// generate pilot
|
||||
nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]);
|
||||
|
||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
|
||||
int re_offset = ssb_offset;
|
||||
pil = (int16_t *)&pilot[0];
|
||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
|
||||
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
|
||||
|
||||
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
|
||||
memset(dl_ch,0,sizeof(*dl_ch)*(ue->frame_parms.ofdm_symbol_size));
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
|
||||
@@ -289,6 +330,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
|
||||
// Treat first 2 pilots specially (left edge)
|
||||
int16_t ch[2];
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
@@ -402,62 +444,18 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
|
||||
}
|
||||
|
||||
idft_size_idx_t idftsizeidx;
|
||||
|
||||
switch (ue->frame_parms.ofdm_symbol_size) {
|
||||
case 128:
|
||||
idftsizeidx = IDFT_128;
|
||||
break;
|
||||
|
||||
case 256:
|
||||
idftsizeidx = IDFT_256;
|
||||
break;
|
||||
|
||||
case 512:
|
||||
idftsizeidx = IDFT_512;
|
||||
break;
|
||||
|
||||
case 1024:
|
||||
idftsizeidx = IDFT_1024;
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
idftsizeidx = IDFT_1536;
|
||||
break;
|
||||
|
||||
case 2048:
|
||||
idftsizeidx = IDFT_2048;
|
||||
break;
|
||||
|
||||
case 3072:
|
||||
idftsizeidx = IDFT_3072;
|
||||
break;
|
||||
|
||||
case 4096:
|
||||
idftsizeidx = IDFT_4096;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unsupported ofdm symbol size \n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if( dmrss == 2) // update time statistics for last PBCH symbol
|
||||
{
|
||||
// do ifft of channel estimate
|
||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++)
|
||||
for (p=0; p<ue->frame_parms.nb_antenna_ports_gNB; p++) {
|
||||
if (ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx])
|
||||
{
|
||||
LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, proc->thread_id, symbol, ch_offset);
|
||||
idft(idftsizeidx,
|
||||
(int16_t*) &ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx][ch_offset],
|
||||
(int16_t*) ue->pbch_vars[gNB_id]->dl_ch_estimates_time[(p*ue->frame_parms.nb_antennas_rx)+aarx],1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
LOG_D(PHY,"Channel Impulse Computation Slot %d Symbol %d ch_offset %d\n", Ns, symbol, ch_offset);
|
||||
idft(idftsizeidx,
|
||||
(int16_t*) &dl_ch_estimates[aarx][ch_offset],
|
||||
(int16_t*) dl_ch_estimates_time[aarx],
|
||||
1);
|
||||
}
|
||||
}
|
||||
if (dmrss == 2)
|
||||
UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,10 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_SSB *current_ssb);
|
||||
|
||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int estimateSz,
|
||||
struct complex16 dl_ch_estimates [][estimateSz],
|
||||
struct complex16 dl_ch_estimates_time [][estimateSz],
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id,
|
||||
unsigned char Ns,
|
||||
unsigned char symbol,
|
||||
@@ -79,6 +82,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
module_id_t gNB_id,
|
||||
int estimateSz,
|
||||
struct complex16 dl_ch_estimates_time [][estimateSz],
|
||||
uint8_t frame,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
|
||||
@@ -79,9 +79,11 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) {
|
||||
free(params);
|
||||
}
|
||||
|
||||
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
|
||||
int i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS;
|
||||
|
||||
NR_UE_DLSCH_t *dlsch=*dlschptr;
|
||||
|
||||
if (dlsch) {
|
||||
@@ -90,29 +92,21 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
||||
for (int i=0; i<dlsch->Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
if (dlsch->harq_processes[i]->b) {
|
||||
free16(dlsch->harq_processes[i]->b,a_segments*1056);
|
||||
dlsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++) {
|
||||
for (int r=0; r<a_segments; r++) {
|
||||
free16(dlsch->harq_processes[i]->c[r],1056);
|
||||
dlsch->harq_processes[i]->c[r] = NULL;
|
||||
free16(dlsch->harq_processes[i]->d[r],5*8448);
|
||||
dlsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++)
|
||||
if (dlsch->harq_processes[i]->d[r]) {
|
||||
free16(dlsch->harq_processes[i]->d[r],(5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<a_segments; r++)
|
||||
if (dlsch->harq_processes[i]->w[r]) {
|
||||
free16(dlsch->harq_processes[i]->w[r],(5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->w[r] = NULL;
|
||||
}
|
||||
free16(dlsch->harq_processes[i]->c,a_segments);
|
||||
free16(dlsch->harq_processes[i]->d,a_segments);
|
||||
|
||||
free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t));
|
||||
dlsch->harq_processes[i] = NULL;
|
||||
@@ -124,10 +118,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL) {
|
||||
|
||||
NR_UE_DLSCH_t *dlsch;
|
||||
uint8_t exit_flag = 0,i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
uint8_t exit_flag = 0;
|
||||
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
||||
|
||||
if (N_RB_DL != 273) {
|
||||
a_segments = a_segments*N_RB_DL;
|
||||
@@ -146,7 +143,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
dlsch->Mlimit = 4;
|
||||
dlsch->max_ldpc_iterations = max_ldpc_iterations;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
for (int i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i] = (NR_DL_UE_HARQ_t *)malloc16(sizeof(NR_DL_UE_HARQ_t));
|
||||
|
||||
if (dlsch->harq_processes[i]) {
|
||||
@@ -160,25 +157,15 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
else
|
||||
exit_flag=3;
|
||||
|
||||
for (r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
dlsch->harq_processes[i]->d = (int16_t **)malloc16(a_segments*sizeof(int16_t *));
|
||||
for (int r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t));
|
||||
if (dlsch->harq_processes[i]->c[r])
|
||||
memset(dlsch->harq_processes[i]->c[r],0,1056);
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->w[r])
|
||||
memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
|
||||
memset(dlsch->harq_processes[i]->d[r],0,5*8448);
|
||||
else
|
||||
exit_flag=2;
|
||||
}
|
||||
@@ -310,11 +297,15 @@ void nr_processDLSegment(void* arg) {
|
||||
t_nrLDPC_time_stats procTime = {0};
|
||||
t_nrLDPC_time_stats* p_procTime = &procTime ;
|
||||
|
||||
int16_t w[5*8448];
|
||||
memset(w,0,(5*8448)*sizeof(short));
|
||||
|
||||
start_meas(&rdata->ts_deinterleave);
|
||||
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
|
||||
nr_deinterleaving_ldpc(E,
|
||||
Qm,
|
||||
harq_process->w[r], // [hna] w is e
|
||||
w, // [hna] w is e
|
||||
dlsch_llr+r_offset);
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
|
||||
stop_meas(&rdata->ts_deinterleave);
|
||||
@@ -336,7 +327,7 @@ void nr_processDLSegment(void* arg) {
|
||||
p_decoderParms->BG,
|
||||
p_decoderParms->Z,
|
||||
harq_process->d[r],
|
||||
harq_process->w[r],
|
||||
w,
|
||||
harq_process->C,
|
||||
harq_process->rvidx,
|
||||
(harq_process->first_rx==1)?1:0,
|
||||
@@ -567,6 +558,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
&harq_process->F,
|
||||
p_decParams->BG);
|
||||
|
||||
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100))
|
||||
LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl);
|
||||
}
|
||||
@@ -582,7 +578,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
|
||||
p_decParams->outMode= 0;
|
||||
r_offset = 0;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl; //number of segments to be allocated
|
||||
|
||||
if (nb_rb != 273) {
|
||||
a_segments = a_segments*nb_rb;
|
||||
|
||||
@@ -202,7 +202,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
pdsch_vars = ue->pdsch_vars[proc->thread_id];
|
||||
dlsch = ue->dlsch[proc->thread_id][gNB_id];
|
||||
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
|
||||
dlsch1_harq = dlsch[1]->harq_processes[harq_pid];
|
||||
if (NR_MAX_NB_LAYERS>4)
|
||||
dlsch1_harq = dlsch[1]->harq_processes[harq_pid];
|
||||
beamforming_mode = ue->transmission_mode[gNB_id] < 7 ? 0 :ue->transmission_mode[gNB_id];
|
||||
break;
|
||||
|
||||
|
||||
@@ -146,17 +146,23 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
|
||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||
// computing channel estimation for selected best ssb
|
||||
const int estimateSz=7*2*frame_parms->ofdm_symbol_size;
|
||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
|
||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
|
||||
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
||||
nr_pbch_channel_estimation(ue,proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
|
||||
nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time,
|
||||
proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
|
||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||
|
||||
fapiPbch_t result;
|
||||
ret = nr_rx_pbch(ue,
|
||||
proc,
|
||||
ue->pbch_vars[0],
|
||||
estimateSz, dl_ch_estimates,
|
||||
ue->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
temp_ptr->i_ssb,
|
||||
SISO);
|
||||
SISO,
|
||||
&result);
|
||||
|
||||
temp_ptr=temp_ptr->next_ssb;
|
||||
}
|
||||
|
||||
@@ -36,28 +36,30 @@
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "openair1/SCHED_NR_UE/defs.h"
|
||||
#include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h>
|
||||
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
|
||||
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
|
||||
//#include "PHY_INTERFACE/defs.h"
|
||||
//#include "PHY_INTERFACE/defs.h"
|
||||
|
||||
#define PBCH_A 24
|
||||
|
||||
#define PBCH_MAX_RE_PER_SYMBOL (20*12)
|
||||
#define PBCH_MAX_RE (PBCH_MAX_RE_PER_SYMBOL*4)
|
||||
#define print_shorts(s,x) printf("%s : %d,%d,%d,%d,%d,%d,%d,%d\n",s,((int16_t*)x)[0],((int16_t*)x)[1],((int16_t*)x)[2],((int16_t*)x)[3],((int16_t*)x)[4],((int16_t*)x)[5],((int16_t*)x)[6],((int16_t*)x)[7])
|
||||
|
||||
uint16_t nr_pbch_extract(int **rxdataF,
|
||||
int **dl_ch_estimates,
|
||||
int **rxdataF_ext,
|
||||
int **dl_ch_estimates_ext,
|
||||
uint32_t symbol,
|
||||
uint32_t s_offset,
|
||||
NR_DL_FRAME_PARMS *frame_parms) {
|
||||
static uint16_t nr_pbch_extract(int **rxdataF,
|
||||
const int estimateSz,
|
||||
struct complex16 dl_ch_estimates[][estimateSz],
|
||||
struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL],
|
||||
struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
|
||||
uint32_t symbol,
|
||||
uint32_t s_offset,
|
||||
NR_DL_FRAME_PARMS *frame_parms) {
|
||||
uint16_t rb;
|
||||
uint8_t i,j,aarx;
|
||||
int32_t *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext;
|
||||
int nushiftmod4 = frame_parms->nushift;
|
||||
|
||||
AssertFatal(symbol>=1 && symbol<5,
|
||||
"symbol %d illegal for PBCH extraction\n",
|
||||
symbol);
|
||||
@@ -65,9 +67,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier;
|
||||
rx_offset = (rx_offset)%(frame_parms->ofdm_symbol_size);
|
||||
|
||||
rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size];
|
||||
rxF_ext = &rxdataF_ext[aarx][symbol*20*12];
|
||||
struct complex16 *rxF = (struct complex16 *)&rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size];
|
||||
struct complex16 *rxF_ext = rxdataF_ext[aarx];
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("extract_rbs (nushift %d): rx_offset=%d, symbol %u\n",frame_parms->nushift,
|
||||
(rx_offset + ((symbol+s_offset)*(frame_parms->ofdm_symbol_size))),symbol);
|
||||
@@ -76,7 +77,6 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
for (int i =0; i<8; i++) {
|
||||
printf("rxF [%d]= %d\n",i,rxF[i]);
|
||||
printf("pbch extract rxF %d %d addr %p\n", p[2*i], p[2*i+1], &p[2*i]);
|
||||
printf("rxF ext addr %p\n", &rxF_ext[i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -91,19 +91,18 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
(i!=(nushiftmod4+8))) {
|
||||
rxF_ext[j]=rxF[rx_offset];
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(9*rb) + j,
|
||||
((int16_t *)&rxF_ext[j])[0],
|
||||
((int16_t *)&rxF_ext[j])[1],
|
||||
printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",
|
||||
(9*rb) + j,
|
||||
rxF_ext[j].r, rxF_ext[j].i,
|
||||
rx_offset,
|
||||
((int16_t *)&rxF[rx_offset])[0],
|
||||
((int16_t *)&rxF[rx_offset])[1]);
|
||||
rxF[rx_offset].r,rxF[rx_offset].j;
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size);
|
||||
//rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||
}
|
||||
}
|
||||
|
||||
rxF_ext+=9;
|
||||
} else { //symbol 2
|
||||
@@ -115,11 +114,9 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
rxF_ext[j]=rxF[rx_offset];
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(rb<4) ? (9*rb) + j : (9*(rb-12))+j,
|
||||
((int16_t *)&rxF_ext[j])[0],
|
||||
((int16_t *)&rxF_ext[j])[1],
|
||||
rxF_ext[j].r, rxF_ext[j].i,
|
||||
rx_offset,
|
||||
((int16_t *)&rxF[rx_offset])[0],
|
||||
((int16_t *)&rxF[rx_offset])[1]);
|
||||
rxF[rx_offset].r,rxF[rx_offset].j;
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
@@ -129,16 +126,16 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
}
|
||||
|
||||
rxF_ext+=9;
|
||||
} else{ //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);
|
||||
rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
} else { //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);
|
||||
rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))];
|
||||
struct complex16 *dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))];
|
||||
|
||||
//printf("dl_ch0 addr %p\n",dl_ch0);
|
||||
dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*20*12];
|
||||
struct complex16 *dl_ch0_ext = dl_ch_estimates_ext[aarx];
|
||||
|
||||
for (rb=0; rb<20; rb++) {
|
||||
j=0;
|
||||
@@ -150,15 +147,11 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
(i!=(nushiftmod4+8))) {
|
||||
dl_ch0_ext[j]=dl_ch0[i];
|
||||
#ifdef DEBUG_PBCH
|
||||
|
||||
if ((rb==0) && (i<2))
|
||||
printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j,
|
||||
((int16_t *)&dl_ch0_ext[j])[0],
|
||||
((int16_t *)&dl_ch0_ext[j])[1],
|
||||
dl_ch0_ext[j].r, dl_ch0_ext[j].i,
|
||||
i,
|
||||
((int16_t *)&dl_ch0[i])[0],
|
||||
((int16_t *)&dl_ch0[i])[1]);
|
||||
|
||||
dl_ch0[j].r, dl_ch0[j].i,
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
@@ -175,11 +168,9 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
dl_ch0_ext[j]=dl_ch0[i];
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j,
|
||||
((int16_t *)&dl_ch0_ext[j])[0],
|
||||
((int16_t *)&dl_ch0_ext[j])[1],
|
||||
dl_ch0_ext[j].r, dl_ch0_ext[j].i,
|
||||
i,
|
||||
((int16_t *)&dl_ch0[i])[0],
|
||||
((int16_t *)&dl_ch0[i])[1]);
|
||||
dl_ch0[j].r, dl_ch0[j].i,
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
@@ -199,11 +190,10 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
//__m128i avg128;
|
||||
|
||||
//compute average channel_level on each (TX,RX) antenna pair
|
||||
int nr_pbch_channel_level(int **dl_ch_estimates_ext,
|
||||
int nr_pbch_channel_level(struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL],
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t symbol) {
|
||||
int16_t rb, nb_rb=20;
|
||||
uint8_t aarx;
|
||||
int nb_re) {
|
||||
int16_t nb_rb=nb_re/12;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i avg128;
|
||||
__m128i *dl_ch128;
|
||||
@@ -213,22 +203,23 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
|
||||
#endif
|
||||
int avg1=0,avg2=0;
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
//clear average level
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128 = _mm_setzero_si128();
|
||||
dl_ch128=(__m128i *)&dl_ch_estimates_ext[aarx][symbol*20*12];
|
||||
dl_ch128=(__m128i *)dl_ch_estimates_ext[aarx];
|
||||
#elif defined(__arm__)
|
||||
avg128 = vdupq_n_s32(0);
|
||||
dl_ch128=(int16x8_t *)&dl_ch_estimates_ext[aarx][symbol*20*12];
|
||||
dl_ch128=(int16x8_t *)dl_ch_estimates_ext[aarx];
|
||||
#endif
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
for (int rb=0; rb<nb_rb; rb++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0]));
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[1],dl_ch128[1]));
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[2],dl_ch128[2]));
|
||||
#elif defined(__arm__)
|
||||
abort();
|
||||
// to be filled in
|
||||
#endif
|
||||
dl_ch128+=3;
|
||||
@@ -251,35 +242,19 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
|
||||
//LOG_I(PHY,"Channel level : %d, %d\n",avg1, avg2);
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
return(avg2);
|
||||
}
|
||||
|
||||
void nr_pbch_channel_compensation(int **rxdataF_ext,
|
||||
int **dl_ch_estimates_ext,
|
||||
int **rxdataF_comp,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t symbol,
|
||||
uint8_t output_shift) {
|
||||
const uint16_t nb_re=symbol == 2 ? 72 : 180;
|
||||
AssertFatal((symbol > 0 && symbol < 4),
|
||||
"symbol %d is illegal for PBCH DM-RS\n",
|
||||
symbol);
|
||||
|
||||
// printf("comp: symbol %d : nb_re %d\n",symbol,nb_re);
|
||||
|
||||
static 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],
|
||||
int nb_re,
|
||||
struct complex16 rxdataF_comp[][PBCH_MAX_RE_PER_SYMBOL],
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t output_shift) {
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
vect128 *dl_ch128 = (vect128 *)&dl_ch_estimates_ext[aarx][symbol*20*12];
|
||||
vect128 *rxdataF128 = (vect128 *)&rxdataF_ext[aarx][symbol*20*12];
|
||||
vect128 *rxdataF_comp128 = (vect128 *)&rxdataF_comp[aarx][symbol*20*12];
|
||||
/*
|
||||
printf("ch compensation dl_ch ext addr %p \n", &dl_ch_estimates_ext[aarx][symbol*20*12]);
|
||||
printf("rxdataf ext addr %p symbol %d\n", &rxdataF_ext[aarx][symbol*20*12], symbol);
|
||||
printf("rxdataf_comp addr %p\n",&rxdataF_comp[aarx][symbol*20*12]);
|
||||
*/
|
||||
vect128 *dl_ch128 = (vect128 *)dl_ch_estimates_ext[aarx];
|
||||
vect128 *rxdataF128 = (vect128 *)rxdataF_ext[aarx];
|
||||
vect128 *rxdataF_comp128 = (vect128 *)rxdataF_comp[aarx];
|
||||
|
||||
for (int re=0; re<nb_re; re+=12) {
|
||||
*rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
|
||||
@@ -327,16 +302,18 @@ void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
static void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
|
||||
uint16_t Nid,
|
||||
uint8_t nushift,
|
||||
uint16_t M,
|
||||
uint16_t length,
|
||||
uint8_t bitwise,
|
||||
uint32_t unscrambling_mask) {
|
||||
int16_t *demod_pbch_e,
|
||||
uint16_t Nid,
|
||||
uint8_t nushift,
|
||||
uint16_t M,
|
||||
uint16_t length,
|
||||
uint8_t bitwise,
|
||||
uint32_t unscrambling_mask,
|
||||
uint32_t pbch_a_prime,
|
||||
uint32_t *pbch_a_interleaved) {
|
||||
uint8_t reset, offset;
|
||||
uint32_t x1, x2, s=0;
|
||||
uint8_t k=0;
|
||||
int16_t *demod_pbch_e = pbch->llr;
|
||||
reset = 1;
|
||||
// x1 is set in first call to lte_gold_generic
|
||||
x2 = Nid; //this is c_init
|
||||
@@ -361,10 +338,10 @@ static void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
(pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<<i : (((pbch->pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i;
|
||||
*pbch_a_interleaved ^= ((unscrambling_mask>>i)&1)? ((pbch_a_prime>>i)&1)<<i : (((pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i;
|
||||
k += (!((unscrambling_mask>>i)&1));
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, pbch->pbch_a_interleaved,
|
||||
printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, *pbch_a_interleaved,
|
||||
(!((unscrambling_mask>>i)&1)));
|
||||
#endif
|
||||
} else {
|
||||
@@ -386,18 +363,16 @@ static void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
|
||||
}
|
||||
}
|
||||
|
||||
void nr_pbch_quantize(int16_t *pbch_llr8,
|
||||
int16_t *pbch_llr,
|
||||
uint16_t len) {
|
||||
uint16_t i;
|
||||
|
||||
for (i=0; i<len; i++) {
|
||||
static void nr_pbch_quantize(int16_t *pbch_llr8,
|
||||
int16_t *pbch_llr,
|
||||
uint16_t len) {
|
||||
for (int i=0; i<len; i++) {
|
||||
if (pbch_llr[i]>31)
|
||||
pbch_llr8[i]=32;
|
||||
else if (pbch_llr[i]<-31)
|
||||
pbch_llr8[i]=-32;
|
||||
else
|
||||
pbch_llr8[i] = (char)(pbch_llr[i]);
|
||||
pbch_llr8[i]=pbch_llr[i];
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -410,36 +385,33 @@ uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11,
|
||||
|
||||
int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int estimateSz, struct complex16 dl_ch_estimates [][estimateSz],
|
||||
NR_UE_PBCH *nr_ue_pbch_vars,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t gNB_id,
|
||||
uint8_t i_ssb,
|
||||
MIMO_mode_t mimo_mode) {
|
||||
|
||||
MIMO_mode_t mimo_mode,
|
||||
fapiPbch_t *result) {
|
||||
NR_UE_COMMON *nr_ue_common_vars = &ue->common_vars;
|
||||
int max_h=0;
|
||||
int symbol;
|
||||
//uint8_t pbch_a[64];
|
||||
//FT ?? cppcheck doesn't like pbch_a allocation because of line 525..and i don't get what this variable is for..
|
||||
//uint8_t *pbch_a = malloc(sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
//uint32_t pbch_a_prime;
|
||||
int16_t *pbch_e_rx;
|
||||
uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output;
|
||||
//FT ?? cppcheck doesn't like pbch_a allocation because of line 525..and i don't get what this variable is for..
|
||||
//uint8_t *pbch_a = malloc(sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
uint8_t nushift;
|
||||
uint16_t M;
|
||||
uint8_t Lmax=frame_parms->Lmax;
|
||||
uint8_t Lmax=frame_parms->Lmax;
|
||||
//uint16_t crc;
|
||||
//unsigned short idx_demod =0;
|
||||
uint32_t decoderState=0;
|
||||
//uint8_t decoderListSize = 8, pathMetricAppr = 0;
|
||||
//time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
|
||||
//time_stats_t path_metric,sorting,update_LLR;
|
||||
// FT ?? cppcheck fix memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
// FT ?? cppcheck fix memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
|
||||
|
||||
pbch_e_rx = &nr_ue_pbch_vars->llr[0];
|
||||
// clear LLR buffer
|
||||
memset(nr_ue_pbch_vars->llr,0,NR_POLAR_PBCH_E);
|
||||
int16_t pbch_e_rx[960]= {0}; //Fixme: previous version erase only NR_POLAR_PBCH_E bytes
|
||||
int16_t pbch_unClipped[960]= {0};
|
||||
int pbch_e_rx_idx=0;
|
||||
int symbol_offset=1;
|
||||
|
||||
if (ue->is_synchronized > 0)
|
||||
@@ -447,20 +419,24 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
else
|
||||
symbol_offset=0;
|
||||
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
//printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF);
|
||||
write_output("rxdataF0_pbch.m","rxF0pbch",
|
||||
&nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][(symbol_offset+1)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size*3,1,1);
|
||||
#endif
|
||||
|
||||
// symbol refers to symbol within SSB. symbol_offset is the offset of the SSB wrt start of slot
|
||||
for (symbol=1; symbol<4; symbol++) {
|
||||
double log2_maxh;
|
||||
|
||||
for (symbol=1; symbol<4; symbol++) {
|
||||
const uint16_t nb_re=symbol == 2 ? 72 : 180;
|
||||
struct complex16 rxdataF_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL];
|
||||
struct complex16 dl_ch_estimates_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL];
|
||||
memset(dl_ch_estimates_ext,0, sizeof dl_ch_estimates_ext);
|
||||
nr_pbch_extract(nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF,
|
||||
nr_ue_pbch_vars->dl_ch_estimates,
|
||||
nr_ue_pbch_vars->rxdataF_ext,
|
||||
nr_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
estimateSz,
|
||||
dl_ch_estimates,
|
||||
rxdataF_ext,
|
||||
dl_ch_estimates_ext,
|
||||
symbol,
|
||||
symbol_offset,
|
||||
frame_parms);
|
||||
@@ -470,142 +446,139 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
|
||||
if (symbol == 1) {
|
||||
max_h = nr_pbch_channel_level(nr_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
max_h = nr_pbch_channel_level(dl_ch_estimates_ext,
|
||||
frame_parms,
|
||||
symbol);
|
||||
nr_ue_pbch_vars->log2_maxh = 3+(log2_approx(max_h)/2);
|
||||
nb_re);
|
||||
log2_maxh = 3+(log2_approx(max_h)/2);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_I(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n",nr_ue_pbch_vars->log2_maxh,max_h);
|
||||
#endif
|
||||
nr_pbch_channel_compensation(nr_ue_pbch_vars->rxdataF_ext,
|
||||
nr_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
nr_ue_pbch_vars->rxdataF_comp,
|
||||
struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL];
|
||||
nr_pbch_channel_compensation(rxdataF_ext,
|
||||
dl_ch_estimates_ext,
|
||||
nb_re,
|
||||
rxdataF_comp,
|
||||
frame_parms,
|
||||
symbol,
|
||||
nr_ue_pbch_vars->log2_maxh); // log2_maxh+I0_shift
|
||||
log2_maxh); // log2_maxh+I0_shift
|
||||
|
||||
/*if (frame_parms->nb_antennas_rx > 1)
|
||||
pbch_detection_mrc(frame_parms,
|
||||
nr_ue_pbch_vars->rxdataF_comp,
|
||||
rxdataF_comp,
|
||||
symbol);*/
|
||||
|
||||
/*
|
||||
if (mimo_mode == ALAMOUTI) {
|
||||
nr_pbch_alamouti(frame_parms,nr_ue_pbch_vars->rxdataF_comp,symbol);
|
||||
nr_pbch_alamouti(frame_parms,rxdataF_comp,symbol);
|
||||
} else if (mimo_mode != SISO) {
|
||||
LOG_I(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
|
||||
return(-1);
|
||||
}
|
||||
*/
|
||||
if (symbol==2) {
|
||||
nr_pbch_quantize(pbch_e_rx,
|
||||
(short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]),
|
||||
144);
|
||||
pbch_e_rx+=144;
|
||||
} else {
|
||||
nr_pbch_quantize(pbch_e_rx,
|
||||
(short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]),
|
||||
360);
|
||||
pbch_e_rx+=360;
|
||||
}
|
||||
int nb=symbol==2 ? 144 : 360;
|
||||
nr_pbch_quantize(pbch_e_rx+pbch_e_rx_idx,
|
||||
(short *)rxdataF_comp[0],
|
||||
nb);
|
||||
memcpy(pbch_unClipped+pbch_e_rx_idx, rxdataF_comp[0], nb*sizeof(int16_t));
|
||||
pbch_e_rx_idx+=nb;
|
||||
}
|
||||
|
||||
// legacy code use int16, but it is complex16
|
||||
UEscopeCopy(ue, pbchRxdataF_comp, pbch_unClipped, sizeof(struct complex16), frame_parms->nb_antennas_rx, pbch_e_rx_idx/2);
|
||||
UEscopeCopy(ue, pbchLlr, pbch_e_rx, sizeof(int16_t), frame_parms->nb_antennas_rx, pbch_e_rx_idx);
|
||||
#ifdef DEBUG_PBCH
|
||||
write_output("rxdataF_comp.m","rxFcomp",&nr_ue_pbch_vars->rxdataF_comp[0][240],240*3,1,1);
|
||||
#endif
|
||||
pbch_e_rx = nr_ue_pbch_vars->llr;
|
||||
//demod_pbch_e = nr_ue_pbch_vars->demod_pbch_e;
|
||||
// FT?? cppcheck fix - pbch_a = nr_ue_pbch_vars->pbch_a;
|
||||
#ifdef DEBUG_PBCH
|
||||
//pbch_e_rx = &nr_ue_pbch_vars->llr[0];
|
||||
short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][20*12]);
|
||||
|
||||
write_output("rxdataF_comp.m","rxFcomp",rxdataF_comp[0],240*3,1,1);
|
||||
short *p = (short *)rxdataF_comp[0]);
|
||||
|
||||
for (int cnt = 0; cnt < 864 ; cnt++)
|
||||
printf("pbch rx llr %d\n",*(pbch_e_rx+cnt));
|
||||
|
||||
|
||||
#endif
|
||||
//un-scrambling
|
||||
M = NR_POLAR_PBCH_E;
|
||||
nushift = (Lmax==4)? i_ssb&3 : i_ssb&7;
|
||||
uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041;
|
||||
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0);
|
||||
uint32_t pbch_a_interleaved=0;
|
||||
uint32_t pbch_a_prime=0;
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_E,
|
||||
0, 0, pbch_a_prime, &pbch_a_interleaved);
|
||||
//polar decoding de-rate matching
|
||||
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,
|
||||
uint64_t tmp=0;
|
||||
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&tmp,0,
|
||||
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
|
||||
pbch_a_prime=tmp;
|
||||
if(decoderState)
|
||||
return(decoderState);
|
||||
|
||||
if(decoderState) return(decoderState);
|
||||
|
||||
// printf("polar decoder output 0x%08x\n",nr_ue_pbch_vars->pbch_a_prime);
|
||||
// printf("polar decoder output 0x%08x\n",pbch_a_prime);
|
||||
// Decoder reversal
|
||||
uint32_t a_reversed=0;
|
||||
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
|
||||
a_reversed |= (((uint64_t)nr_ue_pbch_vars->pbch_a_prime>>i)&1)<<(31-i);
|
||||
a_reversed |= (((uint64_t)pbch_a_prime>>i)&1)<<(31-i);
|
||||
|
||||
nr_ue_pbch_vars->pbch_a_prime = a_reversed;
|
||||
pbch_a_prime = a_reversed;
|
||||
//payload un-scrambling
|
||||
nr_ue_pbch_vars->pbch_a_interleaved=0;
|
||||
M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3);
|
||||
nushift = ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) ^ (((nr_ue_pbch_vars->pbch_a_prime>>6)&1)<<1);
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_PAYLOAD_BITS,1,unscrambling_mask);
|
||||
//printf("nushift %d sfn 3rd %d 2nd %d", nushift,((nr_ue_pbch_vars->pbch_a_prime>>6)&1), ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) );
|
||||
nushift = ((pbch_a_prime>>24)&1) ^ (((pbch_a_prime>>6)&1)<<1);
|
||||
pbch_a_interleaved=0;
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS,
|
||||
1, unscrambling_mask, pbch_a_prime, &pbch_a_interleaved);
|
||||
//printf("nushift %d sfn 3rd %d 2nd %d", nushift,((pbch_a_prime>>6)&1), ((pbch_a_prime>>24)&1) );
|
||||
//payload deinterleaving
|
||||
//uint32_t in=0;
|
||||
uint32_t out=0;
|
||||
|
||||
for (int i=0; i<32; i++) {
|
||||
out |= ((nr_ue_pbch_vars->pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]);
|
||||
out |= ((pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]);
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, nr_ue_pbch_vars->pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (nr_ue_pbch_vars->pbch_a_interleaved>>i)&1);
|
||||
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (pbch_a_interleaved>>i)&1);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t payload = 0;
|
||||
//uint8_t xtra_byte = 0;
|
||||
nr_ue_pbch_vars->xtra_byte = (out>>24)&0xff;
|
||||
result->xtra_byte = (out>>24)&0xff;
|
||||
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
|
||||
payload |= ((out>>i)&1)<<(NR_POLAR_PBCH_PAYLOAD_BITS-i-1);
|
||||
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
decoded_output[i] = (uint8_t)((payload>>((3-i)<<3))&0xff);
|
||||
|
||||
frame_parms->half_frame_bit = ((nr_ue_pbch_vars->xtra_byte>>4)&0x01); // computing the half frame index from the extra byte
|
||||
|
||||
result->decoded_output[i] = (uint8_t)((payload>>((3-i)<<3))&0xff);
|
||||
|
||||
frame_parms->half_frame_bit = (result->xtra_byte>>4)&0x01; // computing the half frame index from the extra byte
|
||||
frame_parms->ssb_index = i_ssb; // ssb index corresponds to i_ssb for Lmax = 4,8
|
||||
|
||||
if (Lmax == 64) { // for Lmax = 64 ssb index 4th,5th and 6th bits are in extra byte
|
||||
for (int i=0; i<3; i++)
|
||||
frame_parms->ssb_index += (((nr_ue_pbch_vars->xtra_byte>>(7-i))&0x01)<<(3+i));
|
||||
frame_parms->ssb_index += (((result->xtra_byte>>(7-i))&0x01)<<(3+i));
|
||||
}
|
||||
|
||||
ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms,frame_parms->ssb_index);
|
||||
|
||||
if (frame_parms->half_frame_bit)
|
||||
ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot;
|
||||
ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot;
|
||||
|
||||
uint8_t frame_number_4lsb = 0;
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
frame_number_4lsb |= ((nr_ue_pbch_vars->xtra_byte>>i)&1)<<(3-i);
|
||||
|
||||
frame_number_4lsb |= ((result->xtra_byte>>i)&1)<<(3-i);
|
||||
|
||||
proc->decoded_frame_rx = frame_number_4lsb;
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
printf("xtra_byte %x payload %x\n", nr_ue_pbch_vars->xtra_byte, payload);
|
||||
printf("xtra_byte %x payload %x\n", xtra_byte, payload);
|
||||
|
||||
for (int i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++) {
|
||||
// printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]);
|
||||
printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]);
|
||||
printf("[PBCH] decoder payload[%d] = %x\n",i,result->decoded_output[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t *rx_ind=calloc(sizeof(*rx_ind),1);
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
|
||||
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc);
|
||||
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc,(void *)result);
|
||||
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
|
||||
@@ -1152,11 +1152,14 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin
|
||||
*/
|
||||
int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
const int estimateSz,
|
||||
struct complex16 dl_ch_estimates[][estimateSz],
|
||||
NR_UE_PBCH *nr_ue_pbch_vars,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t eNB_id,
|
||||
uint8_t i_ssb,
|
||||
MIMO_mode_t mimo_mode);
|
||||
MIMO_mode_t mimo_mode,
|
||||
fapiPbch_t* result);
|
||||
|
||||
int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
|
||||
@@ -88,9 +88,9 @@ typedef struct {
|
||||
/// LDPC-code outputs
|
||||
uint8_t *d[MAX_NUM_NR_ULSCH_SEGMENTS];
|
||||
/// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17)
|
||||
uint8_t *e;
|
||||
uint8_t *e;
|
||||
/// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30)
|
||||
uint8_t *f;
|
||||
uint8_t *f;
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of bits in code segments
|
||||
@@ -122,55 +122,15 @@ typedef struct {
|
||||
typedef struct {
|
||||
/// SRS active flag
|
||||
uint8_t srs_active;
|
||||
//#if defined(UPGRADE_RAT_NR)
|
||||
#if 1
|
||||
// Pointers to HARQ processes for the ULSCH
|
||||
NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
|
||||
int harq_process_id[NR_MAX_SLOTS_PER_FRAME];
|
||||
// UL number of harq processes
|
||||
uint8_t number_harq_processes_for_pusch;
|
||||
#endif
|
||||
/*
|
||||
/// Pointer to CQI data (+1 for 8 bits crc)
|
||||
uint8_t o[1+MAX_CQI_BYTES];
|
||||
/// Length of CQI data (bits)
|
||||
uint8_t O;
|
||||
/// Format of CQI data
|
||||
UCI_format_t uci_format;
|
||||
/// Rank information
|
||||
uint8_t o_RI[2];
|
||||
/// Length of rank information (bits)
|
||||
uint8_t O_RI;
|
||||
/// Pointer to ACK
|
||||
uint8_t o_ACK[4];
|
||||
*/
|
||||
/// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37)
|
||||
uint8_t O_CQI_MIN;
|
||||
/// ACK/NAK Bundling flag
|
||||
uint8_t bundling;
|
||||
/// Concatenated "g"-sequences (for definition see 36-212 V15.4.0 2018-12, p.31)
|
||||
uint8_t g[MAX_NUM_NR_CHANNEL_BITS] __attribute__ ((aligned(32)));
|
||||
/// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
|
||||
uint8_t h[MAX_NUM_NR_CHANNEL_BITS];
|
||||
/// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
|
||||
uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS];
|
||||
/// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
|
||||
int32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
|
||||
/// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4)
|
||||
int32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
|
||||
/*
|
||||
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
|
||||
uint8_t q[MAX_CQI_PAYLOAD];
|
||||
|
||||
/// coded and interleaved CQI bits
|
||||
uint8_t o_w[(MAX_CQI_BITS+8)*3];
|
||||
/// coded CQI bits
|
||||
uint8_t o_d[96+((MAX_CQI_BITS+8)*3)];
|
||||
/// coded ACK bits
|
||||
uint8_t q_ACK[MAX_ACK_PAYLOAD];
|
||||
/// coded RI bits
|
||||
uint8_t q_RI[MAX_RI_PAYLOAD];
|
||||
*/
|
||||
/// beta_offset_cqi times 8
|
||||
uint16_t beta_offset_cqi_times8;
|
||||
/// beta_offset_ri times 8
|
||||
@@ -219,7 +179,9 @@ typedef struct {
|
||||
/// Pointer to the payload
|
||||
uint8_t *b;
|
||||
/// Pointers to transport block segments
|
||||
uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t **c;
|
||||
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
int16_t **d;
|
||||
/// Index of current HARQ round for this DLSCH
|
||||
uint8_t round;
|
||||
/// MCS table for this DLSCH
|
||||
@@ -234,12 +196,6 @@ typedef struct {
|
||||
uint8_t rvidx;
|
||||
/// MIMO mode for this DLSCH
|
||||
MIMO_nrmode_t mimo_mode;
|
||||
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
int16_t *w[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
//double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
|
||||
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
|
||||
int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of bits in code segments
|
||||
|
||||
@@ -86,16 +86,17 @@ void nr_rf_card_config_freq(openair0_config_t *openair0_cfg,
|
||||
uint8_t cc_id = 0;
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id];
|
||||
int rf_chain = ue->rf_map.chain;
|
||||
double freq_scale = (double)(dl_carrier + freq_offset) / dl_carrier;
|
||||
|
||||
for (int i = rf_chain; i < rf_chain + 4; i++) {
|
||||
|
||||
if (i < openair0_cfg->rx_num_channels)
|
||||
openair0_cfg->rx_freq[i + rf_chain] = dl_carrier + freq_offset;
|
||||
openair0_cfg->rx_freq[i + rf_chain] = dl_carrier * freq_scale;
|
||||
else
|
||||
openair0_cfg->rx_freq[i] = 0.0;
|
||||
|
||||
if (i<openair0_cfg->tx_num_channels)
|
||||
openair0_cfg->tx_freq[i] = ul_carrier + freq_offset;
|
||||
openair0_cfg->tx_freq[i] = ul_carrier * freq_scale;
|
||||
else
|
||||
openair0_cfg->tx_freq[i] = 0.0;
|
||||
|
||||
|
||||
@@ -174,43 +174,23 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
unsigned int G)
|
||||
{
|
||||
start_meas(&ue->ulsch_encoding_stats);
|
||||
/////////////////////////parameters and variables declaration/////////////////////////
|
||||
///////////
|
||||
|
||||
unsigned int crc;
|
||||
NR_UL_UE_HARQ_t *harq_process;
|
||||
uint16_t nb_rb ;
|
||||
uint32_t A, F;
|
||||
uint32_t *pz;
|
||||
uint8_t mod_order;
|
||||
uint16_t Kr,r;
|
||||
uint32_t r_offset;
|
||||
uint32_t E,Kb;
|
||||
uint8_t Ilbrm;
|
||||
uint32_t Tbslbrm;
|
||||
uint16_t R;
|
||||
float Coderate;
|
||||
|
||||
///////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////parameters and variables initialization/////////////////////////
|
||||
///////////
|
||||
|
||||
crc = 1;
|
||||
harq_process = ulsch->harq_processes[harq_pid];
|
||||
nb_rb = harq_process->pusch_pdu.rb_size;
|
||||
A = harq_process->pusch_pdu.pusch_data.tb_size*8;
|
||||
pz = &harq_process->Z;
|
||||
mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
|
||||
R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
|
||||
Kr=0;
|
||||
r_offset=0;
|
||||
F=0;
|
||||
Ilbrm = 0;
|
||||
Tbslbrm = 950984; //max tbs
|
||||
Coderate = 0.0;
|
||||
unsigned int crc = 1;
|
||||
NR_UL_UE_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
||||
uint16_t nb_rb = harq_process->pusch_pdu.rb_size;
|
||||
uint32_t A = harq_process->pusch_pdu.pusch_data.tb_size*8;
|
||||
uint32_t *pz = &harq_process->Z;
|
||||
uint8_t mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
|
||||
uint16_t R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
|
||||
uint16_t Kr=0;
|
||||
uint32_t r_offset=0;
|
||||
uint32_t F=0;
|
||||
uint8_t Ilbrm = 0;
|
||||
uint32_t Tbslbrm = 950984; //max tbs
|
||||
float Coderate = 0.0;
|
||||
///////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -286,14 +266,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
|
||||
start_meas(&ue->ulsch_segmentation_stats);
|
||||
Kb=nr_segmentation(harq_process->b,
|
||||
harq_process->c,
|
||||
harq_process->B,
|
||||
&harq_process->C,
|
||||
&harq_process->K,
|
||||
pz,
|
||||
&harq_process->F,
|
||||
harq_process->BG);
|
||||
uint32_t Kb=nr_segmentation(harq_process->b,
|
||||
harq_process->c,
|
||||
harq_process->B,
|
||||
&harq_process->C,
|
||||
&harq_process->K,
|
||||
pz,
|
||||
&harq_process->F,
|
||||
harq_process->BG);
|
||||
|
||||
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->pusch_pdu.nrOfLayers) {
|
||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
||||
return(-1);
|
||||
}
|
||||
stop_meas(&ue->ulsch_segmentation_stats);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -310,7 +295,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
//printf("segment Z %d k %d Kr %d BG %d\n", *pz,harq_process->K,Kr,BG);
|
||||
|
||||
//start_meas(te_stats);
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
for (int r=0; r<harq_process->C; r++) {
|
||||
//channel_input[r] = &harq_process->d[r][0];
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("Encoder: B %d F %d \n",harq_process->B, harq_process->F);
|
||||
@@ -345,8 +330,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN);
|
||||
|
||||
start_meas(&ue->ulsch_ldpc_encoding_stats);
|
||||
for(int j = 0; j < (harq_process->C/8 + 1); j++)
|
||||
{
|
||||
for(int j = 0; j < (harq_process->C/8 + 1); j++) {
|
||||
impp.macro_num = j;
|
||||
nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,harq_process->BG,&impp);
|
||||
}
|
||||
@@ -369,14 +353,13 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
F = harq_process->F;
|
||||
Kr = harq_process->K;
|
||||
|
||||
for (r=0; r<harq_process->C; r++) { // looping over C segments
|
||||
|
||||
for (int r=0; r<harq_process->C; r++) { // looping over C segments
|
||||
if (harq_process->F>0) {
|
||||
for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) {
|
||||
harq_process->d[r][k] = NR_NULL;
|
||||
//if (k<(Kr-F+8))
|
||||
//printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]);
|
||||
}
|
||||
for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) {
|
||||
harq_process->d[r][k] = NR_NULL;
|
||||
//if (k<(Kr-F+8))
|
||||
//printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +374,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
|
||||
///////////
|
||||
|
||||
E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r);
|
||||
uint32_t E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r);
|
||||
|
||||
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers);
|
||||
|
||||
@@ -434,9 +417,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
start_meas(&ue->ulsch_interleaving_stats);
|
||||
nr_interleaving_ldpc(E,
|
||||
mod_order,
|
||||
harq_process->e+r_offset,
|
||||
harq_process->f+r_offset);
|
||||
mod_order,
|
||||
harq_process->e+r_offset,
|
||||
harq_process->f+r_offset);
|
||||
stop_meas(&ue->ulsch_interleaving_stats);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT);
|
||||
@@ -458,8 +441,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
}
|
||||
|
||||
memcpy(ulsch->g,harq_process->f,G); // g is the concatenated code block
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
|
||||
stop_meas(&ue->ulsch_encoding_stats);
|
||||
|
||||
@@ -105,18 +105,15 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
}
|
||||
|
||||
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
unsigned char harq_pid,
|
||||
uint32_t frame,
|
||||
uint8_t slot,
|
||||
uint8_t thread_id,
|
||||
int gNB_id) {
|
||||
unsigned char harq_pid,
|
||||
uint32_t frame,
|
||||
uint8_t slot,
|
||||
uint8_t thread_id,
|
||||
int gNB_id) {
|
||||
|
||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||
|
||||
uint32_t available_bits;
|
||||
uint8_t cwd_index, l;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **tx_layers;
|
||||
int32_t **txdataF;
|
||||
int8_t Wf[2], Wt[2];
|
||||
int l_prime[2], delta;
|
||||
@@ -125,102 +122,100 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
int sample_offsetF, N_RE_prime;
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
|
||||
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
||||
|
||||
uint8_t num_of_codewords = 1; // tmp assumption
|
||||
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
|
||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id];
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
|
||||
int start_symbol = pusch_pdu->start_symbol_index;
|
||||
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos;
|
||||
uint8_t number_of_symbols = pusch_pdu->nr_of_symbols;
|
||||
uint8_t dmrs_type = pusch_pdu->dmrs_config_type;
|
||||
uint16_t start_rb = pusch_pdu->rb_start;
|
||||
uint16_t nb_rb = pusch_pdu->rb_size;
|
||||
uint8_t Nl = pusch_pdu->nrOfLayers;
|
||||
uint8_t mod_order = pusch_pdu->qam_mod_order;
|
||||
uint16_t rnti = pusch_pdu->rnti;
|
||||
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB;
|
||||
|
||||
int start_symbol = pusch_pdu->start_symbol_index;
|
||||
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos;
|
||||
uint8_t number_of_symbols = pusch_pdu->nr_of_symbols;
|
||||
uint8_t dmrs_type = pusch_pdu->dmrs_config_type;
|
||||
uint16_t start_rb = pusch_pdu->rb_start;
|
||||
uint16_t nb_rb = pusch_pdu->rb_size;
|
||||
uint8_t Nl = pusch_pdu->nrOfLayers;
|
||||
uint8_t mod_order = pusch_pdu->qam_mod_order;
|
||||
uint16_t rnti = pusch_pdu->rnti;
|
||||
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB;
|
||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||
start_sc -= frame_parms->ofdm_symbol_size;
|
||||
|
||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||
start_sc -= frame_parms->ofdm_symbol_size;
|
||||
ulsch_ue->Nid_cell = frame_parms->Nid_cell;
|
||||
|
||||
ulsch_ue->Nid_cell = frame_parms->Nid_cell;
|
||||
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||
if((ul_dmrs_symb_pos >> i) & 0x01)
|
||||
number_dmrs_symbols += 1;
|
||||
}
|
||||
|
||||
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||
if((ul_dmrs_symb_pos >> i) & 0x01)
|
||||
number_dmrs_symbols += 1;
|
||||
}
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
|
||||
|
||||
LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
|
||||
// TbD num_of_mod_symbols is set but never used
|
||||
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb;
|
||||
|
||||
// TbD num_of_mod_symbols is set but never used
|
||||
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords;
|
||||
/////////////////////////ULSCH coding/////////////////////////
|
||||
///////////
|
||||
|
||||
/////////////////////////ULSCH coding/////////////////////////
|
||||
///////////
|
||||
|
||||
unsigned int G = nr_get_G(nb_rb, number_of_symbols,
|
||||
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
|
||||
unsigned int G = nr_get_G(nb_rb, number_of_symbols,
|
||||
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
|
||||
|
||||
|
||||
trace_NRpdu(DIRECTION_UPLINK,
|
||||
ulsch_ue->harq_processes[harq_pid]->a,
|
||||
ulsch_ue->harq_processes[harq_pid]->pusch_pdu.pusch_data.tb_size,
|
||||
0, WS_C_RNTI, rnti, frame, slot, 0, 0);
|
||||
trace_NRpdu(DIRECTION_UPLINK,
|
||||
harq_process_ul_ue->a,
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size,
|
||||
0, WS_C_RNTI, rnti, frame, slot, 0, 0);
|
||||
|
||||
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
|
||||
return;
|
||||
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
|
||||
return;
|
||||
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////ULSCH scrambling/////////////////////////
|
||||
///////////
|
||||
/////////////////////////ULSCH scrambling/////////////////////////
|
||||
///////////
|
||||
|
||||
available_bits = G;
|
||||
available_bits = G;
|
||||
uint32_t scrambled_output[(available_bits>>5)+1];
|
||||
memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t));
|
||||
|
||||
memset(scrambled_output[cwd_index], 0, ((available_bits>>5)+1)*sizeof(uint32_t));
|
||||
nr_pusch_codeword_scrambling(harq_process_ul_ue->f,
|
||||
available_bits,
|
||||
ulsch_ue->Nid_cell,
|
||||
rnti,
|
||||
false,
|
||||
scrambled_output);
|
||||
|
||||
nr_pusch_codeword_scrambling(ulsch_ue->g,
|
||||
available_bits,
|
||||
ulsch_ue->Nid_cell,
|
||||
rnti,
|
||||
false,
|
||||
scrambled_output[cwd_index]); // assume one codeword for the moment
|
||||
/////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////ULSCH modulation/////////////////////////
|
||||
///////////
|
||||
|
||||
/////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int max_num_re = number_of_symbols*nb_rb*NR_NB_SC_PER_RB;
|
||||
int32_t d_mod[max_num_re] __attribute__ ((aligned(16)));
|
||||
|
||||
/////////////////////////ULSCH modulation/////////////////////////
|
||||
///////////
|
||||
|
||||
nr_modulation(scrambled_output[cwd_index], // assume one codeword for the moment
|
||||
available_bits,
|
||||
mod_order,
|
||||
(int16_t *)ulsch_ue->d_mod);
|
||||
nr_modulation(scrambled_output, // assume one codeword for the moment
|
||||
available_bits,
|
||||
mod_order,
|
||||
(int16_t *)d_mod);
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////DMRS Modulation/////////////////////////
|
||||
///////////
|
||||
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||
uint32_t **pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||
uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||
int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
|
||||
///////////
|
||||
@@ -256,9 +251,11 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
/////////////////////////ULSCH layer mapping/////////////////////////
|
||||
///////////
|
||||
|
||||
tx_layers = (int16_t **)pusch_ue->txdataF_layers;
|
||||
int16_t **tx_layers = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *));
|
||||
for (int nl=0; nl<Nl; nl++)
|
||||
tx_layers[nl] = (int16_t *)malloc16_clear((available_bits<<1)/mod_order*sizeof(int16_t));
|
||||
|
||||
nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id],
|
||||
nr_ue_layer_mapping((int16_t *)d_mod,
|
||||
Nl,
|
||||
available_bits/mod_order,
|
||||
tx_layers);
|
||||
@@ -276,13 +273,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
uint8_t u = 0, v = 0;
|
||||
int16_t *dmrs_seq = NULL;
|
||||
|
||||
/// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4)
|
||||
int32_t y[max_num_re] __attribute__ ((aligned(16)));
|
||||
|
||||
// if transform precoding is enbaled (value 0)
|
||||
if (pusch_pdu->transform_precoding == 0) {
|
||||
|
||||
uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB;
|
||||
uint32_t y_offset = 0;
|
||||
uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2);
|
||||
|
||||
|
||||
// Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol
|
||||
index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol);
|
||||
u = pusch_pdu->dfts_ofdm.low_papr_group_number;
|
||||
@@ -291,59 +291,54 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n");
|
||||
AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated");
|
||||
|
||||
|
||||
LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index);
|
||||
|
||||
for (l = start_symbol; l < start_symbol + number_of_symbols; l++) {
|
||||
for (int l = start_symbol; l < start_symbol + number_of_symbols; l++) {
|
||||
|
||||
if((ul_dmrs_symb_pos >> l) & 0x01)
|
||||
/* In the symbol with DMRS no data would be transmitted CDM groups is 2*/
|
||||
continue;
|
||||
|
||||
nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch);
|
||||
nr_dft(&y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch);
|
||||
|
||||
y_offset = y_offset + nb_re_pusch;
|
||||
|
||||
LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset);
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n",
|
||||
y_offset, nb_re_pusch, l, nb_rb);
|
||||
#endif
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n",
|
||||
y_offset, nb_re_pusch, l, nb_rb);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DFT_IDFT
|
||||
int32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
|
||||
int offset = 0;
|
||||
printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order);
|
||||
#ifdef DEBUG_DFT_IDFT
|
||||
int32_t debug_symbols[max_num_re] __attribute__ ((aligned(16)));
|
||||
int offset = 0;
|
||||
printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order);
|
||||
|
||||
for (int ll = 0; ll < (available_bits/mod_order); ll++) {
|
||||
debug_symbols[ll] = ulsch_ue->y[ll];
|
||||
}
|
||||
|
||||
printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols);
|
||||
for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) {
|
||||
for (int ll = 0; ll < (available_bits/mod_order); ll++) {
|
||||
debug_symbols[ll] = y[ll];
|
||||
}
|
||||
|
||||
nr_idft(&debug_symbols[offset], nb_re_pusch);
|
||||
|
||||
offset = offset + nb_re_pusch;
|
||||
|
||||
}
|
||||
LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("postDFT_all_symbols.m","UE_postDFT", ulsch_ue->y,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1);
|
||||
#endif
|
||||
printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols);
|
||||
for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) {
|
||||
nr_idft(&debug_symbols[offset], nb_re_pusch);
|
||||
offset = offset + nb_re_pusch;
|
||||
}
|
||||
LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("postDFT_all_symbols.m","UE_postDFT", y,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1);
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t));
|
||||
memcpy(y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t));
|
||||
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
for (int nl = 0; nl < Nl; nl++)
|
||||
free_and_zero(tx_layers[nl]);
|
||||
free_and_zero(tx_layers);
|
||||
|
||||
/////////////////////////ULSCH RE mapping/////////////////////////
|
||||
///////////
|
||||
@@ -356,18 +351,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
uint16_t m = 0;
|
||||
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u);
|
||||
#endif
|
||||
|
||||
// DMRS params for this ap
|
||||
get_Wt(Wt, ap, dmrs_type);
|
||||
get_Wf(Wf, ap, dmrs_type);
|
||||
delta = get_delta(ap, dmrs_type);
|
||||
|
||||
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
||||
for (int l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
||||
|
||||
uint16_t k = start_sc;
|
||||
uint16_t n = 0;
|
||||
@@ -388,21 +381,18 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // Qm = 2 as DMRS is QPSK modulated
|
||||
} else {
|
||||
dmrs_idx = 0;
|
||||
}
|
||||
|
||||
|
||||
} else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
|
||||
AssertFatal(pusch_pdu->transform_precoding == 1, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n");
|
||||
|
||||
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) {
|
||||
is_ptrs_sym = 1;
|
||||
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
||||
nr_modulation(pusch_dmrs[l], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,15 +407,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
||||
is_dmrs = 1;
|
||||
} else if (is_ptrs_sym) {
|
||||
is_ptrs = is_ptrs_subcarrier(k,
|
||||
rnti,
|
||||
ap,
|
||||
dmrs_type,
|
||||
K_ptrs,
|
||||
nb_rb,
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset,
|
||||
start_sc,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
is_ptrs = is_ptrs_subcarrier(k,
|
||||
rnti,
|
||||
ap,
|
||||
dmrs_type,
|
||||
K_ptrs,
|
||||
nb_rb,
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset,
|
||||
start_sc,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
|
||||
if (is_dmrs == 1) {
|
||||
@@ -434,19 +424,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n",
|
||||
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n",
|
||||
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
|
||||
dmrs_idx++;
|
||||
@@ -463,14 +453,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
} else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k, start_sc, frame_parms->ofdm_symbol_size, cdm_grps_no_data, dmrs_type)) {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) y)[m<<1];
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) y)[(m<<1) + 1];
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||
m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
m++;
|
||||
|
||||
@@ -486,10 +476,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
||||
harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid];
|
||||
harq_process_ulsch = UE->ulsch[thread_id][gNB_id]->harq_processes[harq_pid];
|
||||
harq_process_ulsch->status = SCH_IDLE;
|
||||
|
||||
///////////
|
||||
|
||||
@@ -861,7 +861,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
|
||||
|
||||
/* perform correlation of rx data and pss sequence ie it is a dot product */
|
||||
result = dot_product64((short*)primary_synchro_time_nr[pss_index],
|
||||
(short*) &(rxdata[ar][n+is*frame_parms->samples_per_frame]),
|
||||
(short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]),
|
||||
frame_parms->ofdm_symbol_size,
|
||||
shift);
|
||||
pss_corr_ue[pss_index][n] += abs64(result);
|
||||
|
||||
@@ -40,6 +40,13 @@ const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED};
|
||||
typedef struct complex16 scopeSample_t;
|
||||
#define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i)
|
||||
|
||||
typedef struct {
|
||||
int dataSize;
|
||||
int elementSz;
|
||||
int colSz;
|
||||
int lineSz;
|
||||
} scopeGraphData_t;
|
||||
|
||||
typedef struct OAIgraph {
|
||||
FL_OBJECT *graph;
|
||||
FL_OBJECT *text;
|
||||
@@ -56,7 +63,7 @@ typedef struct OAIgraph {
|
||||
boolean_t initDone;
|
||||
int iteration;
|
||||
void (*gNBfunct) (struct OAIgraph *graph, scopeData_t *p, int UE_id);
|
||||
void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id);
|
||||
void (*nrUEfunct)(scopeGraphData_t **data, struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id);
|
||||
} OAIgraph_t;
|
||||
|
||||
/* Forms and Objects */
|
||||
@@ -140,7 +147,7 @@ static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, scopeData_t
|
||||
return graph;
|
||||
}
|
||||
|
||||
static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id),
|
||||
static OAIgraph_t nrUEcommonGraph( void (*funct) (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id),
|
||||
int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
||||
OAIgraph_t graph;
|
||||
commonGraph(&graph, type, x, y, w, h, label, pointColor);
|
||||
@@ -341,7 +348,7 @@ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
||||
static void gNBfreqWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
||||
NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms;
|
||||
//use 1st antenna
|
||||
genericWaterFall(graph, (scopeSample_t *)p->rxdataF, frame_parms->samples_per_frame_wCP,
|
||||
genericWaterFall(graph, (scopeSample_t *)p->liveData, frame_parms->samples_per_frame_wCP,
|
||||
frame_parms->slots_per_frame,
|
||||
"X axis: Frequency domain, one subframe");
|
||||
}
|
||||
@@ -515,6 +522,7 @@ void phy_scope_gNB(OAI_phy_scope_t *form,
|
||||
|
||||
//fl_check_forms();
|
||||
}
|
||||
|
||||
static void *scope_thread_gNB(void *arg) {
|
||||
scopeData_t *p=(scopeData_t *) arg;
|
||||
size_t stksize=0;
|
||||
@@ -539,11 +547,12 @@ static void *scope_thread_gNB(void *arg) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void copyRxdataF(int32_t *data, int slot, void *scopeData) {
|
||||
scopeData_t *scope=(scopeData_t *)scopeData;
|
||||
memcpy(scope->rxdataF + slot*scope->gNB->frame_parms.samples_per_slot_wCP,
|
||||
memcpy(((int32_t *)scope->liveData) + slot*scope->gNB->frame_parms.samples_per_slot_wCP,
|
||||
data,
|
||||
scope->gNB->frame_parms.samples_per_slot_wCP);
|
||||
scope->gNB->frame_parms.samples_per_slot_wCP*sizeof(int32_t));
|
||||
}
|
||||
|
||||
void gNBinitScope(scopeParms_t *p) {
|
||||
@@ -554,11 +563,11 @@ void gNBinitScope(scopeParms_t *p) {
|
||||
scope->ru=p->ru;
|
||||
scope->gNB=p->gNB;
|
||||
scope->slotFunc=copyRxdataF;
|
||||
AssertFatal(scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),"");
|
||||
AssertFatal(scope->liveData= calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),"");
|
||||
pthread_t forms_thread;
|
||||
threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW);
|
||||
}
|
||||
static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void ueWaterFall (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// Received signal in time domain of receive antenna 0
|
||||
genericWaterFall(graph,
|
||||
(scopeSample_t *) phy_vars_ue->common_vars.rxdata[0],
|
||||
@@ -574,13 +583,19 @@ static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int
|
||||
phy_vars_ue->frame_parms.samples_per_frame);
|
||||
}
|
||||
*/
|
||||
static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
|
||||
static void ueChannelResponse (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// Channel Impulse Response
|
||||
genericPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx,
|
||||
(const scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time,
|
||||
phy_vars_ue->frame_parms.ofdm_symbol_size>>3);
|
||||
if (!data[pbchDlChEstimateTime])
|
||||
return;
|
||||
|
||||
const scopeSample_t *tmp=(scopeSample_t *)(data[pbchDlChEstimateTime]+1);
|
||||
genericPowerPerAntena(graph, data[pbchDlChEstimateTime]->colSz,
|
||||
&tmp,
|
||||
data[pbchDlChEstimateTime]->lineSz);
|
||||
}
|
||||
static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) {
|
||||
|
||||
static void ueFreqWaterFall (scopeGraphData_t **data, OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) {
|
||||
NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms;
|
||||
//use 1st antenna
|
||||
genericWaterFall(graph,
|
||||
@@ -624,56 +639,44 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue
|
||||
oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10);
|
||||
}
|
||||
*/
|
||||
static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void uePbchLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PBCH LLRs
|
||||
if ( !phy_vars_ue->pbch_vars[eNB_id]->llr)
|
||||
if ( !data[pbchLlr])
|
||||
return;
|
||||
|
||||
int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr;
|
||||
const int sz=data[pbchLlr]->lineSz;
|
||||
//const int antennas=data[pbchLlr]->colSz;
|
||||
// We take the first antenna only for now
|
||||
int16_t *llrs = (int16_t *) (data[pbchLlr]+1);
|
||||
float *llr_pbch, *bit_pbch;
|
||||
oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, 864, 0);
|
||||
oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, sz, 0);
|
||||
|
||||
for (int i=0; i<864; i++) {
|
||||
llr_pbch[i] = (float) pbch_llr[i];
|
||||
for (int i=0; i<sz; i++) {
|
||||
llr_pbch[i] = llrs[i];
|
||||
}
|
||||
|
||||
oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10);
|
||||
oai_xygraph(graph,bit_pbch,llr_pbch,sz,0,10);
|
||||
}
|
||||
static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
|
||||
static void uePbchIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PBCH I/Q of MF Output
|
||||
if (!phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0])
|
||||
if (!data[pbchRxdataF_comp])
|
||||
return;
|
||||
|
||||
scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0];
|
||||
scopeSample_t *pbch_comp = (scopeSample_t *) (data[pbchRxdataF_comp]+1);
|
||||
const int sz=data[pbchRxdataF_comp]->lineSz;
|
||||
float *I, *Q;
|
||||
oai_xygraph_getbuff(graph, &I, &Q, 180*3, 0);
|
||||
memset(I,0,180*3*sizeof(*I));
|
||||
memset(Q,0,180*3*sizeof(*Q));
|
||||
int first_symbol=1;
|
||||
int base=0;
|
||||
oai_xygraph_getbuff(graph, &I, &Q, sz, 0);
|
||||
|
||||
for (int symbol=first_symbol; symbol<(first_symbol+3); symbol++) {
|
||||
int nb_re;
|
||||
|
||||
if (symbol == 2 || symbol == 6)
|
||||
nb_re = 72;
|
||||
else
|
||||
nb_re = 180;
|
||||
|
||||
AssertFatal(base+nb_re<180*3,"");
|
||||
|
||||
for (int i=0; i<nb_re; i++) {
|
||||
I[base+i] = pbch_comp[symbol*20*12+i].r;
|
||||
Q[base+i] = pbch_comp[symbol*20*12+i].i;
|
||||
}
|
||||
|
||||
base+=nb_re;
|
||||
for (int i=0; i<sz; i++) {
|
||||
I[i]=pbch_comp[i].r;
|
||||
Q[i]=pbch_comp[i].i;
|
||||
}
|
||||
|
||||
AssertFatal(base <= 180*3,"");
|
||||
oai_xygraph(graph,I,Q,base,0, 10);
|
||||
oai_xygraph(graph, I, Q, sz, 0, true);
|
||||
}
|
||||
static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
|
||||
static void uePcchLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PDCCH LLRs
|
||||
if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr)
|
||||
return;
|
||||
@@ -698,7 +701,7 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
||||
AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, "");
|
||||
oai_xygraph(graph,bit,llr,base,0,10);
|
||||
}
|
||||
static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void uePcchIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PDCCH I/Q of MF Output
|
||||
if (!phy_vars_ue->pdcch_vars[0][eNB_id]->rxdataF_comp[0])
|
||||
return;
|
||||
@@ -722,7 +725,7 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i
|
||||
AssertFatal(base <= nb*RX_NB_TH_MAX, "");
|
||||
oai_xygraph(graph,I,Q,base,0,10);
|
||||
}
|
||||
static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void uePdschLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PDSCH LLRs
|
||||
if (!phy_vars_ue->pdsch_vars[0][eNB_id]->llr[0])
|
||||
return;
|
||||
@@ -749,7 +752,7 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB
|
||||
//fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword);
|
||||
oai_xygraph(graph,bit,llr,base,0,10);
|
||||
}
|
||||
static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void uePdschIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
// PDSCH I/Q of MF Output
|
||||
if (!phy_vars_ue->pdsch_vars[0][eNB_id]->rxdataF_comp0[0])
|
||||
return;
|
||||
@@ -776,7 +779,7 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
|
||||
AssertFatal(base <= sz*RX_NB_TH_MAX, "");
|
||||
oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10);
|
||||
}
|
||||
static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
static void uePdschThroughput (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
|
||||
/*
|
||||
float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||
float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
|
||||
@@ -869,7 +872,9 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) {
|
||||
fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, buf);
|
||||
return fdui;
|
||||
}
|
||||
void phy_scope_nrUE(OAI_phy_scope_t *form,
|
||||
|
||||
void phy_scope_nrUE(scopeGraphData_t **UEliveData,
|
||||
OAI_phy_scope_t *form,
|
||||
PHY_VARS_NR_UE *phy_vars_ue,
|
||||
int eNB_id,
|
||||
int UE_id) {
|
||||
@@ -886,26 +891,29 @@ void phy_scope_nrUE(OAI_phy_scope_t *form,
|
||||
int i=0;
|
||||
|
||||
while (form->graph[i].graph) {
|
||||
form->graph[i].nrUEfunct(form->graph+i, phy_vars_ue, eNB_id, UE_id);
|
||||
form->graph[i].nrUEfunct(UEliveData, form->graph+i, phy_vars_ue, eNB_id, UE_id);
|
||||
i++;
|
||||
}
|
||||
|
||||
//fl_check_forms();
|
||||
}
|
||||
|
||||
static void *nrUEscopeThread(void *arg) {
|
||||
PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg;
|
||||
size_t stksize;
|
||||
pthread_attr_t atr={0};
|
||||
pthread_attr_t atr= {0};
|
||||
pthread_attr_getstacksize(&atr, &stksize);
|
||||
pthread_attr_setstacksize(&atr,32*1024*1024 );
|
||||
int fl_argc=1;
|
||||
char *name="5G-UE-scope";
|
||||
fl_initialize (&fl_argc, &name, NULL, 0, 0);
|
||||
OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0);
|
||||
(( scopeData_t *)ue->scopeData)->liveData=calloc(sizeof(scopeGraphData_t *), UEdataTypeNumberOfItems);
|
||||
|
||||
while (!oai_exit) {
|
||||
fl_freeze_form(form_nrue->phy_scope);
|
||||
phy_scope_nrUE(form_nrue,
|
||||
phy_scope_nrUE((( scopeData_t *)ue->scopeData)->liveData,
|
||||
form_nrue,
|
||||
ue,
|
||||
0,0);
|
||||
fl_unfreeze_form(form_nrue->phy_scope);
|
||||
@@ -915,10 +923,41 @@ static void *nrUEscopeThread(void *arg) {
|
||||
|
||||
pthread_exit((void *)arg);
|
||||
}
|
||||
|
||||
void UEcopyData(PHY_VARS_NR_UE *ue, enum UEdataType type, void *dataIn, int elementSz, int colSz, int lineSz) {
|
||||
scopeData_t *tmp=(scopeData_t *)ue->scopeData;
|
||||
|
||||
if (tmp) {
|
||||
scopeGraphData_t *live= ((scopeGraphData_t **)tmp->liveData)[type];
|
||||
|
||||
if (live == NULL || live->dataSize < elementSz*colSz*lineSz) {
|
||||
scopeGraphData_t *ptr=realloc(live, sizeof(scopeGraphData_t) + elementSz*colSz*lineSz);
|
||||
|
||||
if (!ptr) {
|
||||
LOG_E(PHY,"can't realloc\n");
|
||||
return;
|
||||
} else {
|
||||
live=ptr;
|
||||
}
|
||||
}
|
||||
|
||||
live->dataSize=elementSz*colSz*lineSz;
|
||||
live->elementSz=elementSz;
|
||||
live->colSz=colSz;
|
||||
live->lineSz=lineSz;
|
||||
memcpy(live+1, dataIn, elementSz*colSz*lineSz);
|
||||
((scopeGraphData_t **)tmp->liveData)[type]=live;
|
||||
}
|
||||
}
|
||||
|
||||
void nrUEinitScope(PHY_VARS_NR_UE *ue) {
|
||||
AssertFatal(ue->scopeData=malloc(sizeof(scopeData_t)),"");
|
||||
scopeData_t *scope=(scopeData_t *) ue->scopeData;
|
||||
scope->copyData=UEcopyData;
|
||||
pthread_t forms_thread;
|
||||
threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW);
|
||||
}
|
||||
|
||||
void nrscope_autoinit(void *dataptr) {
|
||||
AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context");
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#ifndef __PHY_SCOPE_INTERFACE_H__
|
||||
#define __PHY_SCOPE_INTERFACE_H__
|
||||
#include <openair1/PHY/defs_gNB.h>
|
||||
#include <openair1/PHY/defs_nr_UE.h>
|
||||
|
||||
typedef struct {
|
||||
int *argc;
|
||||
char **argv;
|
||||
@@ -39,16 +41,25 @@ typedef struct {
|
||||
PHY_VARS_gNB *gNB;
|
||||
} scopeParms_t;
|
||||
|
||||
enum UEdataType {
|
||||
pbchDlChEstimateTime,
|
||||
pbchLlr,
|
||||
pbchRxdataF_comp,
|
||||
UEdataTypeNumberOfItems
|
||||
};
|
||||
|
||||
typedef struct scopeData_s {
|
||||
int *argc;
|
||||
char **argv;
|
||||
RU_t *ru;
|
||||
PHY_VARS_gNB *gNB;
|
||||
int32_t * rxdataF;
|
||||
void (*slotFunc)(int32_t* data, int slot, void * scopeData);
|
||||
void *liveData;
|
||||
void (*slotFunc)(int32_t *data, int slot, void *scopeData);
|
||||
void (*copyData)(PHY_VARS_NR_UE *,enum UEdataType, void *data, int elementSz, int colSz, int lineSz);
|
||||
} scopeData_t;
|
||||
|
||||
int load_softscope(char *exectype, void *initarg);
|
||||
int end_forms(void) ;
|
||||
|
||||
#define UEscopeCopy(ue, type, ...) if(ue->scopeData) ((scopeData_t*)ue->scopeData)->copyData(ue, type, ##__VA_ARGS__);
|
||||
#endif
|
||||
|
||||
@@ -837,6 +837,7 @@ typedef struct {
|
||||
/// RF and Interface devices per CC
|
||||
|
||||
openair0_device rfdevice;
|
||||
void *scopeData;
|
||||
} PHY_VARS_UE;
|
||||
|
||||
/* this structure is used to pass both UE phy vars and
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct {
|
||||
/// Pointer to the payload
|
||||
uint8_t *b;
|
||||
/// Pointers to transport block segments
|
||||
uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||
uint8_t **c;
|
||||
/// Frame where current HARQ round was sent
|
||||
uint32_t frame;
|
||||
/// Subframe where current HARQ round was sent
|
||||
@@ -157,13 +157,11 @@ typedef struct {
|
||||
/// Pointers to variables related to DLSCH harq process
|
||||
NR_DL_gNB_HARQ_t harq_process;
|
||||
/// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding)
|
||||
int32_t *txdataF[NR_MAX_NB_LAYERS];
|
||||
/// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding)
|
||||
int32_t *txdataF_precoding[NR_MAX_NB_LAYERS];
|
||||
int32_t **txdataF;
|
||||
/// Modulated symbols buffer
|
||||
int32_t *mod_symbs[NR_MAX_NB_CODEWORDS];
|
||||
int32_t **mod_symbs;
|
||||
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
||||
int32_t **ue_spec_bf_weights[NR_MAX_NB_LAYERS];
|
||||
int32_t ***ue_spec_bf_weights;
|
||||
/// dl channel estimates (estimated from ul channel estimates)
|
||||
int32_t **calib_dl_ch_estimates;
|
||||
/// Allocated RNTI (0 means DLSCH_t is not currently used)
|
||||
@@ -285,7 +283,7 @@ typedef struct {
|
||||
/// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1)
|
||||
uint32_t Z;
|
||||
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
|
||||
int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
|
||||
/// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
||||
uint32_t E;
|
||||
/// Number of segments processed so far
|
||||
@@ -769,7 +767,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords]
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times]
|
||||
NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
|
||||
NR_gNB_DLSCH_t *dlsch_PCH;
|
||||
/// statistics for DLSCH measurement collection
|
||||
|
||||
@@ -225,11 +225,6 @@ typedef struct {
|
||||
|
||||
} NR_UE_COMMON_PER_THREAD;
|
||||
|
||||
typedef struct {
|
||||
/// TX buffers for multiple layers
|
||||
int32_t *txdataF_layers[NR_MAX_NB_LAYERS];
|
||||
} NR_UE_PUSCH;
|
||||
|
||||
typedef struct {
|
||||
bool active[2];
|
||||
fapi_nr_ul_config_pucch_pdu pucch_pdu[2];
|
||||
@@ -654,40 +649,6 @@ typedef struct {
|
||||
#define PBCH_A 24
|
||||
|
||||
typedef struct {
|
||||
/// \brief Pointers to extracted PBCH symbols in frequency-domain.
|
||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..287] (hard coded)
|
||||
int32_t **rxdataF_ext;
|
||||
/// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain.
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..287] (hard coded)
|
||||
int32_t **rxdataF_comp;
|
||||
/// \brief Hold the channel estimates in frequency domain.
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
|
||||
int32_t **dl_ch_estimates;
|
||||
/// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS.
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..287] (hard coded)
|
||||
int32_t **dl_ch_estimates_ext;
|
||||
/// \brief Hold the channel estimates in time domain (used for tracking).
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: samples? [0..2*ofdm_symbol_size[
|
||||
int32_t **dl_ch_estimates_time;
|
||||
int log2_maxh;
|
||||
uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
|
||||
uint32_t pbch_a_interleaved;
|
||||
uint32_t pbch_a_prime;
|
||||
uint8_t pbch_e[NR_POLAR_PBCH_E];
|
||||
int16_t demod_pbch_e[NR_POLAR_PBCH_E];
|
||||
/// \brief Pointer to PBCH llrs.
|
||||
/// - first index: ? [0..1919] (hard coded)
|
||||
int16_t *llr;
|
||||
/// \brief Pointer to PBCH decoded output.
|
||||
/// - first index: ? [0..63] (hard coded)
|
||||
uint8_t *decoded_output;
|
||||
/// \brief PBCH additional bits
|
||||
uint8_t xtra_byte;
|
||||
/// \brief Total number of PDU errors.
|
||||
uint32_t pdu_errors;
|
||||
/// \brief Total number of PDU errors 128 frames ago.
|
||||
@@ -695,7 +656,7 @@ typedef struct {
|
||||
/// \brief Total number of consecutive PDU errors.
|
||||
uint32_t pdu_errors_conseq;
|
||||
/// \brief FER (in percent) .
|
||||
uint32_t pdu_fer;
|
||||
//uint32_t pdu_fer;
|
||||
} NR_UE_PBCH;
|
||||
|
||||
typedef struct {
|
||||
@@ -819,10 +780,9 @@ typedef struct {
|
||||
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PUCCH *pucch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
|
||||
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
|
||||
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_LAYERS>4 ? 2:1]; // two RxTx Threads
|
||||
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
@@ -866,7 +826,7 @@ typedef struct {
|
||||
uint16_t scramblingID_pdcch;
|
||||
|
||||
/// PUSCH DMRS sequence
|
||||
uint32_t ****nr_gold_pusch_dmrs;
|
||||
uint32_t ***nr_gold_pusch_dmrs;
|
||||
|
||||
uint32_t X_u[64][839];
|
||||
|
||||
@@ -1073,7 +1033,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
int dl_stats[5];
|
||||
|
||||
void* scopeData;
|
||||
} PHY_VARS_NR_UE;
|
||||
|
||||
/* this structure is used to pass both UE phy vars and
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
#define MAX_NUM_SUBCARRIER_SPACING 5
|
||||
|
||||
#define NR_MAX_NB_RB 275
|
||||
|
||||
#define NR_NB_SC_PER_RB 12
|
||||
#define NR_NB_REG_PER_CCE 6
|
||||
|
||||
@@ -67,22 +65,9 @@
|
||||
#define NR_PBCH_DMRS_LENGTH 144 // in mod symbols
|
||||
#define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32)
|
||||
|
||||
/*These max values are for the gold sequences which are generated at init for the
|
||||
* full carrier bandwidth*/
|
||||
#define NR_MAX_PDCCH_DMRS_INIT_LENGTH ((NR_MAX_NB_RB<<1)*3) // 3 symbols *2(QPSK)
|
||||
#define NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD 52 // ceil(NR_MAX_PDCCH_DMRS_LENGTH/32)
|
||||
/*used for the resource mapping*/
|
||||
#define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE)
|
||||
|
||||
#define NR_MAX_PDSCH_DMRS_LENGTH 3300 //275*6(k)*2(QPSK real+imag)
|
||||
#define NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD 104 // ceil(NR_MAX_PDSCH_DMRS_LENGTH/32)
|
||||
|
||||
#define NR_MAX_CSI_RS_LENGTH 4400 //275*8(max allocation per RB)*2(QPSK)
|
||||
#define NR_MAX_CSI_RS_INIT_LENGTH_DWORD 138 // ceil(NR_MAX_CSI_RS_LENGTH/32)
|
||||
|
||||
#define NR_MAX_PUSCH_DMRS_LENGTH NR_MAX_PDSCH_DMRS_LENGTH
|
||||
#define NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD
|
||||
|
||||
#define NR_MAX_DCI_PAYLOAD_SIZE 64
|
||||
#define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE)
|
||||
#define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32)
|
||||
@@ -93,24 +78,19 @@
|
||||
#define NR_MAX_CSET_DURATION 3
|
||||
|
||||
#define NR_MAX_NB_RBG 18
|
||||
#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3)
|
||||
#define NR_MAX_NB_CODEWORDS 2
|
||||
#define NR_MAX_NB_LAYERS 4 // 8
|
||||
#define NR_MAX_NB_HARQ_PROCESSES 16
|
||||
#define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!)
|
||||
#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH
|
||||
|
||||
#define NR_MAX_PDSCH_TBS 3824
|
||||
#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits.
|
||||
|
||||
#define MAX_NUM_NR_DLSCH_SEGMENTS (NR_MAX_NB_LAYERS*34)
|
||||
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
|
||||
#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 34
|
||||
|
||||
#define MAX_NUM_NR_ULSCH_SEGMENTS 34
|
||||
#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056)
|
||||
|
||||
#define MAX_NUM_NR_SRS_SYMBOLS 4
|
||||
|
||||
#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB
|
||||
#define MAX_NUM_NR_RE (14*273*12)
|
||||
#define NR_RX_NB_TH 1
|
||||
#define NR_NB_TH_SLOT 2
|
||||
|
||||
@@ -253,7 +233,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint16_t sc_list_length;
|
||||
uint16_t sc_list[6 * NR_MAX_NB_RB];
|
||||
uint16_t *sc_list;
|
||||
uint8_t srs_generated_signal_bits;
|
||||
int32_t *srs_generated_signal;
|
||||
int32_t **srs_received_signal;
|
||||
|
||||
Reference in New Issue
Block a user