Commit a611e0b9 authored by martino's avatar martino

Fixing of some errors

parent 92cdd224
...@@ -121,7 +121,8 @@ int main(int argc, char *argv[]) { ...@@ -121,7 +121,8 @@ int main(int argc, char *argv[]) {
SNR_lin = pow(10, SNR/10); SNR_lin = pow(10, SNR/10);
for (itr = 1; itr <= iterations; itr++) { for (itr = 1; itr <= iterations; itr++) {
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, &nrPolar_params);
......
...@@ -255,7 +255,6 @@ void nr_crc_computation(uint8_t* input, uint8_t* output, uint16_t payloadBits, u ...@@ -255,7 +255,6 @@ void nr_crc_computation(uint8_t* input, uint8_t* output, uint16_t payloadBits, u
//create crc in byte //create crc in byte
unsigned int mask2=0x80000000; //100... unsigned int mask2=0x80000000; //100...
output = (uint8_t*)malloc(sizeof(uint8_t)*crcParityBits);
for(uint8_t ind=0; ind<crcParityBits; ind++) for(uint8_t ind=0; ind<crcParityBits; ind++)
{ {
......
...@@ -137,7 +137,6 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24... ...@@ -137,7 +137,6 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
polarParams->crc256Table = malloc(sizeof(uint32_t)*256); polarParams->crc256Table = malloc(sizeof(uint32_t)*256);
crcTable256Init(polarParams->crc_polynomial, polarParams->crc256Table); crcTable256Init(polarParams->crc_polynomial, polarParams->crc256Table);
polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n); polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n);
polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K); polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K);
......
...@@ -37,9 +37,11 @@ void polar_encoder( ...@@ -37,9 +37,11 @@ void polar_encoder(
//nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(input, polarParams->crc_generator_matrix, //nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(input, polarParams->crc_generator_matrix,
// polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits); // polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits);
//for (uint8_t i = 0; i < polarParams->crcParityBits; i++) polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2); //for (uint8_t i = 0; i < polarParams->crcParityBits; i++) polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
// --- NEW --- // --- NEW ---
nr_crc_computation(input, polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits, polarParams->crc256Table); nr_crc_computation(input, polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits, polarParams->crc256Table);
//Attach CRC to the Transport Block. (a to b) //Attach CRC to the Transport Block. (a to b)
for (uint16_t i = 0; i < polarParams->payloadBits; i++) polarParams->nr_polar_b[i] = input[i]; for (uint16_t i = 0; i < polarParams->payloadBits; i++) polarParams->nr_polar_b[i] = input[i];
for (uint16_t i = polarParams->payloadBits; i < polarParams->K; i++) for (uint16_t i = polarParams->payloadBits; i < polarParams->K; i++)
...@@ -56,10 +58,16 @@ void polar_encoder( ...@@ -56,10 +58,16 @@ void polar_encoder(
// --- OLD --- // --- OLD ---
//nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(polarParams->nr_polar_u, polarParams->G_N, polarParams->nr_polar_d, polarParams->N, polarParams->N); //nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(polarParams->nr_polar_u, polarParams->G_N, polarParams->nr_polar_d, polarParams->N, polarParams->N);
//for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2); //for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2);
//printf("\nd old: ");
//for (uint16_t i = 0; i < polarParams->N; i++)
//printf("%i ", polarParams->nr_polar_d[i]);
// --- NEW --- // --- NEW ---
nr_polar_kernal_operation(polarParams->nr_polar_u, polarParams->nr_polar_d, polarParams->N); nr_polar_kernal_operation(polarParams->nr_polar_u, polarParams->nr_polar_d, polarParams->N);
//printf("\nd new: ");
for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2); //for (uint16_t i = 0; i < polarParams->N; i++)
// printf("%i ", polarParams->nr_polar_d[i]);
//for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2);
//Rate matching //Rate matching
//Sub-block interleaving (d to y) and Bit selection (y to e) //Sub-block interleaving (d to y) and Bit selection (y to e)
......
...@@ -16,12 +16,15 @@ void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N) ...@@ -16,12 +16,15 @@ void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N)
d[i]=0; d[i]=0;
for(j=0; j<N; j++) // ... looking at all the elements of u for(j=0; j<N; j++) // ... looking at all the elements of u
{ {
d[i]=d[i] || ( (!(j-i)) | (!i) )*u[j]; //d[i]=d[i] || ( (!(j-i)) | (!i) )*u[j];
d[i]=d[i] ^ (!( (j-i)& i ))*u[j];
} }
//d[i]=d[i]%2; // modulo 2 //d[i]=d[i]%2; // modulo 2
} }
/* /*
__m256i maddReg, uReg, orReg; __m256i maddReg, uReg, orReg;
__m512i maddRegConv; __m512i maddRegConv;
......
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