Commit fa3a637b authored by Raymond Knopp's avatar Raymond Knopp

cleanup of generator, added directory/file creation for output

parent 550ab500
......@@ -11,7 +11,19 @@
void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
{
printf("void nrLDPC_cnProc_BG1_Z%d\n",Z);
const char *ratestr[3]={"13","23","89"};
if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();}
system("mkdir -p ldpc_gen_files");
char fname[50];
sprintf(fname,"ldpc_gen_files/nrLDPC_cnProc_BG1_Z%d_%s.c",Z,ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {printf("Cannot create %s\n");abort();}
fprintf(fd,"void nrLDPC_cnProc_BG1_Z%d_%s(t_nrLDPC_procBuf* p_procBuf) {\n",Z,ratestr[R]);
const uint8_t* lut_numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG1;
......@@ -19,7 +31,7 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
if (R==0) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R13;
else if (R==1) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R23;
else if (R==2) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R89;
else { printf("aborting, illegal R %d\n",R); abort();}
else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();}
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
......@@ -44,7 +56,7 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
// LUT with offsets for bits that need to be processed
// 1. bit proc requires LLRs of 2. and 3. bit, 2.bits of 1. and 3. etc.
// Offsets are in units of bitOffsetInGroup (1*384/32)
// const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}};
// const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}};
// =====================================================================
// Process group with 3 BNs
......@@ -54,9 +66,9 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
// Offsets are in units of bitOffsetInGroup (1*384/32)
const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}};
printf(" __m256i ymm0, min, sgn;\n");
printf(" const __m256i* p_ones = (__m256i*) ones256_epi8;\n");
printf(" const __m256i* p_maxLLR = (__m256i*) maxLLR256_epi8;\n");
fprintf(fd," __m256i ymm0, min, sgn;\n");
fprintf(fd," const __m256i* p_ones = (__m256i*) ones256_epi8;\n");
fprintf(fd," const __m256i* p_maxLLR = (__m256i*) maxLLR256_epi8;\n");
if (lut_numCnInCnGroups[0] > 0)
{
......@@ -83,29 +95,29 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[0]+lut_idxCnProcG3[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[0]+lut_idxCnProcG3[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// 32 CNs of second BN
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[0]+lut_idxCnProcG3[j][1] + i);
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[0]+lut_idxCnProcG3[j][1] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcB ufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[0]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcB ufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[0]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -141,32 +153,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[1]+lut_idxCnProcG4[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[1]+lut_idxCnProcG4[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<3; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[1]+lut_idxCnProcG4[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[1]+lut_idxCnProcG4[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[1]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[1]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -205,32 +217,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[2]+lut_idxCnProcG5[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[2]+lut_idxCnProcG5[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<4; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[2]+lut_idxCnProcG5[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[2]+lut_idxCnProcG5[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[2]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[2]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -269,32 +281,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[3]+lut_idxCnProcG6[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[3]+lut_idxCnProcG6[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<5; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[3]+lut_idxCnProcG6[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[3]+lut_idxCnProcG6[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[3]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[3]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -336,32 +348,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[4]+lut_idxCnProcG7[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[4]+lut_idxCnProcG7[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<6; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[4]+lut_idxCnProcG7[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[4]+lut_idxCnProcG7[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[4]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[4]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -404,37 +416,37 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[5]+lut_idxCnProcG8[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[5]+lut_idxCnProcG8[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<7; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[5]+lut_idxCnProcG8[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[5]+lut_idxCnProcG8[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[5]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[5]+(j*bitOffsetInGroup)+i);
}
}
}
// =====================================================================
// =====================================================================
// Process group with 9 BNs
// Offset is 2*384/32 = 24
......@@ -473,32 +485,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[6]+lut_idxCnProcG9[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[6]+lut_idxCnProcG9[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<8; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[6]+lut_idxCnProcG9[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[6]+lut_idxCnProcG9[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[6]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[6]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -542,32 +554,32 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[7]+lut_idxCnProcG10[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[7]+lut_idxCnProcG10[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<9; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[7]+lut_idxCnProcG10[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[7]+lut_idxCnProcG10[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[7]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[7]+(j*bitOffsetInGroup)+i);
}
}
}
......@@ -613,34 +625,36 @@ void nrLDPC_cnProc_BG1_generator(t_nrLDPC_procBuf* p_procBuf, uint16_t Z,int R)
for (i=0; i<M; i++,iprime++)
{
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[8]+lut_idxCnProcG19[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
printf(" sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
printf(" min = _mm256_abs_epi8(ymm0);\n");
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[8]+lut_idxCnProcG19[j][0] + i);
// sgn = _mm256_sign_epi8(*p_ones, ymm0);
fprintf(fd," sgn = _mm256_sign_epi8(*p_ones, ymm0);\n");
// min = _mm256_abs_epi8(ymm0);
fprintf(fd," min = _mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<18; k++)
{
printf(" ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[8]+lut_idxCnProcG19[j][k] + i);
fprintf(fd," ymm0 = ((__m256i*)&cnProcBuf)[%d];\n",lut_startAddrCnGroups[8]+lut_idxCnProcG19[j][k] + i);
// min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));
printf(" min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
fprintf(fd," min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0));\n");
// sgn = _mm256_sign_epi8(sgn, ymm0);
printf(" sgn = _mm256_sign_epi8(sgn, ymm0);\n");
fprintf(fd," sgn = _mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
printf(" min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
printf(" ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[8]+(j*bitOffsetInGroup)+i);
// min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
fprintf(fd," min = _mm256_min_epu8(min, *p_maxLLR);\n");
// *p_cnProcBufResBit = _mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((__m256i*)cnProcBufRestBit)[%d] = _mm256_sign_epi8(min, sgn);\n",lut_numCnInCnGroups[8]+(j*bitOffsetInGroup)+i);
}
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_cnProc_BG1
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