Commit 0234a5c2 authored by Francesco Mani's avatar Francesco Mani

conflicts resolved after merging with nr-polar-encoder-optimizations

parents 7405eec0 f2d5cfae
...@@ -963,7 +963,7 @@ set(UTIL_SRC ...@@ -963,7 +963,7 @@ set(UTIL_SRC
${OPENAIR_DIR}/common/utils/LOG/log.c ${OPENAIR_DIR}/common/utils/LOG/log.c
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c # ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c ${OPENAIR2_DIR}/UTIL/MATH/oml.c
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c # ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
...@@ -1652,8 +1652,9 @@ set ( NR_LTE_UE_REUSE_SRC ...@@ -1652,8 +1652,9 @@ set ( NR_LTE_UE_REUSE_SRC
${OPENAIR1_DIR}/PHY/CODING/viterbi.c ${OPENAIR1_DIR}/PHY/CODING/viterbi.c
#${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich_common.c #${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich_common.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
#${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c # ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
# ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
...@@ -2561,13 +2562,13 @@ add_executable(ldpctest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c) ...@@ -2561,13 +2562,13 @@ add_executable(ldpctest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c)
target_link_libraries(ldpctest SIMU PHY PHY_NR m ${ATLAS_LIBRARIES}) target_link_libraries(ldpctest SIMU PHY PHY_NR m ${ATLAS_LIBRARIES})
add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c ${T_SOURCE}) add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c ${T_SOURCE})
target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU PHY PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl)
add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c ${T_SOURCE}) add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c ${T_SOURCE})
target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl)
add_executable(nr_dlsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c ${T_SOURCE}) add_executable(nr_dlsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c ${T_SOURCE})
target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl)
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
......
...@@ -1035,14 +1035,16 @@ ...@@ -1035,14 +1035,16 @@
<testCase id="015103"> <testCase id="015103">
<class>execution</class> <class>execution</class>
<desc>polartest Test cases. (Test1: PBCH polar test)</desc> <desc>polartest Test cases. (Test1: PBCH polar test),
(Test2: DCI polar test)</desc>
<pre_compile_prog></pre_compile_prog> <pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args> <compile_prog_args> --phy_simulators -c </compile_prog_args>
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
<pre_exec_args></pre_exec_args> <pre_exec_args></pre_exec_args>
<main_exec> $OPENAIR_DIR/targets/bin/polartest.Rel15</main_exec> <main_exec> $OPENAIR_DIR/targets/bin/polartest.Rel15</main_exec>
<main_exec_args>-q -s-10 -f0</main_exec_args> <main_exec_args>-q -s-10 -f0
-q -s-10 -f0 -m1</main_exec_args>
<tags>polartest.test1</tags> <tags>polartest.test1</tags>
<search_expr_true>BLER= 0.000000</search_expr_true> <search_expr_true>BLER= 0.000000</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
...@@ -1051,16 +1053,24 @@ ...@@ -1051,16 +1053,24 @@
<testCase id="015104"> <testCase id="015104">
<class>execution</class> <class>execution</class>
<desc>nr_pbchsim Test cases. (Test1: PBCH-only), <desc>nr_pbchsim Test cases. (Test1: PBCH-only, 106 PRB),
(Test2: PBCH and synchronization)</desc> (Test2: PBCH and synchronization, 106PBR),
(Test3: PBCH-only, 217 PRB),
(Test4: PBCH and synchronization, 217 RPB),
(Test5: PBCH-only, 217 PRB),
(Test6: PBCH and synchronization, 217 PRB)</desc>
<pre_compile_prog></pre_compile_prog> <pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args> <compile_prog_args> --phy_simulators -c </compile_prog_args>
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
<pre_exec_args></pre_exec_args> <pre_exec_args></pre_exec_args>
<main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec> <main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
<main_exec_args>-s-11 -S-10 -n1000 <main_exec_args>-s-11 -S-10 -n1000 -R106
-s-11 -S-10 -n10 -I</main_exec_args> -s-11 -S-10 -n10 -I -R106
-s-11 -S-10 -n1000 -R217 -N10
-s-11 -S-10 -n10 -I -R217 -N10
-s-11 -S-10 -n1000 -R273 -N20
-s-11 -S-10 -n10 -I -R273 -N20</main_exec_args>
<tags>nr_pbchsim.test1 nr_pbchsim.test2</tags> <tags>nr_pbchsim.test1 nr_pbchsim.test2</tags>
<search_expr_true>PBCH test OK</search_expr_true> <search_expr_true>PBCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
......
...@@ -3,11 +3,11 @@ set(PACKAGE_NAME "unitary_tests_simulators") ...@@ -3,11 +3,11 @@ set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True) set(PHYSIM True)
set(RF_BOARD None) set(RF_BOARD None)
set(XFORMS True) set(XFORMS True)
set(ENABLE_ITTI False) set(ENABLE_ITTI True)
set(DEBUG_PHY False) set(DEBUG_PHY False)
set(MU_RECIEVER False) set(MU_RECIEVER False)
set(NAS_UE False) set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False) set(MESSAGE_CHART_GENERATOR False)
set(RRC_ASN1_VERSION "Rel14") set(RRC_ASN1_VERSION "Rel15")
set(T_TRACER True) set(T_TRACER True)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
...@@ -74,10 +74,10 @@ const char* eurecomVariablesNames[] = { ...@@ -74,10 +74,10 @@ const char* eurecomVariablesNames[] = {
"frame_number_TX1_RU", "frame_number_TX1_RU",
"frame_number_RX0_RU", "frame_number_RX0_RU",
"frame_number_RX1_RU", "frame_number_RX1_RU",
"subframe_number_TX0_RU", "tti_number_TX0_RU",
"subframe_number_TX1_RU", "tti_number_TX1_RU",
"subframe_number_RX0_RU", "tti_number_RX0_RU",
"subframe_number_RX1_RU", "tti_number_RX1_RU",
"runtime_TX_eNB", "runtime_TX_eNB",
"runtime_RX_eNB", "runtime_RX_eNB",
"frame_number_TX0_UE", "frame_number_TX0_UE",
...@@ -196,10 +196,10 @@ const char* eurecomVariablesNames[] = { ...@@ -196,10 +196,10 @@ const char* eurecomVariablesNames[] = {
"frame_number_TX1_gNB", "frame_number_TX1_gNB",
"frame_number_RX0_gNB", "frame_number_RX0_gNB",
"frame_number_RX1_gNB", "frame_number_RX1_gNB",
"subframe_number_TX0_gNB", "slot_number_TX0_gNB",
"subframe_number_TX1_gNB", "slot_number_TX1_gNB",
"subframe_number_RX0_gNB", "slot_number_RX0_gNB",
"subframe_number_RX1_gNB" "slot_number_RX1_gNB"
}; };
const char* eurecomFunctionsNames[] = { const char* eurecomFunctionsNames[] = {
......
...@@ -51,10 +51,10 @@ typedef enum { ...@@ -51,10 +51,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_RU, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_RU,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_RU, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_RU,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU, VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_RU, VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX1_RU,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX0_RU,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_RU, VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX1_RU,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,
...@@ -173,10 +173,10 @@ typedef enum { ...@@ -173,10 +173,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX1_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX1_GNB,
VCD_SIGNAL_DUMPER_VARIABLES_END VCD_SIGNAL_DUMPER_VARIABLES_END
} vcd_signal_dump_variables; } vcd_signal_dump_variables;
......
...@@ -1099,26 +1099,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_RX1_RU ...@@ -1099,26 +1099,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_RX1_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = frame_number_RX1_RU VCD_NAME = frame_number_RX1_RU
ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU ID = VCD_VARIABLE_TTI_NUMBER_TX0_RU
DESC = VCD variable SUBFRAME_NUMBER_TX0_RU DESC = VCD variable TTI_NUMBER_TX0_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_TX0_RU VCD_NAME = tti_number_TX0_RU
ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU ID = VCD_VARIABLE_TTI_NUMBER_TX1_RU
DESC = VCD variable SUBFRAME_NUMBER_TX1_RU DESC = VCD variable TTI_NUMBER_TX1_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_TX1_RU VCD_NAME = tti_number_TX1_RU
ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU ID = VCD_VARIABLE_TTI_NUMBER_RX0_RU
DESC = VCD variable SUBFRAME_NUMBER_RX0_RU DESC = VCD variable TTI_NUMBER_RX0_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_RX0_RU VCD_NAME = tti_number_RX0_RU
ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU ID = VCD_VARIABLE_TTI_NUMBER_RX1_RU
DESC = VCD variable SUBFRAME_NUMBER_RX1_RU DESC = VCD variable TTI_NUMBER_RX1_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_RX1_RU VCD_NAME = tti_number_RX1_RU
ID = VCD_VARIABLE_RUNTIME_TX_ENB ID = VCD_VARIABLE_RUNTIME_TX_ENB
DESC = VCD variable RUNTIME_TX_ENB DESC = VCD variable RUNTIME_TX_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
...@@ -1701,26 +1701,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_RX1_GNB ...@@ -1701,26 +1701,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_RX1_GNB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = frame_number_RX1_gNB VCD_NAME = frame_number_RX1_gNB
ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX0_GNB ID = VCD_VARIABLE_SLOT_NUMBER_TX0_GNB
DESC = VCD variable SUBFRAME_NUMBER_TX0_GNB DESC = VCD variable SLOT_NUMBER_TX0_GNB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_TX0_gNB VCD_NAME = slot_number_TX0_gNB
ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX1_GNB ID = VCD_VARIABLE_SLOT_NUMBER_TX1_GNB
DESC = VCD variable SUBFRAME_NUMBER_TX1_GNB DESC = VCD variable SLOT_NUMBER_TX1_GNB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_TX1_gNB VCD_NAME = slot_number_TX1_gNB
ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX0_GNB ID = VCD_VARIABLE_SLOT_NUMBER_RX0_GNB
DESC = VCD variable SUBFRAME_NUMBER_RX0_GNB DESC = VCD variable SLOT_NUMBER_RX0_GNB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_RX0_gNB VCD_NAME = slot_number_RX0_gNB
ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_GNB ID = VCD_VARIABLE_SLOT_NUMBER_RX1_GNB
DESC = VCD variable SUBFRAME_NUMBER_RX1_GNB DESC = VCD variable SLOT_NUMBER_RX1_GNB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = subframe_number_RX1_gNB VCD_NAME = slot_number_RX1_gNB
#functions #functions
......
...@@ -72,7 +72,7 @@ typedef struct ...@@ -72,7 +72,7 @@ typedef struct
// These TLVs are used by the VNF to configure the RF in the PNF // These TLVs are used by the VNF to configure the RF in the PNF
// nfapi_uint16_tlv_t max_transmit_power; // nfapi_uint16_tlv_t max_transmit_power;
nfapi_uint16_tlv_t earfcn; nfapi_uint16_tlv_t nrarfcn;
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands; // nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands; // nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
...@@ -95,7 +95,7 @@ typedef struct ...@@ -95,7 +95,7 @@ typedef struct
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x511F #define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x511F
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x5120 #define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x5120
#define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128 #define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128
#define NFAPI_NR_NFAPI_EARFCN_TAG 0x5129 #define NFAPI_NR_NFAPI_NRARFCN_TAG 0x5129
#define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130 #define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130
#define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131 #define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131
#define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132 #define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132
...@@ -149,8 +149,6 @@ typedef struct { ...@@ -149,8 +149,6 @@ typedef struct {
#define NFAPI_NR_SUBFRAME_CONFIG_NUMEROLOGY_INDEX_MU_TAG 0x5006 #define NFAPI_NR_SUBFRAME_CONFIG_NUMEROLOGY_INDEX_MU_TAG 0x5006
typedef struct { typedef struct {
nfapi_uint16_tlv_t tx_antenna_ports;
nfapi_uint16_tlv_t rx_antenna_ports;
nfapi_uint16_tlv_t dl_carrier_bandwidth; nfapi_uint16_tlv_t dl_carrier_bandwidth;
nfapi_uint16_tlv_t ul_carrier_bandwidth; nfapi_uint16_tlv_t ul_carrier_bandwidth;
nfapi_uint16_tlv_t dl_bwp_subcarrierspacing; nfapi_uint16_tlv_t dl_bwp_subcarrierspacing;
...@@ -161,18 +159,17 @@ typedef struct { ...@@ -161,18 +159,17 @@ typedef struct {
nfapi_uint16_tlv_t ul_absolutefrequencypointA; nfapi_uint16_tlv_t ul_absolutefrequencypointA;
nfapi_uint16_tlv_t dl_offsettocarrier; nfapi_uint16_tlv_t dl_offsettocarrier;
nfapi_uint16_tlv_t ul_offsettocarrier; nfapi_uint16_tlv_t ul_offsettocarrier;
nfapi_uint16_tlv_t dl_scs_subcarrierspacing; nfapi_uint16_tlv_t dl_subcarrierspacing;
nfapi_uint16_tlv_t ul_scs_subcarrierspacing; nfapi_uint16_tlv_t ul_subcarrierspacing;
nfapi_uint16_tlv_t dl_scs_specificcarrier_k0; nfapi_uint16_tlv_t dl_specificcarrier_k0;
nfapi_uint16_tlv_t ul_scs_specificcarrier_k0; nfapi_uint16_tlv_t ul_specificcarrier_k0;
nfapi_uint16_tlv_t NIA_subcarrierspacing; nfapi_uint16_tlv_t NIA_subcarrierspacing;
} nfapi_nr_rf_config_t; } nfapi_nr_rf_config_t;
#define NFAPI_NR_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG 0x500A #define NFAPI_NR_RF_CONFIG_DL_CARRIER_BANDWIDTH_TAG 0x500A
#define NFAPI_NR_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG 0x500B #define NFAPI_NR_RF_CONFIG_UL_CARRIER_BANDWIDTH_TAG 0x500B
#define NFAPI_NR_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG 0x500C #define NFAPI_NR_RF_CONFIG_DL_SUBCARRIERSPACING_TAG 0x500C
#define NFAPI_NR_RF_CONFIG_TX_ANTENNA_PORTS_TAG 0x500D #define NFAPI_NR_RF_CONFIG_UL_SUBCARRIERSPACING_TAG 0x500D
#define NFAPI_NR_RF_CONFIG_RX_ANTENNA_PORTS_TAG 0x500E
typedef struct { typedef struct {
nfapi_uint16_tlv_t physical_cell_id; nfapi_uint16_tlv_t physical_cell_id;
...@@ -511,6 +508,8 @@ typedef struct { ...@@ -511,6 +508,8 @@ typedef struct {
uint16_t rnti; uint16_t rnti;
uint8_t rnti_type; uint8_t rnti_type;
uint8_t dci_format; uint8_t dci_format;
/// Number of CRB in BWP that this DCI configures
uint16_t n_RB_BWP;
uint8_t config_type; uint8_t config_type;
uint8_t search_space_type; uint8_t search_space_type;
uint8_t common_search_space_type; uint8_t common_search_space_type;
......
...@@ -421,7 +421,6 @@ int test_ldpc(short No_iteration, ...@@ -421,7 +421,6 @@ int test_ldpc(short No_iteration,
stop_meas(time_decoder); stop_meas(time_decoder);
} }
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++) //for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]); // printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
...@@ -435,8 +434,6 @@ int test_ldpc(short No_iteration, ...@@ -435,8 +434,6 @@ int test_ldpc(short No_iteration,
///printf("test_input[0][%d]: %d \n",i,test_input[0][i]); ///printf("test_input[0][%d]: %d \n",i,test_input[0][i]);
if (estimated_output[j][i] != test_input[j][i]) if (estimated_output[j][i] != test_input[j][i])
{ {
//////printf("error pos %d (%d, %d)\n\n",i,estimated_output[i],test_input[0][i]); //////printf("error pos %d (%d, %d)\n\n",i,estimated_output[i],test_input[0][i]);
segment_bler = segment_bler + 1; segment_bler = segment_bler + 1;
break; break;
......
...@@ -20,11 +20,8 @@ int main(int argc, char *argv[]) { ...@@ -20,11 +20,8 @@ int main(int argc, char *argv[]) {
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) //Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
time_stats_t timeEncoder,timeDecoder; time_stats_t timeEncoder,timeDecoder;
time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
time_stats_t path_metric,sorting,update_LLR;
opp_enabled=1; opp_enabled=1;
int decoder_int16=0; int decoder_int16=0;
int generate_optim_code=0;
cpu_freq_GHz = get_cpu_freq_GHz(); cpu_freq_GHz = get_cpu_freq_GHz();
reset_meas(&timeEncoder); reset_meas(&timeEncoder);
reset_meas(&timeDecoder); reset_meas(&timeDecoder);
...@@ -37,7 +34,7 @@ int main(int argc, char *argv[]) { ...@@ -37,7 +34,7 @@ int main(int argc, char *argv[]) {
double SNR, SNR_lin; double SNR, SNR_lin;
int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks). int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks).
int8_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error. uint32_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error.
uint16_t testLength = 0, coderLength = 0, blockErrorCumulative=0, bitErrorCumulative=0; uint16_t testLength = 0, coderLength = 0, blockErrorCumulative=0, bitErrorCumulative=0;
double timeEncoderCumulative = 0, timeDecoderCumulative = 0; double timeEncoderCumulative = 0, timeDecoderCumulative = 0;
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0; uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0;
...@@ -73,21 +70,20 @@ int main(int argc, char *argv[]) { ...@@ -73,21 +70,20 @@ int main(int argc, char *argv[]) {
pathMetricAppr = (uint8_t) atoi(optarg); pathMetricAppr = (uint8_t) atoi(optarg);
break; break;
case 'q': case 'q':
decoder_int16=1; decoder_int16 = 1;
break; break;
case 'g': case 'g':
generate_optim_code=1; iterations = 1;
iterations=1; SNRstart = -6.0;
SNRstart=-6.0; SNRstop = -6.0;
SNRstop =-6.0; decoder_int16 = 1;
decoder_int16=1; break;
break;
case 'h': case 'h':
printf("./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr -q (use fixed point decoder)\n"); printf("./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr\n");
exit(-1); exit(-1);
default: default:
perror("[polartest.c] Problem at argument parsing with getopt"); perror("[polartest.c] Problem at argument parsing with getopt");
...@@ -95,13 +91,13 @@ int main(int argc, char *argv[]) { ...@@ -95,13 +91,13 @@ int main(int argc, char *argv[]) {
} }
if (polarMessageType == 0) { //PBCH if (polarMessageType == 0) { //PBCH
testLength = NR_POLAR_PBCH_PAYLOAD_BITS; testLength = 64;//NR_POLAR_PBCH_PAYLOAD_BITS;
coderLength = NR_POLAR_PBCH_E; coderLength = NR_POLAR_PBCH_E;
aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL;
} else if (polarMessageType == 1) { //DCI } else if (polarMessageType == 1) { //DCI
//testLength = nr_get_dci_size(params_rel15->dci_format, params_rel15->rnti_type, &fp->initial_bwp_dl, cfg); //testLength = nr_get_dci_size(params_rel15->dci_format, params_rel15->rnti_type, &fp->initial_bwp_dl, cfg);
testLength = 20; testLength = 41; //20;
coderLength = 108; //to be changed by aggregate level function. coderLength = 108*8; //to be changed by aggregate level function.
} else if (polarMessageType == -1) { //UCI } else if (polarMessageType == -1) { //UCI
//testLength = ; //testLength = ;
//coderLength = ; //coderLength = ;
...@@ -149,18 +145,18 @@ int main(int argc, char *argv[]) { ...@@ -149,18 +145,18 @@ int main(int argc, char *argv[]) {
uint8_t testArrayLength = ceil(testLength / 32.0); uint8_t testArrayLength = ceil(testLength / 32.0);
uint8_t coderArrayLength = ceil(coderLength / 32.0); uint8_t coderArrayLength = ceil(coderLength / 32.0);
uint32_t *testInput = malloc(sizeof(uint32_t) * testArrayLength); //generate randomly uint32_t testInput[testArrayLength]; //generate randomly
uint32_t *encoderOutput = malloc(sizeof(uint32_t) * coderArrayLength); uint32_t encoderOutput[coderArrayLength];
uint32_t *estimatedOutput = malloc(sizeof(uint32_t) * testArrayLength); //decoder output uint32_t estimatedOutput[testArrayLength]; //decoder output
memset(testInput,0,sizeof(uint32_t) * testArrayLength); memset(testInput,0,sizeof(uint32_t) * testArrayLength);
memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength); memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength);
memset(estimatedOutput,0,sizeof(uint32_t) * testArrayLength); memset(estimatedOutput,0,sizeof(uint32_t) * testArrayLength);
uint8_t *encoderOutputByte = malloc(sizeof(uint8_t) * coderLength); uint8_t encoderOutputByte[coderLength];
double *modulatedInput = malloc (sizeof(double) * coderLength); //channel input double modulatedInput[coderLength]; //channel input
double *channelOutput = malloc (sizeof(double) * coderLength); //add noise double channelOutput[coderLength]; //add noise
int16_t *channelOutput_int16;
if (decoder_int16 == 1) channelOutput_int16 = (int16_t*)malloc (sizeof(int16_t) * coderLength); int16_t channelOutput_int16[coderLength];
t_nrPolar_paramsPtr nrPolar_params = NULL, currentPtr = NULL; t_nrPolar_paramsPtr nrPolar_params = NULL, currentPtr = NULL;
nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level); nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level);
...@@ -211,6 +207,8 @@ int main(int argc, char *argv[]) { ...@@ -211,6 +207,8 @@ int main(int argc, char *argv[]) {
rnti); rnti);
printf("dci_estimation: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", printf("dci_estimation: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
dci_estimation[0], dci_estimation[1], dci_estimation[2], dci_estimation[3]); dci_estimation[0], dci_estimation[1], dci_estimation[2], dci_estimation[3]);
free(encoder_outputByte);
free(channel_output);
return 0; return 0;
#endif #endif
...@@ -270,7 +268,7 @@ int main(int argc, char *argv[]) { ...@@ -270,7 +268,7 @@ int main(int argc, char *argv[]) {
uint8_t nr_polar_A[32] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1}; uint8_t nr_polar_A[32] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1};
uint8_t nr_polar_crc[24]; uint8_t nr_polar_crc[24];
uint8_t **crc_generator_matrix = crc24c_generator_matrix(32); uint8_t **crc_generator_matrix = crc24c_generator_matrix(32);
nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(nr_polar_A, nr_matrix_multiplication_uint8_1D_uint8_2D(nr_polar_A,
crc_generator_matrix, crc_generator_matrix,
nr_polar_crc, nr_polar_crc,
32, 32,
...@@ -326,10 +324,18 @@ int main(int argc, char *argv[]) { ...@@ -326,10 +324,18 @@ int main(int argc, char *argv[]) {
for (int i=0; i<32; i++) for (int i=0; i<32; i++)
printf("%d\n",(testInput[0]>>i)&1);*/ printf("%d\n",(testInput[0]>>i)&1);*/
int len_mod64=currentPtr->payloadBits&63;
((uint64_t*)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<<len_mod64)-1);
start_meas(&timeEncoder); start_meas(&timeEncoder);
polar_encoder(testInput, encoderOutput, currentPtr); if (decoder_int16==0)
polar_encoder(testInput, encoderOutput, currentPtr);
else
polar_encoder_fast((uint64_t*)testInput, encoderOutput,0, currentPtr);
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr);
stop_meas(&timeEncoder); stop_meas(&timeEncoder);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]); /*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/ printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
...@@ -371,7 +377,7 @@ int main(int argc, char *argv[]) { ...@@ -371,7 +377,7 @@ int main(int argc, char *argv[]) {
aPrioriArray); aPrioriArray);
else else
decoderState = polar_decoder_int16(channelOutput_int16, decoderState = polar_decoder_int16(channelOutput_int16,
estimatedOutput, (uint64_t*)estimatedOutput,
currentPtr); currentPtr);
...@@ -381,17 +387,20 @@ int main(int argc, char *argv[]) { ...@@ -381,17 +387,20 @@ int main(int argc, char *argv[]) {
//calculate errors //calculate errors
if (decoderState==-1) { if (decoderState!=0) {
blockErrorState=-1; blockErrorState=-1;
nBitError=-1; nBitError=-1;
} else { } else {
for (int i = 0; i < testArrayLength; i++) { for (int j = 0; j < currentPtr->payloadBits; j++) {
for (int j = 0; j < (sizeof(testInput[0])*8); j++) { if (((estimatedOutput[0]>>j) & 1) != ((testInput[0]>>j) & 1)) nBitError++;
if (((estimatedOutput[i]>>j) & 1) != ((testInput[i]>>j) & 1)) nBitError++; // printf("bit %d: %d => %d\n",j,(testInput[0]>>j)&1,(estimatedOutput[0]>>j)&1);
} }
}
if (nBitError>0) blockErrorState=1; if (nBitError>0) {
blockErrorState=1;
// printf("Error: Input %x, Output %x\n",testInput[0],estimatedOutput[0]);
}
} }
//Iteration times are in microseconds. //Iteration times are in microseconds.
...@@ -417,7 +426,8 @@ int main(int argc, char *argv[]) { ...@@ -417,7 +426,8 @@ int main(int argc, char *argv[]) {
printf("[ListSize=%d, Appr=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", printf("[ListSize=%d, Appr=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n",
decoderListSize, pathMetricAppr, SNR, ((double)blockErrorCumulative/iterations), decoderListSize, pathMetricAppr, SNR, ((double)blockErrorCumulative/iterations),
((double)bitErrorCumulative / (iterations*testLength)), ((double)bitErrorCumulative / (iterations*testLength)),
(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0));
//(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations);
if (blockErrorCumulative==0 && bitErrorCumulative==0) if (blockErrorCumulative==0 && bitErrorCumulative==0)
break; break;
...@@ -430,14 +440,5 @@ int main(int argc, char *argv[]) { ...@@ -430,14 +440,5 @@ int main(int argc, char *argv[]) {
print_meas(&timeDecoder,"polar_decoder",NULL,NULL); print_meas(&timeDecoder,"polar_decoder",NULL,NULL);
fclose(logFile); fclose(logFile);
//Bit
free(testInput);
free(encoderOutput);
free(estimatedOutput);
//Byte
free(encoderOutputByte);
free(modulatedInput);
free(channelOutput);
return (0); return (0);
} }
...@@ -342,7 +342,7 @@ void ccodedab_init_inv(void); ...@@ -342,7 +342,7 @@ void ccodedab_init_inv(void);
/*!\fn void crcTableInit(void) /*!\fn void crcTableInit(void)
\brief This function initializes the different crc tables.*/ \brief This function initializes the different crc tables.*/
//void crcTableInit (void); void crcTableInit (void);
...@@ -387,6 +387,8 @@ unsigned int crc12 (unsigned char * inptr, int bitlen); ...@@ -387,6 +387,8 @@ unsigned int crc12 (unsigned char * inptr, int bitlen);
@param inPtr Pointer to input byte stream @param inPtr Pointer to input byte stream
@param bitlen length of inputs in bits*/ @param bitlen length of inputs in bits*/
unsigned int crc8 (unsigned char * inptr, int bitlen); unsigned int crc8 (unsigned char * inptr, int bitlen);
int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type);
/*!\fn void phy_viterbi_dot11_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n,int offset,int traceback) /*!\fn void phy_viterbi_dot11_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n,int offset,int traceback)
\brief This routine performs a SIMD optmized Viterbi decoder for the 802.11 64-state convolutional code. It can be \brief This routine performs a SIMD optmized Viterbi decoder for the 802.11 64-state convolutional code. It can be
...@@ -441,8 +443,6 @@ int32_t rate_matching_lte(uint32_t N_coded, ...@@ -441,8 +443,6 @@ int32_t rate_matching_lte(uint32_t N_coded,
uint8_t *inPtr, uint8_t *inPtr,
uint32_t off); uint32_t off);
void crcTableInit (void);
unsigned int crcbit (unsigned char * inputptr, int octetlen, unsigned int poly); unsigned int crcbit (unsigned char * inputptr, int octetlen, unsigned int poly);
int16_t reverseBits(int32_t ,int32_t); int16_t reverseBits(int32_t ,int32_t);
......
...@@ -58,8 +58,8 @@ The first bit is in the MSB of each byte ...@@ -58,8 +58,8 @@ The first bit is in the MSB of each byte
*********************************************************/ *********************************************************/
unsigned int crcbit (unsigned char * inputptr, unsigned int crcbit (unsigned char * inputptr,
int octetlen, int octetlen,
unsigned int poly) unsigned int poly)
{ {
unsigned int i, crc = 0, c; unsigned int i, crc = 0, c;
...@@ -170,14 +170,12 @@ unsigned int crc24c (unsigned char * inptr, ...@@ -170,14 +170,12 @@ unsigned int crc24c (unsigned char * inptr,
resbit = (bitlen % 8); resbit = (bitlen % 8);
while (octetlen-- > 0) { while (octetlen-- > 0) {
/*#ifdef DEBUG_CRC24C
printf("crc24c: in %x => crc %x (%x)\n",crc,*inptr,crc24cTable[(*inptr) ^ (crc >> 24)]);
#endif*/
crc = (crc << 8) ^ crc24cTable[(*inptr++) ^ (crc >> 24)]; crc = (crc << 8) ^ crc24cTable[(*inptr++) ^ (crc >> 24)];
} }
if (resbit > 0) if (resbit > 0) {
crc = (crc << resbit) ^ crc24cTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; crc = (crc << resbit) ^ crc24cTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
}
return crc; return crc;
} }
......
...@@ -201,7 +201,7 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho ...@@ -201,7 +201,7 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput) int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{ {
short Zc,Kb,nrows,ncols; short Zc,Kb=0,nrows=0,ncols=0;
int i,i1; int i,i1;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
...@@ -210,7 +210,6 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -210,7 +210,6 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int simd_size; int simd_size;
//determine number of bits in codeword
//determine number of bits in codeword //determine number of bits in codeword
//if (block_length>3840) //if (block_length>3840)
if (BG==1) if (BG==1)
...@@ -256,7 +255,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -256,7 +255,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
#endif #endif
if ((Zc&31) > 0) simd_size = 16; if ((Zc&31) > 0) simd_size = 16;
else simd_size = 32; else simd_size = 32;
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
...@@ -321,7 +320,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -321,7 +320,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput) int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{ {
short Zc,Kb,nrows,ncols; short Zc,Kb=0,nrows=0,ncols=0;
int i,i1,j; int i,i1,j;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
//Table of possible lifting sizes //Table of possible lifting sizes
...@@ -521,7 +520,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -521,7 +520,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput) int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{ {
short Zc,Kb,nrows,ncols; short Zc,Kb=0,nrows=0,ncols=0;
int i,i1,j; int i,i1,j;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
//Table of possible lifting sizes //Table of possible lifting sizes
......
...@@ -367,7 +367,13 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -367,7 +367,13 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
unsigned char d[68*384]; //coded output, unpacked, max size unsigned char d[68*384]; //coded output, unpacked, max size
unsigned char channel_temp,temp; unsigned char channel_temp,temp;
short *Gen_shift_values, *no_shift_values, *pointer_shift_values; short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
short Zc,Kb,nrows,ncols; short Zc;
//initialize for BG == 1
short Kb = 22;
short nrows = 46;//parity check bits
short ncols = 22;//info bits
int i,i1,i2,i3,i4,i5,temp_prime,var; int i,i1,i2,i3,i4,i5,temp_prime,var;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
//Table of possible lifting sizes //Table of possible lifting sizes
...@@ -438,6 +444,9 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -438,6 +444,9 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
no_shift_values=(short *) no_shift_values_BG2; no_shift_values=(short *) no_shift_values_BG2;
pointer_shift_values=(short *) pointer_shift_values_BG2; pointer_shift_values=(short *) pointer_shift_values_BG2;
} }
else {
AssertFatal(0,"BG %d is not supported yet\n",BG);
}
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc; no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*3); removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*3);
......
...@@ -34,18 +34,18 @@ ...@@ -34,18 +34,18 @@
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
//#define DEBUG_NEW_IMPL //#define DEBUG_NEW_IMPL 1
void updateLLR(double ***llr, void updateLLR(double ***llr,
uint8_t **llrU, uint8_t **llrU,
uint8_t ***bit, uint8_t ***bit,
uint8_t **bitU, uint8_t **bitU,
uint8_t listSize, uint8_t listSize,
uint16_t row, uint16_t row,
uint16_t col, uint16_t col,
uint16_t xlen, uint16_t xlen,
uint8_t ylen, uint8_t ylen,
uint8_t approximation) uint8_t approximation)
{ {
uint16_t offset = (xlen/(pow(2,(ylen-col-1)))); uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
for (uint8_t i=0; i<listSize; i++) { for (uint8_t i=0; i<listSize; i++) {
...@@ -219,8 +219,8 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) { ...@@ -219,8 +219,8 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) {
decoder_node_t *new_node = new_decoder_node(first_leaf_index,level); decoder_node_t *new_node = new_decoder_node(first_leaf_index,level);
#ifdef DEBUG_NEW_IMPL #ifdef DEBUG_NEW_IMPL
printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level); printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level);
pp->tree.num_nodes++;
#endif #endif
pp->tree.num_nodes++;
if (level==0) { if (level==0) {
#ifdef DEBUG_NEW_IMPL #ifdef DEBUG_NEW_IMPL
printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen"); printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen");
...@@ -233,16 +233,19 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) { ...@@ -233,16 +233,19 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) {
for (int i=0;i<Nv;i++) { for (int i=0;i<Nv;i++) {
if (pp->information_bit_pattern[i+first_leaf_index]>0) all_frozen_below=0; if (pp->information_bit_pattern[i+first_leaf_index]>0) all_frozen_below=0;
} }
if (all_frozen_below==0) new_node->left=add_nodes(level-1,first_leaf_index,pp); if (all_frozen_below==0) new_node->left=add_nodes(level-1,first_leaf_index,pp);
else { else {
#ifdef DEBUG_NEW_IMPL #ifdef DEBUG_NEW_IMPL
printf("aggregating frozen bits %d ... %d at level %d (%s)\n",first_leaf_index,first_leaf_index+Nv-1,level,((first_leaf_index/Nv)&1)==0?"left":"right"); printf("aggregating frozen bits %d ... %d at level %d (%s)\n",first_leaf_index,first_leaf_index+Nv-1,level,((first_leaf_index/Nv)&1)==0?"left":"right");
#endif #endif
new_node->leaf=1; new_node->leaf=1;
new_node->all_frozen=1; new_node->all_frozen=1;
} }
if (all_frozen_below==0) new_node->right=add_nodes(level-1,first_leaf_index+(Nv/2),pp); if (all_frozen_below==0) new_node->right=add_nodes(level-1,first_leaf_index+(Nv/2),pp);
#ifdef DEBUG_NEW_IMPL
printf("new_node (%d): first_leaf_index %d, left %p, right %p\n",Nv,first_leaf_index,new_node->left,new_node->right);
#endif
return(new_node); return(new_node);
} }
...@@ -251,7 +254,9 @@ void build_decoder_tree(t_nrPolar_params *pp) { ...@@ -251,7 +254,9 @@ void build_decoder_tree(t_nrPolar_params *pp) {
pp->tree.num_nodes=0; pp->tree.num_nodes=0;
pp->tree.root = add_nodes(pp->n,0,pp); pp->tree.root = add_nodes(pp->n,0,pp);
#ifdef DEBUG_NEW_IMPL
printf("root : left %p, right %p\n",pp->tree.root->left,pp->tree.root->right);
#endif
} }
#if defined(__arm__) || defined(__aarch64__) #if defined(__arm__) || defined(__aarch64__)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(uint8_t *matrix1, uint8_t **matrix2, void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1, uint8_t **matrix2,
uint8_t *output, uint16_t row, uint16_t col) { uint8_t *output, uint16_t row, uint16_t col) {
for (uint16_t i = 0; i < col; i++) { for (uint16_t i = 0; i < col; i++) {
...@@ -43,12 +43,12 @@ void nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(uint8_t *matrix1, uint8_t ** ...@@ -43,12 +43,12 @@ void nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(uint8_t *matrix1, uint8_t **
} }
} }
uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) { uint8_t ***nr_alloc_uint8_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) {
uint8_t ***output; uint8_t ***output;
int i, j; int i, j;
if ((output = malloc(xlen * sizeof(*output))) == NULL) { if ((output = malloc(xlen * sizeof(*output))) == NULL) {
perror("[nr_alloc_uint8_t_3D_array] Problem at 1D allocation"); perror("[nr_alloc_uint8_3D_array] Problem at 1D allocation");
return NULL; return NULL;
} }
for (i = 0; i < xlen; i++) for (i = 0; i < xlen; i++)
...@@ -57,8 +57,8 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen ...@@ -57,8 +57,8 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
for (i = 0; i < xlen; i++) for (i = 0; i < xlen; i++)
if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) { if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
perror("[nr_alloc_uint8_t_3D_array] Problem at 2D allocation"); perror("[nr_alloc_uint8_3D_array] Problem at 2D allocation");
nr_free_uint8_t_3D_array(output, xlen, ylen); nr_free_uint8_3D_array(output, xlen, ylen);
return NULL; return NULL;
} }
for (i = 0; i < xlen; i++) for (i = 0; i < xlen; i++)
...@@ -69,14 +69,39 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen ...@@ -69,14 +69,39 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
for (i = 0; i < xlen; i++) for (i = 0; i < xlen; i++)
for (j = 0; j < ylen; j++) for (j = 0; j < ylen; j++)
if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) { if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) {
perror("[nr_alloc_uint8_t_3D_array] Problem at 3D allocation"); perror("[nr_alloc_uint8_3D_array] Problem at 3D allocation");
nr_free_uint8_t_3D_array(output, xlen, ylen); nr_free_uint8_3D_array(output, xlen, ylen);
return NULL; return NULL;
} }
return output; return output;
} }
uint8_t **nr_alloc_uint8_2D_array(uint16_t xlen, uint16_t ylen) {
uint8_t **output;
int i, j;
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
perror("[nr_alloc_uint8_2D_array] Problem at 1D allocation");
return NULL;
}
for (i = 0; i < xlen; i++)
output[i] = NULL;
for (i = 0; i < xlen; i++)
if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
perror("[nr_alloc_uint8_2D_array] Problem at 2D allocation");
nr_free_uint8_2D_array(output, xlen);
return NULL;
}
for (i = 0; i < xlen; i++)
for (j = 0; j < ylen; j++)
output[i][j] = 0;
return output;
}
double ***nr_alloc_double_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) { double ***nr_alloc_double_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) {
double ***output; double ***output;
int i, j; int i, j;
...@@ -137,31 +162,6 @@ double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) { ...@@ -137,31 +162,6 @@ double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
return output; return output;
} }
uint8_t **nr_alloc_uint8_t_2D_array(uint16_t xlen, uint16_t ylen) {
uint8_t **output;
int i, j;
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
perror("[nr_alloc_uint8_t_2D_array] Problem at 1D allocation");
return NULL;
}
for (i = 0; i < xlen; i++)
output[i] = NULL;
for (i = 0; i < xlen; i++)
if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
perror("[nr_alloc_uint8_t_2D_array] Problem at 2D allocation");
nr_free_uint8_t_2D_array(output, xlen);
return NULL;
}
for (i = 0; i < xlen; i++)
for (j = 0; j < ylen; j++)
output[i][j] = 0;
return output;
}
void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) { void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
int i, j; int i, j;
...@@ -174,7 +174,16 @@ void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) { ...@@ -174,7 +174,16 @@ void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
free(input); free(input);
} }
void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) { void nr_free_double_2D_array(double **input, uint16_t xlen) {
int i;
for (i = 0; i < xlen; i++) {
free(input[i]);
}
free(input);
}
void nr_free_uint8_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
int i, j; int i, j;
for (i = 0; i < xlen; i++) { for (i = 0; i < xlen; i++) {
...@@ -186,20 +195,11 @@ void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) { ...@@ -186,20 +195,11 @@ void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
free(input); free(input);
} }
void nr_free_uint8_t_2D_array(uint8_t **input, uint16_t xlen) { void nr_free_uint8_2D_array(uint8_t **input, uint16_t xlen) {
for (int i = 0; i < xlen; i++) free(input[i]); for (int i = 0; i < xlen; i++) free(input[i]);
free(input); free(input);
} }
void nr_free_double_2D_array(double **input, uint16_t xlen) {
int i;
for (i = 0; i < xlen; i++) {
free(input[i]);
}
free(input);
}
// Modified Bubble Sort. // Modified Bubble Sort.
void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) { void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) {
int swaps; int swaps;
......
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void nr_polar_bit_insertion(uint8_t *input, void nr_polar_bit_insertion(uint8_t *input,
uint8_t *output, uint8_t *output,
uint16_t N, uint16_t N,
uint16_t K, uint16_t K,
int16_t *Q_I_N, int16_t *Q_I_N,
int16_t *Q_PC_N, int16_t *Q_PC_N,
uint8_t n_PC) uint8_t n_PC)
{ {
uint16_t k=0; uint16_t k=0;
uint8_t flag; uint8_t flag;
if (n_PC>0) { if (n_PC>0) {
/* /*
...@@ -325,7 +325,7 @@ void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp ...@@ -325,7 +325,7 @@ void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp
if ( (K/(double)E) <= (7.0/16) ) { //puncturing if ( (K/(double)E) <= (7.0/16) ) { //puncturing
for (int i=0; i<=N-1; i++) output[i]=0; for (int i=0; i<=N-1; i++) output[i]=0;
} else { //shortening } else { //shortening
for (int i=0; i<=N-1; i++) output[i]=INFINITY; for (int i=0; i<=N-1; i++) output[i]=32767;//instead of INFINITY, to prevent [-Woverflow]
} }
for (int i=0; i<=E-1; i++){ for (int i=0; i<=E-1; i++){
......
...@@ -36,20 +36,27 @@ ...@@ -36,20 +36,27 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/NR_TRANSPORT/nr_dci.h"
static int intcmp(const void *p1,const void *p2) {
return(*(int16_t*)p1 > *(int16_t*)p2);
}
void nr_polar_init(t_nrPolar_paramsPtr *polarParams, void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) uint8_t aggregation_level)
{ {
t_nrPolar_paramsPtr currentPtr = *polarParams; t_nrPolar_paramsPtr currentPtr = *polarParams;
uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level); uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level);
//Parse the list. If the node is already created, return without initialization. //Parse the list. If the node is already created, return without initialization.
while (currentPtr != NULL) { while (currentPtr != NULL) {
if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return; //printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength);
else currentPtr = currentPtr->nextPtr; if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return;
else currentPtr = currentPtr->nextPtr;
} }
// printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams);
//Else, initialize and add node to the end of the linked list. //Else, initialize and add node to the end of the linked list.
t_nrPolar_paramsPtr newPolarInitNode = malloc(sizeof(t_nrPolar_params)); t_nrPolar_paramsPtr newPolarInitNode = malloc(sizeof(t_nrPolar_params));
...@@ -57,6 +64,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -57,6 +64,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->idx = (messageType * messageLength * aggregation_prime); newPolarInitNode->idx = (messageType * messageLength * aggregation_prime);
newPolarInitNode->nextPtr = NULL; newPolarInitNode->nextPtr = NULL;
//printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
if (messageType == 0) { //PBCH if (messageType == 0) { //PBCH
newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX; newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
...@@ -70,6 +78,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -70,6 +78,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P
//printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength);
} else if (messageType == 1) { //DCI } else if (messageType == 1) { //DCI
newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
...@@ -82,6 +91,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -82,6 +91,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->encoderLength = aggregation_level*108; newPolarInitNode->encoderLength = aggregation_level*108;
newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
//printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level);
} else if (messageType == -1) { //UCI } else if (messageType == -1) { //UCI
} else { } else {
...@@ -115,6 +125,10 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -115,6 +125,10 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->i_il, newPolarInitNode->i_il,
newPolarInitNode->interleaving_pattern); newPolarInitNode->interleaving_pattern);
newPolarInitNode->deinterleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
for (int i=0;i<newPolarInitNode->K;i++)
newPolarInitNode->deinterleaving_pattern[newPolarInitNode->interleaving_pattern[i]] = i;
newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength); newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
uint16_t *J = malloc(sizeof(uint16_t) * newPolarInitNode->N); uint16_t *J = malloc(sizeof(uint16_t) * newPolarInitNode->N);
nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern, nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
...@@ -139,7 +153,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -139,7 +153,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
newPolarInitNode->N, newPolarInitNode->N,
newPolarInitNode->encoderLength, newPolarInitNode->encoderLength,
newPolarInitNode->n_pc); newPolarInitNode->n_pc);
// sort the Q_I_N array in ascending order (first K positions)
qsort((void*)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp);
newPolarInitNode->channel_interleaver_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength); newPolarInitNode->channel_interleaver_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern, nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
newPolarInitNode->i_bil, newPolarInitNode->i_bil,
...@@ -148,6 +164,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -148,6 +164,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
free(J); free(J);
build_decoder_tree(newPolarInitNode); build_decoder_tree(newPolarInitNode);
build_polar_tables(newPolarInitNode);
init_polar_deinterleaver_table(newPolarInitNode);
//printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes); //printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
} else { } else {
...@@ -159,13 +178,18 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, ...@@ -159,13 +178,18 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
if (currentPtr == NULL) if (currentPtr == NULL)
{ {
*polarParams = newPolarInitNode; *polarParams = newPolarInitNode;
//printf("Creating first polarParams entry index %d, %p\n",newPolarInitNode->idx,*polarParams);
return; return;
} }
//Else, add node to the end of the linked list. //Else, add node to the end of the linked list.
while (currentPtr->nextPtr != NULL) { while (currentPtr->nextPtr != NULL) {
currentPtr = currentPtr->nextPtr; currentPtr = currentPtr->nextPtr;
} }
currentPtr->nextPtr= newPolarInitNode; currentPtr->nextPtr= newPolarInitNode;
printf("Adding new polarParams entry to list index %d,%p\n",
newPolarInitNode->idx,
currentPtr->nextPtr);
return; return;
} }
......
...@@ -78,7 +78,7 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -78,7 +78,7 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
{ {
uint8_t Cprime; uint8_t Cprime;
uint32_t Ncb,E,ind,k,Nref,N; uint32_t Ncb,E,ind,k,Nref,N;
uint8_t *e2; //uint8_t *e2;
AssertFatal(Nl>0,"Nl is 0\n"); AssertFatal(Nl>0,"Nl is 0\n");
AssertFatal(Qm>0,"Qm is 0\n"); AssertFatal(Qm>0,"Qm is 0\n");
...@@ -110,7 +110,7 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -110,7 +110,7 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
printf("nr_rate_matching: E %d, k0 %d Cprime %d modcprime %d\n",E,ind, Cprime,((G/(Nl*Qm))%Cprime)); printf("nr_rate_matching: E %d, k0 %d Cprime %d modcprime %d\n",E,ind, Cprime,((G/(Nl*Qm))%Cprime));
#endif #endif
e2 = e; //e2 = e;
k=0; k=0;
...@@ -120,7 +120,8 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -120,7 +120,8 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
if (w[ind] != NR_NULL) e2[k++]=w[ind]; //if (w[ind] != NR_NULL) e2[k++]=w[ind];
if (w[ind] != NR_NULL) e[k++]=w[ind];
} }
while(k<E) { while(k<E) {
...@@ -130,7 +131,8 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -130,7 +131,8 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
if (w[ind] != NR_NULL) e2[k++]=w[ind]; //if (w[ind] != NR_NULL) e2[k++]=w[ind];
if (w[ind] != NR_NULL) e[k++]=w[ind];
} }
} }
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
#include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/LTE_REFSIG/lte_refsig.h"
#include "SCHED_NR/fapi_nr_l1.h" #include "SCHED_NR/fapi_nr_l1.h"
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn); extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn);
extern int32_t get_uldl_offset(int eutra_bandP); extern int32_t get_uldl_offset(int nr_bandP);
int l1_north_init_gNB() { int l1_north_init_gNB() {
...@@ -125,10 +125,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -125,10 +125,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
// PBCH DMRS gold sequences generation // PBCH DMRS gold sequences generation
nr_init_pbch_dmrs(gNB); nr_init_pbch_dmrs(gNB);
// Polar encoder init for PBCH // Polar encoder init for PBCH
nr_polar_init(&gNB->nrPolar_params, nr_polar_init(&gNB->nrPolar_params,
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_MESSAGE_TYPE,
NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_PAYLOAD_BITS,
NR_POLAR_PBCH_AGGREGATION_LEVEL); NR_POLAR_PBCH_AGGREGATION_LEVEL);
//PDCCH DMRS init //PDCCH DMRS init
gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**)); gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**));
...@@ -186,20 +187,16 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -186,20 +187,16 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
common_vars->rxdata = (int32_t **)NULL; common_vars->rxdata = (int32_t **)NULL;
common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t*)); common_vars->txdataF = (int32_t **)malloc16(15*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t*)); common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t*));
LOG_D(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_gNB:%d\n", NB_ANTENNA_PORTS_ENB, cfg->rf_config.tx_antenna_ports.value); for (i=0;i<15;i++){
for (i=0; i<NB_ANTENNA_PORTS_ENB; i++) {
if (i<cfg->rf_config.tx_antenna_ports.value || i==5) {
common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t) ); common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t) );
LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n", LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i], i,common_vars->txdataF[i],
fp->samples_per_frame_wCP*sizeof(int32_t)); fp->samples_per_frame_wCP*sizeof(int32_t));
} }
}
// Channel estimates for SRS // Channel estimates for SRS
...@@ -317,8 +314,8 @@ void phy_config_request(PHY_Config_t *phy_config) { ...@@ -317,8 +314,8 @@ void phy_config_request(PHY_Config_t *phy_config) {
void phy_free_nr_gNB(PHY_VARS_gNB *gNB) void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
{ {
// NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms; //NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms;
nfapi_nr_config_request_t *cfg = &gNB->gNB_config; //nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
NR_gNB_COMMON* const common_vars = &gNB->common_vars; NR_gNB_COMMON* const common_vars = &gNB->common_vars;
LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = gNB->srs_vars; LTE_eNB_SRS* const srs_vars = gNB->srs_vars;
...@@ -327,11 +324,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -327,11 +324,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
int i, UE_id; int i, UE_id;
for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) { for (i = 0; i < 15; i++) {
if (i < cfg->rf_config.tx_antenna_ports.value || i == 5) { free_and_zero(common_vars->txdataF[i]);
free_and_zero(common_vars->txdataF[i]);
/* rxdataF[i] is not allocated -> don't free */ /* rxdataF[i] is not allocated -> don't free */
}
} }
free_and_zero(common_vars->txdataF); free_and_zero(common_vars->txdataF);
free_and_zero(common_vars->rxdataF); free_and_zero(common_vars->rxdataF);
...@@ -392,28 +387,28 @@ void install_schedule_handlers(IF_Module_t *if_inst) ...@@ -392,28 +387,28 @@ void install_schedule_handlers(IF_Module_t *if_inst)
/// this function is a temporary addition for NR configuration /// this function is a temporary addition for NR configuration
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu) void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell)
{ {
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nfapi_nr_config_request_t *gNB_config = &gNB->gNB_config; nfapi_nr_config_request_t *gNB_config = &gNB->gNB_config;
//overwrite for new NR parameters //overwrite for new NR parameters
gNB_config->nfapi_config.rf_bands.rf_band[0] = 22; gNB_config->nfapi_config.rf_bands.rf_band[0] = 78;
gNB_config->nfapi_config.earfcn.value = 6600; gNB_config->nfapi_config.nrarfcn.value = 620000;
gNB_config->subframe_config.numerology_index_mu.value = mu; gNB_config->subframe_config.numerology_index_mu.value = mu;
gNB_config->subframe_config.duplex_mode.value = TDD; gNB_config->subframe_config.duplex_mode.value = TDD;
gNB_config->rf_config.tx_antenna_ports.value = 1;
gNB_config->rf_config.dl_carrier_bandwidth.value = N_RB_DL; gNB_config->rf_config.dl_carrier_bandwidth.value = N_RB_DL;
gNB_config->rf_config.ul_carrier_bandwidth.value = N_RB_UL; gNB_config->rf_config.ul_carrier_bandwidth.value = N_RB_UL;
gNB_config->sch_config.half_frame_index.value = 0; gNB_config->sch_config.half_frame_index.value = 0;
gNB_config->sch_config.ssb_subcarrier_offset.value = 0; gNB_config->sch_config.ssb_subcarrier_offset.value = 0;
gNB_config->sch_config.n_ssb_crb.value = (N_RB_DL-20); gNB_config->sch_config.n_ssb_crb.value = (N_RB_DL-20);
gNB_config->sch_config.ssb_subcarrier_offset.value = 0; gNB_config->sch_config.ssb_subcarrier_offset.value = 0;
gNB_config->sch_config.physical_cell_id.value=Nid_cell;
gNB->mac_enabled = 1; gNB->mac_enabled = 1;
fp->dl_CarrierFreq = from_earfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.earfcn.value); fp->dl_CarrierFreq = from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->threequarter_fs = 0; fp->threequarter_fs = 0;
...@@ -435,9 +430,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) ...@@ -435,9 +430,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
gNB_config->nfapi_config.rf_bands.rf_band[0] = phy_config->cfg->nfapi_config.rf_bands.rf_band[0]; //22 gNB_config->nfapi_config.rf_bands.rf_band[0] = phy_config->cfg->nfapi_config.rf_bands.rf_band[0]; //22
gNB_config->nfapi_config.earfcn.value = phy_config->cfg->nfapi_config.earfcn.value; //6600 gNB_config->nfapi_config.nrarfcn.value = phy_config->cfg->nfapi_config.nrarfcn.value; //6600
gNB_config->subframe_config.numerology_index_mu.value = phy_config->cfg->subframe_config.numerology_index_mu.value;//1 gNB_config->subframe_config.numerology_index_mu.value = phy_config->cfg->subframe_config.numerology_index_mu.value;//1
gNB_config->rf_config.tx_antenna_ports.value = phy_config->cfg->rf_config.tx_antenna_ports.value; //1
gNB_config->rf_config.dl_carrier_bandwidth.value = phy_config->cfg->rf_config.dl_carrier_bandwidth.value;//106; gNB_config->rf_config.dl_carrier_bandwidth.value = phy_config->cfg->rf_config.dl_carrier_bandwidth.value;//106;
gNB_config->rf_config.ul_carrier_bandwidth.value = phy_config->cfg->rf_config.ul_carrier_bandwidth.value;//106; gNB_config->rf_config.ul_carrier_bandwidth.value = phy_config->cfg->rf_config.ul_carrier_bandwidth.value;//106;
gNB_config->sch_config.half_frame_index.value = 0; gNB_config->sch_config.half_frame_index.value = 0;
...@@ -454,20 +448,19 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) ...@@ -454,20 +448,19 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
RC.gNB[Mod_id][CC_id]->mac_enabled = 1; RC.gNB[Mod_id][CC_id]->mac_enabled = 1;
fp->dl_CarrierFreq = from_earfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.earfcn.value); fp->dl_CarrierFreq = from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->threequarter_fs = 0; fp->threequarter_fs = 0;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,gNB_tx_antenna_ports %d,DL freq %u)\n", LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,DL freq %u)\n",
Mod_id, Mod_id,
CC_id, CC_id,
gNB_config->nfapi_config.rf_bands.rf_band[0], gNB_config->nfapi_config.rf_bands.rf_band[0],
gNB_config->rf_config.dl_carrier_bandwidth.value, gNB_config->rf_config.dl_carrier_bandwidth.value,
gNB_config->rf_config.ul_carrier_bandwidth.value, gNB_config->rf_config.ul_carrier_bandwidth.value,
gNB_config->sch_config.physical_cell_id.value, gNB_config->sch_config.physical_cell_id.value,
gNB_config->rf_config.tx_antenna_ports.value, fp->dl_CarrierFreq );
fp->dl_CarrierFreq );
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
if (RC.gNB[Mod_id][CC_id]->configured == 1){ if (RC.gNB[Mod_id][CC_id]->configured == 1){
......
...@@ -107,9 +107,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -107,9 +107,7 @@ int nr_phy_init_RU(RU_t *ru) {
for (i=0; i<RC.nb_nr_L1_inst; i++) { for (i=0; i<RC.nb_nr_L1_inst; i++) {
for (p=0;p<15;p++) { for (p=0;p<15;p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->gNB_list[i]->gNB_config.rf_config.tx_antenna_ports.value); if (p == 0|| p==5) {
if (p<ru->gNB_list[i]->gNB_config.rf_config.tx_antenna_ports.value || p==5) {
LOG_D(PHY,"[INIT] %s() DO BEAM WEIGHTS nb_antenna_ports_eNB:%d nb_tx:%d\n", __FUNCTION__, ru->gNB_list[i]->gNB_config.rf_config.tx_antenna_ports.value, ru->nb_tx);
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) { for (j=0; j<ru->nb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
...@@ -180,7 +178,7 @@ void nr_phy_free_RU(RU_t *ru) ...@@ -180,7 +178,7 @@ void nr_phy_free_RU(RU_t *ru)
for (i = 0; i < RC.nb_nr_L1_inst; i++) { for (i = 0; i < RC.nb_nr_L1_inst; i++) {
for (p = 0; p < 15; p++) { for (p = 0; p < 15; p++) {
if (p < ru->gNB_list[i]->gNB_config.rf_config.tx_antenna_ports.value || p == 5) { if (p == 0 || p == 5) {
for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]); for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
free_and_zero(ru->beam_weights[i][p]); free_and_zero(ru->beam_weights[i][p]);
} }
......
...@@ -656,6 +656,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -656,6 +656,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
int eNB_id; int eNB_id;
int th_id; int th_id;
int n_ssb_crb=(fp->N_RB_DL-20); int n_ssb_crb=(fp->N_RB_DL-20);
int k_ssb=0;
abstraction_flag = 0; abstraction_flag = 0;
fp->nb_antennas_tx = 1; fp->nb_antennas_tx = 1;
fp->nb_antennas_rx=1; fp->nb_antennas_rx=1;
...@@ -664,7 +665,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -664,7 +665,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,0); nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb);
phy_init_nr_top(ue); phy_init_nr_top(ue);
// many memory allocation sizes are hard coded // many memory allocation sizes are hard coded
...@@ -816,10 +817,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -816,10 +817,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) { for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
(*pdcch_vars_th)[th_id][eNB_id]->llr = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); (*pdcch_vars_th)[th_id][eNB_id]->llr = (int16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
(*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); (*pdcch_vars_th)[th_id][eNB_id]->llr16 = (int16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
(*pdcch_vars_th)[th_id][eNB_id]->wbar = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); (*pdcch_vars_th)[th_id][eNB_id]->wbar = (int16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
(*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int8_t*)malloc16_clear( 4*2*100*12 ); (*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int16_t*)malloc16_clear( 4*2*100*12 );
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
...@@ -952,12 +953,7 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) ...@@ -952,12 +953,7 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue)
generate_ul_reference_signal_sequences(SHRT_MAX); generate_ul_reference_signal_sequences(SHRT_MAX);
// Polar encoder init for PBCH // Polar encoder init for PBCH
ue->nrPolar_params = NULL;
nr_polar_init(&ue->nrPolar_params,
NR_POLAR_PBCH_MESSAGE_TYPE,
NR_POLAR_PBCH_PAYLOAD_BITS,
NR_POLAR_PBCH_AGGREGATION_LEVEL);
//lte_sync_time_init(frame_parms); //lte_sync_time_init(frame_parms);
//generate_ul_ref_sigs(); //generate_ul_ref_sigs();
...@@ -987,8 +983,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA ...@@ -987,8 +983,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
config->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL config->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
config->rf_config.dl_carrier_bandwidth.value = 106; config->rf_config.dl_carrier_bandwidth.value = 106;
config->rf_config.ul_carrier_bandwidth.value = 106; config->rf_config.ul_carrier_bandwidth.value = 106;
config->rf_config.tx_antenna_ports.value = 1;
config->rf_config.rx_antenna_ports.value = 1;
config->sch_config.physical_cell_id.value = 0; config->sch_config.physical_cell_id.value = 0;
frame_parms->frame_type = FDD; frame_parms->frame_type = FDD;
......
...@@ -159,6 +159,8 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -159,6 +159,8 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
fp->samples_per_frame_wCP = 10 * fp->samples_per_subframe_wCP; fp->samples_per_frame_wCP = 10 * fp->samples_per_subframe_wCP;
fp->samples_per_slot_wCP = fp->symbols_per_slot*fp->ofdm_symbol_size;
fp->samples_per_slot = fp->nb_prefix_samples0 + ((fp->symbols_per_slot-1)*fp->nb_prefix_samples) + (fp->symbols_per_slot*fp->ofdm_symbol_size);
fp->samples_per_subframe = (fp->samples_per_subframe_wCP + (fp->nb_prefix_samples0 * fp->slots_per_subframe) + fp->samples_per_subframe = (fp->samples_per_subframe_wCP + (fp->nb_prefix_samples0 * fp->slots_per_subframe) +
(fp->nb_prefix_samples * fp->slots_per_subframe * (fp->symbols_per_slot - 1))); (fp->nb_prefix_samples * fp->slots_per_subframe * (fp->symbols_per_slot - 1)));
fp->samples_per_frame = 10 * fp->samples_per_subframe; fp->samples_per_frame = 10 * fp->samples_per_subframe;
...@@ -176,7 +178,9 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -176,7 +178,9 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
} }
int nr_init_frame_parms(nfapi_nr_config_request_t* config, int nr_init_frame_parms(nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *fp) { NR_DL_FRAME_PARMS *fp)
{
return nr_init_frame_parms0(fp, return nr_init_frame_parms0(fp,
config->subframe_config.numerology_index_mu.value, config->subframe_config.numerology_index_mu.value,
...@@ -191,10 +195,9 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -191,10 +195,9 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
int n_ssb_crb, int n_ssb_crb,
int ssb_subcarrier_offset) int ssb_subcarrier_offset)
{ {
/*n_ssb_crb and ssb_subcarrier_offset are given in 15kHz SCS*/
nr_init_frame_parms0(fp,mu,Ncp,N_RB_DL); nr_init_frame_parms0(fp,mu,Ncp,N_RB_DL);
int start_rb = n_ssb_crb / (1<<mu); fp->ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset)/(1<<mu);
fp->ssb_start_subcarrier = 12 * start_rb + ssb_subcarrier_offset;
return 0; return 0;
} }
......
...@@ -379,10 +379,11 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); ...@@ -379,10 +379,11 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request(NR_PHY_Config_t *gNB);
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu); void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell);
void phy_free_nr_gNB(PHY_VARS_gNB *gNB); void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
int l1_north_init_gNB(void); int l1_north_init_gNB(void);
void init_nr_transport(PHY_VARS_gNB *gNB); void init_nr_transport(PHY_VARS_gNB *gNB);
......
...@@ -703,7 +703,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB, ...@@ -703,7 +703,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
int dlsch_encoding(PHY_VARS_eNB *eNB, int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char *a, unsigned char *a,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch,
int frame, int frame,
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
#define SOFFSET 0 #define SOFFSET 0
/*#ifdef LOG_I
#undef LOG_I
#define LOG_I(A,B...) printf(A)
#endif*/
int nr_slot_fep(PHY_VARS_NR_UE *ue, int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned char l, unsigned char l,
unsigned char Ns, unsigned char Ns,
...@@ -49,8 +54,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -49,8 +54,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
//int i; //int i;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset; unsigned int rx_offset;
//NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0]; NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0];
uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset+516; uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset+((int)floor(frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB)+pdcch_vars->coreset[0].rb_offset)*NR_NB_SC_PER_RB;
uint16_t nb_rb_coreset = 24; uint16_t nb_rb_coreset = 24;
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset+516; uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset+516;
uint16_t nb_rb_pdsch = 50; uint16_t nb_rb_pdsch = 50;
...@@ -123,6 +128,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -123,6 +128,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
// Align with 256 bit // Align with 256 bit
// rx_offset = rx_offset&0xfffffff8; // rx_offset = rx_offset&0xfffffff8;
#ifdef DEBUG_FEP
// if (ue->frame <100)
/*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
#endif
if (l==0) { if (l==0) {
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
...@@ -151,12 +162,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -151,12 +162,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// + rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); // (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
//#ifdef DEBUG_FEP
// if (ue->frame <100)
LOG_D(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,sample_offset,rx_offset,frame_length_samples);
//#endif
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((void *)&common_vars->rxdata[aa][frame_length_samples], memcpy((void *)&common_vars->rxdata[aa][frame_length_samples],
(void *)&common_vars->rxdata[aa][0], (void *)&common_vars->rxdata[aa][0],
......
...@@ -20,15 +20,15 @@ ...@@ -20,15 +20,15 @@
*/ */
/*! \file PHY/NR_REFSIG/nr_dl_dmrs.c /*! \file PHY/NR_REFSIG/nr_dl_dmrs.c
* \brief Top-level routines for generating DMRS from 38-211 * \brief Top-level routines for generating DMRS from 38-211
* \author * \author
* \date 2018 * \date 2018
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
* \email: * \email:
* \note * \note
* \warning * \warning
*/ */
//#define NR_PBCH_DMRS_LENGTH_DWORD 5 //#define NR_PBCH_DMRS_LENGTH_DWORD 5
//#define NR_PBCH_DMRS_LENGTH 144 //#define NR_PBCH_DMRS_LENGTH 144
...@@ -47,6 +47,7 @@ short nr_rx_mod_table[14] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,2 ...@@ -47,6 +47,7 @@ short nr_rx_mod_table[14] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,2
short nr_rx_nmod_table[14] = {0,0,-23170,23170,23170,-23170,-23170,23170,-23170,-23170,23170,23170,23170,-23170}; short nr_rx_nmod_table[14] = {0,0,-23170,23170,23170,-23170,-23170,23170,-23170,-23170,23170,23170,23170,-23170};
int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
unsigned int Ns, unsigned int Ns,
unsigned int *nr_gold_pdsch, unsigned int *nr_gold_pdsch,
...@@ -69,7 +70,7 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -69,7 +70,7 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
wt = (config_type==0) ? wt1 : wt2; wt = (config_type==0) ? wt1 : wt2;
if (config_type > 1) if (config_type > 1)
LOG_E(PHY,"Bad PDSCH DMRS config type %d\n", config_type); LOG_E(PHY,"Bad PDSCH DMRS config type %d\n", config_type);
if ((p>=1000) && (p<((config_type==0) ? 1008 : 1012))) { if ((p>=1000) && (p<((config_type==0) ? 1008 : 1012))) {
if (ue->frame_parms.Ncp == NORMAL) { if (ue->frame_parms.Ncp == NORMAL) {
...@@ -100,32 +101,32 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -100,32 +101,32 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
} }
int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset, uint8_t eNB_offset,
unsigned int Ns, unsigned int Ns,
unsigned int *nr_gold_pdcch, unsigned int *nr_gold_pdcch,
int32_t *output, int32_t *output,
unsigned short p, unsigned short p,
unsigned short nb_rb_coreset) unsigned short nb_rb_coreset)
{ {
uint8_t idx=0; uint8_t idx=0;
//uint8_t pdcch_rb_offset =0; //uint8_t pdcch_rb_offset =0;
//nr_gold_pdcch += ((int)floor(ue->frame_parms.ssb_start_subcarrier/12)+pdcch_rb_offset)*3/32; //nr_gold_pdcch += ((int)floor(ue->frame_parms.ssb_start_subcarrier/12)+pdcch_rb_offset)*3/32;
if (p==2000) { if (p==2000) {
for (int i=0; i<((nb_rb_coreset*6)>>1); i++) { for (int i=0; i<((nb_rb_coreset*6)>>1); i++) {
idx = ((((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1); idx = ((((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1);
((int16_t*)output)[i<<1] = nr_rx_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; ((int16_t*)output)[i<<1] = nr_rx_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
((int16_t*)output)[(i<<1)+1] = nr_rx_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1]; ((int16_t*)output)[(i<<1)+1] = nr_rx_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
#ifdef DEBUG_PDCCH #ifdef DEBUG_PDCCH
if (i<8) if (i<8)
printf("i %d idx %d pdcch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdcch[(i<<1)>>5], (((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1), printf("i %d idx %d pdcch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdcch[(i<<1)>>5], (((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1),
(((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1],&output[0]); (((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1],&output[0]);
#endif #endif
} }
} }
return(0); return(0);
} }
int nr_pbch_dmrs_rx(int symbol,unsigned int *nr_gold_pbch,int32_t *output ) int nr_pbch_dmrs_rx(int symbol,unsigned int *nr_gold_pbch,int32_t *output )
......
...@@ -37,15 +37,15 @@ ...@@ -37,15 +37,15 @@
//#define DEBUG_CHANNEL_CODING //#define DEBUG_CHANNEL_CODING
#define PDCCH_TEST_POLAR_TEMP_FIX #define PDCCH_TEST_POLAR_TEMP_FIX
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
nfapi_nr_rnti_type_e rnti_type, nfapi_nr_rnti_type_e rnti_type,
NR_BWP_PARMS* bwp, uint16_t N_RB,
nfapi_nr_config_request_t* config) nfapi_nr_config_request_t* config)
{ {
uint16_t size = 0; uint16_t size = 0;
uint16_t N_RB = bwp->N_RB;
switch(format) { switch(format) {
/*Only sizes for 0_0 and 1_0 are correct at the moment*/ /*Only sizes for 0_0 and 1_0 are correct at the moment*/
...@@ -53,7 +53,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, ...@@ -53,7 +53,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
/// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20 /// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20
size += 20; size += 20;
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated
size += nr_get_dci_size(NFAPI_NR_DL_DCI_FORMAT_1_0, rnti_type, bwp, config) - size; // Padding to match 1_0 size size += nr_get_dci_size(NFAPI_NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, config) - size; // Padding to match 1_0 size
// UL/SUL indicator assumed to be 0 // UL/SUL indicator assumed to be 0
break; break;
...@@ -149,11 +149,12 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -149,11 +149,12 @@ void nr_pdcch_scrambling(uint32_t *in,
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
if (i){ if (i){
in++; in++;
out++; out++;
} }
} }
(*out) ^= ((((*in)>>(i&0x1f))&1) ^ ((s>>(i&0x1f))&1))<<(i&0x1f); (*out) ^= ((((*in)>>(i&0x1f))&1) ^ ((s>>(i&0x1f))&1))<<(i&0x1f);
// printf("nr_pdcch_scrambling: in %d => out %d\n",((*in)>>(i&0x1f))&1,((*out)>>(i&0x1f))&1);
} }
} }
...@@ -161,7 +162,7 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -161,7 +162,7 @@ void nr_pdcch_scrambling(uint32_t *in,
uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
t_nrPolar_paramsPtr *nrPolar_params, t_nrPolar_paramsPtr *nrPolar_params,
uint32_t **gold_pdcch_dmrs, uint32_t **gold_pdcch_dmrs,
int32_t** txdataF, int32_t* txdataF,
int16_t amp, int16_t amp,
NR_DL_FRAME_PARMS frame_parms, NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config) nfapi_nr_config_request_t config)
...@@ -169,7 +170,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -169,7 +170,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration
uint8_t idx=0; uint8_t idx=0;
uint16_t a; //uint16_t a;
int k,l,k_prime,dci_idx, dmrs_idx; int k,l,k_prime,dci_idx, dmrs_idx;
nr_cce_t cce; nr_cce_t cce;
nr_reg_t reg; nr_reg_t reg;
...@@ -185,10 +186,12 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -185,10 +186,12 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset * in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset
* in time: by its first slot and its first symbol*/ * in time: by its first slot and its first symbol*/
uint16_t cset_start_sc = frame_parms.first_carrier_offset + ((int)floor(frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB)+pdcch_params.rb_offset)*NR_NB_SC_PER_RB; uint16_t cset_start_sc = frame_parms.first_carrier_offset + ((int)floor(frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB)+pdcch_params.rb_offset)*NR_NB_SC_PER_RB;
uint8_t cset_start_symb = pdcch_params.first_slot*frame_parms.symbols_per_slot + pdcch_params.first_symbol; // uint8_t cset_start_symb = pdcch_params.first_slot*frame_parms.symbols_per_slot + pdcch_params.first_symbol;
uint8_t cset_start_symb = pdcch_params.first_symbol;
uint8_t cset_nsymb = pdcch_params.n_symb; uint8_t cset_nsymb = pdcch_params.n_symb;
dci_idx = 0; dci_idx = 0;
/// DMRS QPSK modulation /// DMRS QPSK modulation
/*There is a need to shift from which index the pregenerated DMRS sequence is used /*There is a need to shift from which index the pregenerated DMRS sequence is used
* see 38211 r15.2.0 section 7.4.1.3.2: assumption is the reference point for k refers to the DMRS sequence*/ * see 38211 r15.2.0 section 7.4.1.3.2: assumption is the reference point for k refers to the DMRS sequence*/
...@@ -213,16 +216,16 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -213,16 +216,16 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD]; uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? ((pdcch_params.scrambling_id)?pdcch_params.rnti:0) : 0; uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? ((pdcch_params.scrambling_id)?pdcch_params.rnti:0) : 0;
uint16_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value; uint16_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value;
#ifdef PDCCH_TEST_POLAR_TEMP_FIX //#ifdef PDCCH_TEST_POLAR_TEMP_FIX
t_nrPolar_paramsPtr currentPtr = NULL;//, polarParams = NULL; // nr_polar_init(&currentPtr, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
nr_polar_init(&currentPtr, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
// t_nrPolar_paramsPtr currentPtr = nr_polar_params(*nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L); // t_nrPolar_paramsPtr currentPtr = nr_polar_params(*nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
#else //#else
nr_polar_init(nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L); nr_polar_init(nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
t_nrPolar_paramsPtr currentPtr = nr_polar_params(*nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L); t_nrPolar_paramsPtr currentPtr = nr_polar_params(*nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
#endif //#endif
polar_encoder_dci(dci_alloc.dci_pdu, encoder_output, currentPtr, pdcch_params.rnti); //polar_encoder_dci(dci_alloc.dci_pdu, encoder_output, currentPtr, pdcch_params.rnti);
polar_encoder_fast(dci_alloc.dci_pdu, encoder_output, pdcch_params.rnti,currentPtr);
#ifdef DEBUG_CHANNEL_CODING #ifdef DEBUG_CHANNEL_CODING
printf("polar rnti %d\n",pdcch_params.rnti); printf("polar rnti %d\n",pdcch_params.rnti);
...@@ -257,10 +260,7 @@ printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%0 ...@@ -257,10 +260,7 @@ printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%0
} }
/// Resource mapping /// Resource mapping
a = (config.rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (int aa = 0; aa < config.rf_config.tx_antenna_ports.value; aa++)
{
if (cset_start_sc >= frame_parms.ofdm_symbol_size) if (cset_start_sc >= frame_parms.ofdm_symbol_size)
cset_start_sc -= frame_parms.ofdm_symbol_size; cset_start_sc -= frame_parms.ofdm_symbol_size;
...@@ -277,20 +277,23 @@ printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%0 ...@@ -277,20 +277,23 @@ printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%0
} }
} }
#ifdef DEBUG_DCI #ifdef DEBUG_DCI
printf("\n Ordered REG list:\n"); printf("\n Ordered REG list:\n");
for (int i=0; i<nb_regs; i++) for (int i=0; i<nb_regs; i++)
printf("%d\t",reg_mapping_list[i].reg_idx ); printf("%d\t",reg_mapping_list[i].reg_idx );
printf("\n"); printf("\n");
#endif #endif
if (pdcch_params.precoder_granularity == NFAPI_NR_CSET_ALL_CONTIGUOUS_RBS) { if (pdcch_params.precoder_granularity == NFAPI_NR_CSET_ALL_CONTIGUOUS_RBS) {
/*in this case the DMRS are mapped on all the coreset*/ /*in this case the DMRS are mapped on all the coreset*/
for (l=cset_start_symb; l<cset_start_symb+ cset_nsymb; l++) { for (l=cset_start_symb; l<cset_start_symb+ cset_nsymb; l++) {
dmrs_idx = 0; dmrs_idx = 0;
k = cset_start_sc + 1; k = cset_start_sc + 1;
while (dmrs_idx<3*pdcch_params.n_rb) { while (dmrs_idx<3*pdcch_params.n_rb) {
((int16_t*)txdataF[aa])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (a * mod_dmrs[l][dmrs_idx<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (a * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_PDCCH_DMRS
printf("symbol %d position %d => (%d,%d)\n",l,k,((int16_t*)txdataF[aa])[(l*frame_parms.ofdm_symbol_size + k)<<1] , ((int16_t*)txdataF[aa])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
#endif
k+=4; k+=4;
if (k >= frame_parms.ofdm_symbol_size) if (k >= frame_parms.ofdm_symbol_size)
k -= frame_parms.ofdm_symbol_size; k -= frame_parms.ofdm_symbol_size;
...@@ -312,15 +315,18 @@ printf("\n"); ...@@ -312,15 +315,18 @@ printf("\n");
for (int m=0; m<NR_NB_SC_PER_RB; m++) { for (int m=0; m<NR_NB_SC_PER_RB; m++) {
if ( m == (k_prime<<2)+1) { // DMRS if not already mapped if ( m == (k_prime<<2)+1) { // DMRS if not already mapped
if (pdcch_params.precoder_granularity == NFAPI_NR_CSET_SAME_AS_REG_BUNDLE) { if (pdcch_params.precoder_granularity == NFAPI_NR_CSET_SAME_AS_REG_BUNDLE) {
((int16_t*)txdataF[aa])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (a * mod_dmrs[l][dmrs_idx<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (a * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_PDCCH_DMRS
printf("l %d position %d => (%d,%d)\n",l,k,((int16_t*)txdataF[aa])[(l*frame_parms.ofdm_symbol_size + k)<<1] , ((int16_t*)txdataF[aa])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
#endif
k_prime++; k_prime++;
dmrs_idx++; dmrs_idx++;
} }
} }
else { // DCI payload else { // DCI payload
((int16_t*)txdataF[aa])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (a * mod_dci[dci_idx<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dci[dci_idx<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (a * mod_dci[(dci_idx<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dci[(dci_idx<<1) + 1]) >> 15;
//printf("dci output %d %d\n",(a * mod_dci[dci_idx<<1]) >> 15, (a * mod_dci[(dci_idx<<1) + 1]) >> 15); //printf("dci output %d %d\n",(a * mod_dci[dci_idx<<1]) >> 15, (a * mod_dci[(dci_idx<<1) + 1]) >> 15);
dci_idx++; dci_idx++;
} }
...@@ -329,7 +335,6 @@ printf("\n"); ...@@ -329,7 +335,6 @@ printf("\n");
k -= frame_parms.ofdm_symbol_size; k -= frame_parms.ofdm_symbol_size;
} }
} }
}
return 0; return 0;
} }
...@@ -29,13 +29,13 @@ typedef unsigned __int128 uint128_t; ...@@ -29,13 +29,13 @@ typedef unsigned __int128 uint128_t;
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
nfapi_nr_rnti_type_e rnti_type, nfapi_nr_rnti_type_e rnti_type,
NR_BWP_PARMS* bwp, uint16_t N_RB,
nfapi_nr_config_request_t* config); nfapi_nr_config_request_t* config);
uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
t_nrPolar_paramsPtr *nrPolar_params, t_nrPolar_paramsPtr *nrPolar_params,
uint32_t **gold_pdcch_dmrs, uint32_t **gold_pdcch_dmrs,
int32_t** txdataF, int32_t* txdataF,
int16_t amp, int16_t amp,
NR_DL_FRAME_PARMS frame_parms, NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config); nfapi_nr_config_request_t config);
......
This diff is collapsed.
...@@ -196,7 +196,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -196,7 +196,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
uint32_t ***pdsch_dmrs, uint32_t ***pdsch_dmrs,
int32_t** txdataF, int32_t** txdataF,
int16_t amp, int16_t amp,
uint8_t subframe, uint8_t slot,
NR_DL_FRAME_PARMS frame_parms, NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config) { nfapi_nr_config_request_t config) {
...@@ -212,7 +212,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -212,7 +212,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
uint16_t encoded_length = nb_symbols*Qm; uint16_t encoded_length = nb_symbols*Qm;
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
nr_dlsch_encoding(harq->pdu, subframe, &dlsch, &frame_parms); nr_dlsch_encoding(harq->pdu, slot, &dlsch, &frame_parms);
#ifdef DEBUG_DLSCH #ifdef DEBUG_DLSCH
printf("PDSCH encoding:\nPayload:\n"); printf("PDSCH encoding:\nPayload:\n");
for (int i=0; i<TBS>>7; i++) { for (int i=0; i<TBS>>7; i++) {
...@@ -305,8 +305,7 @@ for (int i=0; i<n_dmrs>>4; i++) { ...@@ -305,8 +305,7 @@ for (int i=0; i<n_dmrs>>4; i++) {
#endif #endif
/// Resource mapping /// Resource mapping
AssertFatal(rel15->nb_layers<=config.rf_config.tx_antenna_ports.value, "Not enough Tx antennas (%d) for %d layers\n",\
config.rf_config.tx_antenna_ports.value, rel15->nb_layers);
// Non interleaved VRB to PRB mapping // Non interleaved VRB to PRB mapping
uint16_t start_sc = frame_parms.first_carrier_offset + frame_parms.ssb_start_subcarrier; uint16_t start_sc = frame_parms.first_carrier_offset + frame_parms.ssb_start_subcarrier;
......
...@@ -90,6 +90,10 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -90,6 +90,10 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
@param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */ @param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl); uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl);
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
int nr_dlsch_encoding(unsigned char *a, int nr_dlsch_encoding(unsigned char *a,
uint8_t subframe, uint8_t subframe,
NR_gNB_DLSCH_t *dlsch, NR_gNB_DLSCH_t *dlsch,
......
...@@ -142,9 +142,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo, ...@@ -142,9 +142,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
dlsch->Nsoft = Nsoft; dlsch->Nsoft = Nsoft;
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) { for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(config->rf_config.tx_antenna_ports.value*sizeof(int32_t*)); dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*));
for (aa=0; aa<config->rf_config.tx_antenna_ports.value; aa++) { for (aa=0; aa<64; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
...@@ -157,8 +157,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo, ...@@ -157,8 +157,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
dlsch->mod_symbs[q] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH>>1)*sizeof(int32_t*)); dlsch->mod_symbs[q] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH>>1)*sizeof(int32_t*));
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(config->rf_config.tx_antenna_ports.value*sizeof(int32_t*)); dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(64*sizeof(int32_t*));
for (aa=0; aa<config->rf_config.tx_antenna_ports.value; aa++) { for (aa=0; aa<64; aa++) {
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
} }
...@@ -265,7 +265,7 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) ...@@ -265,7 +265,7 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
} }
int nr_dlsch_encoding(unsigned char *a, int nr_dlsch_encoding(unsigned char *a,
uint8_t subframe, uint8_t slot,
NR_gNB_DLSCH_t *dlsch, NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms) NR_DL_FRAME_PARMS* frame_parms)
{ {
...@@ -273,7 +273,7 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -273,7 +273,7 @@ int nr_dlsch_encoding(unsigned char *a,
unsigned int G; unsigned int G;
unsigned int crc=1; unsigned int crc=1;
uint8_t harq_pid = dlsch->harq_ids[subframe]; uint8_t harq_pid = dlsch->harq_ids[slot];
nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15; nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15;
uint16_t nb_rb = rel15.n_prb; uint16_t nb_rb = rel15.n_prb;
uint8_t nb_symb_sch = rel15.nb_symbols; uint8_t nb_symb_sch = rel15.nb_symbols;
...@@ -379,7 +379,8 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -379,7 +379,8 @@ int nr_dlsch_encoding(unsigned char *a,
} }
printf("\n");*/ printf("\n");*/
ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL); //ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
//stop_meas(te_stats); //stop_meas(te_stats);
//printf("end ldpc encoder -- output\n"); //printf("end ldpc encoder -- output\n");
......
...@@ -46,14 +46,14 @@ uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6 ...@@ -46,14 +46,14 @@ uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31}; 9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31};
int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int k,l; int k,l;
int16_t a; //int16_t a;
int16_t mod_dmrs[NR_PBCH_DMRS_LENGTH<<1]; int16_t mod_dmrs[NR_PBCH_DMRS_LENGTH<<1];
uint8_t idx=0; uint8_t idx=0;
uint8_t nushift = config->sch_config.physical_cell_id.value &3; uint8_t nushift = config->sch_config.physical_cell_id.value &3;
...@@ -72,10 +72,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -72,10 +72,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
} }
/// Resource mapping /// Resource mapping
a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (int aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{
// PBCH DMRS are mapped within the SSB block on every fourth subcarrier starting from nushift of symbols 1, 2, 3 // PBCH DMRS are mapped within the SSB block on every fourth subcarrier starting from nushift of symbols 1, 2, 3
///symbol 1 [0+nushift:4:236+nushift] -- 60 mod symbols ///symbol 1 [0+nushift:4:236+nushift] -- 60 mod symbols
...@@ -86,12 +83,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -86,12 +83,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("m %d at k %d of l %d\n", m, k, l); printf("m %d at k %d of l %d\n", m, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_dmrs[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_dmrs[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[(m<<1) + 1]) >> 15;
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("(%d,%d)\n", printf("(%d,%d)\n",
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1], ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]); ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif #endif
k+=4; k+=4;
...@@ -107,12 +104,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -107,12 +104,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("m %d at k %d of l %d\n", m, k, l); printf("m %d at k %d of l %d\n", m, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_dmrs[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_dmrs[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[(m<<1) + 1]) >> 15;
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("(%d,%d)\n", printf("(%d,%d)\n",
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1], ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]); ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif #endif
k+=(m==71)?148:4; // Jump from 44+nu to 192+nu k+=(m==71)?148:4; // Jump from 44+nu to 192+nu
...@@ -128,12 +125,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -128,12 +125,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("m %d at k %d of l %d\n", m, k, l); printf("m %d at k %d of l %d\n", m, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_dmrs[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_dmrs[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[(m<<1) + 1]) >> 15;
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("(%d,%d)\n", printf("(%d,%d)\n",
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1], ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]); ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif #endif
k+=4; k+=4;
...@@ -141,7 +138,6 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -141,7 +138,6 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
k-=frame_parms->ofdm_symbol_size; k-=frame_parms->ofdm_symbol_size;
} }
}
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
...@@ -225,13 +221,14 @@ void nr_init_pbch_interleaver(uint8_t *interleaver) { ...@@ -225,13 +221,14 @@ void nr_init_pbch_interleaver(uint8_t *interleaver) {
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_hrf); *(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_hrf);
else // Ssb bits:3 else // Ssb bits:3
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_ssb++); *(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_ssb++);
} }
int nr_generate_pbch(NR_gNB_PBCH *pbch, int nr_generate_pbch(NR_gNB_PBCH *pbch,
t_nrPolar_paramsPtr polar_params, t_nrPolar_paramsPtr polar_params,
uint8_t *pbch_pdu, uint8_t *pbch_pdu,
uint8_t *interleaver, uint8_t *interleaver,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t n_hf, uint8_t n_hf,
...@@ -243,12 +240,13 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -243,12 +240,13 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
{ {
int k,l,m; int k,l,m;
int16_t a; //int16_t a;
int16_t mod_pbch_e[NR_POLAR_PBCH_E]; int16_t mod_pbch_e[NR_POLAR_PBCH_E];
uint8_t idx=0; uint8_t idx=0;
uint16_t M; uint16_t M;
uint8_t nushift; uint8_t nushift;
uint32_t unscrambling_mask; uint32_t unscrambling_mask;
uint64_t a_reversed=0;
LOG_I(PHY, "PBCH generation started\n"); LOG_I(PHY, "PBCH generation started\n");
...@@ -303,8 +301,13 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -303,8 +301,13 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
printf("pbch_a_prime: 0x%08x\n", pbch->pbch_a_prime); printf("pbch_a_prime: 0x%08x\n", pbch->pbch_a_prime);
#endif #endif
// Encoder reversal
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i);
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder (&pbch->pbch_a_prime, pbch->pbch_e, polar_params); polar_encoder_fast (&a_reversed, (uint32_t*)pbch->pbch_e, 0, polar_params);
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
printf("Channel coding:\n"); printf("Channel coding:\n");
for (int i=0; i<NR_POLAR_PBCH_E_DWORD; i++) for (int i=0; i<NR_POLAR_PBCH_E_DWORD; i++)
...@@ -336,10 +339,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -336,10 +339,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
/// Resource mapping /// Resource mapping
nushift = config->sch_config.physical_cell_id.value &3; nushift = config->sch_config.physical_cell_id.value &3;
a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (int aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{
// PBCH modulated symbols are mapped within the SSB block on symbols 1, 2, 3 excluding the subcarriers used for the PBCH DMRS // PBCH modulated symbols are mapped within the SSB block on symbols 1, 2, 3 excluding the subcarriers used for the PBCH DMRS
///symbol 1 [0:239] -- 180 mod symbols ///symbol 1 [0:239] -- 180 mod symbols
...@@ -357,8 +357,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -357,8 +357,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l); printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_pbch_e[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_pbch_e[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_pbch_e[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_pbch_e[(m<<1) + 1]) >> 15;
k++; k++;
m++; m++;
} }
...@@ -382,8 +382,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -382,8 +382,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l); printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_pbch_e[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_pbch_e[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_pbch_e[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_pbch_e[(m<<1) + 1]) >> 15;
k++; k++;
m++; m++;
} }
...@@ -408,8 +408,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -408,8 +408,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l); printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_pbch_e[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_pbch_e[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_pbch_e[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_pbch_e[(m<<1) + 1]) >> 15;
k++; k++;
m++; m++;
} }
...@@ -433,8 +433,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -433,8 +433,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l); printf("m %d ssb_sc_idx %d at k %d of l %d\n", m, ssb_sc_idx, k, l);
#endif #endif
((int16_t*)txdataF[aa])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (a * mod_pbch_e[m<<1]) >> 15; ((int16_t*)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_pbch_e[m<<1]) >> 15;
((int16_t*)txdataF[aa])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (a * mod_pbch_e[(m<<1) + 1]) >> 15; ((int16_t*)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_pbch_e[(m<<1) + 1]) >> 15;
k++; k++;
m++; m++;
} }
...@@ -443,7 +443,6 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -443,7 +443,6 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
k-=frame_parms->ofdm_symbol_size; k-=frame_parms->ofdm_symbol_size;
} }
}
return 0; return 0;
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
//#define NR_PSS_DEBUG //#define NR_PSS_DEBUG
int nr_generate_pss( int16_t *d_pss, int nr_generate_pss( int16_t *d_pss,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
...@@ -48,7 +48,7 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -48,7 +48,7 @@ int nr_generate_pss( int16_t *d_pss,
for (i=0; i < NR_PSS_LENGTH; i++) { for (i=0; i < NR_PSS_LENGTH; i++) {
m = (i + 43*Nid2)%(NR_PSS_LENGTH); m = (i + 43*Nid2)%(NR_PSS_LENGTH);
d_pss[i] = (1 - 2*x[m]) * 32767; d_pss[i] = (1 - 2*x[m]) * 23170;
} }
#ifdef NR_PSS_DEBUG #ifdef NR_PSS_DEBUG
...@@ -57,10 +57,8 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -57,10 +57,8 @@ int nr_generate_pss( int16_t *d_pss,
#endif #endif
/// Resource mapping /// Resource mapping
a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; a = amp;
for (int aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{
// PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from // PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and
...@@ -70,13 +68,12 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -70,13 +68,12 @@ int nr_generate_pss( int16_t *d_pss,
for (m = 0; m < NR_PSS_LENGTH; m++) { for (m = 0; m < NR_PSS_LENGTH; m++) {
// printf("pss: writing position k %d / %d\n",k,frame_parms->ofdm_symbol_size); // printf("pss: writing position k %d / %d\n",k,frame_parms->ofdm_symbol_size);
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_pss[m]) >> 15; ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_pss[m]) >> 15;
k++; k++;
if (k >= frame_parms->ofdm_symbol_size) if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size; k-=frame_parms->ofdm_symbol_size;
} }
}
#ifdef NR_PSS_DEBUG #ifdef NR_PSS_DEBUG
LOG_M("pss_0.m", "pss_0", LOG_M("pss_0.m", "pss_0",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
//#define NR_SSS_DEBUG //#define NR_SSS_DEBUG
int nr_generate_sss( int16_t *d_sss, int nr_generate_sss( int16_t *d_sss,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
...@@ -33,7 +33,7 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -33,7 +33,7 @@ int nr_generate_sss( int16_t *d_sss,
int i,k,l; int i,k,l;
int m0, m1; int m0, m1;
int Nid, Nid1, Nid2; int Nid, Nid1, Nid2;
int16_t a; //int16_t a;
int16_t x0[NR_SSS_LENGTH], x1[NR_SSS_LENGTH]; int16_t x0[NR_SSS_LENGTH], x1[NR_SSS_LENGTH];
const int x0_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; const int x0_initial[7] = { 1, 0, 0, 0, 0, 0, 0 };
const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 };
...@@ -57,7 +57,7 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -57,7 +57,7 @@ int nr_generate_sss( int16_t *d_sss,
m1 = Nid1 % 112; m1 = Nid1 % 112;
for (i = 0; i < NR_SSS_LENGTH ; i++) { for (i = 0; i < NR_SSS_LENGTH ; i++) {
d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 32767; d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 23170;
} }
#ifdef NR_SSS_DEBUG #ifdef NR_SSS_DEBUG
...@@ -65,23 +65,18 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -65,23 +65,18 @@ int nr_generate_sss( int16_t *d_sss,
#endif #endif
/// Resource mapping /// Resource mapping
a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (int aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{
// SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from // SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and
l = ssb_start_symbol + 2; l = ssb_start_symbol + 2;
for (int m = 0; m < NR_SSS_LENGTH; m++) { for (int m = 0; m < NR_SSS_LENGTH; m++) {
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_sss[m]) >> 15; ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (amp * d_sss[m]) >> 15;
k++; k++;
if (k >= frame_parms->ofdm_symbol_size) if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size; k-=frame_parms->ofdm_symbol_size;
} }
}
#ifdef NR_SSS_DEBUG #ifdef NR_SSS_DEBUG
// write_output("sss_0.m", "sss_0", (void*)txdataF[0][l*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); // write_output("sss_0.m", "sss_0", (void*)txdataF[0][l*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1);
#endif #endif
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
@returns 0 on success @returns 0 on success
*/ */
int nr_generate_pss( int16_t *d_pss, int nr_generate_pss( int16_t *d_pss,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
...@@ -46,7 +46,7 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -46,7 +46,7 @@ int nr_generate_pss( int16_t *d_pss,
@returns 0 on success @returns 0 on success
*/ */
int nr_generate_sss( int16_t *d_sss, int nr_generate_sss( int16_t *d_sss,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
...@@ -59,7 +59,7 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -59,7 +59,7 @@ int nr_generate_sss( int16_t *d_sss,
@returns 0 on success @returns 0 on success
*/ */
int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
...@@ -88,7 +88,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -88,7 +88,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
t_nrPolar_paramsPtr polar_params, t_nrPolar_paramsPtr polar_params,
uint8_t *pbch_pdu, uint8_t *pbch_pdu,
uint8_t *interleaver, uint8_t *interleaver,
int32_t **txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t n_hf, uint8_t n_hf,
......
...@@ -295,8 +295,10 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -295,8 +295,10 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
fm = filt16a_m1; fm = filt16a_m1;
fr = filt16a_r1; fr = filt16a_r1;
// generate pilot
nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns>>1][symbol], &pilot[0],2000,nb_rb_coreset); // generate pilot
nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[0],2000,nb_rb_coreset);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
...@@ -313,10 +315,10 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -313,10 +315,10 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p\n", rxF); printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
#endif
if ((ue->frame_parms.N_RB_DL&1)==0) {
printf("dl_ch addr %p\n",dl_ch);
#endif
// if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
...@@ -421,7 +423,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -421,7 +423,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
} }
} //}
} }
......
This diff is collapsed.
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* \warning * \warning
*/ */
//#include "PHY/defs.h" //#include "PHY/defs.h"
#include <stdint.h>
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
//#include "PHY/NR_TRANSPORT/nr_dci.h" //#include "PHY/NR_TRANSPORT/nr_dci.h"
//#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" //#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
...@@ -67,18 +68,28 @@ uint16_t nr_dci_field(uint32_t dci_pdu[4], ...@@ -67,18 +68,28 @@ uint16_t nr_dci_field(uint32_t dci_pdu[4],
uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS], uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS],
uint8_t dci_field) uint8_t dci_field)
{ {
uint16_t field_value = 0 ; // uint16_t field_value = 0 ;
// first_bit_position contains the position of the first bit of the corresponding field within the dci pdu payload // first_bit_position contains the position of the first bit of the corresponding field within the dci pdu payload
uint16_t first_bit_position = 0;
// last_bit_position contains the position of the last bit of the corresponding field within the dci pdu payload // last_bit_position contains the position of the last bit of the corresponding field within the dci pdu payload
uint16_t last_bit_position = 0; // uint16_t last_bit_position = 0;
uint8_t bit=0; // uint8_t bit=0;
//printf("\tdci_field=%d, \tsize=%d \t|",dci_field,dci_fields_sizes[dci_field]); //printf("\tdci_field=%d, \tsize=%d \t|",dci_field,dci_fields_sizes[dci_field]);
for (int i=0; i<dci_field ; i++){ int dci_size=0;
first_bit_position = first_bit_position + dci_fields_sizes[i];
for (int i=0;i<NBR_NR_DCI_FIELDS;i++) dci_size+=dci_fields_sizes[i];
AssertFatal(dci_size<65,"DCI has %d > 64 bits, not supported for now\n",
dci_size);
uint16_t first_bit_position = dci_size;
for (int i=0; i<=dci_field ; i++){
first_bit_position = first_bit_position - dci_fields_sizes[i];
} }
last_bit_position = first_bit_position + dci_fields_sizes[dci_field]; // last_bit_position = first_bit_position + dci_fields_sizes[dci_field];
//printf("\tfirst_bit=%d,\tlast_bit=%d",first_bit_position,last_bit_position); //printf("\tfirst_bit=%d,\tlast_bit=%d",first_bit_position,last_bit_position);
/*
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
for (int j=0; j<32; j++){ for (int j=0; j<32; j++){
if ((((i*32)+j) >= first_bit_position) && (((i*32)+j) < last_bit_position)){ if ((((i*32)+j) >= first_bit_position) && (((i*32)+j) < last_bit_position)){
...@@ -87,7 +98,14 @@ uint16_t nr_dci_field(uint32_t dci_pdu[4], ...@@ -87,7 +98,14 @@ uint16_t nr_dci_field(uint32_t dci_pdu[4],
//printf(" bit(%d)=%d[%d] ",(i*32)+j,bit,field_value); //printf(" bit(%d)=%d[%d] ",(i*32)+j,bit,field_value);
} }
} }
return field_value; */
uint64_t *dci_pdu64=(uint64_t*)&dci_pdu[0];
/*
printf("pdu %llx, field %d, pos %d, size %d => %u\n",(long long unsigned int)*dci_pdu64,dci_field,first_bit_position,dci_fields_sizes[dci_field],
(unsigned int)((*dci_pdu64>>first_bit_position)&((1<<dci_fields_sizes[dci_field])-1)));*/
return (uint16_t)((*dci_pdu64>>first_bit_position)&((1<<dci_fields_sizes[dci_field])-1));
} }
int nr_extract_dci_info(PHY_VARS_NR_UE *ue, int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment