Working polartest.c
This commit is contained in:
@@ -1108,7 +1108,7 @@ set(PHY_TURBOSRC
|
|||||||
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
|
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
|
||||||
)
|
)
|
||||||
set(PHY_POLARSRC
|
set(PHY_POLARSRC
|
||||||
${OPENAIR1_DIR}/PHY/CODING/nrPolar_init.c
|
${OPENAIR1_DIR}/PHY/CODING/nr_polar_init.c
|
||||||
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
|
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
|
||||||
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_crc_byte.c
|
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_crc_byte.c
|
||||||
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
|
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#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/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
|
||||||
|
#include "PHY/defs_gNB.h"
|
||||||
#include "SIMULATION/TOOLS/sim.h"
|
#include "SIMULATION/TOOLS/sim.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
@@ -21,7 +22,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
randominit(0);
|
randominit(0);
|
||||||
//Default simulation values (Aim for iterations = 1000000.)
|
//Default simulation values (Aim for iterations = 1000000.)
|
||||||
int itr, iterations = 1000, arguments, polarMessageType = 1; //0=DCI, 1=PBCH, 2=UCI
|
int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI
|
||||||
double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB
|
double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB
|
||||||
|
|
||||||
double SNR, SNR_lin;
|
double SNR, SNR_lin;
|
||||||
@@ -69,13 +70,13 @@ int main(int argc, char *argv[]) {
|
|||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polarMessageType == 0) { //DCI
|
if (polarMessageType == 0) { //PBCH
|
||||||
//testLength = ;
|
|
||||||
//coderLength = ;
|
|
||||||
} else if (polarMessageType == 1) { //PBCH
|
|
||||||
testLength = NR_POLAR_PBCH_PAYLOAD_BITS;
|
testLength = NR_POLAR_PBCH_PAYLOAD_BITS;
|
||||||
coderLength = NR_POLAR_PBCH_E;
|
coderLength = NR_POLAR_PBCH_E;
|
||||||
} else if (polarMessageType == 2) { //UCI
|
} else if (polarMessageType == 1) { //DCI
|
||||||
|
//testLength = nr_get_dci_size(rel15->dci_format, rel15->rnti_type, &fp->initial_bwp_params_ul ,cfg);
|
||||||
|
//coderLength = ;
|
||||||
|
} else if (polarMessageType == -1) { //UCI
|
||||||
//testLength = ;
|
//testLength = ;
|
||||||
//coderLength = ;
|
//coderLength = ;
|
||||||
}
|
}
|
||||||
@@ -110,12 +111,21 @@ int main(int argc, char *argv[]) {
|
|||||||
double *channelOutput = malloc (sizeof(double) * coderLength); //add noise
|
double *channelOutput = malloc (sizeof(double) * coderLength); //add noise
|
||||||
uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * testLength); //decoder output
|
uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * testLength); //decoder output
|
||||||
|
|
||||||
t_nrPolar_params nrPolar_params;
|
t_nrPolar_paramsPtr nrPolar_params = NULL;
|
||||||
nr_polar_init(&nrPolar_params, polarMessageType);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We assume no a priori knowledge available about the payload.
|
// We assume no a priori knowledge available about the payload.
|
||||||
double aPrioriArray[nrPolar_params.payloadBits];
|
double aPrioriArray[currentPtr->payloadBits];
|
||||||
for (int i=0; i<nrPolar_params.payloadBits; i++) aPrioriArray[i] = NAN;
|
for (int i=0; i<currentPtr->payloadBits; i++) aPrioriArray[i] = NAN;
|
||||||
|
|
||||||
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
|
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
|
||||||
SNR_lin = pow(10, SNR/10);
|
SNR_lin = pow(10, SNR/10);
|
||||||
@@ -124,7 +134,7 @@ int main(int argc, char *argv[]) {
|
|||||||
for(int i=0; i<testLength; i++) testInput[i]=(uint8_t) (rand() % 2);
|
for(int i=0; i<testLength; i++) testInput[i]=(uint8_t) (rand() % 2);
|
||||||
|
|
||||||
start_meas(&timeEncoder);
|
start_meas(&timeEncoder);
|
||||||
polar_encoder(testInput, encoderOutput, &nrPolar_params);
|
polar_encoder(testInput, encoderOutput, currentPtr);
|
||||||
stop_meas(&timeEncoder);
|
stop_meas(&timeEncoder);
|
||||||
|
|
||||||
//BPSK modulation
|
//BPSK modulation
|
||||||
@@ -139,7 +149,12 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
|
|
||||||
start_meas(&timeDecoder);
|
start_meas(&timeDecoder);
|
||||||
decoderState = polar_decoder(channelOutput, estimatedOutput, &nrPolar_params, decoderListSize, aPrioriArray, pathMetricAppr);
|
decoderState = polar_decoder(channelOutput,
|
||||||
|
estimatedOutput,
|
||||||
|
currentPtr,
|
||||||
|
decoderListSize,
|
||||||
|
aPrioriArray,
|
||||||
|
pathMetricAppr);
|
||||||
stop_meas(&timeDecoder);
|
stop_meas(&timeDecoder);
|
||||||
|
|
||||||
//calculate errors
|
//calculate errors
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
||||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.openairinterface.org/?page_id=698
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*-------------------------------------------------------------------------------
|
|
||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
||||||
* contact@openairinterface.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nrPolar_tools/nr_polar_defs.h"
|
|
||||||
#include "nrPolar_tools/nr_polar_pbch_defs.h"
|
|
||||||
|
|
||||||
void nr_polar_init(t_nrPolar_params* polarParams, int messageType) {
|
|
||||||
|
|
||||||
if (messageType == 0) { //DCI
|
|
||||||
|
|
||||||
} else if (messageType == 1) { //PBCH
|
|
||||||
polarParams->n_max = NR_POLAR_PBCH_N_MAX;
|
|
||||||
polarParams->i_il = NR_POLAR_PBCH_I_IL;
|
|
||||||
polarParams->i_seg = NR_POLAR_PBCH_I_SEG;
|
|
||||||
polarParams->n_pc = NR_POLAR_PBCH_N_PC;
|
|
||||||
polarParams->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
|
|
||||||
polarParams->i_bil = NR_POLAR_PBCH_I_BIL;
|
|
||||||
polarParams->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
|
|
||||||
polarParams->encoderLength = NR_POLAR_PBCH_E;
|
|
||||||
polarParams->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
|
|
||||||
polarParams->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
|
|
||||||
|
|
||||||
polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode.
|
|
||||||
polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max);
|
|
||||||
polarParams->n = log2(polarParams->N);
|
|
||||||
|
|
||||||
polarParams->crc_generator_matrix=crc24c_generator_matrix(polarParams->payloadBits);
|
|
||||||
polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n);
|
|
||||||
|
|
||||||
//polar_encoder vectors:
|
|
||||||
polarParams->nr_polar_crc = malloc(sizeof(uint8_t) * polarParams->crcParityBits);
|
|
||||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K);
|
|
||||||
polarParams->nr_polar_d = malloc(sizeof(uint8_t) * polarParams->N);
|
|
||||||
|
|
||||||
//Polar Coding vectors
|
|
||||||
polarParams->nr_polar_u = malloc(sizeof(uint8_t) * polarParams->N); //Decoder: nr_polar_uHat
|
|
||||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat
|
|
||||||
polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat
|
|
||||||
} else if (messageType == 2) { //UCI
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n);
|
|
||||||
|
|
||||||
polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K);
|
|
||||||
nr_polar_interleaving_pattern(polarParams->K, polarParams->i_il, polarParams->interleaving_pattern);
|
|
||||||
|
|
||||||
polarParams->rate_matching_pattern = malloc(sizeof(uint16_t) * polarParams->encoderLength);
|
|
||||||
uint16_t *J = malloc(sizeof(uint16_t) * polarParams->N);
|
|
||||||
nr_polar_rate_matching_pattern(polarParams->rate_matching_pattern, J,
|
|
||||||
nr_polar_subblock_interleaver_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
|
||||||
|
|
||||||
|
|
||||||
polarParams->information_bit_pattern = malloc(sizeof(uint8_t) * polarParams->N);
|
|
||||||
polarParams->Q_I_N = malloc(sizeof(int16_t) * (polarParams->K + polarParams->n_pc));
|
|
||||||
polarParams->Q_F_N = malloc(sizeof(int16_t) * (polarParams->N+1)); // Last element shows the final array index assigned a value.
|
|
||||||
polarParams->Q_PC_N = malloc(sizeof(int16_t) * (polarParams->n_pc));
|
|
||||||
for (int i=0; i<=polarParams->N; i++) polarParams->Q_F_N[i] = -1; // Empty array.
|
|
||||||
nr_polar_info_bit_pattern(polarParams->information_bit_pattern,
|
|
||||||
polarParams->Q_I_N, polarParams->Q_F_N, J, polarParams->Q_0_Nminus1,
|
|
||||||
polarParams->K, polarParams->N, polarParams->encoderLength, polarParams->n_pc);
|
|
||||||
|
|
||||||
polarParams->channel_interleaver_pattern = malloc(sizeof(uint16_t) * polarParams->encoderLength);
|
|
||||||
nr_polar_channel_interleaver_pattern(polarParams->channel_interleaver_pattern,
|
|
||||||
polarParams->i_bil, polarParams->encoderLength);
|
|
||||||
|
|
||||||
free(J);
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
int8_t polar_decoder(
|
int8_t polar_decoder(
|
||||||
double *input,
|
double *input,
|
||||||
uint8_t *output,
|
uint8_t *output,
|
||||||
t_nrPolar_params *polarParams,
|
t_nrPolar_paramsPtr polarParams,
|
||||||
uint8_t listSize,
|
uint8_t listSize,
|
||||||
double *aPrioriPayload,
|
double *aPrioriPayload,
|
||||||
uint8_t pathMetricAppr)
|
uint8_t pathMetricAppr)
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
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 {
|
||||||
|
//messageType: 0=PBCH, 1=DCI, -1=UCI
|
||||||
|
int8_t idx; //idx = messageType*messageLength;
|
||||||
|
struct nrPolar_params *nextPtr;
|
||||||
|
|
||||||
uint8_t n_max;
|
uint8_t n_max;
|
||||||
uint8_t i_il;
|
uint8_t i_il;
|
||||||
uint8_t i_seg;
|
uint8_t i_seg;
|
||||||
@@ -65,13 +69,14 @@ struct nrPolar_params {
|
|||||||
uint8_t *nr_polar_d;
|
uint8_t *nr_polar_d;
|
||||||
} __attribute__ ((__packed__));
|
} __attribute__ ((__packed__));
|
||||||
typedef struct nrPolar_params t_nrPolar_params;
|
typedef struct nrPolar_params t_nrPolar_params;
|
||||||
|
typedef t_nrPolar_params *t_nrPolar_paramsPtr;
|
||||||
|
|
||||||
void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_params* polarParams);
|
void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_paramsPtr polarParams);
|
||||||
|
|
||||||
int8_t polar_decoder(double *input, uint8_t *output, t_nrPolar_params *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_params* polarParams, int messageType);
|
void nr_polar_init(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);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
void polar_encoder(
|
void polar_encoder(
|
||||||
uint8_t *input,
|
uint8_t *input,
|
||||||
uint8_t *output,
|
uint8_t *output,
|
||||||
t_nrPolar_params *polarParams)
|
t_nrPolar_paramsPtr polarParams)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||||
|
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.openairinterface.org/?page_id=698
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*-------------------------------------------------------------------------------
|
||||||
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
|
* contact@openairinterface.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nrPolar_tools/nr_polar_defs.h"
|
||||||
|
#include "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) {
|
||||||
|
|
||||||
|
t_nrPolar_paramsPtr currentPtr = *polarParams;
|
||||||
|
t_nrPolar_paramsPtr previousPtr = NULL;
|
||||||
|
|
||||||
|
//Parse the list. If the node is already created, return without initialization.
|
||||||
|
while (currentPtr != NULL) {
|
||||||
|
if (currentPtr->idx == (messageType * messageLength)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
previousPtr = currentPtr;
|
||||||
|
currentPtr = currentPtr->nextPtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Else, initialize and add node to the end of the linked list.
|
||||||
|
t_nrPolar_paramsPtr newPolarInitNode = malloc(sizeof(t_nrPolar_params));
|
||||||
|
|
||||||
|
if (newPolarInitNode != NULL) {
|
||||||
|
|
||||||
|
newPolarInitNode->idx = (messageType * messageLength);
|
||||||
|
newPolarInitNode->nextPtr = NULL;
|
||||||
|
|
||||||
|
if (messageType == 0) { //PBCH
|
||||||
|
newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
|
||||||
|
newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL;
|
||||||
|
newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG;
|
||||||
|
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->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
|
||||||
|
|
||||||
|
} else if (messageType == -1) { //UCI
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType);
|
||||||
|
}
|
||||||
|
|
||||||
|
newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
|
||||||
|
|
||||||
|
newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
|
||||||
|
nr_polar_interleaving_pattern(newPolarInitNode->K,
|
||||||
|
newPolarInitNode->i_il,
|
||||||
|
newPolarInitNode->interleaving_pattern);
|
||||||
|
|
||||||
|
newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
|
||||||
|
uint16_t *J = malloc(sizeof(uint16_t) * newPolarInitNode->N);
|
||||||
|
nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
|
||||||
|
J,
|
||||||
|
nr_polar_subblock_interleaver_pattern,
|
||||||
|
newPolarInitNode->K,
|
||||||
|
newPolarInitNode->N,
|
||||||
|
newPolarInitNode->encoderLength);
|
||||||
|
|
||||||
|
newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N);
|
||||||
|
newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc));
|
||||||
|
newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value.
|
||||||
|
newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc));
|
||||||
|
for (int i = 0; i <= newPolarInitNode->N; i++)
|
||||||
|
newPolarInitNode->Q_F_N[i] = -1; // Empty array.
|
||||||
|
nr_polar_info_bit_pattern(newPolarInitNode->information_bit_pattern,
|
||||||
|
newPolarInitNode->Q_I_N,
|
||||||
|
newPolarInitNode->Q_F_N,
|
||||||
|
J,
|
||||||
|
newPolarInitNode->Q_0_Nminus1,
|
||||||
|
newPolarInitNode->K,
|
||||||
|
newPolarInitNode->N,
|
||||||
|
newPolarInitNode->encoderLength,
|
||||||
|
newPolarInitNode->n_pc);
|
||||||
|
|
||||||
|
newPolarInitNode->channel_interleaver_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
|
||||||
|
nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
|
||||||
|
newPolarInitNode->i_bil,
|
||||||
|
newPolarInitNode->encoderLength);
|
||||||
|
|
||||||
|
free(J);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AssertFatal(1 == 0, "[nr_polar_init] New t_nrPolar_paramsPtr could not be created");
|
||||||
|
}
|
||||||
|
|
||||||
|
currentPtr = *polarParams;
|
||||||
|
//If polarParams is empty:
|
||||||
|
if (currentPtr == NULL)
|
||||||
|
{
|
||||||
|
*polarParams = newPolarInitNode;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Else, add node to the end of the linked list.
|
||||||
|
while (currentPtr->nextPtr != NULL) {
|
||||||
|
currentPtr = currentPtr->nextPtr;
|
||||||
|
}
|
||||||
|
currentPtr->nextPtr= newPolarInitNode;
|
||||||
|
return;
|
||||||
|
}
|
||||||
@@ -120,7 +120,7 @@ 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_init(&fp->pbch_polar_params, 1, NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||||
//PDCCH DMRS init
|
//PDCCH DMRS init
|
||||||
pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**));
|
pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**));
|
||||||
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
|
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
|
||||||
|
|||||||
@@ -37,12 +37,12 @@
|
|||||||
|
|
||||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||||
|
|
||||||
uint8_t nr_get_dci_size(nfapi_nr_dci_format_e format,
|
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
|
||||||
nfapi_nr_rnti_type_e rnti_type,
|
nfapi_nr_rnti_type_e rnti_type,
|
||||||
NR_BWP_PARMS* bwp,
|
NR_BWP_PARMS* bwp,
|
||||||
nfapi_nr_config_request_t* config)
|
nfapi_nr_config_request_t* config)
|
||||||
{
|
{
|
||||||
uint8_t size = 0;
|
uint16_t size = 0;
|
||||||
uint16_t N_RB = bwp->N_RB;
|
uint16_t N_RB = bwp->N_RB;
|
||||||
|
|
||||||
switch(format) {
|
switch(format) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
typedef unsigned __int128 uint128_t;
|
typedef unsigned __int128 uint128_t;
|
||||||
|
|
||||||
uint8_t nr_get_dci_size(nfapi_nr_dci_format_e format,
|
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
|
||||||
nfapi_nr_rnti_type_e rnti_type,
|
nfapi_nr_rnti_type_e rnti_type,
|
||||||
NR_BWP_PARMS* bwp,
|
NR_BWP_PARMS* bwp,
|
||||||
nfapi_nr_config_request_t* config);
|
nfapi_nr_config_request_t* config);
|
||||||
|
|||||||
Reference in New Issue
Block a user