Remove LDPC generators as they are not used anymore

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
Robert Schmidt
2026-06-05 15:50:41 +02:00
parent 56e489b7dd
commit 67fafd3b1a
36 changed files with 5 additions and 17693 deletions

View File

@@ -2160,20 +2160,6 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrLDPC_encoder/ldpc_BG2_Zc208_byte.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrLDPC_encoder/ldpc240_byte.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrLDPC_encoder/ldpc_BG2_Zc352_byte_128.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/defs_NB_IoT.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/lte_segmentation.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/CODING/3gpplte.c \

View File

@@ -62,9 +62,9 @@ versions of gcc defined in the cmake cross-compilation file (`cross-arm.cmake`).
### Build code generation tools for host
Use the x86 compiler to build the `ldpc_generators` and generate the header
file in the `ran_build/build` folder. They are necessary during a build for
code generation, and therefore need to be created for the x86 architecture.
Use the x86 compiler to generate the T header file in the `ran_build/build`
folder. This is necessary during a build for code generation, and therefore
need to be created for the x86 architecture.
```shell
rm -r ran_build
@@ -74,7 +74,7 @@ mkdir ran_build/build-cross
cd ran_build/build
cmake ../../..
make -j`nproc` ldpc_generators generate_T
make -j`nproc` generate_T
```
### Build executables for ARM64

View File

@@ -36,6 +36,5 @@ add_dependencies(nr_dlschsim ldpc ldpc_orig)
add_library(crc_byte OBJECT crc_byte.c)
add_subdirectory(nrLDPC_coding)
add_subdirectory(nrLDPC_decoder)
add_subdirectory(nrPolar_tools)
add_subdirectory(nrSmallBlock)

View File

@@ -23,7 +23,7 @@ if (ENABLE_LDPC_AAL)
set_target_properties(ldpc_aal PROPERTIES COMPILE_FLAGS "-DALLOW_EXPERIMENTAL_API")
set_target_properties(ldpc_aal PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
target_include_directories(ldpc_aal PRIVATE ${LIBDPDK_AAL_INCLUDE_DIRS})
target_link_libraries(ldpc_aal PRIVATE log_headers ldpc_gen_HEADERS ${LIBDPDK_AAL_LDFLAGS})
target_link_libraries(ldpc_aal PRIVATE log_headers ${LIBDPDK_AAL_LDFLAGS})
if (PMD_T2)
target_link_libraries(ldpc_aal PRIVATE ${PMD_T2})
endif()

View File

@@ -1,3 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
#add_subdirectory(nrLDPC_tools)

View File

@@ -1,35 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
add_subdirectory(generator_bnProc ldpc/generator_bnProc)
add_subdirectory(generator_bnProc_avx512 ldpc/generator_bnProc_avx512)
add_subdirectory(generator_cnProc ldpc/generator_cnProc)
add_subdirectory(generator_cnProc_avx512 ldpc/generator_cnProc_avx512)
# custom target to build all generators
add_custom_target(ldpc_generators)
# if (CROSS_COMPILE)
# find_package(bnProc_gen_avx2)
# find_package(bnProc_gen_128)
# find_package(bnProc_gen_avx512)
# find_package(cnProc_gen_avx2)
# find_package(cnProc_gen_128)
# find_package(cnProc_gen_avx512)
# endif()
add_dependencies(ldpc_generators
bnProc_gen_avx2_files
bnProc_gen_128_files
bnProc_gen_avx512_files
cnProc_gen_avx2_files
cnProc_gen_128_files
cnProc_gen_avx512_files)
add_library(ldpc_gen_HEADERS INTERFACE)
target_link_libraries(ldpc_gen_HEADERS INTERFACE
bnProc_gen_avx2_HEADERS
bnProc_gen_128_HEADERS
bnProc_gen_avx512_HEADERS
cnProc_gen_avx2_HEADERS
cnProc_gen_128_HEADERS
cnProc_gen_avx512_HEADERS)

View File

@@ -1,91 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
if (CROSS_COMPILE)
find_package(bnProc_gen_128)
find_package(bnProc_gen_avx2)
else()
add_executable(bnProc_gen_avx2
bnProc_gen_BG1_avx2.c
bnProc_gen_BG2_avx2.c
bnProcPc_gen_BG1_avx2.c
bnProcPc_gen_BG2_avx2.c
main.c)
add_executable(bnProc_gen_128
bnProc_gen_BG1_128.c
bnProc_gen_BG2_128.c
bnProcPc_gen_BG1_128.c
bnProcPc_gen_BG2_128.c
main128.c)
target_compile_options(bnProc_gen_avx2 PRIVATE -W -Wall )
target_compile_options(bnProc_gen_128 PRIVATE -W -Wall )
export(TARGETS bnProc_gen_avx2 FILE
"${CMAKE_BINARY_DIR}/bnProc_gen_avx2Config.cmake")
export(TARGETS bnProc_gen_128 FILE
"${CMAKE_BINARY_DIR}/bnProc_gen_128Config.cmake")
endif ()
set(bnProc_headers
bnProc/nrLDPC_bnProc_BG1_R13_AVX2.h
bnProc/nrLDPC_bnProc_BG1_R23_AVX2.h
bnProc/nrLDPC_bnProc_BG1_R89_AVX2.h
bnProc/nrLDPC_bnProc_BG2_R13_AVX2.h
bnProc/nrLDPC_bnProc_BG2_R15_AVX2.h
bnProc/nrLDPC_bnProc_BG2_R23_AVX2.h)
set(bnProcPc_headers
bnProcPc/nrLDPC_bnProcPc_BG1_R13_AVX2.h
bnProcPc/nrLDPC_bnProcPc_BG1_R23_AVX2.h
bnProcPc/nrLDPC_bnProcPc_BG1_R89_AVX2.h
bnProcPc/nrLDPC_bnProcPc_BG2_R13_AVX2.h
bnProcPc/nrLDPC_bnProcPc_BG2_R15_AVX2.h
bnProcPc/nrLDPC_bnProcPc_BG2_R23_AVX2.h)
set(bnProc128_headers
bnProc/nrLDPC_bnProc_BG1_R13_128.h
bnProc/nrLDPC_bnProc_BG1_R23_128.h
bnProc/nrLDPC_bnProc_BG1_R89_128.h
bnProc/nrLDPC_bnProc_BG2_R13_128.h
bnProc/nrLDPC_bnProc_BG2_R15_128.h
bnProc/nrLDPC_bnProc_BG2_R23_128.h)
set(bnProcPc128_headers
bnProcPc/nrLDPC_bnProcPc_BG1_R13_128.h
bnProcPc/nrLDPC_bnProcPc_BG1_R23_128.h
bnProcPc/nrLDPC_bnProcPc_BG1_R89_128.h
bnProcPc/nrLDPC_bnProcPc_BG2_R13_128.h
bnProcPc/nrLDPC_bnProcPc_BG2_R15_128.h
bnProcPc/nrLDPC_bnProcPc_BG2_R23_128.h)
add_custom_command(
# TARGET bnProc_gen_avx2 POST_BUILD
OUTPUT ${bnProc_headers} ${bnProcPc_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory bnProc
COMMAND ${CMAKE_COMMAND} -E make_directory bnProcPc
COMMAND bnProc_gen_avx2 .
DEPENDS bnProc_gen_avx2
COMMENT "Generating LDPC bnProc header files for AVX2"
)
add_custom_target(bnProc_gen_avx2_files DEPENDS ${bnProc_headers} ${bnProcPc_headers})
add_custom_command(
# TARGET bnProc_gen_128 POST_BUILD
OUTPUT ${bnProc128_headers} ${bnProcPc128_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory bnProc128
COMMAND ${CMAKE_COMMAND} -E make_directory bnProcPc128
COMMAND bnProc_gen_128 .
DEPENDS bnProc_gen_128
COMMENT "Generating LDPC bnProc header files for 128-bit SIMD"
)
add_custom_target(bnProc_gen_128_files DEPENDS ${bnProc128_headers} ${bnProcPc128_headers})
add_library(bnProc_gen_avx2_HEADERS INTERFACE)
target_include_directories(bnProc_gen_avx2_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(bnProc_gen_avx2_HEADERS bnProc_gen_avx2_files)
add_library(bnProc_gen_128_HEADERS INTERFACE)
target_include_directories(bnProc_gen_128_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(bnProc_gen_128_HEADERS bnProc_gen_128_files)

View File

@@ -1,146 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProcPc_BG1_generator_128(const char *dir, int R)
{
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[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/bnProcPc128/nrLDPC_bnProcPc_BG1_R%s_128.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_bnProcPc_BG1_R%s_128(int8_t* bnProcBuf,int8_t* bnProcBufRes,int8_t* llrRes , int8_t* llrProcBuf, uint16_t Z ) {\n",ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R==0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R13;
}
else if (R==1){
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R23;
}
else if (R==2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R89;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R89;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R89;
}
else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();}
// Number of BNs in Groups
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd," // Process group with 1 CN\n");
fprintf(fd," uint32_t M = (%d*Z + 15)>>4;\n",lut_numBnInBnGroups[0]);
fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," simde__m128i ymm0, ymm1, ymmRes0, ymmRes1;\n");
fprintf(fd," for (int i=0;i<M;i++) {\n");
fprintf(fd," p_bnProcBufRes[i] = p_llrProcBuf[i];\n");
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_bnProcBuf [i]);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(p_llrProcBuf[i]);\n");
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymm0, ymm1);\n");
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf [i],8));\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_llrProcBuf[i],8));\n");
fprintf(fd," ymmRes1 = simde_mm_adds_epi16(ymm0, ymm1);\n");
fprintf(fd," *p_llrRes = simde_mm_packs_epi16(ymmRes0, ymmRes1);\n");
fprintf(fd," p_llrRes++;\n");
fprintf(fd," }\n");
for (uint32_t cnidx=1;cnidx<30;cnidx++) {
// Process group with 4 CNs
if (lut_numBnInBnGroups[cnidx] > 0)
{
// If elements in group move to next address
idxBnGroup++;
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numBnInBnGroups[cnidx]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[cnidx]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 2
fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
// Loop over BNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// First 16 LLRs of first CN
fprintf(fd," ymmRes0 = simde_mm_cvtepi8_epi16(p_bnProcBuf [i]);\n");
fprintf(fd," ymmRes1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf [i],8));\n");
// Loop over CNs
for (k=1; k<=cnidx; k++)
{
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_bnProcBuf[%u + i]);\n", k * cnOffsetInGroup);
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymmRes0, ymm0);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf[%u + i],8));\n", k * cnOffsetInGroup);
fprintf(fd, " ymmRes1 = simde_mm_adds_epi16(ymmRes1, ymm1); \n");
}
// Add LLR from receiver input
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_llrProcBuf[i]);\n");
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymmRes0, ymm0);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_llrProcBuf[i],8));\n");
fprintf(fd," ymmRes1 = simde_mm_adds_epi16(ymmRes1, ymm1);\n");
// Pack results back to epi8
fprintf(fd," *p_llrRes = simde_mm_packs_epi16(ymmRes0, ymmRes1);\n");
fprintf(fd," p_llrRes++;\n");
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_bnProcPc_BG1

