Commit d3c11bd5 authored by Guy De Souza's avatar Guy De Souza

Merge branch 'nr_pdcch' of https://gitlab.eurecom.fr/oai/openairinterface5g into nr_pdcch

parents fa1fb8e5 3c4d3ef9
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <time.h> #include <time.h>
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #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 "PHY/defs_gNB.h"
#include "SIMULATION/TOOLS/sim.h" #include "SIMULATION/TOOLS/sim.h"
...@@ -20,6 +20,16 @@ int main(int argc, char *argv[]) { ...@@ -20,6 +20,16 @@ int main(int argc, char *argv[]) {
reset_meas(&timeEncoder); reset_meas(&timeEncoder);
reset_meas(&timeDecoder); 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); randominit(0);
//Default simulation values (Aim for iterations = 1000000.) //Default simulation values (Aim for iterations = 1000000.)
int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI
...@@ -31,7 +41,7 @@ int main(int argc, char *argv[]) { ...@@ -31,7 +41,7 @@ int main(int argc, char *argv[]) {
uint16_t testLength, coderLength, blockErrorCumulative=0, bitErrorCumulative=0; uint16_t testLength, coderLength, blockErrorCumulative=0, bitErrorCumulative=0;
double timeEncoderCumulative = 0, timeDecoderCumulative = 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) while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:")) != -1)
switch (arguments) switch (arguments)
...@@ -73,9 +83,11 @@ int main(int argc, char *argv[]) { ...@@ -73,9 +83,11 @@ int main(int argc, char *argv[]) {
if (polarMessageType == 0) { //PBCH if (polarMessageType == 0) { //PBCH
testLength = NR_POLAR_PBCH_PAYLOAD_BITS; testLength = NR_POLAR_PBCH_PAYLOAD_BITS;
coderLength = NR_POLAR_PBCH_E; coderLength = NR_POLAR_PBCH_E;
aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL;
} else if (polarMessageType == 1) { //DCI } else if (polarMessageType == 1) { //DCI
//testLength = nr_get_dci_size(rel15->dci_format, rel15->rnti_type, &fp->initial_bwp_params_ul ,cfg); //testLength = nr_get_dci_size(params_rel15->dci_format, params_rel15->rnti_type, &fp->initial_bwp_dl, cfg);
//coderLength = ; testLength = 20;
coderLength = 108; //to be changed by aggregate level function.
} else if (polarMessageType == -1) { //UCI } else if (polarMessageType == -1) { //UCI
//testLength = ; //testLength = ;
//coderLength = ; //coderLength = ;
...@@ -112,16 +124,8 @@ int main(int argc, char *argv[]) { ...@@ -112,16 +124,8 @@ int main(int argc, char *argv[]) {
uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * testLength); //decoder output uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * testLength); //decoder output
t_nrPolar_paramsPtr nrPolar_params = NULL; t_nrPolar_paramsPtr nrPolar_params = NULL;
nr_polar_init(&nrPolar_params, polarMessageType, testLength); nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level);
t_nrPolar_paramsPtr currentPtr = nr_polar_params(nrPolar_params, polarMessageType, testLength);
t_nrPolar_paramsPtr currentPtr = nrPolar_params;
while (currentPtr != NULL) {
if (currentPtr->idx == (polarMessageType * testLength)) {
break;
} else {
currentPtr = currentPtr->nextPtr;
}
}
// We assume no a priori knowledge available about the payload. // We assume no a priori knowledge available about the payload.
double aPrioriArray[currentPtr->payloadBits]; double aPrioriArray[currentPtr->payloadBits];
......
...@@ -21,17 +21,29 @@ ...@@ -21,17 +21,29 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #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<arraySize; i++){ for (int i = 0; i < arraySize; i++) {
bitArray[(7+(i*8))] = ( array[i]>>0 & 0x01); bitArray[(7 + (i * 8))] = (array[i] >> 0 & 0x01);
bitArray[(6+(i*8))] = ( array[i]>>1 & 0x01); bitArray[(6 + (i * 8))] = (array[i] >> 1 & 0x01);
bitArray[(5+(i*8))] = ( array[i]>>2 & 0x01); bitArray[(5 + (i * 8))] = (array[i] >> 2 & 0x01);
bitArray[(4+(i*8))] = ( array[i]>>3 & 0x01); bitArray[(4 + (i * 8))] = (array[i] >> 3 & 0x01);
bitArray[(3+(i*8))] = ( array[i]>>4 & 0x01); bitArray[(3 + (i * 8))] = (array[i] >> 4 & 0x01);
bitArray[(2+(i*8))] = ( array[i]>>5 & 0x01); bitArray[(2 + (i * 8))] = (array[i] >> 5 & 0x01);
bitArray[(1+(i*8))] = ( array[i]>>6 & 0x01); bitArray[(1 + (i * 8))] = (array[i] >> 6 & 0x01);
bitArray[ (i*8) ] = ( array[i]>>7 & 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];
}
} }
...@@ -33,10 +33,14 @@ ...@@ -33,10 +33,14 @@
#ifndef __NR_POLAR_DCI_DEFS__H__ #ifndef __NR_POLAR_DCI_DEFS__H__
#define __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 //Sec. 7.3.3: Channel Coding
#define NR_POLAR_DCI_N_MAX 9 //uint8_t #define NR_POLAR_DCI_N_MAX 9 //uint8_t
#define NR_POLAR_DCI_I_IL 1 //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 0 //uint8_t
#define NR_POLAR_DCI_N_PC_WM 0 //uint8_t #define NR_POLAR_DCI_N_PC_WM 0 //uint8_t
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.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"
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 }; 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 { struct nrPolar_params {
...@@ -76,7 +80,14 @@ void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_paramsPtr polarPar ...@@ -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, int8_t polar_decoder(double *input, uint8_t *output, t_nrPolar_paramsPtr polarParams,
uint8_t listSize, double *aPrioriPayload, uint8_t pathMetricAppr); 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); 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, ...@@ -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, void nr_polar_info_bit_extraction(uint8_t *input, uint8_t *output,
uint8_t *pattern, uint16_t size); 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, 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); uint16_t K, int16_t *Q_I_N, int16_t *Q_PC_N, uint8_t n_PC);
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
*/ */
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
void polar_encoder( void polar_encoder(
uint8_t *input, uint8_t *input,
......
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#ifndef __NR_POLAR_PBCH_DEFS__H__ #ifndef __NR_POLAR_PBCH_DEFS__H__
#define __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_PARITY_BITS 24
#define NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS 3 #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. //Assumed 3 by 3GPP when NR_POLAR_PBCH_L>8 to meet false alarm rate requirements.
......
...@@ -33,4 +33,7 @@ ...@@ -33,4 +33,7 @@
#ifndef __NR_POLAR_UCI_DEFS__H__ #ifndef __NR_POLAR_UCI_DEFS__H__
#define __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 #endif
...@@ -20,13 +20,16 @@ ...@@ -20,13 +20,16 @@
*/ */
#include "nrPolar_tools/nr_polar_defs.h" #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" #include "PHY/NR_TRANSPORT/nr_dci.h"
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)
{
t_nrPolar_paramsPtr currentPtr = *polarParams; t_nrPolar_paramsPtr currentPtr = *polarParams;
t_nrPolar_paramsPtr previousPtr = NULL; t_nrPolar_paramsPtr previousPtr = NULL;
...@@ -55,35 +58,45 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -55,35 +58,45 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC; newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC;
newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM; newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL; newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL;
newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS; newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_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 } 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 if (messageType == -1) { //UCI
} else { } else {
AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType); 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->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K); newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
...@@ -141,3 +154,35 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -141,3 +154,35 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
currentPtr->nextPtr= newPolarInitNode; currentPtr->nextPtr= newPolarInitNode;
return; 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;
}
...@@ -119,7 +119,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -119,7 +119,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(&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 //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**));
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
......
...@@ -148,11 +148,12 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -148,11 +148,12 @@ void nr_pdcch_scrambling(uint32_t *in,
reset = 0; reset = 0;
} }
*out ^= (((*in)>>i)&1) ^ ((s>>i)&1); *out ^= (((*in)>>i)&1) ^ ((s>>i)&1);
} }
} }
uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
t_nrPolar_paramsPtr *nrPolar_params,
uint32_t *gold_pdcch_dmrs, uint32_t *gold_pdcch_dmrs,
int32_t** txdataF, int32_t** txdataF,
int16_t amp, int16_t amp,
...@@ -187,13 +188,25 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -187,13 +188,25 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
} }
/// DCI payload processing /// 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 // scrambling
uint32_t scrambled_payload[4]; 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 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; 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 // QPSK modulation
uint32_t mod_dci[NR_MAX_DCI_SIZE>>1]; uint32_t mod_dci[NR_MAX_DCI_SIZE>>1];
......
...@@ -33,6 +33,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, ...@@ -33,6 +33,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
nfapi_nr_config_request_t* config); nfapi_nr_config_request_t* config);
uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
t_nrPolar_paramsPtr *nrPolar_params,
uint32_t *gold_pdcch_dmrs, uint32_t *gold_pdcch_dmrs,
int32_t** txdataF, int32_t** txdataF,
int16_t amp, int16_t amp,
......
...@@ -142,3 +142,4 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, ...@@ -142,3 +142,4 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB,
return; return;
} }
...@@ -48,7 +48,7 @@ typedef struct { ...@@ -48,7 +48,7 @@ typedef struct {
typedef struct { typedef struct {
/// Length of DCI payload in bits /// Length of DCI payload in bits
uint8_t size; uint16_t size;
/// Aggregation level /// Aggregation level
uint8_t L; uint8_t L;
/// PDCCH parameters /// PDCCH parameters
...@@ -462,6 +462,8 @@ typedef struct PHY_VARS_gNB_s { ...@@ -462,6 +462,8 @@ typedef struct PHY_VARS_gNB_s {
int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
t_nrPolar_paramsPtr nrPolar_params;
} PHY_VARS_gNB; } PHY_VARS_gNB;
#endif #endif
...@@ -151,8 +151,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -151,8 +151,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
} }
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
gNB_rxtx_proc_t *proc, gNB_rxtx_proc_t *proc,
int do_meas) int do_meas)
{ {
int aa; int aa;
int frame=proc->frame_tx; int frame=proc->frame_tx;
...@@ -188,6 +188,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -188,6 +188,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
if (nfapi_mode == 0 || nfapi_mode == 1) if (nfapi_mode == 0 || nfapi_mode == 1)
nr_generate_dci_top(gNB->pdcch_vars, nr_generate_dci_top(gNB->pdcch_vars,
&gNB->nrPolar_params,
gNB->nr_gold_pdcch_dmrs[0][0], gNB->nr_gold_pdcch_dmrs[0][0],
gNB->common_vars.txdataF, gNB->common_vars.txdataF,
AMP, *fp, *cfg); AMP, *fp, *cfg);
......
...@@ -83,6 +83,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -83,6 +83,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
params_rel15->rnti = 0x03; params_rel15->rnti = 0x03;
params_rel15->rnti_type = NFAPI_NR_RNTI_RA; params_rel15->rnti_type = NFAPI_NR_RNTI_RA;
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0; 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 \ 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 \ 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", ss params : nb_ss_sets_per_slot %d, first symb %d, nb_slots %d, sfn_mod2 %d, first slot %d\n",
......
...@@ -916,7 +916,10 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { ...@@ -916,7 +916,10 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
gNB = RC.gNB[inst][CC_id]; gNB = RC.gNB[inst][CC_id];
gNB->abstraction_flag = 0; gNB->abstraction_flag = 0;
gNB->single_thread_flag = single_thread_flag; 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); LOG_I(PHY,"Initializing gNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag);
#ifndef OCP_FRAMEWORK #ifndef OCP_FRAMEWORK
......
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