diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 98a160f547..b9d52d849f 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -7,7 +7,7 @@ #include #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" +#include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/defs_gNB.h" #include "SIMULATION/TOOLS/sim.h" @@ -20,6 +20,16 @@ int main(int argc, char *argv[]) { reset_meas(&timeEncoder); reset_meas(&timeDecoder); + //gNB scheduler + /*PHY_VARS_gNB *gNB = RC.gNB[0][0]; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + nfapi_nr_config_request_t *cfg = &gNB->gNB_config; + + nfapi_nr_dl_config_request_pdu_t *pdu; + nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdu->dci_dl_pdu.pdcch_params_rel15; + params_rel15->rnti_type = NFAPI_NR_RNTI_RA; + params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;*/ + randominit(0); //Default simulation values (Aim for iterations = 1000000.) int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI @@ -31,7 +41,7 @@ int main(int argc, char *argv[]) { uint16_t testLength, coderLength, blockErrorCumulative=0, bitErrorCumulative=0; double timeEncoderCumulative = 0, timeDecoderCumulative = 0; - uint8_t decoderListSize = 8, pathMetricAppr = 0; //0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12) + uint8_t aggregation_level, decoderListSize = 8, pathMetricAppr = 0; //0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12) while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:")) != -1) switch (arguments) @@ -73,9 +83,11 @@ int main(int argc, char *argv[]) { if (polarMessageType == 0) { //PBCH testLength = NR_POLAR_PBCH_PAYLOAD_BITS; coderLength = NR_POLAR_PBCH_E; + aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; } else if (polarMessageType == 1) { //DCI - //testLength = nr_get_dci_size(rel15->dci_format, rel15->rnti_type, &fp->initial_bwp_params_ul ,cfg); - //coderLength = ; + //testLength = nr_get_dci_size(params_rel15->dci_format, params_rel15->rnti_type, &fp->initial_bwp_dl, cfg); + testLength = 20; + coderLength = 108; //to be changed by aggregate level function. } else if (polarMessageType == -1) { //UCI //testLength = ; //coderLength = ; @@ -112,16 +124,8 @@ int main(int argc, char *argv[]) { uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * testLength); //decoder output t_nrPolar_paramsPtr nrPolar_params = NULL; - nr_polar_init(&nrPolar_params, polarMessageType, testLength); - - t_nrPolar_paramsPtr currentPtr = nrPolar_params; - while (currentPtr != NULL) { - if (currentPtr->idx == (polarMessageType * testLength)) { - break; - } else { - currentPtr = currentPtr->nextPtr; - } - } + nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level); + t_nrPolar_paramsPtr currentPtr = nr_polar_params(nrPolar_params, polarMessageType, testLength); // We assume no a priori knowledge available about the payload. double aPrioriArray[currentPtr->payloadBits]; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c index 8e4953574c..ea47405d5b 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c @@ -21,17 +21,29 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -void nr_byte2bit(uint8_t *array, uint8_t arraySize, uint8_t *bitArray){//First 2 parameters are in bytes. +void nr_byte2bit_uint8(uint8_t *array, uint8_t arraySize, uint8_t *bitArray) { + //First 2 parameters are in bytes. - for (int i=0; i>0 & 0x01); - bitArray[(6+(i*8))] = ( array[i]>>1 & 0x01); - bitArray[(5+(i*8))] = ( array[i]>>2 & 0x01); - bitArray[(4+(i*8))] = ( array[i]>>3 & 0x01); - bitArray[(3+(i*8))] = ( array[i]>>4 & 0x01); - bitArray[(2+(i*8))] = ( array[i]>>5 & 0x01); - bitArray[(1+(i*8))] = ( array[i]>>6 & 0x01); - bitArray[ (i*8) ] = ( array[i]>>7 & 0x01); + for (int i = 0; i < arraySize; i++) { + bitArray[(7 + (i * 8))] = (array[i] >> 0 & 0x01); + bitArray[(6 + (i * 8))] = (array[i] >> 1 & 0x01); + bitArray[(5 + (i * 8))] = (array[i] >> 2 & 0x01); + bitArray[(4 + (i * 8))] = (array[i] >> 3 & 0x01); + bitArray[(3 + (i * 8))] = (array[i] >> 4 & 0x01); + bitArray[(2 + (i * 8))] = (array[i] >> 5 & 0x01); + bitArray[(1 + (i * 8))] = (array[i] >> 6 & 0x01); + bitArray[(i * 8)] = (array[i] >> 7 & 0x01); + } +} + +void nr_bit2byte(uint32_t *in, uint16_t arraySize, uint8_t *out) { + for (int i = 0; i < arraySize; i++) { + out[i] = ((*in) >> i) & 1; + } +} + +void nr_byte2bit(uint8_t *in, uint16_t arraySize, uint32_t *out) { + for (int i = 0; i < arraySize; i++) { + *out = (*out) << i | in[i]; } - } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h index 6c28a594f2..842088b26c 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h @@ -33,10 +33,14 @@ #ifndef __NR_POLAR_DCI_DEFS__H__ #define __NR_POLAR_DCI_DEFS__H__ +#define NR_POLAR_DCI_MESSAGE_TYPE 1 //int8_t +#define NR_POLAR_DCI_CRC_PARITY_BITS 24 +#define NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS 3 + //Sec. 7.3.3: Channel Coding #define NR_POLAR_DCI_N_MAX 9 //uint8_t #define NR_POLAR_DCI_I_IL 1 //uint8_t -//#define NR_POLAR_DCI_I_SEG 0 //uint8_t +#define NR_POLAR_DCI_I_SEG 0 //uint8_t #define NR_POLAR_DCI_N_PC 0 //uint8_t #define NR_POLAR_DCI_N_PC_WM 0 //uint8_t diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index b5d2496f43..574b199c50 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -28,6 +28,10 @@ #include #include +#include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h" +#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" +#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" + static const uint8_t nr_polar_subblock_interleaver_pattern[32] = { 0, 1, 2, 4, 3, 5, 6, 7, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 14, 22, 15, 23, 24, 25, 26, 28, 27, 29, 30, 31 }; struct nrPolar_params { @@ -76,7 +80,14 @@ void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_paramsPtr polarPar int8_t polar_decoder(double *input, uint8_t *output, t_nrPolar_paramsPtr polarParams, uint8_t listSize, double *aPrioriPayload, uint8_t pathMetricAppr); -void nr_polar_init(t_nrPolar_paramsPtr *polarParams, int8_t messageType, uint16_t messageLength); +void nr_polar_init(t_nrPolar_paramsPtr *polarParams, + int8_t messageType, + uint16_t messageLength, + uint8_t aggregation_level); +void nr_polar_print_polarParams(t_nrPolar_paramsPtr polarParams); +t_nrPolar_paramsPtr nr_polar_params (t_nrPolar_paramsPtr polarParams, + int8_t messageType, + uint16_t messageLength); uint8_t** nr_polar_kronecker_power_matrices(uint8_t n); @@ -102,7 +113,9 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, int16_t *Q_I_N, int16_t *Q_F_N, void nr_polar_info_bit_extraction(uint8_t *input, uint8_t *output, uint8_t *pattern, uint16_t size); -void nr_byte2bit(uint8_t *array, uint8_t arraySize, uint8_t *bitArray); +void nr_byte2bit(uint8_t *in, uint16_t arraySize, uint32_t *out); +void nr_byte2bit_uint8(uint8_t *array, uint8_t arraySize, uint8_t *bitArray); +void nr_bit2byte(uint32_t *in, uint16_t arraySize, uint8_t *out); void nr_polar_bit_insertion(uint8_t *input, uint8_t *output, uint16_t N, uint16_t K, int16_t *Q_I_N, int16_t *Q_PC_N, uint8_t n_PC); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index 74fb6bd900..eafb45cab4 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -20,7 +20,6 @@ */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" void polar_encoder( uint8_t *input, diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h index 85b20f90fc..aa32b03e35 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h @@ -33,7 +33,9 @@ #ifndef __NR_POLAR_PBCH_DEFS__H__ #define __NR_POLAR_PBCH_DEFS__H__ -#define NR_POLAR_PBCH_PAYLOAD_BITS 32 //uint16_t +#define NR_POLAR_PBCH_AGGREGATION_LEVEL 0 //uint8_t +#define NR_POLAR_PBCH_MESSAGE_TYPE 0 //int8_t +#define NR_POLAR_PBCH_PAYLOAD_BITS 32 //uint16_t #define NR_POLAR_PBCH_CRC_PARITY_BITS 24 #define NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS 3 //Assumed 3 by 3GPP when NR_POLAR_PBCH_L>8 to meet false alarm rate requirements. diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h index 214267d94c..724da73fa0 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h @@ -33,4 +33,7 @@ #ifndef __NR_POLAR_UCI_DEFS__H__ #define __NR_POLAR_UCI_DEFS__H__ +#define NR_POLAR_UCI_MESSAGE_TYPE -1 //int8_t +#define NR_POLAR_UCI_CRC_ERROR_CORRECTION_BITS 3 + #endif diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 2f781e4a23..c0dcdf7b0b 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -20,13 +20,16 @@ */ #include "nrPolar_tools/nr_polar_defs.h" -#include "nrPolar_tools/nr_polar_pbch_defs.h" +#include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h" +#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" +#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/NR_TRANSPORT/nr_dci.h" void nr_polar_init(t_nrPolar_paramsPtr *polarParams, int8_t messageType, - uint16_t messageLength) { - + uint16_t messageLength, + uint8_t aggregation_level) +{ t_nrPolar_paramsPtr currentPtr = *polarParams; t_nrPolar_paramsPtr previousPtr = NULL; @@ -55,35 +58,45 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC; newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM; newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL; + newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS; newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS; newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; - newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; - - newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode. - newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K, newPolarInitNode->encoderLength, newPolarInitNode->n_max); - newPolarInitNode->n = log2(newPolarInitNode->N); - - newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits); - newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n); - - //polar_encoder vectors: - newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits); - newPolarInitNode->nr_polar_cPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); - newPolarInitNode->nr_polar_d = malloc(sizeof(uint8_t) * newPolarInitNode->N); - - //Polar Coding vectors - newPolarInitNode->nr_polar_u = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat - newPolarInitNode->nr_polar_cPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat - newPolarInitNode->nr_polar_b = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat } else if (messageType == 1) { //DCI - + newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; + newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; + newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG; + newPolarInitNode->n_pc = NR_POLAR_DCI_N_PC; + newPolarInitNode->n_pc_wm = NR_POLAR_DCI_N_PC_WM; + newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL; + newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS; + newPolarInitNode->payloadBits = messageLength; + newPolarInitNode->encoderLength = aggregation_level*108; + newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; } else if (messageType == -1) { //UCI } else { AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType); } + newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode. + newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K, newPolarInitNode->encoderLength, newPolarInitNode->n_max); + newPolarInitNode->n = log2(newPolarInitNode->N); + + newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits); + newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n); + + //polar_encoder vectors: + newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits); + newPolarInitNode->nr_polar_cPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); + newPolarInitNode->nr_polar_d = malloc(sizeof(uint8_t) * newPolarInitNode->N); + + //Polar Coding vectors + newPolarInitNode->nr_polar_u = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat + newPolarInitNode->nr_polar_cPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat + newPolarInitNode->nr_polar_b = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat + + newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n); newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K); @@ -141,3 +154,35 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, currentPtr->nextPtr= newPolarInitNode; return; } + +void nr_polar_print_polarParams(t_nrPolar_paramsPtr polarParams) +{ + uint8_t i = 0; + if (polarParams == NULL) { + printf("polarParams is empty.\n"); + } else { + while (polarParams != NULL){ + printf("polarParams[%d] = %d\n", i, polarParams->idx); + polarParams = polarParams->nextPtr; + i++; + } + } + return; +} + +t_nrPolar_paramsPtr nr_polar_params (t_nrPolar_paramsPtr polarParams, + int8_t messageType, + uint16_t messageLength) +{ + t_nrPolar_paramsPtr currentPtr; + + while (polarParams != NULL) { + if (polarParams->idx == (messageType * messageLength)) { + currentPtr = polarParams; + break; + } else { + polarParams = polarParams->nextPtr; + } + } + return currentPtr; +} diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index ef7a9235d0..d15c39e222 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -119,7 +119,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, // PBCH DMRS gold sequences generation nr_init_pbch_dmrs(gNB); // Polar encoder init for PBCH - nr_polar_init(&fp->pbch_polar_params, 1, NR_POLAR_PBCH_PAYLOAD_BITS); + nr_polar_init(&fp->pbch_polar_params, + NR_POLAR_PBCH_MESSAGE_TYPE, + NR_POLAR_PBCH_PAYLOAD_BITS, + NR_POLAR_PBCH_AGGREGATION_LEVEL); + //PDCCH DMRS init gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**)); uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 7de08ee5d6..fad9cd3a18 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -148,11 +148,12 @@ void nr_pdcch_scrambling(uint32_t *in, reset = 0; } *out ^= (((*in)>>i)&1) ^ ((s>>i)&1); - } + } } uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, + t_nrPolar_paramsPtr *nrPolar_params, uint32_t *gold_pdcch_dmrs, int32_t** txdataF, int16_t amp, @@ -187,13 +188,25 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, } /// DCI payload processing - //channel coding + //channel coding + uint8_t *encoderInput = malloc(sizeof(uint8_t) * dci_alloc.size); + nr_bit2byte(dci_alloc.dci_pdu, dci_alloc.size, encoderInput); + + nr_polar_init(&nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, pdcch_params.aggregation_level); + t_nrPolar_paramsPtr currentPtr = nr_polar_params(nrPolar_params, + NR_POLAR_DCI_MESSAGE_TYPE, + dci_alloc.size); + + uint8_t *encoderOutput = malloc(sizeof(uint8_t) * currentPtr->encoderLength); + polar_encoder(encoderInput, encoderOutput, currentPtr); + uint32_t encoded_payload[4]; + nr_byte2bit(encoderOutput,currentPtr->encoderLength,encoded_payload); // scrambling uint32_t scrambled_payload[4]; uint32_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value; uint32_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? pdcch_params.rnti : 0; - nr_pdcch_scrambling(dci_alloc.dci_pdu, dci_alloc.size, Nid, n_RNTI, scrambled_payload); + nr_pdcch_scrambling(encoded_payload, dci_alloc.size, Nid, n_RNTI, scrambled_payload); // QPSK modulation uint32_t mod_dci[NR_MAX_DCI_SIZE>>1]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.h b/openair1/PHY/NR_TRANSPORT/nr_dci.h index ff33f1ee41..681283cbe9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.h @@ -33,6 +33,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, nfapi_nr_config_request_t* config); uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, + t_nrPolar_paramsPtr *nrPolar_params, uint32_t *gold_pdcch_dmrs, int32_t** txdataF, int16_t amp, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index b43687a8ec..98894ef98a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -43,11 +43,11 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t *dci_pdu = dci_alloc->dci_pdu; nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &pdu->dci_dl_pdu.dci_dl_pdu_rel15; - nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdu->dci_dl_pdu.pdcch_params_rel15; + nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdu->dci_dl_pdu.pdcch_params_rel15; nfapi_nr_config_request_t *cfg = &gNB->gNB_config; - uint16_t N_RB = fp->initial_bwp_dl.N_RB; - uint8_t fsize = 0; + uint16_t N_RB = fp->initial_bwp_dl.N_RB; + uint8_t fsize = 0; /// Payload generation switch(params_rel15->dci_format) { @@ -68,7 +68,6 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, // TB scaling for (int i=0; i<2; i++) *dci_pdu |= ((pdu_rel15->tb_scaling>>(2-i))&1)<frame_tx; @@ -188,6 +188,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (nfapi_mode == 0 || nfapi_mode == 1) nr_generate_dci_top(gNB->pdcch_vars, + &gNB->nrPolar_params, gNB->nr_gold_pdcch_dmrs[0][0], gNB->common_vars.txdataF, AMP, *fp, *cfg); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index bf3dd514b9..97d8c0d6ca 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -81,6 +81,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, params_rel15->rnti = 0x03; params_rel15->rnti_type = NFAPI_NR_RNTI_RA; params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0; + params_rel15->aggregation_level = 1; LOG_I(MAC, "DCI type 1 params: rmsi_pdcch_config %d, rnti %d, rnti_type %d, dci_format %d\n \ coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \ ss params : nb_ss_sets_per_slot %d, first symb %d, nb_slots %d, sfn_mod2 %d, first slot %d\n", diff --git a/targets/RT/USER/nr-gnb.c b/targets/RT/USER/nr-gnb.c index 09b95502c1..27d233bedb 100644 --- a/targets/RT/USER/nr-gnb.c +++ b/targets/RT/USER/nr-gnb.c @@ -916,7 +916,10 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { gNB = RC.gNB[inst][CC_id]; gNB->abstraction_flag = 0; gNB->single_thread_flag = single_thread_flag; - + nr_polar_init(&gNB->nrPolar_params, + NR_POLAR_PBCH_MESSAGE_TYPE, + NR_POLAR_PBCH_PAYLOAD_BITS, + NR_POLAR_PBCH_AGGREGATION_LEVEL); LOG_I(PHY,"Initializing gNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag); #ifndef OCP_FRAMEWORK