View File

@@ -1,149 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#include "PHY/sse_intrin.h"
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProcPc_BG2_generator_128(const char *dir, int R)
{
const char *ratestr[3]={"15","13","23"};
if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();}
// system("mkdir -p ../ldpc_gen_files");
char fname[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/bnProcPc128/nrLDPC_bnProcPc_BG2_R%s_128.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_bnProcPc_BG2_R%s_128(int8_t* bnProcBuf,int8_t* bnProcBufRes,int8_t* llrRes , int8_t* llrProcBuf, uint16_t Z ) {\n",ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R==0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R15;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R15;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R15;
}
else if (R==1){
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R13;
}
else if (R==2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R23;
}
else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();}
// Number of BNs in Groups
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd," // Process group with 1 CN\n");
fprintf(fd," uint32_t M = (%d*Z + 15)>>4;\n",lut_numBnInBnGroups[0]);
fprintf(fd," simde__m128i* p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," simde__m128i* p_bnProcBufRes = (simde__m128i*) &bnProcBufRes [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," simde__m128i* p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," simde__m128i* p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," simde__m128i ymm0, ymm1, ymmRes0, ymmRes1;\n");
fprintf(fd," for (int i=0;i<M;i++) {\n");
fprintf(fd," p_bnProcBufRes[i] = p_llrProcBuf[i];\n");
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_bnProcBuf [i]);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(p_llrProcBuf[i]);\n");
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymm0, ymm1);\n");
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf [i],8));\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_llrProcBuf[i],8));\n");
fprintf(fd," ymmRes1 = simde_mm_adds_epi16(ymm0, ymm1);\n");
fprintf(fd," *p_llrRes = simde_mm_packs_epi16(ymmRes0, ymmRes1);\n");
fprintf(fd," p_llrRes++;\n");
fprintf(fd," }\n");
for (uint32_t cnidx=1;cnidx<30;cnidx++) {
// Process group with 4 CNs
if (lut_numBnInBnGroups[cnidx] > 0)
{
// If elements in group move to next address
idxBnGroup++;
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numBnInBnGroups[cnidx]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[cnidx]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 2
fprintf(fd," p_bnProcBuf = (simde__m128i*) &bnProcBuf [%u];\n", lut_startAddrBnGroups[idxBnGroup]);
fprintf(fd," p_llrProcBuf = (simde__m128i*) &llrProcBuf [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
fprintf(fd," p_llrRes = (simde__m128i*) &llrRes [%d];\n", lut_startAddrBnGroupsLlr[idxBnGroup]);
// Loop over BNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// First 16 LLRs of first CN
fprintf(fd," ymmRes0 = simde_mm_cvtepi8_epi16(p_bnProcBuf [i]);\n");
fprintf(fd," ymmRes1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf [i],8));\n");
// Loop over CNs
for (k=1; k<=cnidx; k++)
{
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_bnProcBuf[%u + i]);\n", k * cnOffsetInGroup);
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymmRes0, ymm0);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_bnProcBuf[%u + i],8));\n", k * cnOffsetInGroup);
fprintf(fd, " ymmRes1 = simde_mm_adds_epi16(ymmRes1, ymm1); \n");
}
// Add LLR from receiver input
fprintf(fd," ymm0 = simde_mm_cvtepi8_epi16(p_llrProcBuf[i]);\n");
fprintf(fd," ymmRes0 = simde_mm_adds_epi16(ymmRes0, ymm0);\n");
fprintf(fd," ymm1 = simde_mm_cvtepi8_epi16(simde_mm_srli_si128(p_llrProcBuf[i],8));\n");
fprintf(fd," ymmRes1 = simde_mm_adds_epi16(ymmRes1, ymm1);\n");
// Pack results back to epi8
fprintf(fd," *p_llrRes = simde_mm_packs_epi16(ymmRes0, ymmRes1);\n");
fprintf(fd," p_llrRes++;\n");
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_bnProcPc_BG2

View File

@@ -1,985 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "PHY/sse_intrin.h"
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProc_BG1_generator_128(const char* dir, int R)
{
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[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/bnProc128/nrLDPC_bnProc_BG1_R%s_128.h", dir, ratestr[R]);
FILE* fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
// fprintf(fd,"#include <stdint.h>\n");
// fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd, "static inline void nrLDPC_bnProc_BG1_R%s_128(int8_t* bnProcBuf,int8_t* bnProcBufRes, int8_t* llrRes, uint16_t Z ) {\n", ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R == 0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R13;
} else if (R == 1) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R23;
} else if (R == 2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R89;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R89;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R89;
} else {
printf("aborting, illegal R %d\n", R);
fclose(fd);
abort();
}
// uint32_t M;
// uint32_t M32rem;
// uint32_t i;
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd, " uint32_t M, i; \n");
// =====================================================================
// Process group with 1 CN
// Already done in bnProcBufPc
// =====================================================================
fprintf(fd, "// Process group with 2 CNs \n");
if (lut_numBnInBnGroups[1] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs or parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[1]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[1] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 2; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 3 CNs \n");
if (lut_numBnInBnGroups[2] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[2]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[2] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// fprintf(fd," ((simde__m128i*) bnProcBuf) = ((simde__m128i*) &bnProcBuf) [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
for (k = 0; k < 3; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 4 CNs \n");
if (lut_numBnInBnGroups[3] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[3]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[3] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
for (k = 0; k < 4; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
((lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup),
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
((lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup));
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 5 CNs \n");
if (lut_numBnInBnGroups[4] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[4]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[4] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 5; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 6 CNs \n");
// Process group with 6 CNs
if (lut_numBnInBnGroups[5] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[5]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[5] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 6; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 7 CNs \n");
// Process group with 7 CNs
if (lut_numBnInBnGroups[6] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[6]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[6] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 7; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 8 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[7] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[7]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[7] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 8; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 9 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[8] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[8]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[8] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 9; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 10 CNs \n");
// Process group with 10 CNs
if (lut_numBnInBnGroups[9] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[9]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[9] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 10; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 11 CNs \n");
if (lut_numBnInBnGroups[10] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[10]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[10] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 11; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 12 CNs \n");
if (lut_numBnInBnGroups[11] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[11]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[11] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 12; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 13 CNs \n");
if (lut_numBnInBnGroups[12] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[12]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[12] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 13; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 14 CNs \n");
if (lut_numBnInBnGroups[13] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[13]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[13] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 14; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 15 CNs \n");
if (lut_numBnInBnGroups[14] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[14]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[14] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 15; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 16 CNs \n");
if (lut_numBnInBnGroups[15] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[15]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[15] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 16; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
// Process group with 17 CNs
fprintf(fd, "// Process group with 17 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[16] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[16]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[16] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 17; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 18 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[17] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[17]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[17] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 18; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 19 CNs \n");
if (lut_numBnInBnGroups[18] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[18]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[18] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 19; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 20 CNs \n");
if (lut_numBnInBnGroups[19] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[19]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[19] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 20; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 21 CNs \n");
if (lut_numBnInBnGroups[20] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[20]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[20] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 21; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 22 CNs \n");
if (lut_numBnInBnGroups[21] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[21]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[21] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 22; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with <23 CNs \n");
if (lut_numBnInBnGroups[22] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[22]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[22] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 23; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 24 CNs \n");
// Process group with 4 CNs
if (lut_numBnInBnGroups[23] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[23]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[23] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 24; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 25 CNs \n");
if (lut_numBnInBnGroups[24] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[24]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[24] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 25; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 26 CNs \n");
if (lut_numBnInBnGroups[25] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[25]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[25] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 26; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 27 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[26] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[26]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[26] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 27; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 28 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[27] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[27]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[27] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 28; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 29 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[28] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[28]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[28] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 29; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 30 CNs \n");
// Process group with 20 CNs
if (lut_numBnInBnGroups[29] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[29]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[29] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 30; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_bnProc_BG1

View File

@@ -1,985 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "PHY/sse_intrin.h"
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProc_BG1_generator_AVX2(const char* dir, int R)
{
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[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/bnProc/nrLDPC_bnProc_BG1_R%s_AVX2.h", dir, ratestr[R]);
FILE* fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
// fprintf(fd,"#include <stdint.h>\n");
// fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd, "static inline void nrLDPC_bnProc_BG1_R%s_AVX2(int8_t* bnProcBuf,int8_t* bnProcBufRes, int8_t* llrRes, uint16_t Z ) {\n", ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R == 0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R13;
} else if (R == 1) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R23;
} else if (R == 2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG1_R89;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG1_R89;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R89;
} else {
printf("aborting, illegal R %d\n", R);
fclose(fd);
abort();
}
// uint32_t M;
// uint32_t M32rem;
// uint32_t i;
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd, " uint32_t M, i; \n");
// =====================================================================
// Process group with 1 CN
// Already done in bnProcBufPc
// =====================================================================
fprintf(fd, "// Process group with 2 CNs \n");
if (lut_numBnInBnGroups[1] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs or parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[1]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[1] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 2; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 3 CNs \n");
if (lut_numBnInBnGroups[2] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[2]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[2] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// fprintf(fd," ((simde__m256i*) bnProcBuf) = ((simde__m256i*) &bnProcBuf) [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
for (k = 0; k < 3; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 4 CNs \n");
if (lut_numBnInBnGroups[3] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[3]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[3] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
for (k = 0; k < 4; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
((lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup),
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
((lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup));
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 5 CNs \n");
if (lut_numBnInBnGroups[4] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[4]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[4] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 5; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 6 CNs \n");
// Process group with 6 CNs
if (lut_numBnInBnGroups[5] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[5]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[5] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 6; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 7 CNs \n");
// Process group with 7 CNs
if (lut_numBnInBnGroups[6] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[6]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[6] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 7; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 8 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[7] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[7]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[7] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 8; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 9 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[8] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[8]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[8] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 9; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 10 CNs \n");
// Process group with 10 CNs
if (lut_numBnInBnGroups[9] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[9]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[9] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 10; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 11 CNs \n");
if (lut_numBnInBnGroups[10] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[10]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[10] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 11; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 12 CNs \n");
if (lut_numBnInBnGroups[11] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[11]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[11] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 12; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 13 CNs \n");
if (lut_numBnInBnGroups[12] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[12]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[12] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 13; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 14 CNs \n");
if (lut_numBnInBnGroups[13] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[13]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[13] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 14; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 15 CNs \n");
if (lut_numBnInBnGroups[14] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[14]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[14] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 15; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 16 CNs \n");
if (lut_numBnInBnGroups[15] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[15]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[15] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 16; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
// Process group with 17 CNs
fprintf(fd, "// Process group with 17 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[16] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[16]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[16] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 17; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 18 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[17] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[17]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[17] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 18; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 19 CNs \n");
if (lut_numBnInBnGroups[18] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[18]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[18] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 19; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 20 CNs \n");
if (lut_numBnInBnGroups[19] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[19]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[19] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 20; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 21 CNs \n");
if (lut_numBnInBnGroups[20] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[20]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[20] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 21; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 22 CNs \n");
if (lut_numBnInBnGroups[21] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[21]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[21] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 22; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with <23 CNs \n");
if (lut_numBnInBnGroups[22] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[22]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[22] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 23; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 24 CNs \n");
// Process group with 4 CNs
if (lut_numBnInBnGroups[23] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[23]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[23] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 24; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 25 CNs \n");
if (lut_numBnInBnGroups[24] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[24]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[24] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 25; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 26 CNs \n");
if (lut_numBnInBnGroups[25] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[25]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[25] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 26; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 27 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[26] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[26]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[26] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 27; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 28 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[27] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[27]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[27] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 28; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 29 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[28] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[28]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[28] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 29; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 30 CNs \n");
// Process group with 20 CNs
if (lut_numBnInBnGroups[29] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[29]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[29] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 30; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_bnProc_BG1

View File

@@ -1,981 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProc_BG2_generator_128(const char* dir, int R)
{
const char* ratestr[3] = {"15", "13", "23"};
if (R < 0 || R > 2) {
printf("Illegal R %d\n", R);
abort();
}
// system("mkdir -p ../ldpc_gen_files");
char fname[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/bnProc128/nrLDPC_bnProc_BG2_R%s_128.h", dir, ratestr[R]);
FILE* fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd, "static inline void nrLDPC_bnProc_BG2_R%s_128(int8_t* bnProcBuf,int8_t* bnProcBufRes, int8_t* llrRes, uint16_t Z ) {\n", ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R == 0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R15;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R15;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R15;
} else if (R == 1) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R13;
} else if (R == 2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R23;
} else {
printf("aborting, illegal R %d\n", R);
fclose(fd);
abort();
}
// uint32_t M;
// uint32_t M32rem;
// uint32_t i;
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd, " uint32_t M, i; \n");
// =====================================================================
// Process group with 1 CN
// Already done in bnProcBufPc
// =====================================================================
fprintf(fd, "// Process group with 2 CNs \n");
if (lut_numBnInBnGroups[1] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs or parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[1]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[1] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 2; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 3 CNs \n");
if (lut_numBnInBnGroups[2] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[2]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[2] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// fprintf(fd," ((simde__m128i*) bnProcBuf) = ((simde__m128i*) &bnProcBuf) [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
for (k = 0; k < 3; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 4 CNs \n");
if (lut_numBnInBnGroups[3] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[3]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[3] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
for (k = 0; k < 4; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
((lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup),
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
((lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup));
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 5 CNs \n");
if (lut_numBnInBnGroups[4] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[4]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[4] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 5; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 6 CNs \n");
// Process group with 6 CNs
if (lut_numBnInBnGroups[5] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[5]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[5] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 6; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 7 CNs \n");
// Process group with 7 CNs
if (lut_numBnInBnGroups[6] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[6]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[6] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 7; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 8 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[7] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[7]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[7] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 8; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 9 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[8] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[8]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[8] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 9; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 10 CNs \n");
// Process group with 10 CNs
if (lut_numBnInBnGroups[9] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[9]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[9] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 10; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 11 CNs \n");
if (lut_numBnInBnGroups[10] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[10]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[10] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 11; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 12 CNs \n");
if (lut_numBnInBnGroups[11] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[11]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[11] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 12; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 13 CNs \n");
if (lut_numBnInBnGroups[12] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[12]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[12] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 13; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 14 CNs \n");
if (lut_numBnInBnGroups[13] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[13]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[13] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 14; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 15 CNs \n");
if (lut_numBnInBnGroups[14] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[14]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[14] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 15; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 16 CNs \n");
if (lut_numBnInBnGroups[15] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[15]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[15] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 16; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
// Process group with 17 CNs
fprintf(fd, "// Process group with 17 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[16] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[16]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[16] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 17; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 18 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[17] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[17]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[17] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 18; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 19 CNs \n");
if (lut_numBnInBnGroups[18] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[18]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[18] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 19; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 20 CNs \n");
if (lut_numBnInBnGroups[19] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[19]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[19] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 20; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 21 CNs \n");
if (lut_numBnInBnGroups[20] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[20]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[20] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 21; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 22 CNs \n");
if (lut_numBnInBnGroups[21] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[21]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[21] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 22; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with <23 CNs \n");
if (lut_numBnInBnGroups[22] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[22]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[22] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 23; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 24 CNs \n");
// Process group with 4 CNs
if (lut_numBnInBnGroups[23] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[23]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[23] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 24; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 25 CNs \n");
if (lut_numBnInBnGroups[24] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[24]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[24] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 25; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 26 CNs \n");
if (lut_numBnInBnGroups[25] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[25]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[25] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 26; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 27 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[26] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[26]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[26] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 27; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 28 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[27] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[27]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[27] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 28; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 29 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[28] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[28]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[28] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 29; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 30 CNs \n");
// Process group with 20 CNs
if (lut_numBnInBnGroups[29] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 15)>>4;\n", lut_numBnInBnGroups[29]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[29] * NR_LDPC_ZMAX) >> 4;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 30; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m128i*)bnProcBufRes)[%d + i ] = simde_mm_subs_epi8(((simde__m128i*)llrRes)[%d + i ], ((simde__m128i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 4),
(lut_startAddrBnGroups[idxBnGroup] >> 4) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_bnProc_BG2

View File

@@ -1,981 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
void nrLDPC_bnProc_BG2_generator_AVX2(const char* dir, int R)
{
const char* ratestr[3] = {"15", "13", "23"};
if (R < 0 || R > 2) {
printf("Illegal R %d\n", R);
abort();
}
// system("mkdir -p ../ldpc_gen_files");
char fname[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/bnProc/nrLDPC_bnProc_BG2_R%s_AVX2.h", dir, ratestr[R]);
FILE* fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd, "static inline void nrLDPC_bnProc_BG2_R%s_AVX2(int8_t* bnProcBuf,int8_t* bnProcBufRes, int8_t* llrRes, uint16_t Z ) {\n", ratestr[R]);
const uint8_t* lut_numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr;
if (R == 0) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R15;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R15;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R15;
} else if (R == 1) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R13;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R13;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R13;
} else if (R == 2) {
lut_numBnInBnGroups = lut_numBnInBnGroups_BG2_R23;
lut_startAddrBnGroups = lut_startAddrBnGroups_BG2_R23;
lut_startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R23;
} else {
printf("aborting, illegal R %d\n", R);
fclose(fd);
abort();
}
// uint32_t M;
// uint32_t M32rem;
// uint32_t i;
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t cnOffsetInGroup;
uint8_t idxBnGroup = 0;
fprintf(fd, " uint32_t M, i; \n");
// =====================================================================
// Process group with 1 CN
// Already done in bnProcBufPc
// =====================================================================
fprintf(fd, "// Process group with 2 CNs \n");
if (lut_numBnInBnGroups[1] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs or parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[1]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[1] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 2; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 3 CNs \n");
if (lut_numBnInBnGroups[2] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[2]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[2] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// fprintf(fd," ((simde__m256i*) bnProcBuf) = ((simde__m256i*) &bnProcBuf) [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
for (k = 0; k < 3; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 4 CNs \n");
if (lut_numBnInBnGroups[3] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[3]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[3] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
for (k = 0; k < 4; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
((lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup),
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
((lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup));
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 5 CNs \n");
if (lut_numBnInBnGroups[4] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[4]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[4] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 5; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 6 CNs \n");
// Process group with 6 CNs
if (lut_numBnInBnGroups[5] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[5]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[5] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 6; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 7 CNs \n");
// Process group with 7 CNs
if (lut_numBnInBnGroups[6] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[6]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[6] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 7; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 8 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[7] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[7]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[7] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 8; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 9 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[8] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[8]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[8] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 9; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 10 CNs \n");
// Process group with 10 CNs
if (lut_numBnInBnGroups[9] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[9]);
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[9] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 10; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 11 CNs \n");
if (lut_numBnInBnGroups[10] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[10]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[10] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 11; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 12 CNs \n");
if (lut_numBnInBnGroups[11] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[11]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[11] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 12; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 13 CNs \n");
if (lut_numBnInBnGroups[12] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[12]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[12] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 13; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 14 CNs \n");
if (lut_numBnInBnGroups[13] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[13]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[13] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 14; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 15 CNs \n");
if (lut_numBnInBnGroups[14] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[14]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[14] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 15; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 16 CNs \n");
if (lut_numBnInBnGroups[15] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[15]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[15] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 16; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
// Process group with 17 CNs
fprintf(fd, "// Process group with 17 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[16] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[16]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[16] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 17; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 18 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[17] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[17]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[17] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 18; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 19 CNs \n");
if (lut_numBnInBnGroups[18] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[18]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[18] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 19; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 20 CNs \n");
if (lut_numBnInBnGroups[19] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[19]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[19] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 20; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 21 CNs \n");
if (lut_numBnInBnGroups[20] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[20]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[20] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 21; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 22 CNs \n");
if (lut_numBnInBnGroups[21] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[21]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[21] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 22; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with <23 CNs \n");
if (lut_numBnInBnGroups[22] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[22]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[22] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 23; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 24 CNs \n");
// Process group with 4 CNs
if (lut_numBnInBnGroups[23] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[23]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[23] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 24; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 25 CNs \n");
if (lut_numBnInBnGroups[24] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[24]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[24] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 25; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 26 CNs \n");
if (lut_numBnInBnGroups[25] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[25]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[25] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 26; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 27 CNs \n");
// Process group with 17 CNs
if (lut_numBnInBnGroups[26] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[26]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[26] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 27; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 28 CNs \n");
// Process group with 8 CNs
if (lut_numBnInBnGroups[27] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[27]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[27] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 28; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 29 CNs \n");
// Process group with 9 CNs
if (lut_numBnInBnGroups[28] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[28]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[28] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 29; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
// =====================================================================
fprintf(fd, "// Process group with 30 CNs \n");
// Process group with 20 CNs
if (lut_numBnInBnGroups[29] > 0) {
// If elements in group move to next address
idxBnGroup++;
// Number of groups of 32 BNs for parallel processing
fprintf(fd, " M = (%d*Z + 31)>>5;\n", lut_numBnInBnGroups[29]);
;
// Set the offset to each CN within a group in terms of 16 Byte
cnOffsetInGroup = (lut_numBnInBnGroups[29] * NR_LDPC_ZMAX) >> 5;
// Set pointers to start of group 2
// Loop over CNs
for (k = 0; k < 30; k++) {
// Loop over BNs
fprintf(fd, " for (i=0;i<M;i++) {\n");
fprintf(fd,
" ((simde__m256i*)bnProcBufRes)[%d + i ] = simde_mm256_subs_epi8(((simde__m256i*)llrRes)[%d + i ], ((simde__m256i*) bnProcBuf)[%d + i]);\n",
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup,
(lut_startAddrBnGroupsLlr[idxBnGroup] >> 5),
(lut_startAddrBnGroups[idxBnGroup] >> 5) + k * cnOffsetInGroup);
fprintf(fd, "}\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_bnProc_BG2

View File

@@ -1,38 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_bnProc_BG1_generator_AVX2(const char*, int);
void nrLDPC_bnProc_BG2_generator_AVX2(const char*, int);
void nrLDPC_bnProcPc_BG1_generator_AVX2(const char*, int);
void nrLDPC_bnProcPc_BG2_generator_AVX2(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++){
nrLDPC_bnProc_BG1_generator_AVX2(dir, R[i]);
nrLDPC_bnProc_BG2_generator_AVX2(dir, R[i]);
nrLDPC_bnProcPc_BG1_generator_AVX2(dir, R[i]);
nrLDPC_bnProcPc_BG2_generator_AVX2(dir, R[i]);
}
return(0);
}

View File

@@ -1,38 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_bnProc_BG1_generator_128(const char*, int);
void nrLDPC_bnProc_BG2_generator_128(const char*, int);
void nrLDPC_bnProcPc_BG1_generator_128(const char*, int);
void nrLDPC_bnProcPc_BG2_generator_128(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++){
nrLDPC_bnProc_BG1_generator_128(dir, R[i]);
nrLDPC_bnProc_BG2_generator_128(dir, R[i]);
nrLDPC_bnProcPc_BG1_generator_128(dir, R[i]);
nrLDPC_bnProcPc_BG2_generator_128(dir, R[i]);
}
return(0);
}

View File

@@ -1,47 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
if (CROSS_COMPILE)
find_package(bnProc_gen_avx512)
else()
add_executable(bnProc_gen_avx512
bnProc_gen_BG1_avx512.c
bnProc_gen_BG2_avx512.c
bnProcPc_gen_BG1_avx512.c
bnProcPc_gen_BG2_avx512.c
main.c)
target_compile_options(bnProc_gen_avx512 PRIVATE -W -Wall )
export(TARGETS bnProc_gen_avx512 FILE
"${CMAKE_BINARY_DIR}/bnProc_gen_avx512Config.cmake")
endif ()
set(bnProc_avx512_headers
bnProc_avx512/nrLDPC_bnProc_BG1_R13_AVX512.h
bnProc_avx512/nrLDPC_bnProc_BG1_R23_AVX512.h
bnProc_avx512/nrLDPC_bnProc_BG1_R89_AVX512.h
bnProc_avx512/nrLDPC_bnProc_BG2_R13_AVX512.h
bnProc_avx512/nrLDPC_bnProc_BG2_R15_AVX512.h
bnProc_avx512/nrLDPC_bnProc_BG2_R23_AVX512.h)
set(bnProcPc_avx512_headers
bnProcPc_avx512/nrLDPC_bnProcPc_BG1_R13_AVX512.h
bnProcPc_avx512/nrLDPC_bnProcPc_BG1_R23_AVX512.h
bnProcPc_avx512/nrLDPC_bnProcPc_BG1_R89_AVX512.h
bnProcPc_avx512/nrLDPC_bnProcPc_BG2_R13_AVX512.h
bnProcPc_avx512/nrLDPC_bnProcPc_BG2_R15_AVX512.h
bnProcPc_avx512/nrLDPC_bnProcPc_BG2_R23_AVX512.h)
add_custom_command(
# TARGET bnProc_gen_avx512 POST_BUILD
OUTPUT ${bnProc_avx512_headers} ${bnProcPc_avx512_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory bnProc_avx512
COMMAND ${CMAKE_COMMAND} -E make_directory bnProcPc_avx512
COMMAND bnProc_gen_avx512 .
DEPENDS bnProc_gen_avx512
COMMENT "Generating LDPC bnProc header files for AVX512"
)
add_custom_target(bnProc_gen_avx512_files DEPENDS ${bnProc_avx512_headers} ${bnProcPc_avx512_headers})
add_library(bnProc_gen_avx512_HEADERS INTERFACE)
target_include_directories(bnProc_gen_avx512_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(bnProc_gen_avx512_HEADERS bnProc_gen_avx512_files)

View File

@@ -1,39 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define NB_R 3
void nrLDPC_bnProc_BG1_generator_AVX512(const char *, int);
void nrLDPC_bnProc_BG2_generator_AVX512(const char *, int);
void nrLDPC_bnProcPc_BG1_generator_AVX512(const char *, int);
void nrLDPC_bnProcPc_BG2_generator_AVX512(const char *, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++){
nrLDPC_bnProc_BG1_generator_AVX512(dir, R[i]);
nrLDPC_bnProc_BG2_generator_AVX512(dir, R[i]);
nrLDPC_bnProcPc_BG1_generator_AVX512(dir, R[i]);
nrLDPC_bnProcPc_BG2_generator_AVX512(dir, R[i]);
}
return(0);
}

View File

@@ -1,66 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
if (CROSS_COMPILE)
find_package(cnProc_gen_128)
find_package(cnProc_gen_avx2)
else()
add_executable(cnProc_gen_avx2
cnProc_gen_BG1_avx2.c
cnProc_gen_BG2_avx2.c
main.c)
add_executable(cnProc_gen_128
cnProc_gen_BG1_128.c
cnProc_gen_BG2_128.c
main128.c)
target_compile_options(cnProc_gen_avx2 PRIVATE -W -Wall )
target_compile_options(cnProc_gen_128 PRIVATE -W -Wall )
export(TARGETS cnProc_gen_avx2 FILE
"${CMAKE_BINARY_DIR}/cnProc_gen_avx2Config.cmake")
export(TARGETS cnProc_gen_128 FILE
"${CMAKE_BINARY_DIR}/cnProc_gen_128Config.cmake")
endif()
set(cnProc_headers
cnProc/nrLDPC_cnProc_BG1_R13_AVX2.h
cnProc/nrLDPC_cnProc_BG1_R23_AVX2.h
cnProc/nrLDPC_cnProc_BG1_R89_AVX2.h
cnProc/nrLDPC_cnProc_BG2_R13_AVX2.h
cnProc/nrLDPC_cnProc_BG2_R15_AVX2.h
cnProc/nrLDPC_cnProc_BG2_R23_AVX2.h)
set(cnProc128_headers
cnProc/nrLDPC_cnProc_BG1_R13_128.h
cnProc/nrLDPC_cnProc_BG1_R23_128.h
cnProc/nrLDPC_cnProc_BG1_R89_128.h
cnProc/nrLDPC_cnProc_BG2_R13_128.h
cnProc/nrLDPC_cnProc_BG2_R15_128.h
cnProc/nrLDPC_cnProc_BG2_R23_128.h)
add_custom_command(
# TARGET cnProc_gen_avx2 POST_BUILD
OUTPUT ${cnProc_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory cnProc
COMMAND cnProc_gen_avx2 .
DEPENDS cnProc_gen_avx2
COMMENT "Generating LDPC cnProc header files for AVX2"
)
add_custom_target(cnProc_gen_avx2_files DEPENDS ${cnProc_headers})
add_custom_command(
# TARGET cnProc_gen_128 POST_BUILD
OUTPUT ${cnProc128_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory cnProc128
COMMAND cnProc_gen_128 .
DEPENDS cnProc_gen_128
COMMENT "Generating LDPC cnProc header files for 128-bit SIMD"
)
add_custom_target(cnProc_gen_128_files DEPENDS ${cnProc128_headers})
add_library(cnProc_gen_avx2_HEADERS INTERFACE)
target_include_directories(cnProc_gen_avx2_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(cnProc_gen_avx2_HEADERS cnProc_gen_avx2_files)
add_library(cnProc_gen_128_HEADERS INTERFACE)
target_include_directories(cnProc_gen_128_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(cnProc_gen_128_HEADERS cnProc_gen_128_files)

View File

@@ -1,770 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
#ifdef __aarch64__
#define AVOID_SIGN 1
#endif
#define DROP_MAXLLR 1
void nrLDPC_cnProc_BG1_generator_128(const char* dir, int R)
{
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[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/cnProc128/nrLDPC_cnProc_BG1_R%s_128.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_cnProc_BG1_R%s_128(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n",ratestr[R]);
const uint8_t* lut_numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG1;
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); fclose(fd);abort();}
//simde__m128i* p_cnProcBuf;
//simde__m128i* p_cnProcBufRes;
// Number of CNs in Groups
//uint32_t M;
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 16 Byte
uint32_t bitOffsetInGroup;
//simde__m128i ymm0, min, sgn;
//simde__m128i* p_cnProcBufResBit;
// const simde__m128i* p_ones = (simde__m128i*) ones256_epi8;
// const simde__m128i* p_maxLLR = (simde__m128i*) maxLLR256_epi8;
// 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}};
// =====================================================================
// Process group with 3 BNs
fprintf(fd,"//Process group with 3 BNs\n");
// 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}};
#ifndef DROP_MAXLLR
fprintf(fd," simde__m128i ymm0, min, sgn,ones,maxLLR;\n");
#else
fprintf(fd," simde__m128i ymm0, min, sgn,ones;\n");
#endif
fprintf(fd," ones = simde_mm_set1_epi8((int8_t)1);\n");
fprintf(fd," uint32_t M;\n");
if (lut_numCnInCnGroups[0] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[0] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 3
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[0]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[0]];
// Loop over every BN
for (j=0; j<3; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>4)+lut_idxCnProcG3[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// 16 CNs of second BN
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>4)+lut_idxCnProcG3[j][1]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[0]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd,"//Process group with 4 BNs\n");
// Offset is 5*384/32 = 60
const uint8_t lut_idxCnProcG4[4][3] = {{60,120,180}, {0,120,180}, {0,60,180}, {0,60,120}};
if (lut_numCnInCnGroups[1] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[1] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<4; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>4)+lut_idxCnProcG4[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<3; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>4)+lut_idxCnProcG4[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[1]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd,"//Process group with 5 BNs\n");
// Offset is 18*384/32 = 216
const uint16_t lut_idxCnProcG5[5][4] = {{216,432,648,864}, {0,432,648,864},
{0,216,648,864}, {0,216,432,864}, {0,216,432,648}};
if (lut_numCnInCnGroups[2] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[2] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<5; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>4)+lut_idxCnProcG5[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<4; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>4)+lut_idxCnProcG5[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[2]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd,"//Process group with 6 BNs\n");
// Offset is 8*384/32 = 96
const uint16_t lut_idxCnProcG6[6][5] = {{96,192,288,384,480}, {0,192,288,384,480},
{0,96,288,384,480}, {0,96,192,384,480},
{0,96,192,288,480}, {0,96,192,288,384}};
if (lut_numCnInCnGroups[3] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[3] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<6; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>4)+lut_idxCnProcG6[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<5; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>4)+lut_idxCnProcG6[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[3]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 7 BNs
fprintf(fd,"//Process group with 7 BNs\n");
// Offset is 5*384/32 = 60
const uint16_t lut_idxCnProcG7[7][6] = {{60,120,180,240,300,360}, {0,120,180,240,300,360},
{0,60,180,240,300,360}, {0,60,120,240,300,360},
{0,60,120,180,300,360}, {0,60,120,180,240,360},
{0,60,120,180,240,300}};
if (lut_numCnInCnGroups[4] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[4] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<7; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>4)+lut_idxCnProcG7[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<6; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>4)+lut_idxCnProcG7[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[4]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd,"//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24,48,72,96,120,144,168}, {0,48,72,96,120,144,168},
{0,24,72,96,120,144,168}, {0,24,48,96,120,144,168},
{0,24,48,72,120,144,168}, {0,24,48,72,96,144,168},
{0,24,48,72,96,120,168}, {0,24,48,72,96,120,144}};
if (lut_numCnInCnGroups[5] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[5] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<8; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>4)+lut_idxCnProcG8[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<7; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>4)+lut_idxCnProcG8[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[5]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 9 BNs
fprintf(fd,"//Process group with 9 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG9[9][8] = {{24,48,72,96,120,144,168,192}, {0,48,72,96,120,144,168,192},
{0,24,72,96,120,144,168,192}, {0,24,48,96,120,144,168,192},
{0,24,48,72,120,144,168,192}, {0,24,48,72,96,144,168,192},
{0,24,48,72,96,120,168,192}, {0,24,48,72,96,120,144,192},
{0,24,48,72,96,120,144,168}};
if (lut_numCnInCnGroups[6] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[6] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 9
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<9; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>4)+lut_idxCnProcG9[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<8; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>4)+lut_idxCnProcG9[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[6]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd,"//Process group with 10 BNs\n");
// Offset is 1*384/32 = 12
const uint8_t lut_idxCnProcG10[10][9] = {{12,24,36,48,60,72,84,96,108}, {0,24,36,48,60,72,84,96,108},
{0,12,36,48,60,72,84,96,108}, {0,12,24,48,60,72,84,96,108},
{0,12,24,36,60,72,84,96,108}, {0,12,24,36,48,72,84,96,108},
{0,12,24,36,48,60,84,96,108}, {0,12,24,36,48,60,72,96,108},
{0,12,24,36,48,60,72,84,108}, {0,12,24,36,48,60,72,84,96}};
if (lut_numCnInCnGroups[7] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, " M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[7] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 10
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<10; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>4)+lut_idxCnProcG10[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<9; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>4)+lut_idxCnProcG10[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[7]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 19 BNs
fprintf(fd,"//Process group with 19 BNs\n");
// Offset is 4*384/32 = 12
const uint16_t lut_idxCnProcG19[19][18] = {{48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816}};
if (lut_numCnInCnGroups[8] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 16
fprintf(fd, " M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[8] );
// Set the offset to each bit within a group in terms of 16 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>4;
// Set pointers to start of group 19
//p_cnProcBuf = (simde__m128i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m128i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<19; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>4)+lut_idxCnProcG19[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(ones, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
#endif
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<18; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>4)+lut_idxCnProcG19[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
#ifdef AVOID_SIGN
fprintf(fd," sgn = simde_mm_xor_si128(sgn, ymm0);\n");
#else
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
#endif
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[8]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_cnProc_BG1

View File

@@ -1,698 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
//#define AVOID_MM256_SIGN 1
//#define DROP_MAXLLR 1
void nrLDPC_cnProc_BG1_generator_AVX2(const char* dir, int R)
{
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[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/cnProc/nrLDPC_cnProc_BG1_R%s_AVX2.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_cnProc_BG1_R%s_AVX2(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n",ratestr[R]);
const uint8_t* lut_numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG1;
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); fclose(fd);abort();}
//simde__m256i* p_cnProcBuf;
//simde__m256i* p_cnProcBufRes;
// Number of CNs in Groups
//uint32_t M;
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 32 Byte
uint32_t bitOffsetInGroup;
//simde__m256i ymm0, min, sgn;
//simde__m256i* p_cnProcBufResBit;
// const simde__m256i* p_ones = (simde__m256i*) ones256_epi8;
// const simde__m256i* p_maxLLR = (simde__m256i*) maxLLR256_epi8;
// 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}};
// =====================================================================
// Process group with 3 BNs
fprintf(fd,"//Process group with 3 BNs\n");
// 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}};
#ifndef DROP_MAXLLR
fprintf(fd," simde__m256i ymm0, min, sgn,ones,maxLLR;\n");
#else
fprintf(fd," simde__m256i ymm0, min, sgn,ones;\n");
#endif
fprintf(fd," ones = simde_mm256_set1_epi8((int8_t)1);\n");
#ifndef DROP_MAXLLR
fprintf(fd," maxLLR = simde_mm256_set1_epi8((int8_t)127);\n");
#endif
fprintf(fd," uint32_t M;\n");
if (lut_numCnInCnGroups[0] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[0] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 3
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[0]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[0]];
// Loop over every BN
for (j=0; j<3; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// 32 CNs of second BN
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd,"//Process group with 4 BNs\n");
// Offset is 5*384/32 = 60
const uint8_t lut_idxCnProcG4[4][3] = {{60,120,180}, {0,120,180}, {0,60,180}, {0,60,120}};
if (lut_numCnInCnGroups[1] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[1] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<4; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<3; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[1]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd,"//Process group with 5 BNs\n");
// Offset is 18*384/32 = 216
const uint16_t lut_idxCnProcG5[5][4] = {{216,432,648,864}, {0,432,648,864},
{0,216,648,864}, {0,216,432,864}, {0,216,432,648}};
if (lut_numCnInCnGroups[2] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[2] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<5; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<4; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[2]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd,"//Process group with 6 BNs\n");
// Offset is 8*384/32 = 96
const uint16_t lut_idxCnProcG6[6][5] = {{96,192,288,384,480}, {0,192,288,384,480},
{0,96,288,384,480}, {0,96,192,384,480},
{0,96,192,288,480}, {0,96,192,288,384}};
if (lut_numCnInCnGroups[3] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[3] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<6; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<5; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[3]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 7 BNs
fprintf(fd,"//Process group with 7 BNs\n");
// Offset is 5*384/32 = 60
const uint16_t lut_idxCnProcG7[7][6] = {{60,120,180,240,300,360}, {0,120,180,240,300,360},
{0,60,180,240,300,360}, {0,60,120,240,300,360},
{0,60,120,180,300,360}, {0,60,120,180,240,360},
{0,60,120,180,240,300}};
if (lut_numCnInCnGroups[4] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[4] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<7; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG7[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<6; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG7[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[4]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd,"//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24,48,72,96,120,144,168}, {0,48,72,96,120,144,168},
{0,24,72,96,120,144,168}, {0,24,48,96,120,144,168},
{0,24,48,72,120,144,168}, {0,24,48,72,96,144,168},
{0,24,48,72,96,120,168}, {0,24,48,72,96,120,144}};
if (lut_numCnInCnGroups[5] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[5] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 4
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<8; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG8[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<7; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG8[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[5]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 9 BNs
fprintf(fd,"//Process group with 9 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG9[9][8] = {{24,48,72,96,120,144,168,192}, {0,48,72,96,120,144,168,192},
{0,24,72,96,120,144,168,192}, {0,24,48,96,120,144,168,192},
{0,24,48,72,120,144,168,192}, {0,24,48,72,96,144,168,192},
{0,24,48,72,96,120,168,192}, {0,24,48,72,96,120,144,192},
{0,24,48,72,96,120,144,168}};
if (lut_numCnInCnGroups[6] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[6] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 9
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<9; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>5)+lut_idxCnProcG9[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<8; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>5)+lut_idxCnProcG9[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[6]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd,"//Process group with 10 BNs\n");
// Offset is 1*384/32 = 12
const uint8_t lut_idxCnProcG10[10][9] = {{12,24,36,48,60,72,84,96,108}, {0,24,36,48,60,72,84,96,108},
{0,12,36,48,60,72,84,96,108}, {0,12,24,48,60,72,84,96,108},
{0,12,24,36,60,72,84,96,108}, {0,12,24,36,48,72,84,96,108},
{0,12,24,36,48,60,84,96,108}, {0,12,24,36,48,60,72,96,108},
{0,12,24,36,48,60,72,84,108}, {0,12,24,36,48,60,72,84,96}};
if (lut_numCnInCnGroups[7] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, " M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[7] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 10
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<10; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>5)+lut_idxCnProcG10[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<9; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>5)+lut_idxCnProcG10[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[7]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 19 BNs
fprintf(fd,"//Process group with 19 BNs\n");
// Offset is 4*384/32 = 12
const uint16_t lut_idxCnProcG19[19][18] = {{48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,288,336,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,384,432,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,480,528,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,576,624,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,672,720,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,768,816,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,864},
{0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816}};
if (lut_numCnInCnGroups[8] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, " M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[8] );
// Set the offset to each bit within a group in terms of 32 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>5;
// Set pointers to start of group 19
//p_cnProcBuf = (simde__m256i*) &cnProcBuf [lut_startAddrCnGroups[1]];
//p_cnProcBufRes = (simde__m256i*) &cnProcBufRes[lut_startAddrCnGroups[1]];
// Loop over every BN
for (j=0; j<19; j++)
{
// Set of results pointer to correct BN address
//p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>5)+lut_idxCnProcG19[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<18; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>5)+lut_idxCnProcG19[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
#ifndef DROP_MAXLLR
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
#endif
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[8]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_cnProc_BG1

View File

@@ -1,419 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
#include "../../nrLDPC_bnProc.h"
void nrLDPC_cnProc_BG2_generator_128(const char* dir, int R)
{
const char *ratestr[3]={"15","13","23"};
if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();}
// system("mkdir -p ldpc_gen_files/avx2");
char fname[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/cnProc128/nrLDPC_cnProc_BG2_R%s_128.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_cnProc_BG2_R%s_128(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n",ratestr[R]);
const uint8_t* lut_numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG2;
if (R==0) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R15;
else if (R==1) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R13;
else if (R==2) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R23;
else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();}
// Number of CNs in Groups
//uint32_t M;
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 32 byte
uint32_t bitOffsetInGroup;
// Offsets are in units of bitOffsetInGroup (1*384/32)
// const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}};
// =====================================================================
// Process group with 3 BNs
fprintf(fd,"//Process group with 3 BNs\n");
// 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
const uint8_t lut_idxCnProcG3[3][2] = {{72,144}, {0,144}, {0,72}};
fprintf(fd," simde__m128i ymm0, min, sgn,ones,maxLLR;\n");
fprintf(fd," ones = simde_mm_set1_epi8((char)1);\n");
fprintf(fd," maxLLR = simde_mm_set1_epi8((char)127);\n");
fprintf(fd," uint32_t M;\n");
if (lut_numCnInCnGroups[0] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[0] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<3; j++)
{
fprintf(fd," for (int i=0;i<M;i+=2) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>4)+lut_idxCnProcG3[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// 16 CNs of second BN
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>4)+lut_idxCnProcG3[j][1]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[0]>>4)+(j*bitOffsetInGroup));
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>4)+lut_idxCnProcG3[j][0]*2+1);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd,"//Process group with 4 BNs\n");
// Offset is 20*384/32 = 240
const uint16_t lut_idxCnProcG4[4][3] = {{240,480,720}, {0,480,720}, {0,240,720}, {0,240,480}};
if (lut_numCnInCnGroups[1] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[1] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[1]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<4; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>4)+lut_idxCnProcG4[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<3; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>4)+lut_idxCnProcG4[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[1]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd,"//Process group with 5 BNs\n");
// Offset is 9*384/32 = 108
const uint16_t lut_idxCnProcG5[5][4] = {{108,216,324,432}, {0,216,324,432},
{0,108,324,432}, {0,108,216,432}, {0,108,216,324}};
if (lut_numCnInCnGroups[2] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[2] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[2]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<5; j++)
{
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>4)+lut_idxCnProcG5[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<4; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>4)+lut_idxCnProcG5[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[2]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd,"//Process group with 6 BNs\n");
// Offset is 3*384/32 = 36
const uint16_t lut_idxCnProcG6[6][5] = {{36,72,108,144,180}, {0,72,108,144,180},
{0,36,108,144,180}, {0,36,72,144,180},
{0,36,72,108,180}, {0,36,72,108,144}};
if (lut_numCnInCnGroups[3] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[3] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[3]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<6; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>4)+lut_idxCnProcG6[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<5; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>4)+lut_idxCnProcG6[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[3]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd,"//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24,48,72,96,120,144,168}, {0,48,72,96,120,144,168},
{0,24,72,96,120,144,168}, {0,24,48,96,120,144,168},
{0,24,48,72,120,144,168}, {0,24,48,72,96,144,168},
{0,24,48,72,96,120,168}, {0,24,48,72,96,120,144}};
if (lut_numCnInCnGroups[4] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[4] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[4]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<8; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>4)+lut_idxCnProcG8[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<7; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>4)+lut_idxCnProcG8[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[4]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd,"//Process group with 10 BNs\n");
const uint8_t lut_idxCnProcG10[10][9] = {{24,48,72,96,120,144,168,192,216}, {0,48,72,96,120,144,168,192,216},
{0,24,72,96,120,144,168,192,216}, {0,24,48,96,120,144,168,192,216},
{0,24,48,72,120,144,168,192,216}, {0,24,48,72,96,144,168,192,216},
{0,24,48,72,96,120,168,192,216}, {0,24,48,72,96,120,144,192,216},
{0,24,48,72,96,120,144,168,216}, {0,24,48,72,96,120,144,168,192}};
if (lut_numCnInCnGroups[5] > 0)
{
// Number of groups of 16 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 15)>>4;\n",lut_numCnInCnGroups[5] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[5]*NR_LDPC_ZMAX)>>4;
// Loop over every BN
for (j=0; j<10; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 16 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>4)+lut_idxCnProcG10[j][0]*2);
// sgn = simde_mm_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(ones, ymm0);\n");
// min = simde_mm_abs_epi8(ymm0);
fprintf(fd," min = simde_mm_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<9; k++)
{
fprintf(fd," ymm0 = ((simde__m128i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>4)+lut_idxCnProcG10[j][k]*2);
// min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));
fprintf(fd," min = simde_mm_min_epu8(min, simde_mm_abs_epi8(ymm0));\n");
// sgn = simde_mm_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m128i*)cnProcBufRes)[%d+i] = simde_mm_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[5]>>4)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_cnProc_BG2

View File

@@ -1,419 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "../../nrLDPCdecoder_defs.h"
#include "../../nrLDPC_types.h"
#include "../../nrLDPC_bnProc.h"
void nrLDPC_cnProc_BG2_generator_AVX2(const char* dir, int R)
{
const char *ratestr[3]={"15","13","23"};
if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();}
// system("mkdir -p ldpc_gen_files/avx2");
char fname[FILENAME_MAX+1];
snprintf(fname, sizeof(fname), "%s/cnProc/nrLDPC_cnProc_BG2_R%s_AVX2.h", dir, ratestr[R]);
FILE *fd=fopen(fname,"w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
fprintf(fd,"#include <stdint.h>\n");
fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
fprintf(fd,"static inline void nrLDPC_cnProc_BG2_R%s_AVX2(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n",ratestr[R]);
const uint8_t* lut_numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG2;
if (R==0) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R15;
else if (R==1) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R13;
else if (R==2) lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R23;
else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();}
// Number of CNs in Groups
//uint32_t M;
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 32 byte
uint32_t bitOffsetInGroup;
// Offsets are in units of bitOffsetInGroup (1*384/32)
// const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}};
// =====================================================================
// Process group with 3 BNs
fprintf(fd,"//Process group with 3 BNs\n");
// 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
const uint8_t lut_idxCnProcG3[3][2] = {{72,144}, {0,144}, {0,72}};
fprintf(fd," simde__m256i ymm0, min, sgn,ones,maxLLR;\n");
fprintf(fd," ones = simde_mm256_set1_epi8((char)1);\n");
fprintf(fd," maxLLR = simde_mm256_set1_epi8((char)127);\n");
fprintf(fd," uint32_t M;\n");
if (lut_numCnInCnGroups[0] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[0] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<3; j++)
{
fprintf(fd," for (int i=0;i<M;i+=2) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// 32 CNs of second BN
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup));
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]+1);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd,"//Process group with 4 BNs\n");
// Offset is 20*384/32 = 240
const uint16_t lut_idxCnProcG4[4][3] = {{240,480,720}, {0,480,720}, {0,240,720}, {0,240,480}};
if (lut_numCnInCnGroups[1] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[1] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[1]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<4; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<3; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[1]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd,"//Process group with 5 BNs\n");
// Offset is 9*384/32 = 108
const uint16_t lut_idxCnProcG5[5][4] = {{108,216,324,432}, {0,216,324,432},
{0,108,324,432}, {0,108,216,432}, {0,108,216,324}};
if (lut_numCnInCnGroups[2] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd," M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[2] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[2]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<5; j++)
{
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<4; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[2]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd,"//Process group with 6 BNs\n");
// Offset is 3*384/32 = 36
const uint16_t lut_idxCnProcG6[6][5] = {{36,72,108,144,180}, {0,72,108,144,180},
{0,36,108,144,180}, {0,36,72,144,180},
{0,36,72,108,180}, {0,36,72,108,144}};
if (lut_numCnInCnGroups[3] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[3] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[3]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<6; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<5; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[3]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd,"//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24,48,72,96,120,144,168}, {0,48,72,96,120,144,168},
{0,24,72,96,120,144,168}, {0,24,48,96,120,144,168},
{0,24,48,72,120,144,168}, {0,24,48,72,96,144,168},
{0,24,48,72,96,120,168}, {0,24,48,72,96,120,144}};
if (lut_numCnInCnGroups[4] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[4] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[4]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<8; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG8[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<7; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG8[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[4]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd,"//Process group with 10 BNs\n");
const uint8_t lut_idxCnProcG10[10][9] = {{24,48,72,96,120,144,168,192,216}, {0,48,72,96,120,144,168,192,216},
{0,24,72,96,120,144,168,192,216}, {0,24,48,96,120,144,168,192,216},
{0,24,48,72,120,144,168,192,216}, {0,24,48,72,96,144,168,192,216},
{0,24,48,72,96,120,168,192,216}, {0,24,48,72,96,120,144,192,216},
{0,24,48,72,96,120,144,168,216}, {0,24,48,72,96,120,144,168,192}};
if (lut_numCnInCnGroups[5] > 0)
{
// Number of groups of 32 CNs for parallel processing
// Ceil for values not divisible by 32
fprintf(fd, "M = (%d*Z + 31)>>5;\n",lut_numCnInCnGroups[5] );
// Set the offset to each bit within a group in terms of 32 byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[5]*NR_LDPC_ZMAX)>>5;
// Loop over every BN
for (j=0; j<10; j++)
{
// Loop over CNs
fprintf(fd," for (int i=0;i<M;i++) {\n");
// Abs and sign of 32 CNs (first BN)
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG10[j][0]);
// sgn = simde_mm256_sign_epi8(ones, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
// min = simde_mm256_abs_epi8(ymm0);
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
// Loop over BNs
for (k=1; k<9; k++)
{
fprintf(fd," ymm0 = ((simde__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG10[j][k]);
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
fprintf(fd," min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));\n");
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
fprintf(fd," sgn = simde_mm256_sign_epi8(sgn, ymm0);\n");
}
// Store result
// min = simde_mm256_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd," min = simde_mm256_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd," ((simde__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[5]>>5)+(j*bitOffsetInGroup));
fprintf(fd," }\n");
}
}
fprintf(fd,"}\n");
fclose(fd);
}//end of the function nrLDPC_cnProc_BG2

View File

@@ -1,33 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_cnProc_BG1_generator_AVX2(const char*, int);
void nrLDPC_cnProc_BG2_generator_AVX2(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++) {
nrLDPC_cnProc_BG1_generator_AVX2(dir, R[i]);
nrLDPC_cnProc_BG2_generator_AVX2(dir, R[i]);
}
return(0);
}

View File

@@ -1,33 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_cnProc_BG1_generator_128(const char*, int);
void nrLDPC_cnProc_BG2_generator_128(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++) {
nrLDPC_cnProc_BG1_generator_128(dir, R[i]);
nrLDPC_cnProc_BG2_generator_128(dir, R[i]);
}
return(0);
}

View File

@@ -1,35 +0,0 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
if (CROSS_COMPILE)
find_package(cnProc_gen_avx512)
else()
add_executable(cnProc_gen_avx512
cnProc_gen_BG1_avx512.c
cnProc_gen_BG2_avx512.c
main.c)
target_compile_options(cnProc_gen_avx512 PRIVATE -W -Wall )
export(TARGETS cnProc_gen_avx512 FILE
"${CMAKE_BINARY_DIR}/cnProc_gen_avx512Config.cmake")
endif()
set(cnProc_avx512_headers
cnProc_avx512/nrLDPC_cnProc_BG1_R13_AVX512.h
cnProc_avx512/nrLDPC_cnProc_BG1_R23_AVX512.h
cnProc_avx512/nrLDPC_cnProc_BG1_R89_AVX512.h
cnProc_avx512/nrLDPC_cnProc_BG2_R13_AVX512.h
cnProc_avx512/nrLDPC_cnProc_BG2_R15_AVX512.h
cnProc_avx512/nrLDPC_cnProc_BG2_R23_AVX512.h)
add_custom_command(
# TARGET cnProc_gen_avx512 POST_BUILD
OUTPUT ${cnProc_avx512_headers}
COMMAND ${CMAKE_COMMAND} -E make_directory cnProc_avx512
COMMAND cnProc_gen_avx512 .
DEPENDS cnProc_gen_avx512
COMMENT "Generating LDPC cnProc header files for AVX512"
)
add_custom_target(cnProc_gen_avx512_files DEPENDS ${cnProc_avx512_headers})
add_library(cnProc_gen_avx512_HEADERS INTERFACE)
target_include_directories(cnProc_gen_avx512_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(cnProc_gen_avx512_HEADERS cnProc_gen_avx512_files)

View File

@@ -1,597 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "../../nrLDPCdecoder_defs.h"
void nrLDPC_cnProc_BG1_generator_AVX512(const char *dir, int R)
{
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[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/cnProc_avx512/nrLDPC_cnProc_BG1_R%s_AVX512.h", dir, ratestr[R]);
FILE *fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
// fprintf(fd,"#include <stdint.h>\n");
// fprintf(fd,"#include \"PHY/sse_intrin.h\"\n");
// fprintf(fd, "#define conditional_negate(a,b,z) simde_mm512_mask_sub_epi8(a,simde_mm512_movepi8_mask(b),z,a)\n");
fprintf(fd, "static inline void nrLDPC_cnProc_BG1_R%s_AVX512(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n", ratestr[R]);
const uint8_t *lut_numCnInCnGroups;
const uint32_t *lut_startAddrCnGroups = lut_startAddrCnGroups_BG1;
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);
fclose(fd);
abort();
}
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 64 Byte
uint32_t bitOffsetInGroup;
fprintf(fd, " uint32_t M, i;\n");
fprintf(fd, " simde__m512i zmm0, min, sgn,zeros,maxLLR, ones;\n");
fprintf(fd, " zeros = simde_mm512_setzero_si512();\n");
fprintf(fd, " maxLLR = simde_mm512_set1_epi8((char)127);\n");
fprintf(fd, " ones = simde_mm512_set1_epi8((char)1);\n");
// =====================================================================
// Process group with 3 BNs
fprintf(fd, "//Process group with 3 BNs\n");
// 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)12
// Offsets are in units of bitOffsetInGroup (1*384/32)12
const uint8_t lut_idxCnProcG3[3][2] = {{12, 24}, {0, 24}, {0, 12}};
if (lut_numCnInCnGroups[0] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[0]*Z + 63)>>6;
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[0]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 3; j++) {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[0] >> 6) + lut_idxCnProcG3[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// for (k=1; k<2; k++)
//{
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[0] >> 6) + lut_idxCnProcG3[j][1] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
// }
// Store result
// min = simde_mm512_min_epu8(min, *maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm512_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[0] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd, "//Process group with 4 BNs\n");
// Offset is 5*384/32 = 30
const uint8_t lut_idxCnProcG4[4][3] = {{60, 120, 180}, {0, 120, 180}, {0, 60, 180}, {0, 60, 120}};
if (lut_numCnInCnGroups[1] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[1]*Z + 63)>>6;
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[1]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 4; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[1] >> 6) + lut_idxCnProcG4[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 3; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[1] >> 6) + lut_idxCnProcG4[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm512_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[1] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd, "//Process group with 5 BNs\n");
// Offset is 18*384/32 = 216
const uint16_t lut_idxCnProcG5[5][4] = {{216, 432, 648, 864}, {0, 432, 648, 864}, {0, 216, 648, 864}, {0, 216, 432, 864}, {0, 216, 432, 648}};
if (lut_numCnInCnGroups[2] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[2]*Z + 63)>>6;
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[2]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 5; j++) {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[2] >> 6) + lut_idxCnProcG5[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 4; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[2] >> 6) + lut_idxCnProcG5[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[2] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd, "//Process group with 6 BNs\n");
// Offset is 8*384/32 = 48
const uint16_t lut_idxCnProcG6[6][5] = {{96, 192, 288, 384, 480}, {0, 192, 288, 384, 480}, {0, 96, 288, 384, 480}, {0, 96, 192, 384, 480}, {0, 96, 192, 288, 480}, {0, 96, 192, 288, 384}};
if (lut_numCnInCnGroups[3] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[3]*Z + 63)>>6;
fprintf(fd, "M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[3]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 6; j++) {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[3] >> 6) + lut_idxCnProcG6[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 5; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[3] >> 6) + lut_idxCnProcG6[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[3] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 7 BNs
fprintf(fd, "//Process group with 7 BNs\n");
// Offset is 5*384/32 = 30
const uint16_t lut_idxCnProcG7[7][6] = {{60, 120, 180, 240, 300, 360},
{0, 120, 180, 240, 300, 360},
{0, 60, 180, 240, 300, 360},
{0, 60, 120, 240, 300, 360},
{0, 60, 120, 180, 300, 360},
{0, 60, 120, 180, 240, 360},
{0, 60, 120, 180, 240, 300}};
if (lut_numCnInCnGroups[4] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[4]*Z + 63)>>6;
fprintf(fd, "M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[4]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 7; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0= ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[4] >> 6) + lut_idxCnProcG7[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 6; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[4] >> 6) + lut_idxCnProcG7[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[4] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd, "//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24, 48, 72, 96, 120, 144, 168},
{0, 48, 72, 96, 120, 144, 168},
{0, 24, 72, 96, 120, 144, 168},
{0, 24, 48, 96, 120, 144, 168},
{0, 24, 48, 72, 120, 144, 168},
{0, 24, 48, 72, 96, 144, 168},
{0, 24, 48, 72, 96, 120, 168},
{0, 24, 48, 72, 96, 120, 144}};
if (lut_numCnInCnGroups[5] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[5]*Z + 63)>>6;
fprintf(fd, "M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[5]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 8; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[5] >> 6) + lut_idxCnProcG8[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 7; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[5] >> 6) + lut_idxCnProcG8[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[5] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 9 BNs
fprintf(fd, "//Process group with 9 BNs\n");
// Offset is 2*384/32 = 12
const uint8_t lut_idxCnProcG9[9][8] = {{24, 48, 72, 96, 120, 144, 168, 192},
{0, 48, 72, 96, 120, 144, 168, 192},
{0, 24, 72, 96, 120, 144, 168, 192},
{0, 24, 48, 96, 120, 144, 168, 192},
{0, 24, 48, 72, 120, 144, 168, 192},
{0, 24, 48, 72, 96, 144, 168, 192},
{0, 24, 48, 72, 96, 120, 168, 192},
{0, 24, 48, 72, 96, 120, 144, 192},
{0, 24, 48, 72, 96, 120, 144, 168}};
if (lut_numCnInCnGroups[6] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[5]*Z + 63)>>6;
fprintf(fd, "M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[6]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 9; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[6] >> 6) + lut_idxCnProcG9[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 8; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[6] >> 6) + lut_idxCnProcG9[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[6] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd, "//Process group with 10 BNs\n");
// Offset is 1*384/32 = 6
const uint8_t lut_idxCnProcG10[10][9] = {{12, 24, 36, 48, 60, 72, 84, 96, 108},
{0, 24, 36, 48, 60, 72, 84, 96, 108},
{0, 12, 36, 48, 60, 72, 84, 96, 108},
{0, 12, 24, 48, 60, 72, 84, 96, 108},
{0, 12, 24, 36, 60, 72, 84, 96, 108},
{0, 12, 24, 36, 48, 72, 84, 96, 108},
{0, 12, 24, 36, 48, 60, 84, 96, 108},
{0, 12, 24, 36, 48, 60, 72, 96, 108},
{0, 12, 24, 36, 48, 60, 72, 84, 108},
{0, 12, 24, 36, 48, 60, 72, 84, 96}};
if (lut_numCnInCnGroups[7] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[7]*Z + 63)>>6;
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[7]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 10; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[7] >> 6) + lut_idxCnProcG10[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 9; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[7] >> 6) + lut_idxCnProcG10[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min,sgn,zeros);\n",
(lut_startAddrCnGroups[7] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 19 BNs
fprintf(fd, "//Process group with 19 BNs\n");
// Offset is 4*384/32 = 24
const uint16_t lut_idxCnProcG19[19][18] = {{48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 432, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 480, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 528, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 576, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 624, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 672, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 720, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 768, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 816, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 864},
{0, 48, 96, 144, 192, 240, 288, 336, 384, 432, 480, 528, 576, 624, 672, 720, 768, 816}};
if (lut_numCnInCnGroups[8] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
// M = (lut_numCnInCnGroups[8]*Z + 63)>>6;
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[8]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 19; j++) {
// Loop over CNs
// for (i=0; i<M; i++,iprime++)
// {
fprintf(fd, " for (i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[8] >> 6) + lut_idxCnProcG19[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 18; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[8] >> 6) + lut_idxCnProcG19[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[8] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_cnProc_BG1

View File

@@ -1,380 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "../../nrLDPCdecoder_defs.h"
void nrLDPC_cnProc_BG2_generator_AVX512(const char *dir, int R)
{
const char *ratestr[3] = {"15", "13", "23"};
if (R < 0 || R > 2) {
printf("Illegal R %d\n", R);
abort();
}
// system("mkdir -p ../ldpc_gen_files");
char fname[FILENAME_MAX + 1];
snprintf(fname, sizeof(fname), "%s/cnProc_avx512/nrLDPC_cnProc_BG2_R%s_AVX512.h", dir, ratestr[R]);
FILE *fd = fopen(fname, "w");
if (fd == NULL) {
printf("Cannot create file %s\n", fname);
abort();
}
//fprintf(fd, "#define conditional_negate(a,b,z) simde_mm512_mask_sub_epi8(a,_mm512_movepi8_mask(b),z,a)\n");
fprintf(fd, "static inline void nrLDPC_cnProc_BG2_R%s_AVX512(int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z) {\n", ratestr[R]);
const uint8_t *lut_numCnInCnGroups;
const uint32_t *lut_startAddrCnGroups = lut_startAddrCnGroups_BG2;
if (R == 0)
lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R15;
else if (R == 1)
lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R13;
else if (R == 2)
lut_numCnInCnGroups = lut_numCnInCnGroups_BG2_R23;
else {
printf("aborting, illegal R %d\n", R);
fclose(fd);
abort();
}
// Number of CNs in Groups
// uint32_t M;
uint32_t j;
uint32_t k;
// Offset to each bit within a group in terms of 64 Byte
uint32_t bitOffsetInGroup;
fprintf(fd, " uint32_t M;\n");
fprintf(fd, " simde__m512i zmm0, min, sgn,zeros,ones,maxLLR;\n");
fprintf(fd, " zeros = simde_mm512_setzero_si512();\n");
fprintf(fd, " maxLLR = simde_mm512_set1_epi8((char)127);\n");
fprintf(fd, " ones = simde_mm512_set1_epi8((char)1);\n");
// =====================================================================
// Process group with 3 BNs
fprintf(fd, "//Process group with 3 BNs\n");
// 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
const uint8_t lut_idxCnProcG3[3][2] = {{72, 144}, {0, 144}, {0, 72}};
if (lut_numCnInCnGroups[0] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[0]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[0] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 3; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[0] >> 6) + lut_idxCnProcG3[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// for (k=1; k<2; k++)
//{
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[0] >> 6) + lut_idxCnProcG3[j][1] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(*p_ones, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
// }
// Store result
// min = simde_mm512_min_epu8(min, *maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm512_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[0] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 4 BNs
fprintf(fd, "//Process group with 4 BNs\n");
// Offset is 20*384/32 = 240
const uint16_t lut_idxCnProcG4[4][3] = {{240, 480, 720}, {0, 480, 720}, {0, 240, 720}, {0, 240, 480}};
if (lut_numCnInCnGroups[1] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[1]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[1] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 4; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[1] >> 6) + lut_idxCnProcG4[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 3; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[1] >> 6) + lut_idxCnProcG4[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(sgn, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
// *p_cnProcBufResBit = simde_mm512_sign_epi8(min, sgn);
// p_cnProcBufResBit++;
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[1] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 5 BNs
fprintf(fd, "//Process group with 5 BNs\n");
// Offset is 9*384/32 = 108
const uint16_t lut_idxCnProcG5[5][4] = {{108, 216, 324, 432}, {0, 216, 324, 432}, {0, 108, 324, 432}, {0, 108, 216, 432}, {0, 108, 216, 324}};
if (lut_numCnInCnGroups[2] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[2]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[2] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 5; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[2] >> 6) + lut_idxCnProcG5[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 4; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[2] >> 6) + lut_idxCnProcG5[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(sgn, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[2] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 6 BNs
fprintf(fd, "//Process group with 6 BNs\n");
// Offset is 3*384/32 = 36
const uint16_t lut_idxCnProcG6[6][5] = {{36, 72, 108, 144, 180}, {0, 72, 108, 144, 180}, {0, 36, 108, 144, 180}, {0, 36, 72, 144, 180}, {0, 36, 72, 108, 180}, {0, 36, 72, 108, 144}};
if (lut_numCnInCnGroups[3] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[3]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[3] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 6; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[3] >> 6) + lut_idxCnProcG6[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 5; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[3] >> 6) + lut_idxCnProcG6[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(sgn, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[3] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 8 BNs
fprintf(fd, "//Process group with 8 BNs\n");
// Offset is 2*384/32 = 24
const uint8_t lut_idxCnProcG8[8][7] = {{24, 48, 72, 96, 120, 144, 168},
{0, 48, 72, 96, 120, 144, 168},
{0, 24, 72, 96, 120, 144, 168},
{0, 24, 48, 96, 120, 144, 168},
{0, 24, 48, 72, 120, 144, 168},
{0, 24, 48, 72, 96, 144, 168},
{0, 24, 48, 72, 96, 120, 168},
{0, 24, 48, 72, 96, 120, 144}};
if (lut_numCnInCnGroups[4] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[4]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[4] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 8; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[4] >> 6) + lut_idxCnProcG8[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 7; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[4] >> 6) + lut_idxCnProcG8[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(sgn, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min, sgn,zeros);\n",
(lut_startAddrCnGroups[4] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
// =====================================================================
// Process group with 10 BNs
fprintf(fd, "//Process group with 10 BNs\n");
const uint8_t lut_idxCnProcG10[10][9] = {{24, 48, 72, 96, 120, 144, 168, 192, 216},
{0, 48, 72, 96, 120, 144, 168, 192, 216},
{0, 24, 72, 96, 120, 144, 168, 192, 216},
{0, 24, 48, 96, 120, 144, 168, 192, 216},
{0, 24, 48, 72, 120, 144, 168, 192, 216},
{0, 24, 48, 72, 96, 144, 168, 192, 216},
{0, 24, 48, 72, 96, 120, 168, 192, 216},
{0, 24, 48, 72, 96, 120, 144, 192, 216},
{0, 24, 48, 72, 96, 120, 144, 168, 216},
{0, 24, 48, 72, 96, 120, 144, 168, 192}};
if (lut_numCnInCnGroups[5] > 0) {
// Number of groups of 64 CNs for parallel processing
// Ceil for values not divisible by 64
fprintf(fd, " M = (%d*Z + 63)>>6;\n", lut_numCnInCnGroups[5]);
// Set the offset to each bit within a group in terms of 64 Byte
bitOffsetInGroup = (lut_numCnInCnGroups_BG2_R15[5] * NR_LDPC_ZMAX) >> 6;
// Loop over every BN
for (j = 0; j < 10; j++) {
fprintf(fd, " for (int i=0;i<M;i++) {\n");
// Abs and sign of 64 CNs (first BN)
// zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[5] >> 6) + lut_idxCnProcG10[j][0] / 2);
fprintf(fd, " sgn = simde_mm512_xor_si512(ones, zmm0);\n");
fprintf(fd, " min = simde_mm512_abs_epi8(zmm0);\n");
// Loop over BNs
for (k = 1; k < 9; k++) {
fprintf(fd,
" zmm0 = ((simde__m512i*)cnProcBuf)[%d+i];\n",
(lut_startAddrCnGroups[5] >> 6) + lut_idxCnProcG10[j][k] / 2);
// min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));
fprintf(fd, " min = simde_mm512_min_epu8(min, simde_mm512_abs_epi8(zmm0));\n");
// sgn = simde_mm512_sign_epi8(sgn, zmm0);
fprintf(fd, " sgn = simde_mm512_xor_si512(sgn, zmm0);\n");
}
// Store result
// min = simde_mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127
fprintf(fd, " min = simde_mm512_min_epu8(min, maxLLR);\n");
fprintf(fd,
" ((simde__m512i*)cnProcBufRes)[%d+i] = conditional_negate(min,sgn,zeros);\n",
(lut_startAddrCnGroups[5] >> 6) + (j * bitOffsetInGroup));
fprintf(fd, " }\n");
}
}
fprintf(fd, "}\n");
fclose(fd);
} // end of the function nrLDPC_cnProc_BG2

View File

@@ -1,33 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_cnProc_BG1_generator_AVX512(const char *, int);
void nrLDPC_cnProc_BG2_generator_AVX512(const char *, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++){
nrLDPC_cnProc_BG1_generator_AVX512(dir, R[i]);
nrLDPC_cnProc_BG2_generator_AVX512(dir, R[i]);
}
return(0);
}

View File

@@ -1,146 +0,0 @@
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
/*!
* \brief Defines the debugging functions
*/
#ifndef __NR_LDPC_DEBUG__H__
#define __NR_LDPC_DEBUG__H__
#include <stdio.h>
/**
Enum with possible LDPC data buffers
*/
typedef enum nrLDPC_buffers {
nrLDPC_buffers_LLR_PROC, /**< LLR processing buffer */
nrLDPC_buffers_CN_PROC, /**< CN processing buffer */
nrLDPC_buffers_CN_PROC_RES, /**< CN processing results buffer */
nrLDPC_buffers_BN_PROC, /**< BN processing buffer */
nrLDPC_buffers_BN_PROC_RES, /**< BN processing results buffer */
nrLDPC_buffers_LLR_RES /**< LLR results buffer */
} e_nrLDPC_buffers;
/**
\brief Writes N data samples to a file
\param fileName Name of the file
\param p_data Pointer to the data
\param N Number of values to write
*/
static inline void nrLDPC_writeFile(const char* fileName, int8_t* p_data, const uint32_t N)
{
FILE *f;
uint32_t i;
f = fopen(fileName, "a");
// Newline indicating new data
fprintf(f, "\n");
for (i=0; i < N; i++)
{
fprintf(f, "%d, ", p_data[i]);
}
fclose(f);
}
/**
\brief Creates empty new file
\param fileName Name of the file
*/
static inline void nrLDPC_initFile(const char* fileName)
{
FILE *f;
f = fopen(fileName, "w");
fprintf(f, " ");
fclose(f);
}
/**
\brief Writes data of predefined buffers to file
\param buffer Enum of buffer name to write
*/
static inline void nrLDPC_debug_writeBuffer2File(e_nrLDPC_buffers buffer, int8_t* p_buffer)
{
switch (buffer)
{
case nrLDPC_buffers_LLR_PROC:
{
nrLDPC_writeFile("llrProcBuf.txt", p_buffer, NR_LDPC_MAX_NUM_LLR);
break;
}
case nrLDPC_buffers_CN_PROC:
{
nrLDPC_writeFile("cnProcBuf.txt", p_buffer, NR_LDPC_SIZE_CN_PROC_BUF);
break;
}
case nrLDPC_buffers_CN_PROC_RES:
{
nrLDPC_writeFile("cnProcBufRes.txt", p_buffer, NR_LDPC_SIZE_CN_PROC_BUF);
break;
}
case nrLDPC_buffers_BN_PROC:
{
nrLDPC_writeFile("bnProcBuf.txt", p_buffer, NR_LDPC_SIZE_BN_PROC_BUF);
break;
}
case nrLDPC_buffers_BN_PROC_RES:
{
nrLDPC_writeFile("bnProcBufRes.txt", p_buffer, NR_LDPC_SIZE_BN_PROC_BUF);
break;
}
case nrLDPC_buffers_LLR_RES:
{
nrLDPC_writeFile("llrRes.txt", p_buffer, NR_LDPC_MAX_NUM_LLR);
break;
}
}
}
/**
\brief Initializes file for writing a buffer
\param buffer Enum of buffer name to write
*/
static inline void nrLDPC_debug_initBuffer2File(e_nrLDPC_buffers buffer)
{
switch (buffer)
{
case nrLDPC_buffers_LLR_PROC:
{
nrLDPC_initFile("llrProcBuf.txt");
break;
}
case nrLDPC_buffers_CN_PROC:
{
nrLDPC_initFile("cnProcBuf.txt");
break;
}
case nrLDPC_buffers_CN_PROC_RES:
{
nrLDPC_initFile("cnProcBufRes.txt");
break;
}
case nrLDPC_buffers_BN_PROC:
{
nrLDPC_initFile("bnProcBuf.txt");
break;
}
case nrLDPC_buffers_BN_PROC_RES:
{
nrLDPC_initFile("bnProcBufRes.txt");
break;
}
case nrLDPC_buffers_LLR_RES:
{
nrLDPC_initFile("llrRes.txt");
break;
}
}
}
#endif

View File

@@ -1,12 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: LicenseRef-CSSL-1.0
echo "to build the LDPC decoder headers: go to the build directory, and type"
echo "make/ninja ldpc_generators"
echo
echo "assuming your build directory is ran_build/build, I trigger building for"
echo "you now. The generated headers will be in ran_build/build/ldpc/generator_*/"
echo
cd $OPENAIR_HOME/cmake_targets/ran_build/build
make ldpc_generators || ninja ldpc_generators