Commit cd07961a authored by Raymond Knopp's avatar Raymond Knopp

intermediate commit

parent 00fc815c
...@@ -1055,7 +1055,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { ...@@ -1055,7 +1055,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
else numbits=residue; else numbits=residue;
for (int i=0;i<numbits;i++) { for (int i=0;i<numbits;i++) {
ip=polarParams->interleaving_pattern[(8*byte)+i]; ip=polarParams->interleaving_pattern[(8*byte)+i];
#if 1 #if 0
printf("byte %d, i %d => ip %d\n",byte,i,ip); printf("byte %d, i %d => ip %d\n",byte,i,ip);
#endif #endif
ipmod64 = ip&63; ipmod64 = ip&63;
......
...@@ -219,8 +219,8 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) { ...@@ -219,8 +219,8 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) {
decoder_node_t *new_node = new_decoder_node(first_leaf_index,level); decoder_node_t *new_node = new_decoder_node(first_leaf_index,level);
#ifdef DEBUG_NEW_IMPL #ifdef DEBUG_NEW_IMPL
printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level); printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level);
pp->tree.num_nodes++;
#endif #endif
pp->tree.num_nodes++;
if (level==0) { if (level==0) {
#ifdef DEBUG_NEW_IMPL #ifdef DEBUG_NEW_IMPL
printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen"); printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen");
......
...@@ -317,7 +317,6 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) { ...@@ -317,7 +317,6 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) {
polarParams->cprime_tab1[byte][val] = 0; polarParams->cprime_tab1[byte][val] = 0;
for (int i=0;i<numbits;i++) { for (int i=0;i<numbits;i++) {
ip=polarParams->deinterleaving_pattern[(8*byte)+i]; ip=polarParams->deinterleaving_pattern[(8*byte)+i];
if (val==0) printf("%d => %d\n",(8*byte)+i,ip);
AssertFatal(ip<128,"ip = %d\n",ip); AssertFatal(ip<128,"ip = %d\n",ip);
bit_i=(val>>i)&1; bit_i=(val>>i)&1;
if (ip<64) polarParams->cprime_tab0[byte][val] |= (((uint64_t)bit_i)<<ip); if (ip<64) polarParams->cprime_tab0[byte][val] |= (((uint64_t)bit_i)<<ip);
...@@ -361,9 +360,11 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) { ...@@ -361,9 +360,11 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) {
if ((ip - iplast) == 1) ccnt++; if ((ip - iplast) == 1) ccnt++;
else { else {
groupcnt++; groupcnt++;
#ifdef DEBUG_POLAR_ENCODER
printf("group %d (size %d): (%d:%d) => (%d:%d)\n",groupcnt,ccnt+1, printf("group %d (size %d): (%d:%d) => (%d:%d)\n",groupcnt,ccnt+1,
firstingroup_in,firstingroup_in+ccnt, firstingroup_in,firstingroup_in+ccnt,
firstingroup_out,firstingroup_out+ccnt); firstingroup_out,firstingroup_out+ccnt);
#endif
if ((ccnt+1)<mingroupsize) mingroupsize=ccnt+1; if ((ccnt+1)<mingroupsize) mingroupsize=ccnt+1;
ccnt=0; ccnt=0;
firstingroup_out=outpos; firstingroup_out=outpos;
......
...@@ -42,9 +42,9 @@ static int intcmp(const void *p1,const void *p2) { ...@@ -42,9 +42,9 @@ static int intcmp(const void *p1,const void *p2) {
} }
void nr_polar_init(t_nrPolar_paramsPtr *polarParams, void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) uint8_t aggregation_level)
{ {
t_nrPolar_paramsPtr currentPtr = *polarParams; t_nrPolar_paramsPtr currentPtr = *polarParams;
uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level); uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level);
...@@ -75,6 +75,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -75,6 +75,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P
printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength);
} else if (messageType == 1) { //DCI } else if (messageType == 1) { //DCI
newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
...@@ -87,6 +88,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -87,6 +88,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->encoderLength = aggregation_level*108; newPolarInitNode->encoderLength = aggregation_level*108;
newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level);
} else if (messageType == -1) { //UCI } else if (messageType == -1) { //UCI
} else { } else {
......
...@@ -124,10 +124,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -124,10 +124,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
// PBCH DMRS gold sequences generation // PBCH DMRS gold sequences generation
nr_init_pbch_dmrs(gNB); nr_init_pbch_dmrs(gNB);
// Polar encoder init for PBCH // Polar encoder init for PBCH
nr_polar_init(&gNB->nrPolar_params, nr_polar_init(&gNB->nrPolar_params,
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_MESSAGE_TYPE,
NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_PAYLOAD_BITS,
NR_POLAR_PBCH_AGGREGATION_LEVEL); NR_POLAR_PBCH_AGGREGATION_LEVEL);
//PDCCH DMRS init //PDCCH DMRS init
gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**)); gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**));
...@@ -436,15 +437,15 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) ...@@ -436,15 +437,15 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
fp->threequarter_fs = 0; fp->threequarter_fs = 0;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,gNB_tx_antenna_ports %d,DL freq %u)\n", LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,gNB_tx_antenna_ports %d,DL freq %u)\n",
Mod_id, Mod_id,
CC_id, CC_id,
gNB_config->nfapi_config.rf_bands.rf_band[0], gNB_config->nfapi_config.rf_bands.rf_band[0],
gNB_config->rf_config.dl_carrier_bandwidth.value, gNB_config->rf_config.dl_carrier_bandwidth.value,
gNB_config->rf_config.ul_carrier_bandwidth.value, gNB_config->rf_config.ul_carrier_bandwidth.value,
gNB_config->sch_config.physical_cell_id.value, gNB_config->sch_config.physical_cell_id.value,
gNB_config->rf_config.tx_antenna_ports.value, gNB_config->rf_config.tx_antenna_ports.value,
fp->dl_CarrierFreq ); fp->dl_CarrierFreq );
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
if (RC.gNB[Mod_id][CC_id]->configured == 1){ if (RC.gNB[Mod_id][CC_id]->configured == 1){
......
...@@ -955,7 +955,7 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) ...@@ -955,7 +955,7 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue)
generate_ul_reference_signal_sequences(SHRT_MAX); generate_ul_reference_signal_sequences(SHRT_MAX);
// Polar encoder init for PBCH // Polar encoder init for PBCH
ue->nrPolar_params = NULL; ue->nrPolar_params = NULL;
nr_polar_init(&ue->nrPolar_params, nr_polar_init(&ue->nrPolar_params,
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_MESSAGE_TYPE,
......
...@@ -1426,9 +1426,9 @@ void nr_dci_decoding_procedure0(int s, ...@@ -1426,9 +1426,9 @@ void nr_dci_decoding_procedure0(int s,
uint32_t dci_estimation[4]={0}; uint32_t dci_estimation[4]={0};
t_nrPolar_paramsPtr nrPolar_params = NULL; t_nrPolar_paramsPtr nrPolar_params = pdcch_vars[eNB_id]->nrPolar_params;
nr_polar_init(&nrPolar_params, 1, 41, 8); nr_polar_init(&nrPolar_params, 1, sizeof_bits, L2);
t_nrPolar_paramsPtr currentPtrDCI=nr_polar_params(nrPolar_params, 1, 41, 8); t_nrPolar_paramsPtr currentPtrDCI=nr_polar_params(nrPolar_params, 1, sizeof_bits, L2);
decoderState = polar_decoder_int16((int16_t*)&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2], decoderState = polar_decoder_int16((int16_t*)&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2],
dci_estimation, dci_estimation,
currentPtrDCI); currentPtrDCI);
......
...@@ -893,6 +893,7 @@ typedef struct { ...@@ -893,6 +893,7 @@ typedef struct {
//Check for specific DCIFormat and AgregationLevel //Check for specific DCIFormat and AgregationLevel
uint8_t dciFormat; uint8_t dciFormat;
uint8_t agregationLevel; uint8_t agregationLevel;
t_nrPolar_paramsPtr nrPolar_params;
#ifdef NR_PDCCH_DEFS_NR_UE #ifdef NR_PDCCH_DEFS_NR_UE
int nb_searchSpaces; int nb_searchSpaces;
// CORESET structure, where maximum number of CORESETs to be handled is 3 (according to 38.331 V15.1.0) // CORESET structure, where maximum number of CORESETs to be handled is 3 (according to 38.331 V15.1.0)
......
...@@ -183,7 +183,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -183,7 +183,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
num_dci = gNB->pdcch_vars.num_dci; num_dci = gNB->pdcch_vars.num_dci;
if (num_dci) { if (num_dci) {
LOG_D(PHY, "[gNB %d] Frame %d subframe %d \ LOG_I(PHY, "[gNB %d] Frame %d subframe %d \
Calling nr_generate_dci_top (number of DCI %d)\n", gNB->Mod_id, frame, subframe, num_dci); Calling nr_generate_dci_top (number of DCI %d)\n", gNB->Mod_id, frame, subframe, num_dci);
uint8_t slot_idx = gNB->pdcch_vars.dci_alloc[0].pdcch_params.first_slot; uint8_t slot_idx = gNB->pdcch_vars.dci_alloc[0].pdcch_params.first_slot;
......
...@@ -375,6 +375,8 @@ int main(int argc, char **argv) ...@@ -375,6 +375,8 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB***) malloc(sizeof(PHY_VARS_gNB **)); RC.gNB = (PHY_VARS_gNB***) malloc(sizeof(PHY_VARS_gNB **));
RC.gNB[0] = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB[0] = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0][0] = malloc(sizeof(PHY_VARS_gNB)); RC.gNB[0][0] = malloc(sizeof(PHY_VARS_gNB));
memset(RC.gNB[0][0],0,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0][0]; gNB = RC.gNB[0][0];
gNB_config = &gNB->gNB_config; gNB_config = &gNB->gNB_config;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
...@@ -454,11 +456,12 @@ int main(int argc, char **argv) ...@@ -454,11 +456,12 @@ int main(int argc, char **argv)
//configure UE //configure UE
UE = malloc(sizeof(PHY_VARS_NR_UE)); UE = malloc(sizeof(PHY_VARS_NR_UE));
memset((void*)UE,0,sizeof(PHY_VARS_NR_UE));
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**)); PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE*)); PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE*));
PHY_vars_UE_g[0][0] = UE; PHY_vars_UE_g[0][0] = UE;
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
phy_init_nr_top(UE);
if (run_initial_sync==1) UE->is_synchronized = 0; if (run_initial_sync==1) UE->is_synchronized = 0;
else UE->is_synchronized = 1; else UE->is_synchronized = 1;
...@@ -562,6 +565,7 @@ int main(int argc, char **argv) ...@@ -562,6 +565,7 @@ int main(int argc, char **argv)
} }
} }
//Configure UE //Configure UE
fapi_nr_dl_config_request_t dl_config; fapi_nr_dl_config_request_t dl_config;
// Type0 PDCCH search space // Type0 PDCCH search space
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment