Commit 5f5053c6 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/better-polar-decode' into integration_2024_w45 (!2949)

- simplify the code
- prevent to use "beta" tables from one decoder run to the next one (to see it
is the case, don't initialize beta, you will see it doesn't decode)
- decrease memory footprint of the decoder by x10 or more
- save about 15% of cpu in polartest unitary test tool, and more if we run in
realistic use case
- still this decoder performs much worse than the (very) slow OAI version by 3dB
parents de90129d 0e93a8b4
...@@ -772,7 +772,7 @@ set(PHY_TURBOSRC ...@@ -772,7 +772,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/nr_polar_init.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/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_decoder.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
......
This diff is collapsed.
...@@ -28,11 +28,12 @@ ...@@ -28,11 +28,12 @@
* \email turker.yilmaz@eurecom.fr * \email turker.yilmaz@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) { void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out)
{
const uint arrayInd = ceil(arraySize / 32.0); const uint arrayInd = ceil(arraySize / 32.0);
for (int i = 0; i < (arrayInd - 1); i++) { for (int i = 0; i < (arrayInd - 1); i++) {
for (int j = 0; j < 32; j++) { for (int j = 0; j < 32; j++) {
...@@ -44,7 +45,8 @@ void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) { ...@@ -44,7 +45,8 @@ void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) {
out[j + ((arrayInd - 1) * 32)] = (in[(arrayInd - 1)] >> j) & 1; out[j + ((arrayInd - 1) * 32)] = (in[(arrayInd - 1)] >> j) & 1;
} }
void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out) { void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out)
{
const uint arrayInd = ceil(arraySize / 32.0); const uint arrayInd = ceil(arraySize / 32.0);
for (int i = 0; i < arrayInd; i++) { for (int i = 0; i < arrayInd; i++) {
out[i] = 0; out[i] = 0;
......
...@@ -29,7 +29,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) ...@@ -29,7 +29,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits)
uint8_t crcPolynomialSize = 24; uint8_t crcPolynomialSize = 24;
uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize]; uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize];
uint8_t **crc_generator_matrix = malloc(payloadSizeBits*sizeof(uint8_t *) + payloadSizeBits*crcPolynomialSize*sizeof(uint8_t)); uint8_t **crc_generator_matrix =
malloc(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t));
if (crc_generator_matrix) if (crc_generator_matrix)
for (int i = 0; i < payloadSizeBits; i++) for (int i = 0; i < payloadSizeBits; i++)
crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize; crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize;
...@@ -38,7 +39,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) ...@@ -38,7 +39,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits)
crc_generator_matrix[payloadSizeBits - 1][i] = crcPolynomialPattern[i + 1]; crc_generator_matrix[payloadSizeBits - 1][i] = crcPolynomialPattern[i + 1];
for (int i = payloadSizeBits - 2; i >= 0; i--) { for (int i = payloadSizeBits - 2; i >= 0; i--) {
for (int j = 0; j < crcPolynomialSize-1; j++) temp1[j]=crc_generator_matrix[i+1][j+1]; for (int j = 0; j < crcPolynomialSize - 1; j++)
temp1[j] = crc_generator_matrix[i + 1][j + 1];
temp1[crcPolynomialSize - 1] = 0; temp1[crcPolynomialSize - 1] = 0;
...@@ -46,10 +48,10 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) ...@@ -46,10 +48,10 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits)
temp2[j] = crc_generator_matrix[i + 1][0] * crcPolynomialPattern[j + 1]; temp2[j] = crc_generator_matrix[i + 1][0] * crcPolynomialPattern[j + 1];
for (int j = 0; j < crcPolynomialSize; j++) { for (int j = 0; j < crcPolynomialSize; j++) {
if(temp1[j]+temp2[j] == 1) if (temp1[j] + temp2[j] == 1)
crc_generator_matrix[i][j]=1; crc_generator_matrix[i][j] = 1;
else else
crc_generator_matrix[i][j]=0; crc_generator_matrix[i][j] = 0;
} }
} }
return (const uint8_t **)crc_generator_matrix; return (const uint8_t **)crc_generator_matrix;
......
...@@ -20,31 +20,31 @@ ...@@ -20,31 +20,31 @@
*/ */
/*! \file PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h /*! \file PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h
* \brief Defines the constant variables for polar coding of the DCI from 38-212, V15.1.1 2018-04. * \brief Defines the constant variables for polar coding of the DCI from 38-212, V15.1.1 2018-04.
* \author * \author
* \date 2018 * \date 2018
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
* \email: * \email:
* \note * \note
* \warning * \warning
*/ */
#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_MESSAGE_TYPE 1 // int8_t
#define NR_POLAR_DCI_CRC_PARITY_BITS 24 #define NR_POLAR_DCI_CRC_PARITY_BITS 24
#define NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS 3 #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
//Sec. 7.3.4: Rate Matching // Sec. 7.3.4: Rate Matching
#define NR_POLAR_DCI_I_BIL 0 //uint8_t #define NR_POLAR_DCI_I_BIL 0 // uint8_t
#endif #endif
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
* \email turker.yilmaz@eurecom.fr * \email turker.yilmaz@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){ void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_)
uint K_IL_max = 164, k = 0; {
uint K_IL_max = 164;
uint8_t interleaving_pattern_table[164] = { uint8_t interleaving_pattern_table[164] = {
0, 2, 4, 7, 9, 14, 19, 20, 24, 25, 26, 28, 31, 34, 42, 45, 49, 50, 51, 53, 54, 56, 58, 59, 0, 2, 4, 7, 9, 14, 19, 20, 24, 25, 26, 28, 31, 34, 42, 45, 49, 50, 51, 53, 54, 56, 58, 59,
61, 62, 65, 66, 67, 69, 70, 71, 72, 76, 77, 81, 82, 83, 87, 88, 89, 91, 93, 95, 98, 101, 104, 106, 61, 62, 65, 66, 67, 69, 70, 71, 72, 76, 77, 81, 82, 83, 87, 88, 89, 91, 93, 95, 98, 101, 104, 106,
...@@ -44,10 +45,10 @@ void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){ ...@@ -44,10 +45,10 @@ void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){
40, 146, 41, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163}; 40, 146, 41, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163};
if (I_IL == 0) { if (I_IL == 0) {
for (; k <= K - 1; k++) for (int k = 0; k < K; k++)
PI_k_[k] = k; PI_k_[k] = k;
} else { } else {
for (int m = 0; m <= (K_IL_max - 1); m++) { for (int m = 0, k = 0; m < K_IL_max; m++) {
if (interleaving_pattern_table[m] >= (K_IL_max - K)) { if (interleaving_pattern_table[m] >= (K_IL_max - K)) {
PI_k_[k] = interleaving_pattern_table[m] - (K_IL_max - K); PI_k_[k] = interleaving_pattern_table[m] - (K_IL_max - K);
k++; k++;
......
...@@ -7,53 +7,48 @@ ...@@ -7,53 +7,48 @@
void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N) void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N)
{ {
// Martino's algorithm to avoid multiplication for the generating matrix of polar codes // Martino's algorithm to avoid multiplication for the generating matrix of polar codes
uint32_t i,j;
simde__m256i A,B,C,D,E,U,zerosOnly, OUT;
simde__m256i inc;
uint32_t dTest[8];
uint32_t uArray[8];
uint32_t k;
uint32_t incArray[8];
//initialisation
for(k=0; k<8; k++)
incArray[k]=k;
inc=simde_mm256_loadu_si256((simde__m256i const*)incArray); // 0, 1, ..., 7 to increase
zerosOnly=simde_mm256_setzero_si256(); // for comparison
for(i=0; i<N; i+=8)
{
B=simde_mm256_set1_epi32((int)i); // i, ..., i
B=simde_mm256_add_epi32(B, inc); // i, i+1, ..., i+7
OUT=simde_mm256_setzero_si256(); // it will contain the result of all the XORs for the d(i)s
for(j=0; j<N; j++)
{
A=simde_mm256_set1_epi32((int)(j)); //j, j, ..., j
A=simde_mm256_sub_epi32(A, B); //(j-i), (j-(i+1)), ... (j-(i+7))
U=simde_mm256_set1_epi32((int)u[j]);
simde_mm256_storeu_si256((simde__m256i*)uArray, U); //u(j) ... u(j) for the maskload
C=simde_mm256_and_si256(A, B); //(j-i)&i -> If zero, then XOR with the u(j)
D=simde_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask
E=simde_mm256_maskload_epi32((int const*)uArray, D); // load only some u(j)s for the XOR
OUT=simde_mm256_xor_si256(OUT, E); //32 bit x 8
}
simde_mm256_storeu_si256((simde__m256i*)dTest, OUT);
for(k=0; k<8; k++) // Conversion from 32 bits to 8 bits
{
d[i+k]=(uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it
}
}
uint32_t i, j;
simde__m256i A, B, C, D, E, U, zerosOnly, OUT;
simde__m256i inc;
uint32_t dTest[8];
uint32_t uArray[8];
uint32_t k;
uint32_t incArray[8];
// initialisation
for (k = 0; k < 8; k++)
incArray[k] = k;
inc = simde_mm256_loadu_si256((simde__m256i const *)incArray); // 0, 1, ..., 7 to increase
zerosOnly = simde_mm256_setzero_si256(); // for comparison
for (i = 0; i < N; i += 8) {
B = simde_mm256_set1_epi32((int)i); // i, ..., i
B = simde_mm256_add_epi32(B, inc); // i, i+1, ..., i+7
OUT = simde_mm256_setzero_si256(); // it will contain the result of all the XORs for the d(i)s
for (j = 0; j < N; j++) {
A = simde_mm256_set1_epi32((int)(j)); // j, j, ..., j
A = simde_mm256_sub_epi32(A, B); //(j-i), (j-(i+1)), ... (j-(i+7))
U = simde_mm256_set1_epi32((int)u[j]);
simde_mm256_storeu_si256((simde__m256i *)uArray, U); // u(j) ... u(j) for the maskload
C = simde_mm256_and_si256(A, B); //(j-i)&i -> If zero, then XOR with the u(j)
D = simde_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask
E = simde_mm256_maskload_epi32((int const *)uArray, D); // load only some u(j)s for the XOR
OUT = simde_mm256_xor_si256(OUT, E); // 32 bit x 8
}
simde_mm256_storeu_si256((simde__m256i *)dTest, OUT);
for (k = 0; k < 8; k++) // Conversion from 32 bits to 8 bits
{
d[i + k] = (uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it
}
}
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* \email turker.yilmaz@eurecom.fr * \email turker.yilmaz@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
...@@ -47,7 +47,8 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(const uint8_t *matrix1, ...@@ -47,7 +47,8 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(const uint8_t *matrix1,
} }
// Modified Bubble Sort. // Modified Bubble Sort.
void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) { void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len)
{
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
int swaps = 0; int swaps = 0;
for (int j = 0; j < (len - i) - 1; j++) { for (int j = 0; j < (len - i) - 1; j++) {
......
...@@ -28,46 +28,70 @@ ...@@ -28,46 +28,70 @@
* \email turker.yilmaz@eurecom.fr * \email turker.yilmaz@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
#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_AGGREGATION_LEVEL 0 //uint8_t #define NR_POLAR_PBCH_AGGREGATION_LEVEL 0 // uint8_t
#define NR_POLAR_PBCH_MESSAGE_TYPE 0 //int8_t #define NR_POLAR_PBCH_MESSAGE_TYPE 0 // int8_t
#define NR_POLAR_PSBCH_MESSAGE_TYPE 3 //int8_t #define NR_POLAR_PSBCH_MESSAGE_TYPE 3 // int8_t
#define NR_POLAR_PBCH_PAYLOAD_BITS 32 //uint16_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.
//Sec. 7.1.4: Channel Coding // Sec. 7.1.4: Channel Coding
#define NR_POLAR_PBCH_N_MAX 9 //uint8_t #define NR_POLAR_PBCH_N_MAX 9 // uint8_t
#define NR_POLAR_PBCH_I_IL 1 //uint8_t #define NR_POLAR_PBCH_I_IL 1 // uint8_t
#define NR_POLAR_PBCH_I_SEG 0 //uint8_t #define NR_POLAR_PBCH_I_SEG 0 // uint8_t
#define NR_POLAR_PBCH_N_PC 0 //uint8_t #define NR_POLAR_PBCH_N_PC 0 // uint8_t
#define NR_POLAR_PBCH_N_PC_WM 0 //uint8_t #define NR_POLAR_PBCH_N_PC_WM 0 // uint8_t
//#define NR_POLAR_PBCH_N 512 //uint16_t // #define NR_POLAR_PBCH_N 512 //uint16_t
//Sec. 7.1.5: Rate Matching // Sec. 7.1.5: Rate Matching
#define NR_POLAR_PBCH_I_BIL 0 //uint8_t #define NR_POLAR_PBCH_I_BIL 0 // uint8_t
#define NR_POLAR_PBCH_E 864 //uint16_t #define NR_POLAR_PBCH_E 864 // uint16_t
#define NR_POLAR_PBCH_E_DWORD 27 // NR_POLAR_PBCH_E/32 #define NR_POLAR_PBCH_E_DWORD 27 // NR_POLAR_PBCH_E/32
#define NR_POLAR_PSBCH_E 1792 //uint16_t #define NR_POLAR_PSBCH_E 1792 // uint16_t
#define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32 #define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32
/* /*
* TEST CODE * TEST CODE
*/ */
//#define DEBUG_POLAR // #define DEBUG_POLAR
// Usage in code: // Usage in code:
//#ifdef DEBUG_POLAR // #ifdef DEBUG_POLAR
//... //...
//#endif // #endif
//unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; // unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0;
//unsigned int testPayload2=0xa5a5a5a5; //testPayload3=0xb3f02c82; // unsigned int testPayload2=0xa5a5a5a5; //testPayload3=0xb3f02c82;
//double testReceivedPayload3[NR_POLAR_PBCH_E] = {-1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1}; // double testReceivedPayload3[NR_POLAR_PBCH_E] = {-1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1,
// -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1,
// -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1,
// -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1,
// -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1,
// -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1,
// -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1,
// -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1,
// 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1,
// -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1,
// -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1,
// -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1,
// -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1,
// -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1,
// -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1,
// 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1,
// -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1,
// -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1,
// -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1,
// 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1,
// -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1,
// -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1,
// -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1,
// 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1,
// 1, -1, -1};
#endif #endif
...@@ -7,22 +7,21 @@ ...@@ -7,22 +7,21 @@
#define NR_POLAR_PUCCH_PAYLOAD_BITS 16 #define NR_POLAR_PUCCH_PAYLOAD_BITS 16
//Ref. 38-212 v15.0.1 // Ref. 38-212 v15.0.1
#define NR_POLAR_PUCCH_N_MAX 10 //uint8_t <------ #define NR_POLAR_PUCCH_N_MAX 10 // uint8_t <------
#define NR_POLAR_PUCCH_I_IL 1 //uint8_t <--- interleaving: if 0 no interleaving #define NR_POLAR_PUCCH_I_IL 1 // uint8_t <--- interleaving: if 0 no interleaving
#define NR_POLAR_PUCCH_N_PC 3 //uint8_t <-- or zero ?? #define NR_POLAR_PUCCH_N_PC 3 // uint8_t <-- or zero ??
#define NR_POLAR_PUCCH_N_PC_WM 0 //uint8_t #define NR_POLAR_PUCCH_N_PC_WM 0 // uint8_t
//#define NR_POLAR_PUCCH_N 512 //uint16_t // #define NR_POLAR_PUCCH_N 512 //uint16_t
//Ref. 38-212 v15.0.1, Section 7.1.5: Rate Matching
#define NR_POLAR_PUCCH_I_BIL 0 //uint8_t
#define NR_POLAR_PUCCH_E 864 //uint16_t
// Ref. 38-212 v15.0.1, Section 7.1.5: Rate Matching
#define NR_POLAR_PUCCH_I_BIL 0 // uint8_t
#define NR_POLAR_PUCCH_E 864 // uint16_t
/* /*
* TEST CODE * TEST CODE
*/ */
//unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; // unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0;
//unsigned int testPayload2=0xa5a5a5a5, testPayload3=0xb3f02c82; // unsigned int testPayload2=0xa5a5a5a5, testPayload3=0xb3f02c82;
#endif #endif
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include <math.h> #include <math.h>
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E){ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E)
{
int d[N]; int d[N];
int y[N]; int y[N];
...@@ -53,8 +54,8 @@ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P ...@@ -53,8 +54,8 @@ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P
} }
} }
void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E)
void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E){ {
if (E >= N) { // repetition if (E >= N) { // repetition
for (int i = 0; i <= N - 1; i++) for (int i = 0; i <= N - 1; i++)
output[i] = 0; output[i] = 0;
......
...@@ -20,32 +20,32 @@ ...@@ -20,32 +20,32 @@
*/ */
/*! \file PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h /*! \file PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h
* \brief Defines the constant variables for polar coding of the UCI from 38-212, V15.1.1 2018-04. * \brief Defines the constant variables for polar coding of the UCI from 38-212, V15.1.1 2018-04.
* \author * \author
* \date 2018 * \date 2018
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
* \email: * \email:
* \note * \note
* \warning * \warning
*/ */
#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_PUCCH_MESSAGE_TYPE 2 //int8_t #define NR_POLAR_UCI_PUCCH_MESSAGE_TYPE 2 // int8_t
#define NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS 3 #define NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS 3
#define NR_POLAR_PUCCH_PAYLOAD_BITS 32 #define NR_POLAR_PUCCH_PAYLOAD_BITS 32
#define NR_POLAR_PUCCH_E 32 #define NR_POLAR_PUCCH_E 32
//Ref. 38-212, Section 6.3.1.2.1 // Ref. 38-212, Section 6.3.1.2.1
#define NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT 6 #define NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT 6
#define NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG 11 #define NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG 11
#define NR_POLAR_PUCCH_I_SEG_LONG 1 #define NR_POLAR_PUCCH_I_SEG_LONG 1
#define NR_POLAR_PUCCH_I_SEG_SHORT 0 #define NR_POLAR_PUCCH_I_SEG_SHORT 0
//Ref. 38-212, Section 6.3.1.3.1 // Ref. 38-212, Section 6.3.1.3.1
#define NR_POLAR_PUCCH_N_MAX 10 #define NR_POLAR_PUCCH_N_MAX 10
#define NR_POLAR_PUCCH_I_IL 0 #define NR_POLAR_PUCCH_I_IL 0
#define NR_POLAR_PUCCH_N_PC_SHORT 3 #define NR_POLAR_PUCCH_N_PC_SHORT 3
...@@ -53,9 +53,7 @@ ...@@ -53,9 +53,7 @@
#define NR_POLAR_PUCCH_N_PC_WM_LONG 0 #define NR_POLAR_PUCCH_N_PC_WM_LONG 0
#define NR_POLAR_PUCCH_N_PC_WM_SHORT 1 #define NR_POLAR_PUCCH_N_PC_WM_SHORT 1
//Ref. 38-212, Section 6.3.1.4.1 // Ref. 38-212, Section 6.3.1.4.1
#define NR_POLAR_PUCCH_I_BIL 1 #define NR_POLAR_PUCCH_I_BIL 1
#endif #endif
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