Merge branch 'eurecom-develop' into episys-throughput-updates-and-downlink-siso-cm
This commit is contained in:
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -33,7 +33,9 @@ podSecurityContext:
|
||||
|
||||
securityContext:
|
||||
privileged: true
|
||||
# capabilities:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_CAP_PTRACE
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
|
||||
@@ -246,7 +246,7 @@ class PhySim:
|
||||
isFinished = False
|
||||
# doing a deep copy!
|
||||
tmpPodNames = podNames.copy()
|
||||
while(count < 32 and isFinished == False):
|
||||
while(count < 50 and isFinished == False):
|
||||
time.sleep(60)
|
||||
for podName in tmpPodNames:
|
||||
mySSH.command2(f'oc logs --tail=1 {podName} 2>&1', 6, silent=True)
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
|
||||
# Author: laurent THOMAS, Lionel GAUTHIER
|
||||
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (OpenAirInterface LANGUAGES C CXX)
|
||||
|
||||
include("macros.cmake")
|
||||
|
||||
# System packages that are required
|
||||
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
|
||||
@@ -48,6 +50,7 @@ include_directories(${CRYPTO_INCLUDE_DIRS})
|
||||
#uhd 4.0 and iris installs by default in /usr/local
|
||||
include_directories("/usr/local/include/")
|
||||
#use native cmake method as this package is not in pkg-config
|
||||
add_list2_option(RF_BOARD "None" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU" "EXMIMO")
|
||||
if (${RF_BOARD} STREQUAL "OAI_USRP")
|
||||
find_package(Boost REQUIRED)
|
||||
include_directories(${LIBBOOST_INCLUDE_DIR})
|
||||
@@ -184,106 +187,6 @@ else (CUDA_FOUND)
|
||||
message ("No CUDA tool installed")
|
||||
endif ()
|
||||
|
||||
|
||||
###########################################
|
||||
# macros to define options as there is numerous options in oai
|
||||
################################################
|
||||
macro(add_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endmacro(add_option)
|
||||
|
||||
macro(add_boolean_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY TYPE BOOL)
|
||||
if (${value})
|
||||
add_definitions("-D${name}")
|
||||
endif (${value})
|
||||
endmacro(add_boolean_option)
|
||||
|
||||
macro(add_integer_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endmacro(add_integer_option)
|
||||
|
||||
macro(add_list1_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endif()
|
||||
endmacro(add_list1_option)
|
||||
|
||||
macro(add_list2_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${value}=1")
|
||||
endif()
|
||||
endmacro(add_list2_option)
|
||||
|
||||
macro(add_list_string_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${name}=\"${value}\"")
|
||||
endif()
|
||||
endmacro(add_list_string_option)
|
||||
|
||||
# this function should produce the same value as the macro MAKE_VERSION defined in the C code (file types.h)
|
||||
function(make_version VERSION_VALUE)
|
||||
math(EXPR RESULT "0")
|
||||
foreach (ARG ${ARGN})
|
||||
math(EXPR RESULT "${RESULT} * 16 + ${ARG}")
|
||||
endforeach()
|
||||
set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(compile_asn1 asn1Source asn1cCmd ResultFlag)
|
||||
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
|
||||
execute_process(COMMAND ${asn1cCmd} ${asn1Source} RESULT_VARIABLE ret)
|
||||
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
|
||||
add_custom_target (
|
||||
${ResultFlag} ALL
|
||||
${asn1cCmd} ${asn1Source}
|
||||
DEPENDS ${asn1Source}
|
||||
)
|
||||
endmacro(compile_asn1)
|
||||
|
||||
####################################################
|
||||
# compilation flags
|
||||
#############################################
|
||||
@@ -341,10 +244,10 @@ set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11")
|
||||
|
||||
|
||||
|
||||
add_boolean_option(SANITIZE_ADDRESS False "enable the address sanitizer (ASan)")
|
||||
if (SANITIZE_ADDRESS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
|
||||
endif ()
|
||||
|
||||
add_definitions("-DASN_DISABLE_OER_SUPPORT")
|
||||
@@ -786,9 +689,6 @@ add_library(F1AP ${F1AP_C_FILES} )
|
||||
add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
|
||||
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
|
||||
|
||||
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU")
|
||||
|
||||
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
|
||||
#NOKIA config enhancement
|
||||
set (CONFIG_ROOTDIR
|
||||
${OPENAIR_DIR}/common/config
|
||||
|
||||
+66
-104
@@ -39,34 +39,24 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
|
||||
|
||||
XFORMS="True"
|
||||
SKIP_SHARED_LIB_FLAG="False"
|
||||
UE_EXPANSION="False"
|
||||
PRINT_STATS="False"
|
||||
VCD_TIMING="False"
|
||||
DEADLINE_SCHEDULER_FLAG_USER=""
|
||||
CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False
|
||||
REL="Rel15"
|
||||
HW="None"
|
||||
TP="Ethernet"
|
||||
EPC=0
|
||||
VERBOSE_CI=0
|
||||
VERBOSE_COMPILE=0
|
||||
CFLAGS_PROCESSOR_USER=""
|
||||
RUN_GROUP=0
|
||||
TEST_CASE_GROUP=""
|
||||
BUILD_DIR=ran_build
|
||||
BUILD_DOXYGEN=0
|
||||
BUILD_COVERITY_SCAN=0
|
||||
T_TRACER="True"
|
||||
DISABLE_HARDWARE_DEPENDENCY="False"
|
||||
CMAKE_BUILD_TYPE="RelWithDebInfo"
|
||||
CMAKE_CMD="$CMAKE"
|
||||
UE_AUTOTEST_TRACE="False"
|
||||
UE_DEBUG_TRACE="False"
|
||||
UE_TIMING_TRACE="False"
|
||||
USRP_REC_PLAY="False"
|
||||
BUILD_ECLIPSE=0
|
||||
NR="False"
|
||||
ITTI_SIM="False"
|
||||
SANITIZE_ADDRESS="False"
|
||||
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope"
|
||||
RU=0
|
||||
trap handle_ctrl_c INT
|
||||
@@ -82,6 +72,8 @@ Options
|
||||
Erase all files made by previous compilations, installations
|
||||
--clean-kernel
|
||||
Erase previously installed features in kernel: iptables, drivers, ...
|
||||
-d | --build-dir
|
||||
Sets build directory (will be <oai-root>/cmake_targets/<build-dir>/build)
|
||||
-I | --install-external-packages
|
||||
Installs required packages such as LibXML, asn1.1 compiler, freediameter, ...
|
||||
This option will require root password
|
||||
@@ -201,6 +193,9 @@ function main() {
|
||||
clean_kernel
|
||||
echo_info "Erased iptables config and removed modules from kernel"
|
||||
shift;;
|
||||
-d | --build-dir)
|
||||
BUILD_DIR=$2
|
||||
shift;;
|
||||
-I | --install-external-packages)
|
||||
INSTALL_EXTERNAL=1
|
||||
echo_info "Will install external packages"
|
||||
@@ -275,7 +270,7 @@ function main() {
|
||||
echo_info "Will compile NR UE"
|
||||
shift;;
|
||||
--mu)
|
||||
UE_EXPANSION="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DUE_EXPANSION=True -DPRE_SCD_THREAD=True"
|
||||
echo_info "Will compile with UE_EXPANSION"
|
||||
shift;;
|
||||
--UE-conf-nvram)
|
||||
@@ -299,7 +294,9 @@ function main() {
|
||||
*)
|
||||
echo_fatal "Unknown HW type $HW: exit..."
|
||||
esac
|
||||
echo_info "Setting hardware to: $HW"
|
||||
echo_info "Setting hardware to: $HW"
|
||||
#CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=\"${HW}\""
|
||||
CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=${HW}"
|
||||
shift 2;;
|
||||
-t | --transport)
|
||||
TP=$2
|
||||
@@ -323,7 +320,7 @@ function main() {
|
||||
shift 2;;
|
||||
-V | --vcd)
|
||||
echo_info "Setting gtk-wave output"
|
||||
VCD_TIMING=1
|
||||
CMAKE_CMD="$CMAKE_CMD -DENABLE_VCD_FIFO=True"
|
||||
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
|
||||
shift;;
|
||||
-x | --xforms)
|
||||
@@ -348,8 +345,8 @@ function main() {
|
||||
echo_info "Will compile with verbose instructions"
|
||||
shift;;
|
||||
--cflags_processor)
|
||||
CFLAGS_PROCESSOR_USER=$2
|
||||
echo_info "Setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
|
||||
CMAKE_CMD="$CMAKE_CMD -DCFLAGS_PROCESSOR_USER=\"$2\""
|
||||
echo_info "Setting CPU FLAGS from USER to: $2"
|
||||
shift 2;;
|
||||
--build-doxygen)
|
||||
BUILD_DOXYGEN=1
|
||||
@@ -361,22 +358,26 @@ function main() {
|
||||
shift;;
|
||||
--disable-deadline)
|
||||
DEADLINE_SCHEDULER_FLAG_USER="False"
|
||||
CMAKE_CMD="$CMAKE_CMD -DDEADLINE_SCHEDULER=False"
|
||||
echo_info "Disabling the usage of deadline scheduler"
|
||||
shift 1;;
|
||||
--enable-deadline)
|
||||
DEADLINE_SCHEDULER_FLAG_USER="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DDEADLINE_SCHEDULER=True"
|
||||
echo_info "Enabling the usage of deadline scheduler"
|
||||
shift 1;;
|
||||
--enable-cpu-affinity)
|
||||
CPU_AFFINITY_FLAG_USER="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=True"
|
||||
echo_info "Enabling CPU Affinity (only valid when not using deadline scheduler)"
|
||||
shift 1;;
|
||||
--disable-cpu-affinity)
|
||||
CPU_AFFINITY_FLAG_USER="False"
|
||||
CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=False"
|
||||
echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)"
|
||||
shift 1;;
|
||||
--disable-T-Tracer)
|
||||
T_TRACER="False"
|
||||
CMAKE_CMD="$CMAKE_CMD -DT_TRACER=False"
|
||||
echo_info "Disabling the T tracer"
|
||||
shift 1;;
|
||||
--disable-hardware-dependency)
|
||||
@@ -384,15 +385,15 @@ function main() {
|
||||
DISABLE_HARDWARE_DEPENDENCY="True"
|
||||
shift 1;;
|
||||
--ue-autotest-trace)
|
||||
UE_AUTOTEST_TRACE="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DUE_AUTOTEST_TRACE=True"
|
||||
echo_info "Enabling autotest specific trace for UE"
|
||||
shift 1;;
|
||||
--ue-trace)
|
||||
UE_DEBUG_TRACE="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DUE_DEBUG_TRACE=False"
|
||||
echo_info "Enabling UE trace for debug"
|
||||
shift 1;;
|
||||
--ue-timing)
|
||||
UE_TIMING_TRACE="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DUE_TIMING_TRACE=True"
|
||||
echo_info "Enabling UE timing trace"
|
||||
shift 1;;
|
||||
--uhd-images-dir)
|
||||
@@ -423,24 +424,20 @@ function main() {
|
||||
fi
|
||||
fi
|
||||
shift 2;;
|
||||
--usrp-recplay)
|
||||
USRP_REC_PLAY="True"
|
||||
echo_info "Enabling USRP record playback mode"
|
||||
shift 1;;
|
||||
-k | --skip-shared-libraries)
|
||||
SKIP_SHARED_LIB_FLAG="True"
|
||||
echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries"
|
||||
shift;;
|
||||
--ninja)
|
||||
CMAKE_CMD="$CMAKE_CMD -GNinja"
|
||||
MAKE_CMD=ninja
|
||||
shift;;
|
||||
--sanitize-address | -fsanitize=address)
|
||||
SANITIZE_ADDRESS=True
|
||||
shift;;
|
||||
--ittiSIM)
|
||||
--ninja)
|
||||
CMAKE_CMD="$CMAKE_CMD -GNinja"
|
||||
MAKE_CMD=ninja
|
||||
shift;;
|
||||
--sanitize-address | -fsanitize=address)
|
||||
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True"
|
||||
shift;;
|
||||
--ittiSIM)
|
||||
ittiSIM=1
|
||||
ITTI_SIM="True"
|
||||
CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True"
|
||||
echo_info "Will compile itti simulator"
|
||||
shift;;
|
||||
-h | --help)
|
||||
@@ -466,9 +463,6 @@ function main() {
|
||||
fi
|
||||
fi
|
||||
|
||||
CMAKE_CMD="$CMAKE_CMD .."
|
||||
echo_info "CMAKE_CMD=$CMAKE_CMD"
|
||||
|
||||
########################################################
|
||||
# Check validity of HW and TP parameters for eNB / gNB #
|
||||
########################################################
|
||||
@@ -508,6 +502,7 @@ function main() {
|
||||
#Disable CPU Affinity for deadline scheduler
|
||||
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
|
||||
CPU_AFFINITY_FLAG_USER="False"
|
||||
CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=False"
|
||||
fi
|
||||
|
||||
echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
|
||||
@@ -585,46 +580,13 @@ function main() {
|
||||
echo_info "3. building the compilation directives ..."
|
||||
|
||||
DIR=$OPENAIR_DIR/cmake_targets
|
||||
if [ "$T_TRACER" = "False" ] ; then
|
||||
build_dir=ran_build_noLOG
|
||||
else
|
||||
build_dir=ran_build
|
||||
fi
|
||||
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/$build_dir/build
|
||||
mkdir -p $DIR/$build_dir/build
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build
|
||||
mkdir -p $DIR/$BUILD_DIR/build
|
||||
|
||||
# configuration module libraries, one currently available, using libconfig
|
||||
config_libconfig_shlib=params_libconfig
|
||||
|
||||
# first generate the CMakefile in the right directory
|
||||
# softmodem compilation
|
||||
|
||||
cmake_file=$DIR/$build_dir/CMakeLists.txt
|
||||
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
|
||||
echo "project (OpenAirInterface)" >> $cmake_file
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
|
||||
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
|
||||
# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
|
||||
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
|
||||
echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
|
||||
echo "set ( PACKAGE_NAME \"${exec}\")" >> $cmake_file
|
||||
echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file
|
||||
echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >> $cmake_file
|
||||
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
|
||||
echo "set ( UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE )" >> $cmake_file
|
||||
echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )" >> $cmake_file
|
||||
echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file
|
||||
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
|
||||
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
|
||||
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
|
||||
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
|
||||
cd $DIR/$build_dir/build
|
||||
eval $CMAKE_CMD
|
||||
cd $DIR/$BUILD_DIR/build
|
||||
echo_info "running $CMAKE_CMD"
|
||||
eval $CMAKE_CMD ../..
|
||||
|
||||
execlist=""
|
||||
if [ "$eNB" = "1" ] ; then
|
||||
@@ -653,7 +615,7 @@ function main() {
|
||||
for f in $execlist ; do
|
||||
echo_info "Compiling $f..."
|
||||
compilations \
|
||||
$build_dir $f \
|
||||
$BUILD_DIR $f \
|
||||
$f $dbin/$f.$REL
|
||||
done
|
||||
|
||||
@@ -662,13 +624,16 @@ function main() {
|
||||
|
||||
if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
|
||||
echo_info "Building shared libraries common to UE and gNB"
|
||||
|
||||
# configuration module libraries, one currently available, using libconfig
|
||||
config_libconfig_shlib=params_libconfig
|
||||
|
||||
compilations \
|
||||
$build_dir $config_libconfig_shlib \
|
||||
$BUILD_DIR $config_libconfig_shlib \
|
||||
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
|
||||
|
||||
compilations \
|
||||
$build_dir coding \
|
||||
$BUILD_DIR coding \
|
||||
libcoding.so $dbin/libcoding.so
|
||||
|
||||
fi
|
||||
@@ -681,7 +646,7 @@ function main() {
|
||||
then
|
||||
echo_info "Building ue_ip module"
|
||||
compilations \
|
||||
$build_dir ue_ip \
|
||||
$BUILD_DIR ue_ip \
|
||||
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
|
||||
else
|
||||
echo_info "Bypassing ue_ip build"
|
||||
@@ -698,7 +663,7 @@ function main() {
|
||||
mkdir -p $DIR/nas_sim_tools/build
|
||||
cd $DIR/nas_sim_tools/build
|
||||
|
||||
eval $CMAKE_CMD
|
||||
eval $CMAKE_CMD ..
|
||||
compilations \
|
||||
nas_sim_tools usim \
|
||||
usim $dbin/usim
|
||||
@@ -712,16 +677,16 @@ function main() {
|
||||
# generate USIM data
|
||||
if [ -f $dbin/conf2uedata ]; then
|
||||
install_nas_tools $conf_nvram_path $gen_nvram_path "$dlog/conf2uedata.txt"
|
||||
echo_info "Copying UE specific part to $DIR/$build_dir/build"
|
||||
cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$build_dir/build
|
||||
cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build
|
||||
cp -Rvf $dbin/.usim.nvram0 $DIR/$build_dir/build
|
||||
echo_info "Copying UE specific part to $DIR/$BUILD_DIR/build"
|
||||
cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$BUILD_DIR/build
|
||||
cp -Rvf $dbin/.ue.nvram0 $DIR/$BUILD_DIR/build
|
||||
cp -Rvf $dbin/.usim.nvram0 $DIR/$BUILD_DIR/build
|
||||
else
|
||||
echo_warning "not generated UE NAS files: binaries not found"
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $DIR/$build_dir/build
|
||||
cd $DIR/$BUILD_DIR/build
|
||||
|
||||
##################
|
||||
# PHY simulators #
|
||||
@@ -739,9 +704,6 @@ function main() {
|
||||
compilations \
|
||||
ran_build coding \
|
||||
libcoding.so $dbin/libcoding.so
|
||||
# compilations \
|
||||
# lte-simulators $config_libconfig_shlib \
|
||||
# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
|
||||
fi
|
||||
|
||||
###################
|
||||
@@ -763,14 +725,14 @@ function main() {
|
||||
if [ "$HW" = "EXMIMO" ] ; then
|
||||
echo_info "Compiling Express MIMO 2 board drivers"
|
||||
compilations \
|
||||
$build_dir openair_rf \
|
||||
$BUILD_DIR openair_rf \
|
||||
CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko
|
||||
compilations \
|
||||
$build_dir updatefw \
|
||||
$BUILD_DIR updatefw \
|
||||
updatefw $dbin/updatefw
|
||||
echo_info "Compiling oarf tools. The logfile for compilation is here: $dlog/oarf.txt"
|
||||
make -C $OPENAIR_DIR/cmake_targets/$build_dir/build oarf > $dlog/oarf.txt 2>&1
|
||||
cp $OPENAIR_DIR/cmake_targets/$build_dir/build/*.oct $dbin
|
||||
make -C $OPENAIR_DIR/cmake_targets/$BUILD_DIR/build oarf > $dlog/oarf.txt 2>&1
|
||||
cp $OPENAIR_DIR/cmake_targets/$BUILD_DIR/build/*.oct $dbin
|
||||
if [ -s $dbin/oarf_config_exmimo.oct ] ; then
|
||||
echo_success "oarf tools compiled"
|
||||
else
|
||||
@@ -785,7 +747,7 @@ function main() {
|
||||
if [ ! -z "$BUILD_OPTLIB" ] ; then
|
||||
for oklib in $BUILD_OPTLIB ; do
|
||||
compilations \
|
||||
$build_dir $oklib \
|
||||
$BUILD_DIR $oklib \
|
||||
lib${oklib}.so $dbin/lib${oklib}.so
|
||||
done
|
||||
fi
|
||||
@@ -859,7 +821,7 @@ function main() {
|
||||
# link liboai_device.so with the selected RF device library
|
||||
if [ "$HW" == "EXMIMO" ] ; then
|
||||
compilations \
|
||||
$build_dir oai_exmimodevif \
|
||||
$BUILD_DIR oai_exmimodevif \
|
||||
liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
|
||||
|
||||
ln -sf liboai_exmimodevif.so liboai_device.so
|
||||
@@ -867,7 +829,7 @@ function main() {
|
||||
echo_info "liboai_device.so is linked to EXMIMO device library"
|
||||
elif [ "$HW" == "OAI_USRP" ] ; then
|
||||
compilations \
|
||||
$build_dir oai_usrpdevif \
|
||||
$BUILD_DIR oai_usrpdevif \
|
||||
liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
|
||||
|
||||
ln -sf liboai_usrpdevif.so liboai_device.so
|
||||
@@ -876,7 +838,7 @@ function main() {
|
||||
elif [ "$HW" == "OAI_BLADERF" ] ; then
|
||||
if [ -f "/usr/include/libbladeRF.h" ] ; then
|
||||
compilations \
|
||||
$build_dir oai_bladerfdevif \
|
||||
$BUILD_DIR oai_bladerfdevif \
|
||||
liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
|
||||
fi
|
||||
|
||||
@@ -886,7 +848,7 @@ function main() {
|
||||
elif [ "$HW" == "OAI_LMSSDR" ] ; then
|
||||
# if [ -f "/usr/include/libbladeRF.h" ] ; then
|
||||
compilations \
|
||||
$build_dir oai_lmssdrdevif \
|
||||
$BUILD_DIR oai_lmssdrdevif \
|
||||
liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
|
||||
# fi
|
||||
|
||||
@@ -895,7 +857,7 @@ function main() {
|
||||
echo_info "liboai_device.so is linked to LMSSDR device library"
|
||||
elif [ "$HW" == "OAI_IRIS" ] ; then
|
||||
compilations \
|
||||
$build_dir oai_irisdevif \
|
||||
$BUILD_DIR oai_irisdevif \
|
||||
liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
|
||||
|
||||
ln -s liboai_irisdevif.so liboai_device.so
|
||||
@@ -915,7 +877,7 @@ function main() {
|
||||
echo_info "liboai_device.so is linked to ADRV9371_ZC706 device library for Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
|
||||
elif [ "$HW" == "OAI_AW2SORI" ] ; then
|
||||
compilations \
|
||||
$build_dir aw2sori_transpro \
|
||||
$BUILD_DIR aw2sori_transpro \
|
||||
libaw2sori_transpro.so $dbin/libaw2sori_transpro.so.$REL
|
||||
|
||||
ln -sf libaw2sori_transpro.so libthirdparty_transpro.so
|
||||
@@ -930,12 +892,12 @@ function main() {
|
||||
if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
|
||||
echo_info "Compiling rfsimulator"
|
||||
compilations \
|
||||
$build_dir rfsimulator \
|
||||
$BUILD_DIR rfsimulator \
|
||||
librfsimulator.so $dbin/librfsimulator.so.$REL
|
||||
|
||||
echo_info "Compiling tcp_bridge_oai"
|
||||
compilations \
|
||||
$build_dir tcp_bridge_oai \
|
||||
$BUILD_DIR tcp_bridge_oai \
|
||||
libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
|
||||
fi
|
||||
|
||||
@@ -946,7 +908,7 @@ function main() {
|
||||
rm -f $dbin/liboai_transpro.so
|
||||
if [ "$TP" == "Ethernet" ]; then
|
||||
compilations \
|
||||
$build_dir oai_eth_transpro \
|
||||
$BUILD_DIR oai_eth_transpro \
|
||||
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
|
||||
ln -sf liboai_eth_transpro.so liboai_transpro.so
|
||||
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
|
||||
@@ -954,7 +916,7 @@ function main() {
|
||||
fi
|
||||
if [ "$TP" == "benetel4g" ]; then
|
||||
compilations \
|
||||
$build_dir benetel_4g \
|
||||
$BUILD_DIR benetel_4g \
|
||||
libbenetel_4g.so $dbin/libbenetel_4g.$REL
|
||||
ln -sf libbenetel_4g.so liboai_transpro.so
|
||||
ln -sf $dbin/libbenetel_4g.so.$REL $dbin/liboai_transpro.so
|
||||
@@ -962,7 +924,7 @@ function main() {
|
||||
fi
|
||||
if [ "$TP" == "benetel5g" ]; then
|
||||
compilations \
|
||||
$build_dir benetel_5g \
|
||||
$BUILD_DIR benetel_5g \
|
||||
libbenetel_5g.so $dbin/libbenetel_5g.$REL
|
||||
ln -sf libbenetel_5g.so liboai_transpro.so
|
||||
ln -sf $dbin/libbenetel_5g.so.$REL $dbin/liboai_transpro.so
|
||||
@@ -983,7 +945,7 @@ function main() {
|
||||
[ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/doxygen/build
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/doxygen/build
|
||||
cd $OPENAIR_DIR/cmake_targets/doxygen/build
|
||||
eval $CMAKE_CMD
|
||||
eval $CMAKE_CMD ..
|
||||
make doc
|
||||
) >& $doxygen_log
|
||||
fi
|
||||
|
||||
@@ -86,6 +86,7 @@ check_supported_distribution() {
|
||||
"ubuntu20.04") return 0 ;;
|
||||
"ubuntu20.10") return 0 ;;
|
||||
"ubuntu21.04") return 0 ;;
|
||||
"ubuntu21.10") return 0 ;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
###########################################
|
||||
# macros to define options as there is numerous options in oai
|
||||
################################################
|
||||
macro(add_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endmacro(add_option)
|
||||
|
||||
macro(add_boolean_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY TYPE BOOL)
|
||||
if (${value})
|
||||
add_definitions("-D${name}")
|
||||
endif (${value})
|
||||
endmacro(add_boolean_option)
|
||||
|
||||
macro(add_integer_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endmacro(add_integer_option)
|
||||
|
||||
macro(add_list1_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${name}=${value}")
|
||||
endif()
|
||||
endmacro(add_list1_option)
|
||||
|
||||
macro(add_list2_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${value}=1")
|
||||
endif()
|
||||
endmacro(add_list2_option)
|
||||
|
||||
macro(add_list_string_option name val helpstr)
|
||||
if(DEFINED ${name})
|
||||
set(value ${${name}})
|
||||
else(DEFINED ${name})
|
||||
set(value ${val})
|
||||
endif()
|
||||
set(${name} ${value} CACHE STRING "${helpstr}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
|
||||
if(NOT "${value}" STREQUAL "False")
|
||||
add_definitions("-D${name}=\"${value}\"")
|
||||
endif()
|
||||
endmacro(add_list_string_option)
|
||||
|
||||
# this function should produce the same value as the macro MAKE_VERSION defined in the C code (file types.h)
|
||||
function(make_version VERSION_VALUE)
|
||||
math(EXPR RESULT "0")
|
||||
foreach (ARG ${ARGN})
|
||||
math(EXPR RESULT "${RESULT} * 16 + ${ARG}")
|
||||
endforeach()
|
||||
set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(compile_asn1 asn1Source asn1cCmd ResultFlag)
|
||||
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
|
||||
execute_process(COMMAND ${asn1cCmd} ${asn1Source} RESULT_VARIABLE ret)
|
||||
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
|
||||
add_custom_target (
|
||||
${ResultFlag} ALL
|
||||
${asn1cCmd} ${asn1Source}
|
||||
DEPENDS ${asn1Source}
|
||||
)
|
||||
endmacro(compile_asn1)
|
||||
@@ -411,6 +411,16 @@ int register_log_component(char *name,
|
||||
return computed_compidx;
|
||||
}
|
||||
|
||||
static void unregister_all_log_components(void)
|
||||
{
|
||||
log_component_t* lc = &g_log->log_component[0];
|
||||
while (lc->name) {
|
||||
free((char *)lc->name); // defined as const, but assigned through strdup()
|
||||
free(lc->filelog_name);
|
||||
lc++;
|
||||
}
|
||||
}
|
||||
|
||||
int isLogInitDone (void)
|
||||
{
|
||||
if (g_log == NULL)
|
||||
@@ -502,6 +512,12 @@ int logInit (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void logTerm(void)
|
||||
{
|
||||
unregister_all_log_components();
|
||||
free_and_zero(g_log);
|
||||
}
|
||||
|
||||
#include <sys/syscall.h>
|
||||
static inline int log_header(log_component_t *c,
|
||||
char *log_buffer,
|
||||
|
||||
@@ -302,6 +302,7 @@ extern "C" {
|
||||
# include "log_if.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int logInit (void);
|
||||
void logTerm (void);
|
||||
int isLogInitDone (void);
|
||||
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
||||
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
|
||||
|
||||
@@ -69,7 +69,6 @@ char *loader_format_shlibpath(char *modname, char *version)
|
||||
char *tmpstr;
|
||||
char *shlibpath =NULL;
|
||||
char *shlibversion=NULL;
|
||||
char *cfgprefix;
|
||||
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0, NULL},
|
||||
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0, NULL}};
|
||||
|
||||
@@ -81,16 +80,11 @@ int ret;
|
||||
/* looks for specific path for this module in the config file */
|
||||
/* specific value for a module path and version is located in a modname subsection of the loader section */
|
||||
/* shared lib name is formatted as lib<module name><module version>.so */
|
||||
cfgprefix = malloc(sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16);
|
||||
if (cfgprefix == NULL) {
|
||||
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
|
||||
exit_fun("[LOADER] unrecoverable error");
|
||||
} else {
|
||||
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
|
||||
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
|
||||
}
|
||||
char cfgprefix[sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16];
|
||||
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
|
||||
ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
|
||||
}
|
||||
/* no specific path, use loader default shared lib path */
|
||||
if (shlibpath == NULL) {
|
||||
@@ -142,6 +136,7 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
|
||||
}
|
||||
|
||||
shlib_path = loader_format_shlibpath(modname, version);
|
||||
printf("shlib_path %s\n", shlib_path);
|
||||
|
||||
for (int i = 0; i < loader_data.numshlibs; i++) {
|
||||
if (strcmp(loader_data.shlibs[i].name, modname) == 0) {
|
||||
@@ -198,15 +193,17 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
|
||||
}
|
||||
|
||||
if (farray) {
|
||||
if (!loader_data.shlibs[lib_idx].funcarray) {
|
||||
loader_data.shlibs[lib_idx].funcarray = malloc(numf*sizeof(loader_shlibfunc_t));
|
||||
if (!loader_data.shlibs[lib_idx].funcarray) {
|
||||
loader_shlibdesc_t *shlib = &loader_data.shlibs[lib_idx];
|
||||
if (!shlib->funcarray) {
|
||||
shlib->funcarray = calloc(numf, sizeof(loader_shlibfunc_t));
|
||||
if (!shlib->funcarray) {
|
||||
fprintf(stderr, "[LOADER] load_module_shlib(): unable to allocate memory\n");
|
||||
ret = -1;
|
||||
goto load_module_shlib_exit;
|
||||
}
|
||||
shlib->len_funcarray = numf;
|
||||
shlib->numfunc = 0;
|
||||
}
|
||||
loader_data.shlibs[lib_idx].numfunc = 0;
|
||||
for (int i = 0; i < numf; i++) {
|
||||
farray[i].fptr = dlsym(lib_handle,farray[i].fname);
|
||||
if (!farray[i].fptr) {
|
||||
@@ -215,9 +212,32 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
|
||||
ret = -1;
|
||||
goto load_module_shlib_exit;
|
||||
}
|
||||
loader_data.shlibs[lib_idx].funcarray[i].fname=strdup(farray[i].fname);
|
||||
loader_data.shlibs[lib_idx].funcarray[i].fptr = farray[i].fptr;
|
||||
loader_data.shlibs[lib_idx].numfunc++;
|
||||
/* check whether this function has been loaded before */
|
||||
int j = 0;
|
||||
for (; j < shlib->numfunc; ++j) {
|
||||
if (shlib->funcarray[j].fptr == farray[i].fptr) {
|
||||
int rc = strcmp(shlib->funcarray[i].fname, farray[i].fname);
|
||||
AssertFatal(rc == 0,
|
||||
"reloading the same fptr with different fnames (%s, %s)\n",
|
||||
shlib->funcarray[i].fname, farray[i].fname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == shlib->numfunc) {
|
||||
if (shlib->numfunc == shlib->len_funcarray) {
|
||||
loader_shlibfunc_t *n = realloc(shlib->funcarray, shlib->numfunc * 2 * sizeof(loader_shlibfunc_t));
|
||||
if (!n) {
|
||||
fprintf(stderr, "[LOADER] %s(): unable to allocate memory\n", __func__);
|
||||
ret = -1;
|
||||
goto load_module_shlib_exit;
|
||||
}
|
||||
shlib->funcarray = n;
|
||||
shlib->len_funcarray = shlib->numfunc * 2;
|
||||
}
|
||||
shlib->funcarray[j].fname = strdup(farray[i].fname);
|
||||
shlib->funcarray[j].fptr = farray[i].fptr;
|
||||
shlib->numfunc++;
|
||||
}
|
||||
} /* for int i... */
|
||||
} else { /* farray ! NULL */
|
||||
sprintf(afname,"%s_getfarray",modname);
|
||||
@@ -248,3 +268,18 @@ void * get_shlibmodule_fptr(char *modname, char *fname)
|
||||
} /* for i loop on modules */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void loader_reset()
|
||||
{
|
||||
for (int i = 0; i < loader_data.numshlibs && loader_data.shlibs[i].name != NULL; i++) {
|
||||
loader_shlibdesc_t *shlib = &loader_data.shlibs[i];
|
||||
free(shlib->name);
|
||||
free(shlib->thisshlib_path);
|
||||
for (int j = 0; j < shlib->numfunc; ++j)
|
||||
free(shlib->funcarray[j].fname);
|
||||
free(shlib->funcarray);
|
||||
shlib->numfunc = 0;
|
||||
shlib->len_funcarray = 0;
|
||||
}
|
||||
free(loader_data.shlibs);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ typedef struct {
|
||||
char *thisshlib_path;
|
||||
uint32_t numfunc;
|
||||
loader_shlibfunc_t *funcarray;
|
||||
uint32_t len_funcarray;
|
||||
}loader_shlibdesc_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -90,5 +91,6 @@ extern void * get_shlibmodule_fptr(char *modname, char *fname);
|
||||
extern loader_data_t loader_data;
|
||||
#endif /* LOAD_MODULE_SHLIB_MAIN */
|
||||
#define load_module_shlib(M, F, N, I) load_module_version_shlib(M, NULL, F, N, I)
|
||||
void loader_reset();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -169,8 +169,7 @@ MACRLCs = (
|
||||
|
||||
|
||||
At the point of writing this document the control-plane exchanges between the CU and the DU over *F1-C* interface, as well as some IP traffic tests over *F1-U* have been validated using the OAI gNB/nrUE in RFSIMULATOR mode.
|
||||
|
||||
*These extensions are not yet fully integrated into develop branch, as they are under merge request. Until they get fully integrated, the CU/DU functionalities can be tested in [NR_F1C_F1U_extensions](https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/NR_F1C_F1U_extensions) branch.*
|
||||
|
||||
|
||||
## 1.2 OAI 5G Core Network installation and configuration
|
||||
The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using `docker-compose` can be found [here](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/README.md).
|
||||
@@ -264,12 +263,12 @@ the gNB can be launched in 2 modes:
|
||||
1. Launch the CU component:
|
||||
```bash
|
||||
sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa \
|
||||
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf
|
||||
-O ../../../ci-scripts/conf_files/gNB_SA_CU.conf
|
||||
```
|
||||
2. Launch the DU component:
|
||||
```bash
|
||||
sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa \
|
||||
-O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf
|
||||
-O ../../../ci-scripts/conf_files/gNB_SA_DU.conf
|
||||
```
|
||||
|
||||
- To launch the OAI UE (valid in `monolithic` gNB and `CU/DU split` gNB):
|
||||
|
||||
@@ -31,11 +31,14 @@ RUN rm -Rf /oai-ran
|
||||
WORKDIR /oai-ran
|
||||
COPY . .
|
||||
|
||||
#only install address sanitizer for this container, the others don't need it
|
||||
RUN yum install -y libasan
|
||||
|
||||
#run build_oai to build the target image
|
||||
RUN /bin/sh oaienv && \
|
||||
cd cmake_targets && \
|
||||
mkdir -p log && \
|
||||
./build_oai --phy_simulators --ninja --verbose-ci
|
||||
./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
|
||||
@@ -85,6 +88,7 @@ COPY --from=phy-sim-build \
|
||||
/lib64/liblapack.so.3 \
|
||||
/lib64/libexslt.so.0 \
|
||||
/lib64/libxslt.so.1 \
|
||||
/usr/lib64/libasan.so.5 \
|
||||
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
|
||||
/oai-ran/cmake_targets/ran_build/build/libSIMU.so \
|
||||
/oai-ran/cmake_targets/ran_build/build/libldpc.so \
|
||||
|
||||
@@ -593,6 +593,7 @@ void init_pdcp(void) {
|
||||
|
||||
if (!get_softmodem_params()->nsa) {
|
||||
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
|
||||
pdcp_layer_init();
|
||||
nr_pdcp_module_init(pdcp_initmask, 0);
|
||||
}
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -168,10 +168,10 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
// initialize all signal buffers
|
||||
init_nr_ue_signal(ue, nb_connected_gNB, abstraction_flag);
|
||||
init_nr_ue_signal(ue, nb_connected_gNB);
|
||||
|
||||
// intialize transport
|
||||
init_nr_ue_transport(ue, abstraction_flag);
|
||||
init_nr_ue_transport(ue);
|
||||
|
||||
// init N_TA offset
|
||||
init_N_TA_offset(ue);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include "assertions.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
|
||||
@@ -118,15 +119,13 @@ int test_ldpc(short No_iteration,
|
||||
//short test_input[block_length];
|
||||
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
|
||||
//short *c; //padded codeword
|
||||
unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
|
||||
unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
|
||||
unsigned char *test_input_bit;
|
||||
unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length];
|
||||
memset(estimated_output, 0, sizeof(estimated_output));
|
||||
unsigned char *channel_input[MAX_NUM_DLSCH_SEGMENTS];
|
||||
unsigned char *channel_output_uncoded[MAX_NUM_DLSCH_SEGMENTS];
|
||||
unsigned char *channel_input_optim[MAX_NUM_DLSCH_SEGMENTS];
|
||||
double *channel_output;
|
||||
double *modulated_input[MAX_NUM_DLSCH_SEGMENTS];
|
||||
char *channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS];
|
||||
//double channel_output[68 * 384];
|
||||
double modulated_input[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
|
||||
char channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
|
||||
unsigned int i,j,trial=0;
|
||||
short BG=0,nrows=0;//,ncols;
|
||||
int no_punctured_columns,removed_bit;
|
||||
@@ -155,24 +154,12 @@ int test_ldpc(short No_iteration,
|
||||
// generate input block
|
||||
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
|
||||
test_input[j]=(unsigned char *)malloc16(sizeof(unsigned char) * block_length/8);
|
||||
memset(test_input[j], 0, sizeof(unsigned char) * block_length / 8);
|
||||
channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
|
||||
memset(channel_input[j], 0, sizeof(unsigned char) * 68 * 384);
|
||||
channel_input_optim[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
|
||||
channel_output_uncoded[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
|
||||
estimated_output[j] = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);
|
||||
estimated_output_bit[j] = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);
|
||||
modulated_input[j] = (double *)malloc16(sizeof(double) * 68*384);
|
||||
channel_output_fixed[j] = (char *)malloc16(sizeof( char) * 68*384);
|
||||
memset(channel_input_optim[j], 0, sizeof(unsigned char) * 68 * 384);
|
||||
}
|
||||
//modulated_input = (double *)malloc(sizeof(double) * 68*384);
|
||||
//channel_output = (double *)malloc(sizeof(double) * 68*384);
|
||||
//channel_output_fixed = (char *)malloc16(sizeof(char) * 68*384);
|
||||
//modulated_input = (double *)calloc(68*384, sizeof(double));
|
||||
channel_output = (double *)calloc(68*384, sizeof(double));
|
||||
//channel_output_fixed = (double *)calloc(68*384, sizeof(double));
|
||||
//channel_output_fixed = (unsigned char*)calloc(68*384, sizeof(unsigned char*));
|
||||
//estimated_output = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);///8);
|
||||
//estimated_output_bit = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);
|
||||
test_input_bit = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);
|
||||
|
||||
reset_meas(&time);
|
||||
reset_meas(time_optim);
|
||||
@@ -319,7 +306,6 @@ int test_ldpc(short No_iteration,
|
||||
for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++)
|
||||
if (channel_input[j][i]!=channel_input_optim[j][i]) {
|
||||
printf("differ in seg %u pos %u (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]);
|
||||
free(channel_output);
|
||||
return (-1);
|
||||
}
|
||||
//else{
|
||||
@@ -367,12 +353,9 @@ int test_ldpc(short No_iteration,
|
||||
//channel_output_fixed[i] = (char)quantize(1,channel_output_fixed[i],qbits);
|
||||
|
||||
//Uncoded BER
|
||||
if (channel_output_fixed[j][i]<0)
|
||||
channel_output_uncoded[j][i]=1; //QPSK demod
|
||||
else
|
||||
channel_output_uncoded[j][i]=0;
|
||||
unsigned char channel_output_uncoded = channel_output_fixed[j][i]<0 ? 1 /* QPSK demod */ : 0;
|
||||
|
||||
if (channel_output_uncoded[j][i] != channel_input_optim[j][i-2*Zc])
|
||||
if (channel_output_uncoded != channel_input_optim[j][i-2*Zc])
|
||||
*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
|
||||
|
||||
}
|
||||
@@ -423,12 +406,10 @@ int test_ldpc(short No_iteration,
|
||||
|
||||
for (i=0; i<block_length; i++)
|
||||
{
|
||||
estimated_output_bit[j][i] = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7);
|
||||
test_input_bit[i] = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
|
||||
if (estimated_output_bit[j][i] != test_input_bit[i])
|
||||
{
|
||||
unsigned char estoutputbit = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7);
|
||||
unsigned char inputbit = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
|
||||
if (estoutputbit != inputbit)
|
||||
*errors_bit = (*errors_bit) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//if (*errors == 1000)
|
||||
@@ -460,17 +441,8 @@ int test_ldpc(short No_iteration,
|
||||
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
|
||||
free(test_input[j]);
|
||||
free(channel_input[j]);
|
||||
free(channel_output_uncoded[j]);
|
||||
free(channel_input_optim[j]);
|
||||
free(modulated_input[j]);
|
||||
free(channel_output_fixed[j]);
|
||||
free(estimated_output[j]);
|
||||
free(estimated_output_bit[j]);
|
||||
}
|
||||
//free(modulated_input);
|
||||
free(channel_output);
|
||||
//free(channel_output_fixed);
|
||||
//free(estimated_output);
|
||||
|
||||
nrLDPC_free_mem(p_nrLDPC_procBuf);
|
||||
|
||||
@@ -728,5 +700,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//Default simulation values (Aim for iterations = 1000000.)
|
||||
//Default simulation values (Aim for iterations = 1000000.)
|
||||
int decoder_int16=0;
|
||||
int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, 2=UCI
|
||||
double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB
|
||||
@@ -158,20 +158,25 @@ if (logFlag){
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t testArrayLength = ceil(testLength / 32.0);
|
||||
uint8_t coderArrayLength = ceil(coderLength / 32.0);
|
||||
uint32_t testInput[testArrayLength]; //generate randomly
|
||||
const uint8_t testArrayLength = ceil(testLength / 32.0);
|
||||
const uint8_t coderArrayLength = ceil(coderLength / 32.0);
|
||||
// in the polar code, often uint64_t arrays are used, but we work with
|
||||
// uint32_t arrays below, so realArrayLength is the length that always
|
||||
// satisfies uint64_t array length
|
||||
const uint8_t realArrayLength = ((testArrayLength + 1) / 2) * 2;
|
||||
printf("testArrayLength %d realArrayLength %d\n", testArrayLength, realArrayLength);
|
||||
uint32_t testInput[realArrayLength]; //generate randomly
|
||||
uint32_t encoderOutput[coderArrayLength];
|
||||
uint32_t estimatedOutput[testArrayLength]; //decoder output
|
||||
memset(testInput,0,sizeof(uint32_t) * testArrayLength);
|
||||
uint32_t estimatedOutput[realArrayLength]; //decoder output
|
||||
memset(testInput,0,sizeof(uint32_t) * realArrayLength); // does not reset all
|
||||
memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength);
|
||||
memset(estimatedOutput,0,sizeof(uint32_t) * testArrayLength);
|
||||
memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength);
|
||||
uint8_t encoderOutputByte[coderLength];
|
||||
double modulatedInput[coderLength]; //channel input
|
||||
double channelOutput[coderLength]; //add noise
|
||||
int16_t channelOutput_int16[coderLength];
|
||||
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level, 1, NULL);
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level, true);
|
||||
|
||||
#ifdef DEBUG_DCI_POLAR_PARAMS
|
||||
uint32_t dci_pdu[4];
|
||||
@@ -206,7 +211,8 @@ if (logFlag){
|
||||
modulated_input[i]=(-1)/sqrt(2);
|
||||
channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin)));
|
||||
}
|
||||
decoderState = polar_decoder_dci(channel_output, dci_est, currentPtrDCI, NR_POLAR_DECODER_LISTSIZE, rnti);
|
||||
decoderState = polar_decoder_dci(channel_output, dci_est, NR_POLAR_DECODER_LISTSIZE, rnti,
|
||||
1, size, aggregation_level);
|
||||
printf("dci_est: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]);
|
||||
free(encoder_outputByte);
|
||||
free(channel_output);
|
||||
@@ -239,13 +245,13 @@ if (logFlag){
|
||||
|
||||
start_meas(&timeEncoder);
|
||||
if (decoder_int16==1) {
|
||||
polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, currentPtr);
|
||||
polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, polarMessageType, testLength, aggregation_level);
|
||||
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr);
|
||||
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
|
||||
if (polarMessageType == 0)
|
||||
polar_encoder(testInput, encoderOutput, currentPtr);
|
||||
polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level);
|
||||
else if (polarMessageType == 1)
|
||||
polar_encoder_dci(testInput, encoderOutput, currentPtr, rnti);
|
||||
polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level);
|
||||
}
|
||||
stop_meas(&timeEncoder);
|
||||
|
||||
@@ -276,19 +282,20 @@ if (logFlag){
|
||||
start_meas(&timeDecoder);
|
||||
|
||||
if (decoder_int16==1) {
|
||||
decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0, currentPtr);
|
||||
decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0,
|
||||
polarMessageType, testLength, aggregation_level);
|
||||
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
|
||||
if (polarMessageType == 0) {
|
||||
decoderState = polar_decoder(channelOutput,
|
||||
estimatedOutput,
|
||||
currentPtr,
|
||||
decoderListSize);
|
||||
decoderState = polar_decoder(channelOutput,
|
||||
estimatedOutput,
|
||||
decoderListSize,
|
||||
polarMessageType, testLength, aggregation_level);
|
||||
} else if (polarMessageType == 1) {
|
||||
decoderState = polar_decoder_dci(channelOutput,
|
||||
estimatedOutput,
|
||||
currentPtr,
|
||||
decoderListSize,
|
||||
rnti);
|
||||
decoderState = polar_decoder_dci(channelOutput,
|
||||
estimatedOutput,
|
||||
decoderListSize,
|
||||
rnti,
|
||||
polarMessageType, testLength, aggregation_level);
|
||||
}
|
||||
}
|
||||
stop_meas(&timeDecoder);
|
||||
@@ -334,9 +341,9 @@ if (logFlag){
|
||||
decoderState=0;
|
||||
nBitError=0;
|
||||
blockErrorState=0;
|
||||
memset(testInput,0,sizeof(uint32_t) * testArrayLength);
|
||||
memset(testInput,0,sizeof(uint32_t) * realArrayLength);
|
||||
memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength);
|
||||
memset(estimatedOutput,0,sizeof(uint32_t) * testArrayLength);
|
||||
memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength);
|
||||
}
|
||||
|
||||
//Calculate error statistics for the SNR.
|
||||
|
||||
@@ -29,12 +29,13 @@ uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits){
|
||||
uint8_t crcPolynomialSize = 24;
|
||||
uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize];
|
||||
|
||||
uint8_t **crc_generator_matrix = malloc(payloadSizeBits * sizeof(uint8_t *));
|
||||
uint8_t **crc_generator_matrix = malloc(payloadSizeBits*sizeof(uint8_t *) + payloadSizeBits*crcPolynomialSize*sizeof(uint8_t));
|
||||
if (crc_generator_matrix)
|
||||
for (int i = 0; i < payloadSizeBits; i++)
|
||||
crc_generator_matrix[i] = malloc(crcPolynomialSize * sizeof(uint8_t));
|
||||
crc_generator_matrix[i] = ((uint8_t*)&crc_generator_matrix[payloadSizeBits])+i*crcPolynomialSize;
|
||||
|
||||
for (int i = 0; i < crcPolynomialSize; i++) crc_generator_matrix[payloadSizeBits-1][i]=crcPolynomialPattern[i+1];
|
||||
for (int i = 0; i < crcPolynomialSize; i++)
|
||||
crc_generator_matrix[payloadSizeBits-1][i]=crcPolynomialPattern[i+1];
|
||||
|
||||
for (int i = payloadSizeBits-2; i >= 0; i--){
|
||||
for (int j = 0; j < crcPolynomialSize-1; j++) temp1[j]=crc_generator_matrix[i+1][j+1];
|
||||
|
||||
@@ -39,19 +39,44 @@
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
#include "assertions.h"
|
||||
|
||||
static inline void updateCrcChecksum2(int xlen,
|
||||
int ylen,
|
||||
uint8_t crcChecksum[xlen][ylen],
|
||||
int gxlen,
|
||||
int gylen,
|
||||
uint8_t crcGen[gxlen][gylen],
|
||||
uint8_t listSize,
|
||||
uint32_t i2,
|
||||
uint8_t len)
|
||||
{
|
||||
for (uint8_t i = 0; i < listSize; i++) {
|
||||
for (uint8_t j = 0; j < len; j++) {
|
||||
crcChecksum[j][i+listSize] = ( (crcChecksum[j][i] + crcGen[i2][j]) % 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int8_t polar_decoder(double *input,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint8_t listSize)
|
||||
uint8_t listSize,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level
|
||||
)
|
||||
{
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
|
||||
//Assumes no a priori knowledge.
|
||||
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
|
||||
uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
uint8_t **llrUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
double ***llr = nr_alloc_double_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
|
||||
uint8_t **crcChecksum = nr_alloc_uint8_2D_array(polarParams->crcParityBits, 2*listSize);
|
||||
double *pathMetric = malloc(sizeof(double)*(2*listSize));
|
||||
uint8_t *crcState = malloc(sizeof(uint8_t)*(2*listSize)); //0=False, 1=True
|
||||
uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
|
||||
memset(bit,0,sizeof bit);
|
||||
uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
|
||||
memset(bitUpdated,0,sizeof bitUpdated);
|
||||
uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
|
||||
memset(llrUpdated,0,sizeof llrUpdated);
|
||||
double llr[polarParams->N][polarParams->n+1][2*listSize];
|
||||
uint8_t crcChecksum[polarParams->crcParityBits][2*listSize];
|
||||
memset(crcChecksum,0,sizeof crcChecksum);
|
||||
double pathMetric[2*listSize];
|
||||
uint8_t crcState[2*listSize]; //0=False, 1=True
|
||||
|
||||
for (int i=0; i<(2*listSize); i++) {
|
||||
pathMetric[i] = 0;
|
||||
@@ -63,13 +88,8 @@ int8_t polar_decoder(double *input,
|
||||
bitUpdated[i][0]=((polarParams->information_bit_pattern[i]+1) % 2);
|
||||
}
|
||||
|
||||
uint8_t **extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3
|
||||
uint8_t **tempECGM = malloc(polarParams->K * sizeof(uint8_t *)); //G_P2
|
||||
|
||||
for (int i = 0; i < polarParams->K; i++) {
|
||||
extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
|
||||
tempECGM[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
|
||||
}
|
||||
uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3
|
||||
uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2
|
||||
|
||||
for (int i=0; i<polarParams->payloadBits; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) {
|
||||
@@ -102,7 +122,7 @@ int8_t polar_decoder(double *input,
|
||||
}
|
||||
}
|
||||
|
||||
double *d_tilde = malloc(sizeof(double) * polarParams->N);
|
||||
double d_tilde[polarParams->N];
|
||||
nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
||||
|
||||
for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0]=d_tilde[j];
|
||||
@@ -117,31 +137,33 @@ int8_t polar_decoder(double *input,
|
||||
uint8_t listIndex[2*listSize], copyIndex;
|
||||
|
||||
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) {
|
||||
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
|
||||
updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n+1, 2*listSize, llr, llrUpdated, bit, bitUpdated);
|
||||
|
||||
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
|
||||
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
|
||||
updatePathMetric(pathMetric, currentListSize, 0, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
|
||||
} else { //Information or CRC bit.
|
||||
updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
|
||||
updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
|
||||
|
||||
for (int i = 0; i < currentListSize; i++) {
|
||||
for (int j = 0; j < polarParams->N; j++) {
|
||||
for (int k = 0; k < (polarParams->n+1); k++) {
|
||||
for (int j = 0; j < polarParams->N; j++) {
|
||||
for (int k = 0; k < (polarParams->n+1); k++) {
|
||||
bit[j][k][i+currentListSize]=bit[j][k][i];
|
||||
llr[j][k][i+currentListSize]=llr[j][k][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < currentListSize; i++) {
|
||||
bit[currentBit][0][i]=0;
|
||||
crcState[i+currentListSize]=crcState[i];
|
||||
}
|
||||
for (int i = 0; i < currentListSize; i++) {
|
||||
bit[currentBit][0][i]=0;
|
||||
crcState[i+currentListSize]=crcState[i];
|
||||
}
|
||||
|
||||
for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1;
|
||||
|
||||
bitUpdated[currentBit][0]=1;
|
||||
updateCrcChecksum2(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
|
||||
updateCrcChecksum2(polarParams->crcParityBits, 2*listSize, crcChecksum,
|
||||
polarParams->K, polarParams->crcParityBits, extended_crc_generator_matrix,
|
||||
currentListSize, nonFrozenBit, polarParams->crcParityBits);
|
||||
currentListSize*=2;
|
||||
|
||||
//Keep only the best "listSize" number of entries.
|
||||
@@ -246,14 +268,7 @@ int8_t polar_decoder(double *input,
|
||||
|
||||
if (decoderIterationCheck==0) {
|
||||
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
|
||||
free(d_tilde);
|
||||
free(pathMetric);
|
||||
free(crcState);
|
||||
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
|
||||
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
|
||||
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
|
||||
free(tempECGM);
|
||||
return(-1);
|
||||
polarReturn(-1);
|
||||
}
|
||||
|
||||
nonFrozenBit++;
|
||||
@@ -282,33 +297,34 @@ int8_t polar_decoder(double *input,
|
||||
}
|
||||
}
|
||||
|
||||
free(d_tilde);
|
||||
free(pathMetric);
|
||||
free(crcState);
|
||||
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
|
||||
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
|
||||
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
|
||||
nr_free_uint8_2D_array(extended_crc_generator_matrix, polarParams->K);
|
||||
nr_free_uint8_2D_array(tempECGM, polarParams->K);
|
||||
/*
|
||||
* Return bits.
|
||||
*/
|
||||
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
|
||||
return(0);
|
||||
|
||||
polarReturn 0;
|
||||
}
|
||||
|
||||
int8_t polar_decoder_dci(double *input,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint8_t listSize,
|
||||
uint16_t n_RNTI) {
|
||||
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
|
||||
uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
uint8_t **llrUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
double ***llr = nr_alloc_double_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
|
||||
uint8_t **crcChecksum = nr_alloc_uint8_2D_array(polarParams->crcParityBits, 2*listSize);
|
||||
double *pathMetric = malloc(sizeof(double)*(2*listSize));
|
||||
uint8_t *crcState = malloc(sizeof(uint8_t)*(2*listSize)); //0=False, 1=True
|
||||
uint16_t n_RNTI,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level ) {
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
|
||||
|
||||
uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
|
||||
memset(bit,0,sizeof bit);
|
||||
uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
|
||||
memset(bitUpdated,0,sizeof bitUpdated);
|
||||
uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
|
||||
memset(llrUpdated,0,sizeof llrUpdated);
|
||||
double llr[polarParams->N][polarParams->n+1][2*listSize];
|
||||
uint8_t crcChecksum[polarParams->crcParityBits][2*listSize];
|
||||
memset(crcChecksum,0,sizeof crcChecksum);
|
||||
double pathMetric[2*listSize];
|
||||
uint8_t crcState[2*listSize]; //0=False, 1=True
|
||||
uint8_t extended_crc_scrambling_pattern[polarParams->crcParityBits];
|
||||
|
||||
for (int i=0; i<(2*listSize); i++) {
|
||||
@@ -321,13 +337,8 @@ int8_t polar_decoder_dci(double *input,
|
||||
bitUpdated[i][0]=((polarParams->information_bit_pattern[i]+1) % 2);
|
||||
}
|
||||
|
||||
uint8_t **extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3: K-by-P
|
||||
uint8_t **tempECGM = malloc(polarParams->K * sizeof(uint8_t *)); //G_P2: K-by-P
|
||||
|
||||
for (int i = 0; i < polarParams->K; i++) {
|
||||
extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
|
||||
tempECGM[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
|
||||
}
|
||||
uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3: K-by-P
|
||||
uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2: K-by-P
|
||||
|
||||
for (int i=0; i<polarParams->payloadBits; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) {
|
||||
@@ -366,17 +377,19 @@ int8_t polar_decoder_dci(double *input,
|
||||
extended_crc_scrambling_pattern[i]=(n_RNTI>>(23-i))&1;
|
||||
}
|
||||
|
||||
double *d_tilde = malloc(sizeof(double) * polarParams->N);
|
||||
double d_tilde[polarParams->N];
|
||||
nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
||||
|
||||
for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0]=d_tilde[j];
|
||||
for (int j = 0; j < polarParams->N; j++)
|
||||
llr[j][polarParams->n][0]=d_tilde[j];
|
||||
|
||||
/*
|
||||
* SCL polar decoder.
|
||||
*/
|
||||
|
||||
for (int i=0; i<polarParams->crcParityBits; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) crcChecksum[i][0]=crcChecksum[i][0]+polarParams->crc_generator_matrix[j][i];
|
||||
for (int j=0; j<polarParams->crcParityBits; j++)
|
||||
crcChecksum[i][0]=crcChecksum[i][0]+polarParams->crc_generator_matrix[j][i];
|
||||
|
||||
crcChecksum[i][0]=(crcChecksum[i][0]%2);
|
||||
}
|
||||
@@ -388,12 +401,12 @@ int8_t polar_decoder_dci(double *input,
|
||||
uint8_t listIndex[2*listSize], copyIndex;
|
||||
|
||||
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) {
|
||||
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
|
||||
updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n+1, 2*listSize, llr, llrUpdated, bit, bitUpdated);
|
||||
|
||||
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
|
||||
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
|
||||
updatePathMetric(pathMetric, currentListSize, 0, currentBit,polarParams->N, polarParams->n+1, 2*listSize, llr);
|
||||
} else { //Information or CRC bit.
|
||||
updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
|
||||
updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
|
||||
|
||||
for (int i = 0; i < currentListSize; i++) {
|
||||
for (int j = 0; j < polarParams->N; j++) {
|
||||
@@ -412,7 +425,9 @@ int8_t polar_decoder_dci(double *input,
|
||||
for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1;
|
||||
|
||||
bitUpdated[currentBit][0]=1;
|
||||
updateCrcChecksum2(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
|
||||
updateCrcChecksum2(polarParams->crcParityBits, 2*listSize, crcChecksum,
|
||||
polarParams->K, polarParams->crcParityBits, extended_crc_generator_matrix,
|
||||
currentListSize, nonFrozenBit, polarParams->crcParityBits);
|
||||
currentListSize*=2;
|
||||
|
||||
//Keep only the best "listSize" number of entries.
|
||||
@@ -513,18 +528,12 @@ int8_t polar_decoder_dci(double *input,
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < currentListSize; i++) decoderIterationCheck+=crcState[i];
|
||||
for (uint8_t i = 0; i < currentListSize; i++)
|
||||
decoderIterationCheck+=crcState[i];
|
||||
|
||||
if (decoderIterationCheck==0) {
|
||||
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
|
||||
free(d_tilde);
|
||||
free(pathMetric);
|
||||
free(crcState);
|
||||
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
|
||||
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
|
||||
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
|
||||
free(tempECGM);
|
||||
return(-1);
|
||||
polarReturn -1;
|
||||
}
|
||||
|
||||
nonFrozenBit++;
|
||||
@@ -553,19 +562,12 @@ int8_t polar_decoder_dci(double *input,
|
||||
}
|
||||
}
|
||||
|
||||
free(d_tilde);
|
||||
free(pathMetric);
|
||||
free(crcState);
|
||||
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
|
||||
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
|
||||
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
|
||||
nr_free_uint8_2D_array(extended_crc_generator_matrix, polarParams->K);
|
||||
nr_free_uint8_2D_array(tempECGM, polarParams->K);
|
||||
/*
|
||||
* Return bits.
|
||||
*/
|
||||
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
|
||||
return(0);
|
||||
|
||||
polarReturn 0;
|
||||
}
|
||||
|
||||
void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
|
||||
@@ -604,8 +606,11 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
|
||||
uint32_t polar_decoder_int16(int16_t *input,
|
||||
uint64_t *out,
|
||||
uint8_t ones_flag,
|
||||
const t_nrPolar_params *polarParams)
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level )
|
||||
{
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
|
||||
int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N);
|
||||
nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
||||
|
||||
@@ -702,5 +707,6 @@ uint32_t polar_decoder_int16(int16_t *input,
|
||||
rxcrc,polarParams->payloadBits);
|
||||
#endif
|
||||
out[0]=Ar;
|
||||
return(crc^rxcrc);
|
||||
|
||||
polarReturn crc^rxcrc;
|
||||
}
|
||||
|
||||
@@ -36,51 +36,25 @@
|
||||
|
||||
//#define DEBUG_NEW_IMPL 1
|
||||
|
||||
void updateLLR(double ***llr,
|
||||
uint8_t **llrU,
|
||||
uint8_t ***bit,
|
||||
uint8_t **bitU,
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen)
|
||||
{
|
||||
uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
|
||||
for (uint8_t i=0; i<listSize; i++) {
|
||||
if (( (row) % (2*offset) ) >= offset ) {
|
||||
if(bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen);
|
||||
if(llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen);
|
||||
if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
|
||||
llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i];
|
||||
} else {
|
||||
if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
|
||||
if(llrU[row+offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row+offset), (col+1), xlen, ylen);
|
||||
computeLLR(llr, row, col, i, offset);
|
||||
}
|
||||
}
|
||||
llrU[row][col]=1;
|
||||
|
||||
// printf("LLR (a %f, b %f): llr[%d][%d] %f\n",32*a,32*b,col,row,32*llr[col][row]);
|
||||
}
|
||||
|
||||
void updateBit(uint8_t ***bit,
|
||||
uint8_t **bitU,
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen)
|
||||
static inline void updateBit(uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen,
|
||||
int zlen,
|
||||
uint8_t bit[xlen][ylen][zlen],
|
||||
uint8_t bitU[xlen][ylen])
|
||||
{
|
||||
uint16_t offset = ( xlen/(pow(2,(ylen-col))) );
|
||||
|
||||
for (uint8_t i=0; i<listSize; i++) {
|
||||
if (( (row) % (2*offset) ) >= offset ) {
|
||||
if (bitU[row][col-1]==0) updateBit(bit, bitU, listSize, row, (col-1), xlen, ylen);
|
||||
if (bitU[row][col-1]==0) updateBit(listSize, row, (col-1), xlen, ylen, zlen, bit, bitU);
|
||||
bit[row][col][i] = bit[row][col-1][i];
|
||||
} else {
|
||||
if (bitU[row][col-1]==0) updateBit(bit, bitU, listSize, row, (col-1), xlen, ylen);
|
||||
if (bitU[row+offset][col-1]==0) updateBit(bit, bitU, listSize, (row+offset), (col-1), xlen, ylen);
|
||||
if (bitU[row][col-1]==0) updateBit(listSize, row, (col-1), xlen, ylen, zlen, bit, bitU);
|
||||
if (bitU[row+offset][col-1]==0) updateBit(listSize, (row+offset), (col-1), xlen, ylen, zlen, bit, bitU);
|
||||
bit[row][col][i] = ( (bit[row][col-1][i]+bit[row+offset][col-1][i]) % 2);
|
||||
}
|
||||
}
|
||||
@@ -88,11 +62,60 @@ void updateBit(uint8_t ***bit,
|
||||
bitU[row][col]=1;
|
||||
}
|
||||
|
||||
static inline void computeLLR(uint16_t row,
|
||||
uint16_t col,
|
||||
uint8_t i,
|
||||
uint16_t offset,
|
||||
int xlen,
|
||||
int ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen])
|
||||
{
|
||||
double a = llr[row][col + 1][i];
|
||||
double b = llr[row + offset][col + 1][i];
|
||||
llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); //eq. (8a)
|
||||
}
|
||||
|
||||
|
||||
void updateLLR(uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen],
|
||||
uint8_t llrU[xlen][ylen],
|
||||
uint8_t bit[xlen][ylen][zlen],
|
||||
uint8_t bitU[xlen][ylen]
|
||||
)
|
||||
{
|
||||
uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
|
||||
for (uint8_t i=0; i<listSize; i++) {
|
||||
if (( (row) % (2*offset) ) >= offset ) {
|
||||
if(bitU[row-offset][col]==0) updateBit(listSize, (row-offset), col, xlen, ylen, zlen, bit, bitU);
|
||||
if(llrU[row-offset][col+1]==0) updateLLR(listSize, (row-offset), (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
|
||||
if(llrU[row][col+1]==0) updateLLR(listSize, row, (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU);
|
||||
llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i];
|
||||
} else {
|
||||
if(llrU[row][col+1]==0) updateLLR(listSize, row, (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
|
||||
if(llrU[row+offset][col+1]==0) updateLLR(listSize, (row+offset), (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
|
||||
computeLLR(row, col, i, offset, xlen, ylen, zlen, llr);
|
||||
}
|
||||
}
|
||||
llrU[row][col]=1;
|
||||
|
||||
// printf("LLR (a %f, b %f): llr[%d][%d] %f\n",32*a,32*b,col,row,32*llr[col][row]);
|
||||
}
|
||||
|
||||
void updatePathMetric(double *pathMetric,
|
||||
double ***llr,
|
||||
uint8_t listSize,
|
||||
uint8_t bitValue,
|
||||
uint16_t row)
|
||||
uint8_t listSize,
|
||||
uint8_t bitValue,
|
||||
uint16_t row,
|
||||
int xlen,
|
||||
int ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen]
|
||||
)
|
||||
{
|
||||
int8_t multiplier = (2*bitValue) - 1;
|
||||
for (uint8_t i=0; i<listSize; i++)
|
||||
@@ -101,11 +124,14 @@ void updatePathMetric(double *pathMetric,
|
||||
}
|
||||
|
||||
void updatePathMetric2(double *pathMetric,
|
||||
double ***llr,
|
||||
uint8_t listSize,
|
||||
uint16_t row)
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
int xlen,
|
||||
int ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen])
|
||||
{
|
||||
double *tempPM = malloc(sizeof(double) * listSize);
|
||||
double tempPM[listSize];
|
||||
memcpy(tempPM, pathMetric, (sizeof(double) * listSize));
|
||||
|
||||
uint8_t bitValue = 0;
|
||||
@@ -118,48 +144,8 @@ void updatePathMetric2(double *pathMetric,
|
||||
for (uint8_t i = listSize; i < 2*listSize; i++)
|
||||
pathMetric[i] = tempPM[(i-listSize)] + log(1 + exp(multiplier * llr[row][0][(i-listSize)])); //eq. (11b)
|
||||
|
||||
free(tempPM);
|
||||
}
|
||||
|
||||
void computeLLR(double ***llr,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint8_t i,
|
||||
uint16_t offset)
|
||||
{
|
||||
double a = llr[row][col + 1][i];
|
||||
double b = llr[row + offset][col + 1][i];
|
||||
llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); //eq. (8a)
|
||||
}
|
||||
|
||||
void updateCrcChecksum(uint8_t **crcChecksum,
|
||||
uint8_t **crcGen,
|
||||
uint8_t listSize,
|
||||
uint32_t i2,
|
||||
uint8_t len)
|
||||
{
|
||||
for (uint8_t i = 0; i < listSize; i++) {
|
||||
for (uint8_t j = 0; j < len; j++) {
|
||||
crcChecksum[j][i] = ( (crcChecksum[j][i] + crcGen[i2][j]) % 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateCrcChecksum2(uint8_t **crcChecksum,
|
||||
uint8_t **crcGen,
|
||||
uint8_t listSize,
|
||||
uint32_t i2,
|
||||
uint8_t len)
|
||||
{
|
||||
for (uint8_t i = 0; i < listSize; i++) {
|
||||
for (uint8_t j = 0; j < len; j++) {
|
||||
crcChecksum[j][i+listSize] = ( (crcChecksum[j][i] + crcGen[i2][j]) % 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
decoder_node_t *new_decoder_node(int first_leaf_index, int level) {
|
||||
|
||||
decoder_node_t *node=(decoder_node_t *)malloc(sizeof(decoder_node_t));
|
||||
@@ -222,6 +208,23 @@ decoder_node_t *add_nodes(int level, int first_leaf_index, t_nrPolar_params *pol
|
||||
return(new_node);
|
||||
}
|
||||
|
||||
void delete_nodes(decoder_node_t * n) {
|
||||
if (n) {
|
||||
if(n->left)
|
||||
delete_nodes(n->left);
|
||||
if(n->right)
|
||||
delete_nodes(n->right);
|
||||
free(n->alpha);
|
||||
free(n->beta);
|
||||
free(n);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_decoder_tree(t_nrPolar_params *polarParams) {
|
||||
if (polarParams->tree.root)
|
||||
delete_nodes(polarParams->tree.root);
|
||||
}
|
||||
|
||||
void build_decoder_tree(t_nrPolar_params *polarParams)
|
||||
{
|
||||
polarParams->tree.num_nodes=0;
|
||||
|
||||
@@ -79,9 +79,10 @@ typedef struct decoder_tree_t_s {
|
||||
|
||||
struct nrPolar_params {
|
||||
//messageType: 0=PBCH, 1=DCI, -1=UCI
|
||||
int idx; //idx = (messageType * messageLength * aggregation_prime);
|
||||
struct nrPolar_params *nextPtr;
|
||||
|
||||
struct nrPolar_params *nextPtr __attribute__((aligned(16)));
|
||||
bool busy;
|
||||
uint32_t idx;
|
||||
uint8_t n_max;
|
||||
uint8_t i_il;
|
||||
uint8_t i_seg;
|
||||
@@ -138,34 +139,46 @@ typedef struct nrPolar_params t_nrPolar_params;
|
||||
|
||||
void polar_encoder(uint32_t *input,
|
||||
uint32_t *output,
|
||||
const t_nrPolar_params *polarParams);
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
void polar_encoder_dci(uint32_t *in,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint16_t n_RNTI);
|
||||
uint16_t n_RNTI,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
void polar_encoder_fast(uint64_t *A,
|
||||
void *out,
|
||||
int32_t crcmask,
|
||||
uint8_t ones_flag,
|
||||
const t_nrPolar_params *polarParams);
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
int8_t polar_decoder(double *input,
|
||||
uint32_t *output,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint8_t listSize);
|
||||
uint8_t listSize,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
uint32_t polar_decoder_int16(int16_t *input,
|
||||
uint64_t *out,
|
||||
uint8_t ones_flag,
|
||||
const t_nrPolar_params *polarParams);
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
int8_t polar_decoder_dci(double *input,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint8_t listSize,
|
||||
uint16_t n_RNTI);
|
||||
uint16_t n_RNTI,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level);
|
||||
|
||||
void generic_polar_decoder(const t_nrPolar_params *pp,
|
||||
decoder_node_t *node);
|
||||
@@ -183,13 +196,12 @@ void build_decoder_tree(t_nrPolar_params *pp);
|
||||
void build_polar_tables(t_nrPolar_params *polarParams);
|
||||
void init_polar_deinterleaver_table(t_nrPolar_params *polarParams);
|
||||
|
||||
void nr_polar_print_polarParams(t_nrPolar_params *polarParams);
|
||||
void nr_polar_print_polarParams(void);
|
||||
|
||||
t_nrPolar_params *nr_polar_params (int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level,
|
||||
int decoder_flag,
|
||||
t_nrPolar_params **polarList_ext);
|
||||
int decoder_flag);
|
||||
|
||||
uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level);
|
||||
|
||||
@@ -278,34 +290,6 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1,
|
||||
uint16_t row,
|
||||
uint16_t col);
|
||||
|
||||
uint8_t ***nr_alloc_uint8_3D_array(uint16_t xlen,
|
||||
uint16_t ylen,
|
||||
uint16_t zlen);
|
||||
|
||||
uint8_t **nr_alloc_uint8_2D_array(uint16_t xlen,
|
||||
uint16_t ylen);
|
||||
|
||||
double ***nr_alloc_double_3D_array(uint16_t xlen,
|
||||
uint16_t ylen,
|
||||
uint16_t zlen);
|
||||
|
||||
double **nr_alloc_double_2D_array(uint16_t xlen,
|
||||
uint16_t ylen);
|
||||
|
||||
void nr_free_double_3D_array(double ***input,
|
||||
uint16_t xlen,
|
||||
uint16_t ylen);
|
||||
|
||||
void nr_free_double_2D_array(double **input,
|
||||
uint16_t xlen);
|
||||
|
||||
void nr_free_uint8_3D_array(uint8_t ***input,
|
||||
uint16_t xlen,
|
||||
uint16_t ylen);
|
||||
|
||||
void nr_free_uint8_2D_array(uint8_t **input,
|
||||
uint16_t xlen);
|
||||
|
||||
void nr_sort_asc_double_1D_array_ind(double *matrix,
|
||||
uint8_t *ind,
|
||||
uint8_t len);
|
||||
@@ -316,52 +300,33 @@ void nr_sort_asc_int16_1D_array_ind(int32_t *matrix,
|
||||
|
||||
void nr_free_double_2D_array(double **input, uint16_t xlen);
|
||||
|
||||
void updateLLR(double ***llr,
|
||||
uint8_t **llrU,
|
||||
uint8_t ***bit,
|
||||
uint8_t **bitU,
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen);
|
||||
|
||||
void updateBit(uint8_t ***bit,
|
||||
uint8_t **bitU,
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen);
|
||||
|
||||
void updateLLR(uint8_t listSize,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen],
|
||||
uint8_t llrU[xlen][ylen],
|
||||
uint8_t bit[xlen][ylen][zlen],
|
||||
uint8_t bitU[xlen][ylen]
|
||||
);
|
||||
void updatePathMetric(double *pathMetric,
|
||||
double ***llr,
|
||||
uint8_t listSize,
|
||||
uint8_t bitValue,
|
||||
uint16_t row);
|
||||
|
||||
uint8_t listSize,
|
||||
uint8_t bitValue,
|
||||
uint16_t row,
|
||||
int xlen,
|
||||
int ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen]
|
||||
);
|
||||
void updatePathMetric2(double *pathMetric,
|
||||
double ***llr,
|
||||
uint8_t listSize,
|
||||
uint16_t row);
|
||||
|
||||
void computeLLR(double ***llr,
|
||||
uint16_t row,
|
||||
uint16_t col,
|
||||
uint8_t i,
|
||||
uint16_t offset);
|
||||
|
||||
void updateCrcChecksum(uint8_t **crcChecksum,
|
||||
uint8_t **crcGen,
|
||||
uint8_t listSize,
|
||||
uint32_t i2,
|
||||
uint8_t len);
|
||||
|
||||
void updateCrcChecksum2(uint8_t **crcChecksum,
|
||||
uint8_t **crcGen,
|
||||
uint8_t listSize,
|
||||
uint32_t i2,
|
||||
uint8_t len);
|
||||
uint8_t listSize,
|
||||
uint16_t row,
|
||||
int xlen,
|
||||
int ylen,
|
||||
int zlen,
|
||||
double llr[xlen][ylen][zlen]);
|
||||
|
||||
//Also nr_polar_rate_matcher
|
||||
static inline void nr_polar_interleaver(uint8_t *input,
|
||||
@@ -379,5 +344,13 @@ static inline void nr_polar_deinterleaver(uint8_t *input,
|
||||
{
|
||||
for (int i=0; i<size; i++) output[pattern[i]]=input[i];
|
||||
}
|
||||
void delete_decoder_tree(t_nrPolar_params *);
|
||||
|
||||
extern pthread_mutex_t PolarListMutex;
|
||||
#define polarReturn \
|
||||
pthread_mutex_lock(&PolarListMutex); \
|
||||
polarParams->busy=false; \
|
||||
pthread_mutex_unlock(&PolarListMutex); \
|
||||
return
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,10 @@
|
||||
|
||||
void polar_encoder(uint32_t *in,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams) {
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level) {
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
|
||||
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
|
||||
/*
|
||||
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<<polarParams->payloadBits);
|
||||
@@ -57,10 +60,10 @@ void polar_encoder(uint32_t *in,
|
||||
*/
|
||||
//Calculate CRC.
|
||||
nr_matrix_multiplication_uint8_1D_uint8_2D(polarParams->nr_polar_A,
|
||||
polarParams->crc_generator_matrix,
|
||||
polarParams->nr_polar_crc,
|
||||
polarParams->payloadBits,
|
||||
polarParams->crcParityBits);
|
||||
polarParams->crc_generator_matrix,
|
||||
polarParams->nr_polar_crc,
|
||||
polarParams->payloadBits,
|
||||
polarParams->crcParityBits);
|
||||
|
||||
for (uint8_t i = 0; i < polarParams->crcParityBits; i++)
|
||||
polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
|
||||
@@ -150,12 +153,19 @@ void polar_encoder(uint32_t *in,
|
||||
|
||||
#endif
|
||||
nr_byte2bit_uint8_32(polarParams->nr_polar_E, polarParams->encoderLength, out);
|
||||
|
||||
polarReturn;
|
||||
|
||||
}
|
||||
|
||||
void polar_encoder_dci(uint32_t *in,
|
||||
uint32_t *out,
|
||||
const t_nrPolar_params *polarParams,
|
||||
uint16_t n_RNTI) {
|
||||
uint16_t n_RNTI,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level) {
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
|
||||
|
||||
#ifdef DEBUG_POLAR_ENCODER_DCI
|
||||
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
|
||||
#endif
|
||||
@@ -249,6 +259,7 @@ void polar_encoder_dci(uint32_t *in,
|
||||
printf("\n[polar_encoder_dci] out: ");
|
||||
for (int i = 0; i < outputInd; i++) printf("[%d]->0x%08x\t", i, out[i]);
|
||||
#endif
|
||||
polarReturn;
|
||||
}
|
||||
|
||||
static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
|
||||
@@ -334,7 +345,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
|
||||
AssertFatal(polarParams->N==512 || polarParams->N==256 || polarParams->N==128,"N = %d, not done yet\n",polarParams->N);
|
||||
// build G bit vectors for information bit positions and convert the bit as bytes tables in nr_polar_kronecker_power_matrices.c to 64 bit packed vectors.
|
||||
// keep only rows of G which correspond to information/crc bits
|
||||
polarParams->G_N_tab = (uint64_t **)malloc((polarParams->K + polarParams->n_pc) * sizeof(int64_t *));
|
||||
polarParams->G_N_tab = (uint64_t **)calloc((polarParams->K + polarParams->n_pc),sizeof(int64_t *));
|
||||
int k=0;
|
||||
|
||||
for (int i=0; i<polarParams->N; i++) {
|
||||
@@ -418,11 +429,14 @@ void polar_encoder_fast(uint64_t *A,
|
||||
void *out,
|
||||
int32_t crcmask,
|
||||
uint8_t ones_flag,
|
||||
const t_nrPolar_params *polarParams) {
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level) {
|
||||
|
||||
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
|
||||
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
|
||||
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
|
||||
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
|
||||
uint64_t B[4]= {0,0,0,0},Cprime[4]= {0,0,0,0};
|
||||
int bitlen = polarParams->payloadBits;
|
||||
// append crc
|
||||
AssertFatal(bitlen<129,"support for payloads <= 128 bits\n");
|
||||
@@ -451,9 +465,12 @@ void polar_encoder_fast(uint64_t *A,
|
||||
A32_flip[1+offset]=((uint8_t *)&Aprime)[2];
|
||||
A32_flip[2+offset]=((uint8_t *)&Aprime)[1];
|
||||
A32_flip[3+offset]=((uint8_t *)&Aprime)[0];
|
||||
if (polarParams->crcParityBits == 24) tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff);
|
||||
else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff);
|
||||
else if (polarParams->crcParityBits == 6) tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f);
|
||||
if (polarParams->crcParityBits == 24)
|
||||
tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff);
|
||||
else if (polarParams->crcParityBits == 11)
|
||||
tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff);
|
||||
else if (polarParams->crcParityBits == 6)
|
||||
tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f);
|
||||
} else if (bitlen<=64) {
|
||||
uint8_t A64_flip[8+offset];
|
||||
if (ones_flag) {
|
||||
@@ -470,8 +487,10 @@ void polar_encoder_fast(uint64_t *A,
|
||||
A64_flip[5+offset]=((uint8_t *)&Aprime)[2];
|
||||
A64_flip[6+offset]=((uint8_t *)&Aprime)[1];
|
||||
A64_flip[7+offset]=((uint8_t *)&Aprime)[0];
|
||||
if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff;
|
||||
else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff;
|
||||
if (polarParams->crcParityBits == 24)
|
||||
tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff;
|
||||
else if (polarParams->crcParityBits == 11)
|
||||
tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff;
|
||||
}
|
||||
else if (bitlen<=128) {
|
||||
uint8_t A128_flip[16+offset];
|
||||
@@ -481,38 +500,37 @@ void polar_encoder_fast(uint64_t *A,
|
||||
A128_flip[2] = 0xff;
|
||||
}
|
||||
uint128_t Aprime= (uint128_t)(((uint128_t)*A)<<(128-bitlen));
|
||||
A128_flip[0+offset]=((uint8_t*)&Aprime)[15]; A128_flip[1+offset]=((uint8_t*)&Aprime)[14];
|
||||
A128_flip[2+offset]=((uint8_t*)&Aprime)[13]; A128_flip[3+offset]=((uint8_t*)&Aprime)[12];
|
||||
A128_flip[4+offset]=((uint8_t*)&Aprime)[11]; A128_flip[5+offset]=((uint8_t*)&Aprime)[10];
|
||||
A128_flip[6+offset] =((uint8_t*)&Aprime)[9]; A128_flip[7+offset] =((uint8_t*)&Aprime)[8];
|
||||
A128_flip[8+offset] =((uint8_t*)&Aprime)[7]; A128_flip[9+offset] =((uint8_t*)&Aprime)[6];
|
||||
A128_flip[10+offset]=((uint8_t*)&Aprime)[5]; A128_flip[11+offset]=((uint8_t*)&Aprime)[4];
|
||||
A128_flip[12+offset]=((uint8_t*)&Aprime)[3]; A128_flip[13+offset]=((uint8_t*)&Aprime)[2];
|
||||
A128_flip[14+offset]=((uint8_t*)&Aprime)[1]; A128_flip[15+offset]=((uint8_t*)&Aprime)[0];
|
||||
if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff;
|
||||
else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff;
|
||||
for (int i=0; i<16 ; i++)
|
||||
A128_flip[i+offset]=((uint8_t*)&Aprime)[15-i];
|
||||
if (polarParams->crcParityBits == 24)
|
||||
tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff;
|
||||
else if (polarParams->crcParityBits == 11)
|
||||
tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff;
|
||||
}
|
||||
|
||||
int n;
|
||||
// this is number of quadwords in the bit string
|
||||
int quadwlen = (polarParams->K>>6);
|
||||
|
||||
if ((polarParams->K&63) > 0) quadwlen++;
|
||||
int quadwlen = (polarParams->K+63)/64;
|
||||
|
||||
// Create the B bit string as
|
||||
// 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1, p_0, p_1, ..., p_{N_parity-1}
|
||||
|
||||
//??? b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0
|
||||
|
||||
for (n=0; n<quadwlen; n++) if (n==0) B[n] = (A[n] << polarParams->crcParityBits) | tcrc;
|
||||
else B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
|
||||
uint64_t B[4]= {0};
|
||||
B[0] = (A[0] << polarParams->crcParityBits) | tcrc;
|
||||
for (n=1; n<quadwlen; n++)
|
||||
if ((bitlen+63)/64 > n)
|
||||
B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
|
||||
else
|
||||
B[n] = (A[n-1]>>(64-polarParams->crcParityBits));
|
||||
|
||||
uint8_t *Bbyte = (uint8_t *)B;
|
||||
|
||||
// for each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position
|
||||
uint64_t Cprime[4]= {0};
|
||||
if (polarParams->K<65)
|
||||
Cprime[0] = polarParams->cprime_tab0[0][Bbyte[0]] |
|
||||
polarParams->cprime_tab0[1][Bbyte[1]] |
|
||||
polarParams->cprime_tab0[1][Bbyte[1]] |
|
||||
polarParams->cprime_tab0[2][Bbyte[2]] |
|
||||
polarParams->cprime_tab0[3][Bbyte[3]] |
|
||||
polarParams->cprime_tab0[4][Bbyte[4]] |
|
||||
@@ -684,4 +702,7 @@ void polar_encoder_fast(uint64_t *A,
|
||||
}
|
||||
memset((void*)out,0,polarParams->encoderLength>>3);
|
||||
polar_rate_matching(polarParams,(void *)D, out);
|
||||
|
||||
polarReturn;
|
||||
|
||||
}
|
||||
|
||||
@@ -43,163 +43,6 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1, uint8_t **matr
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t ***nr_alloc_uint8_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) {
|
||||
uint8_t ***output;
|
||||
int i, j;
|
||||
|
||||
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
|
||||
perror("[nr_alloc_uint8_3D_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_3D_array] Problem at 2D allocation");
|
||||
nr_free_uint8_3D_array(output, xlen, ylen);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < xlen; i++)
|
||||
for (j = 0; j < ylen; j++)
|
||||
output[i][j] = NULL;
|
||||
|
||||
|
||||
for (i = 0; i < xlen; i++)
|
||||
for (j = 0; j < ylen; j++)
|
||||
if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) {
|
||||
perror("[nr_alloc_uint8_3D_array] Problem at 3D allocation");
|
||||
nr_free_uint8_3D_array(output, xlen, ylen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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 ***output;
|
||||
int i, j;
|
||||
|
||||
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
|
||||
perror("[nr_alloc_double_3D_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_double_3D_array] Problem at 2D allocation");
|
||||
nr_free_double_3D_array(output, xlen, ylen);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < xlen; i++)
|
||||
for (j = 0; j < ylen; j++)
|
||||
output[i][j] = NULL;
|
||||
|
||||
|
||||
for (i = 0; i < xlen; i++)
|
||||
for (j = 0; j < ylen; j++)
|
||||
if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) {
|
||||
perror("[nr_alloc_double_3D_array] Problem at 3D allocation");
|
||||
nr_free_double_3D_array(output, xlen, ylen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
|
||||
double **output;
|
||||
int i, j;
|
||||
|
||||
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
|
||||
perror("[nr_alloc_double_3D_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_double_2D_array] Problem at 2D allocation");
|
||||
nr_free_double_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) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < xlen; i++) {
|
||||
for (j = 0; j < ylen; j++) {
|
||||
free(input[i][j]);
|
||||
}
|
||||
free(input[i]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
void nr_free_uint8_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < xlen; i++) {
|
||||
for (j = 0; j < ylen; j++) {
|
||||
free(input[i][j]);
|
||||
}
|
||||
free(input[i]);
|
||||
}
|
||||
free(input);
|
||||
}
|
||||
|
||||
void nr_free_uint8_2D_array(uint8_t **input, uint16_t xlen) {
|
||||
for (int i = 0; i < xlen; i++) free(input[i]);
|
||||
free(input);
|
||||
}
|
||||
|
||||
// Modified Bubble Sort.
|
||||
void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) {
|
||||
int swaps;
|
||||
|
||||
+194
-161
@@ -33,178 +33,236 @@
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
|
||||
#define PolarKey ((messageType<<24)|(messageLength<<8)|aggregation_level)
|
||||
static t_nrPolar_params * PolarList=NULL;
|
||||
pthread_mutex_t PolarListMutex=PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static int intcmp(const void *p1,const void *p2) {
|
||||
return(*(int16_t *)p1 > *(int16_t *)p2);
|
||||
}
|
||||
|
||||
static void nr_polar_init(t_nrPolar_params * *polarParams,
|
||||
int8_t messageType,
|
||||
static void nr_polar_delete_list(t_nrPolar_params * polarParams) {
|
||||
if (!polarParams)
|
||||
return;
|
||||
if (polarParams->nextPtr)
|
||||
nr_polar_delete_list(polarParams->nextPtr);
|
||||
|
||||
delete_decoder_tree(polarParams);
|
||||
//From build_polar_tables()
|
||||
for (int k=0; k < polarParams->K + polarParams->n_pc; k++)
|
||||
if (polarParams->G_N_tab[k])
|
||||
free(polarParams->G_N_tab[k]);
|
||||
free(polarParams->G_N_tab);
|
||||
free(polarParams->rm_tab);
|
||||
if (polarParams->crc_generator_matrix)
|
||||
free(polarParams->crc_generator_matrix);
|
||||
//polar_encoder vectors:
|
||||
free(polarParams->nr_polar_crc);
|
||||
free(polarParams->nr_polar_aPrime);
|
||||
free(polarParams->nr_polar_APrime);
|
||||
free(polarParams->nr_polar_D);
|
||||
free(polarParams->nr_polar_E);
|
||||
//Polar Coding vectors
|
||||
free(polarParams->nr_polar_U);
|
||||
free(polarParams->nr_polar_CPrime);
|
||||
free(polarParams->nr_polar_B);
|
||||
free(polarParams->nr_polar_A);
|
||||
free(polarParams->interleaving_pattern);
|
||||
free(polarParams->deinterleaving_pattern);
|
||||
free(polarParams->rate_matching_pattern);
|
||||
free(polarParams->information_bit_pattern);
|
||||
free(polarParams->Q_I_N);
|
||||
free(polarParams->Q_F_N);
|
||||
free(polarParams->Q_PC_N);
|
||||
free(polarParams->channel_interleaver_pattern);
|
||||
free(polarParams);
|
||||
}
|
||||
|
||||
static void nr_polar_delete(void) {
|
||||
pthread_mutex_lock(&PolarListMutex);
|
||||
nr_polar_delete_list(PolarList);
|
||||
PolarList=NULL;
|
||||
pthread_mutex_unlock(&PolarListMutex);
|
||||
}
|
||||
|
||||
t_nrPolar_params * nr_polar_params(int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level,
|
||||
int decoder_flag) {
|
||||
t_nrPolar_params *currentPtr = *polarParams;
|
||||
uint16_t aggregation_prime = (messageType >= 2) ? aggregation_level : nr_polar_aggregation_prime(aggregation_level);
|
||||
|
||||
// The lock is weak, because we never delete in the list, only at exit time
|
||||
// therefore, returning t_nrPolar_params * from the list is safe for future usage
|
||||
pthread_mutex_lock(&PolarListMutex);
|
||||
if(!PolarList)
|
||||
atexit(nr_polar_delete);
|
||||
|
||||
t_nrPolar_params *currentPtr = PolarList;
|
||||
//Parse the list. If the node is already created, return without initialization.
|
||||
while (currentPtr != NULL) {
|
||||
//printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength);
|
||||
//LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime));
|
||||
if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return;
|
||||
else currentPtr = currentPtr->nextPtr;
|
||||
if (currentPtr->busy == false && currentPtr->idx == PolarKey ) {
|
||||
currentPtr->busy=true;
|
||||
pthread_mutex_unlock(&PolarListMutex);
|
||||
if (decoder_flag && !currentPtr->tree.root)
|
||||
build_decoder_tree(currentPtr);
|
||||
return currentPtr ;
|
||||
}
|
||||
else
|
||||
currentPtr = currentPtr->nextPtr;
|
||||
}
|
||||
|
||||
// printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams);
|
||||
//Else, initialize and add node to the end of the linked list.
|
||||
t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1);
|
||||
|
||||
if (newPolarInitNode != NULL) {
|
||||
// LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime);
|
||||
newPolarInitNode->idx = (messageType * messageLength * aggregation_prime);
|
||||
newPolarInitNode->nextPtr = NULL;
|
||||
//printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
|
||||
newPolarInitNode->busy=true;
|
||||
pthread_mutex_unlock(&PolarListMutex);
|
||||
|
||||
if (messageType == 0) { //PBCH
|
||||
newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL;
|
||||
newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG;
|
||||
newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC;
|
||||
newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
|
||||
newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL;
|
||||
newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
|
||||
newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
|
||||
newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
|
||||
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
|
||||
newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
|
||||
newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG;
|
||||
newPolarInitNode->n_pc = NR_POLAR_DCI_N_PC;
|
||||
newPolarInitNode->n_pc_wm = NR_POLAR_DCI_N_PC_WM;
|
||||
newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL;
|
||||
newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS;
|
||||
newPolarInitNode->payloadBits = messageLength;
|
||||
newPolarInitNode->encoderLength = aggregation_level*108;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
|
||||
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 == 2) { //UCI PUCCH2
|
||||
AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level);
|
||||
AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength);
|
||||
newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL;
|
||||
newPolarInitNode->encoderLength = aggregation_level * 16;
|
||||
AssertFatal(newPolarInitNode != NULL, "[nr_polar_init] New t_nrPolar_params * could not be created");
|
||||
|
||||
// LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime);
|
||||
newPolarInitNode->idx = PolarKey;
|
||||
newPolarInitNode->nextPtr = NULL;
|
||||
//printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
|
||||
|
||||
if (messageType == 0) { //PBCH
|
||||
newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL;
|
||||
newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG;
|
||||
newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC;
|
||||
newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
|
||||
newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL;
|
||||
newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
|
||||
newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
|
||||
newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
|
||||
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
|
||||
newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
|
||||
newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG;
|
||||
newPolarInitNode->n_pc = NR_POLAR_DCI_N_PC;
|
||||
newPolarInitNode->n_pc_wm = NR_POLAR_DCI_N_PC_WM;
|
||||
newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL;
|
||||
newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS;
|
||||
newPolarInitNode->payloadBits = messageLength;
|
||||
newPolarInitNode->encoderLength = aggregation_level*108;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
|
||||
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 == 2) { //UCI PUCCH2
|
||||
AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level);
|
||||
AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength);
|
||||
newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX;
|
||||
newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL;
|
||||
newPolarInitNode->encoderLength = aggregation_level * 16;
|
||||
|
||||
newPolarInitNode->i_seg = 0;
|
||||
newPolarInitNode->i_seg = 0;
|
||||
|
||||
if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)||
|
||||
(messageLength >= 1013)) newPolarInitNode->i_seg = 1;
|
||||
if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)||
|
||||
(messageLength >= 1013)) newPolarInitNode->i_seg = 1;
|
||||
|
||||
newPolarInitNode->crcParityBits = 11;
|
||||
newPolarInitNode->n_pc = 0;
|
||||
newPolarInitNode->n_pc_wm = 0;
|
||||
newPolarInitNode->crcParityBits = 11;
|
||||
newPolarInitNode->n_pc = 0;
|
||||
newPolarInitNode->n_pc_wm = 0;
|
||||
|
||||
if (messageLength < 20) {
|
||||
newPolarInitNode->crcParityBits = 6;
|
||||
newPolarInitNode->n_pc = 3;
|
||||
if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL;
|
||||
|
||||
newPolarInitNode->payloadBits = messageLength;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS;
|
||||
//newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
|
||||
//LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level);
|
||||
} else {
|
||||
AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType);
|
||||
if (messageLength < 20) {
|
||||
newPolarInitNode->crcParityBits = 6;
|
||||
newPolarInitNode->n_pc = 3;
|
||||
if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1;
|
||||
}
|
||||
|
||||
newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode.
|
||||
newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K,
|
||||
newPolarInitNode->encoderLength,
|
||||
newPolarInitNode->n_max);
|
||||
newPolarInitNode->n = log2(newPolarInitNode->N);
|
||||
newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n);
|
||||
//polar_encoder vectors:
|
||||
newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits);
|
||||
newPolarInitNode->nr_polar_aPrime = malloc(sizeof(uint8_t) * ((ceil((newPolarInitNode->payloadBits)/32.0)*4)+3));
|
||||
newPolarInitNode->nr_polar_APrime = malloc(sizeof(uint8_t) * newPolarInitNode->K);
|
||||
newPolarInitNode->nr_polar_D = malloc(sizeof(uint8_t) * newPolarInitNode->N);
|
||||
newPolarInitNode->nr_polar_E = malloc(sizeof(uint8_t) * newPolarInitNode->encoderLength);
|
||||
//Polar Coding vectors
|
||||
newPolarInitNode->nr_polar_U = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat
|
||||
newPolarInitNode->nr_polar_CPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat
|
||||
newPolarInitNode->nr_polar_B = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat
|
||||
newPolarInitNode->nr_polar_A = malloc(sizeof(uint8_t) * newPolarInitNode->payloadBits); //Decoder: nr_polar_aHat
|
||||
newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
|
||||
newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
|
||||
nr_polar_interleaving_pattern(newPolarInitNode->K,
|
||||
newPolarInitNode->i_il,
|
||||
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);
|
||||
uint16_t *J = malloc(sizeof(uint16_t) * newPolarInitNode->N);
|
||||
nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
|
||||
J,
|
||||
nr_polar_subblock_interleaver_pattern,
|
||||
newPolarInitNode->K,
|
||||
newPolarInitNode->N,
|
||||
newPolarInitNode->encoderLength);
|
||||
newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N);
|
||||
newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc));
|
||||
newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value.
|
||||
newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc));
|
||||
newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL;
|
||||
|
||||
for (int i = 0; i <= newPolarInitNode->N; i++)
|
||||
newPolarInitNode->Q_F_N[i] = -1; // Empty array.
|
||||
|
||||
nr_polar_info_bit_pattern(newPolarInitNode->information_bit_pattern,
|
||||
newPolarInitNode->Q_I_N,
|
||||
newPolarInitNode->Q_F_N,
|
||||
J,
|
||||
newPolarInitNode->Q_0_Nminus1,
|
||||
newPolarInitNode->K,
|
||||
newPolarInitNode->N,
|
||||
newPolarInitNode->encoderLength,
|
||||
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);
|
||||
nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
|
||||
newPolarInitNode->i_bil,
|
||||
newPolarInitNode->encoderLength);
|
||||
free(J);
|
||||
if (decoder_flag == 1) build_decoder_tree(newPolarInitNode);
|
||||
build_polar_tables(newPolarInitNode);
|
||||
init_polar_deinterleaver_table(newPolarInitNode);
|
||||
//printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
|
||||
newPolarInitNode->payloadBits = messageLength;
|
||||
newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS;
|
||||
//newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
|
||||
//LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level);
|
||||
} else {
|
||||
AssertFatal(1 == 0, "[nr_polar_init] New t_nrPolar_params * could not be created");
|
||||
AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType);
|
||||
}
|
||||
|
||||
//Fixme: the list is not thread safe
|
||||
//The defect is not critical: we always append (never delete items) and adding two times the same is fine
|
||||
newPolarInitNode->nextPtr=*polarParams;
|
||||
*polarParams=newPolarInitNode;
|
||||
return;
|
||||
newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode.
|
||||
newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K,
|
||||
newPolarInitNode->encoderLength,
|
||||
newPolarInitNode->n_max);
|
||||
newPolarInitNode->n = log2(newPolarInitNode->N);
|
||||
newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n);
|
||||
//polar_encoder vectors:
|
||||
newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits);
|
||||
newPolarInitNode->nr_polar_aPrime = malloc(sizeof(uint8_t) * ((ceil((newPolarInitNode->payloadBits)/32.0)*4)+3));
|
||||
newPolarInitNode->nr_polar_APrime = malloc(sizeof(uint8_t) * newPolarInitNode->K);
|
||||
newPolarInitNode->nr_polar_D = malloc(sizeof(uint8_t) * newPolarInitNode->N);
|
||||
newPolarInitNode->nr_polar_E = malloc(sizeof(uint8_t) * newPolarInitNode->encoderLength);
|
||||
//Polar Coding vectors
|
||||
newPolarInitNode->nr_polar_U = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat
|
||||
newPolarInitNode->nr_polar_CPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat
|
||||
newPolarInitNode->nr_polar_B = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat
|
||||
newPolarInitNode->nr_polar_A = malloc(sizeof(uint8_t) * newPolarInitNode->payloadBits); //Decoder: nr_polar_aHat
|
||||
newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
|
||||
newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
|
||||
nr_polar_interleaving_pattern(newPolarInitNode->K,
|
||||
newPolarInitNode->i_il,
|
||||
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);
|
||||
uint16_t J[newPolarInitNode->N];
|
||||
nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
|
||||
J,
|
||||
nr_polar_subblock_interleaver_pattern,
|
||||
newPolarInitNode->K,
|
||||
newPolarInitNode->N,
|
||||
newPolarInitNode->encoderLength);
|
||||
newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N);
|
||||
newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc));
|
||||
newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value.
|
||||
newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc));
|
||||
|
||||
for (int i = 0; i <= newPolarInitNode->N; i++)
|
||||
newPolarInitNode->Q_F_N[i] = -1; // Empty array.
|
||||
|
||||
nr_polar_info_bit_pattern(newPolarInitNode->information_bit_pattern,
|
||||
newPolarInitNode->Q_I_N,
|
||||
newPolarInitNode->Q_F_N,
|
||||
J,
|
||||
newPolarInitNode->Q_0_Nminus1,
|
||||
newPolarInitNode->K,
|
||||
newPolarInitNode->N,
|
||||
newPolarInitNode->encoderLength,
|
||||
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);
|
||||
nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
|
||||
newPolarInitNode->i_bil,
|
||||
newPolarInitNode->encoderLength);
|
||||
if (decoder_flag == 1)
|
||||
build_decoder_tree(newPolarInitNode);
|
||||
build_polar_tables(newPolarInitNode);
|
||||
init_polar_deinterleaver_table(newPolarInitNode);
|
||||
//printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
|
||||
|
||||
newPolarInitNode->nextPtr=PolarList;
|
||||
PolarList=newPolarInitNode;
|
||||
return newPolarInitNode;
|
||||
}
|
||||
|
||||
void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
|
||||
void nr_polar_print_polarParams() {
|
||||
uint8_t i = 0;
|
||||
|
||||
if (polarParams == NULL) {
|
||||
if (PolarList == NULL) {
|
||||
printf("polarParams is empty.\n");
|
||||
} else {
|
||||
t_nrPolar_params * polarParams=PolarList;
|
||||
while (polarParams != NULL) {
|
||||
printf("polarParams[%d] = %d\n", i, polarParams->idx);
|
||||
printf("polarParams[%d] = %d, %d, %d\n", i,
|
||||
polarParams->idx>>24, (polarParams->idx>>8)&0xFFFF, polarParams->idx&0xFF);
|
||||
polarParams = polarParams->nextPtr;
|
||||
i++;
|
||||
}
|
||||
@@ -213,31 +271,6 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
t_nrPolar_params *nr_polar_params (int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level,
|
||||
int decoding_flag,
|
||||
t_nrPolar_params **polarList_ext) {
|
||||
static t_nrPolar_params *polarList = NULL;
|
||||
nr_polar_init(polarList_ext != NULL ? polarList_ext : &polarList,
|
||||
messageType,messageLength,aggregation_level,decoding_flag);
|
||||
t_nrPolar_params *polarParams=polarList_ext != NULL ? *polarList_ext : polarList;
|
||||
const int tag=messageType * messageLength * (messageType>=2 ? aggregation_level : nr_polar_aggregation_prime(aggregation_level));
|
||||
|
||||
|
||||
|
||||
while (polarParams != NULL) {
|
||||
// LOG_D(PHY,"nr_polar_params : tag %d (from nr_polar_init %d)\n",tag,polarParams->idx);
|
||||
if (polarParams->idx == tag)
|
||||
return polarParams;
|
||||
|
||||
polarParams = polarParams->nextPtr;
|
||||
}
|
||||
|
||||
AssertFatal(false,"Polar Init tables internal failure, no polarParams found\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level) {
|
||||
if (aggregation_level == 0) return 0;
|
||||
else if (aggregation_level == 1) return NR_POLAR_AGGREGATION_LEVEL_1_PRIME;
|
||||
|
||||
+108
-68
@@ -242,37 +242,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
common_vars->debugBuff = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t)*100);
|
||||
common_vars->debugBuff_sample_offset = 0;
|
||||
|
||||
|
||||
// Channel estimates for SRS
|
||||
/*
|
||||
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
|
||||
srs_vars[UE_id].srs_ch_estimates = (int32_t **)malloc16( 64*sizeof(int32_t *) );
|
||||
srs_vars[UE_id].srs_ch_estimates_time = (int32_t **)malloc16( 64*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<64; i++) {
|
||||
srs_vars[UE_id].srs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size );
|
||||
srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
}
|
||||
} //UE_id
|
||||
*/
|
||||
/*generate_ul_ref_sigs_rx();
|
||||
|
||||
init_ulsch_power_LUT();*/
|
||||
|
||||
/*
|
||||
// SRS
|
||||
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
|
||||
srs_vars[UE_id].srs = (int32_t *)malloc16_clear(2*fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
}
|
||||
*/
|
||||
// PRACH
|
||||
prach_vars->prachF = (int16_t *)malloc16_clear( 1024*2*sizeof(int16_t) );
|
||||
prach_vars->rxsigF = (int16_t **)malloc16_clear(Prx*sizeof(int16_t*));
|
||||
/*
|
||||
for (i=0;i<Prx;i++){
|
||||
prach_vars->rxsigF[i] = (int16_t *)malloc16_clear( 1024*2*sizeof(int16_t) );
|
||||
}
|
||||
*/
|
||||
prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t));
|
||||
|
||||
init_prach_list(gNB);
|
||||
@@ -328,51 +300,102 @@ int phy_init_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_gNB_COMMON *const common_vars = &gNB->common_vars;
|
||||
NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
|
||||
/*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
|
||||
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
|
||||
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
|
||||
int Ptx=gNB->gNB_config.carrier_config.num_tx_ant.value;
|
||||
const int Ptx = gNB->gNB_config.carrier_config.num_tx_ant.value;
|
||||
const int Prx = gNB->gNB_config.carrier_config.num_rx_ant.value;
|
||||
const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB()
|
||||
const int n_buf = Prx * max_ul_mimo_layers;
|
||||
|
||||
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
|
||||
free_and_zero(pdcch_dmrs[slot][symb]);
|
||||
free_and_zero(pdcch_dmrs[slot]);
|
||||
}
|
||||
free_and_zero(pdcch_dmrs);
|
||||
|
||||
uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs;
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
|
||||
for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
free_and_zero(pdsch_dmrs[slot][symb][q]);
|
||||
free_and_zero(pdsch_dmrs[slot][symb]);
|
||||
}
|
||||
free_and_zero(pdsch_dmrs[slot]);
|
||||
}
|
||||
free_and_zero(gNB->nr_gold_pdsch_dmrs);
|
||||
|
||||
uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs;
|
||||
for(int nscid = 0; nscid < 2; nscid++) {
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
|
||||
free_and_zero(pusch_dmrs[nscid][slot][symb]);
|
||||
free_and_zero(pusch_dmrs[nscid][slot]);
|
||||
}
|
||||
free_and_zero(pusch_dmrs[nscid]);
|
||||
}
|
||||
free_and_zero(pusch_dmrs);
|
||||
|
||||
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
|
||||
free_and_zero(csi_rs[slot][symb]);
|
||||
free_and_zero(csi_rs[slot]);
|
||||
}
|
||||
free_and_zero(csi_rs);
|
||||
|
||||
for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
|
||||
for (int i = 0; i < Prx; i++){
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_received_signal[i]);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_ls_estimated_channel[i]);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_freq[i]);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]);
|
||||
}
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal);
|
||||
free_and_zero(gNB->nr_srs_info[id]->noise_power);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_received_signal);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_ls_estimated_channel);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_freq);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time);
|
||||
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted);
|
||||
free_and_zero(gNB->nr_srs_info[id]);
|
||||
}
|
||||
|
||||
free_ul_reference_signal_sequences();
|
||||
free_gnb_lowpapr_sequences();
|
||||
|
||||
reset_nr_transport(gNB);
|
||||
|
||||
NR_gNB_COMMON * common_vars = &gNB->common_vars;
|
||||
for (int i = 0; i < Ptx; i++) {
|
||||
free_and_zero(common_vars->txdataF[i]);
|
||||
/* rxdataF[i] is not allocated -> don't free */
|
||||
free_and_zero(common_vars->beam_id[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Prx; ++i) {
|
||||
free_and_zero(common_vars->rxdataF[i]);
|
||||
free_and_zero(common_vars->rxdata[i]);
|
||||
}
|
||||
|
||||
free_and_zero(common_vars->txdataF);
|
||||
free_and_zero(common_vars->rxdata);
|
||||
free_and_zero(common_vars->rxdataF);
|
||||
// PDCCH DMRS sequences
|
||||
free_and_zero(pdcch_dmrs);
|
||||
/*
|
||||
// Channel estimates for SRS
|
||||
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
|
||||
for (i=0; i<64; i++) {
|
||||
free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
|
||||
free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
|
||||
}
|
||||
free_and_zero(common_vars->beam_id);
|
||||
|
||||
free_and_zero(srs_vars[UE_id].srs_ch_estimates);
|
||||
free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
|
||||
} //UE_id
|
||||
|
||||
//free_ul_ref_sigs();
|
||||
|
||||
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) free_and_zero(srs_vars[UE_id].srs);
|
||||
free_and_zero(common_vars->debugBuff);
|
||||
|
||||
NR_gNB_PRACH* prach_vars = &gNB->prach_vars;
|
||||
free_and_zero(prach_vars->prachF);
|
||||
free_and_zero(prach_vars->rxsigF);
|
||||
free_and_zero(prach_vars->prach_ifft);
|
||||
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
|
||||
|
||||
free_and_zero(prach_vars->prach_ifft[0]);
|
||||
free_and_zero(prach_vars->rxsigF[0]);
|
||||
*/
|
||||
NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars;
|
||||
for (int ULSCH_id=0; ULSCH_id<gNB->number_of_nr_ulsch_max; ULSCH_id++) {
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
for (int i = 0; i < Prx; i++) {
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
|
||||
}
|
||||
for (int i = 0; i < 4*fp->nb_antennas_rx; i++) {
|
||||
for (int i = 0; i < n_buf; i++) {
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i]);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time[i]);
|
||||
@@ -392,8 +415,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ptrs_phase_per_slot);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_valid_re_per_slot);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
|
||||
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0);
|
||||
@@ -405,14 +428,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
free_and_zero(pusch_vars[ULSCH_id]->llr);
|
||||
free_and_zero(pusch_vars[ULSCH_id]);
|
||||
} //ULSCH_id
|
||||
/*
|
||||
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL;
|
||||
*/
|
||||
|
||||
|
||||
free_gnb_lowpapr_sequences();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Adding nr_schedule_handler
|
||||
@@ -553,6 +568,16 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
|
||||
{
|
||||
const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++)
|
||||
for (int j=0; j<2; j++)
|
||||
free_gNB_dlsch(&msg->dlsch[i][j], grid_size);
|
||||
}
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
@@ -577,7 +602,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
|
||||
for (int j=0; j<2; j++) {
|
||||
// ULSCH for data
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL);
|
||||
|
||||
if (!gNB->ulsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get gNB ulsch structures\n");
|
||||
@@ -593,3 +618,18 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
|
||||
//fp->pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
}
|
||||
|
||||
void reset_nr_transport(PHY_VARS_gNB *gNB)
|
||||
{
|
||||
const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++)
|
||||
free_gNB_pucch(gNB->pucch[i]);
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++)
|
||||
free_gNB_srs(gNB->srs[i]);
|
||||
|
||||
for (int i=0; i<gNB->number_of_nr_ulsch_max; i++)
|
||||
for (int j=0; j<2; j++)
|
||||
free_gNB_ulsch(&gNB->ulsch[i][j], fp->N_RB_UL);
|
||||
}
|
||||
|
||||
@@ -174,17 +174,13 @@ void nr_phy_free_RU(RU_t *ru)
|
||||
|
||||
LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
|
||||
|
||||
free_and_zero(ru->nr_frame_parms);
|
||||
free_and_zero(ru->frame_parms);
|
||||
|
||||
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
|
||||
int32_t *ptr;
|
||||
for (i = 0; i < ru->nb_tx; i++) {
|
||||
ptr=&ru->common.txdata[i][-ru->sf_extension];
|
||||
free_and_zero(ptr);
|
||||
}
|
||||
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
|
||||
for (i = 0; i < ru->nb_tx; i++)
|
||||
free_and_zero(ru->common.txdata[i]);
|
||||
free_and_zero(ru->common.txdata);
|
||||
|
||||
for (i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->common.rxdata[i]);
|
||||
free_and_zero(ru->common.rxdata);
|
||||
} // else: IF5 or local RF -> nothing to free()
|
||||
|
||||
@@ -193,7 +189,7 @@ void nr_phy_free_RU(RU_t *ru)
|
||||
free_and_zero(ru->common.rxdata_7_5kHz);
|
||||
|
||||
// free beamforming input buffers (TX)
|
||||
for (i = 0; i < 15; i++) free_and_zero(ru->common.txdataF[i]);
|
||||
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF[i]);
|
||||
free_and_zero(ru->common.txdataF);
|
||||
|
||||
// free IFFT input buffers (TX)
|
||||
@@ -205,15 +201,21 @@ void nr_phy_free_RU(RU_t *ru)
|
||||
free_and_zero(ru->common.rxdataF);
|
||||
|
||||
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
|
||||
for (i = 0; i < ru->nb_rx; i++) {
|
||||
for (i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->prach_rxsigF[j][i]);
|
||||
}
|
||||
free_and_zero(ru->prach_rxsigF[j]);
|
||||
}
|
||||
for (i = 0; i < ru->num_gNB; i++) {
|
||||
for (p = 0; p < 15; p++) {
|
||||
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]);
|
||||
|
||||
if (ru->do_precoding == 1) {
|
||||
for (i = 0; i < ru->num_gNB; i++) {
|
||||
for (p = 0; p < ru->nb_log_antennas; p++) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
for(i=0; i< ru->nb_tx; ++i)
|
||||
free_and_zero(ru->common.beam_id[i]);
|
||||
free_and_zero(ru->common.beam_id);
|
||||
}
|
||||
}
|
||||
free_and_zero(ru->common.sync_corr);
|
||||
|
||||
+372
-145
@@ -111,6 +111,49 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
|
||||
}
|
||||
}
|
||||
|
||||
void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp)
|
||||
{
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
for (int j = 0; j < NR_MAX_NB_LAYERS; j++) {
|
||||
const int idx = j * fp->nb_antennas_rx + i;
|
||||
for (int k = 0; k < NR_MAX_NB_LAYERS; k++)
|
||||
free_and_zero(pdsch->rho[i][j*NR_MAX_NB_LAYERS+k]);
|
||||
free_and_zero(pdsch->rxdataF_comp0[idx]);
|
||||
free_and_zero(pdsch->dl_ch_estimates[idx]);
|
||||
free_and_zero(pdsch->dl_ch_estimates_ext[idx]);
|
||||
free_and_zero(pdsch->dl_bf_ch_estimates[idx]);
|
||||
free_and_zero(pdsch->dl_bf_ch_estimates_ext[idx]);
|
||||
free_and_zero(pdsch->dl_ch_mag0[idx]);
|
||||
free_and_zero(pdsch->dl_ch_magb0[idx]);
|
||||
free_and_zero(pdsch->dl_ch_magr0[idx]);
|
||||
}
|
||||
free_and_zero(pdsch->rxdataF_ext[i]);
|
||||
free_and_zero(pdsch->rxdataF_uespec_pilots[i]);
|
||||
free_and_zero(pdsch->ptrs_phase_per_slot[i]);
|
||||
free_and_zero(pdsch->ptrs_re_per_slot[i]);
|
||||
free_and_zero(pdsch->dl_ch_ptrs_estimates_ext[i]);
|
||||
free_and_zero(pdsch->rho[i]);
|
||||
}
|
||||
free_and_zero(pdsch->pmi_ext);
|
||||
free_and_zero(pdsch->llr[0]);
|
||||
free_and_zero(pdsch->layer_llr[0]);
|
||||
free_and_zero(pdsch->llr128);
|
||||
free_and_zero(pdsch->rxdataF_ext);
|
||||
free_and_zero(pdsch->rxdataF_uespec_pilots);
|
||||
free_and_zero(pdsch->rxdataF_comp0);
|
||||
free_and_zero(pdsch->rho);
|
||||
free_and_zero(pdsch->dl_ch_estimates);
|
||||
free_and_zero(pdsch->dl_ch_estimates_ext);
|
||||
free_and_zero(pdsch->dl_bf_ch_estimates);
|
||||
free_and_zero(pdsch->dl_bf_ch_estimates_ext);
|
||||
free_and_zero(pdsch->dl_ch_mag0);
|
||||
free_and_zero(pdsch->dl_ch_magb0);
|
||||
free_and_zero(pdsch->dl_ch_magr0);
|
||||
free_and_zero(pdsch->ptrs_phase_per_slot);
|
||||
free_and_zero(pdsch->ptrs_re_per_slot);
|
||||
free_and_zero(pdsch->dl_ch_ptrs_estimates_ext);
|
||||
}
|
||||
|
||||
void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
const NR_DL_FRAME_PARMS *const fp) {
|
||||
AssertFatal( pusch, "pusch==0" );
|
||||
@@ -120,9 +163,14 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
}
|
||||
}
|
||||
|
||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
int nb_connected_gNB,
|
||||
uint8_t abstraction_flag) {
|
||||
void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch)
|
||||
{
|
||||
for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
|
||||
free_and_zero(pusch->txdataF_layers[i]);
|
||||
}
|
||||
|
||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
{
|
||||
// create shortcuts
|
||||
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
||||
NR_UE_COMMON *const common_vars = &ue->common_vars;
|
||||
@@ -134,10 +182,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
int gNB_id;
|
||||
int th_id;
|
||||
uint32_t ****pusch_dmrs;
|
||||
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
|
||||
int n_scid;
|
||||
abstraction_flag = 0;
|
||||
LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx);
|
||||
LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx);
|
||||
phy_init_nr_top(ue);
|
||||
// many memory allocation sizes are hard coded
|
||||
AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
|
||||
@@ -191,7 +236,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
///////////
|
||||
ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
|
||||
pusch_dmrs = ue->nr_gold_pusch_dmrs;
|
||||
n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
|
||||
|
||||
for (slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
pusch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **));
|
||||
@@ -208,7 +252,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
nr_init_pusch_dmrs(ue, N_n_scid, n_scid);
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -230,29 +273,27 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
for (i=0; i<10; i++)
|
||||
ue->tx_power_dBm[i]=-127;
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
// init TX buffers
|
||||
common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
// init TX buffers
|
||||
common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_tx; i++) {
|
||||
common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
|
||||
common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_slot_wCP*sizeof(int32_t) );
|
||||
}
|
||||
for (i=0; i<fp->nb_antennas_tx; i++) {
|
||||
common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
|
||||
common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_slot_wCP*sizeof(int32_t) );
|
||||
}
|
||||
|
||||
// init RX buffers
|
||||
common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
// init RX buffers
|
||||
common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) );
|
||||
}
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,9 +312,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
ue->scramblingID_pdcch = fp->Nid_cell;
|
||||
nr_gold_pdcch(ue,fp->Nid_cell);
|
||||
|
||||
//PDSCH DMRS init (eNB offset = 0)
|
||||
ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
|
||||
uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0];
|
||||
@@ -293,12 +331,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
// initializing the scrambling IDs for PDSCH DMRS
|
||||
for (int i=0; i<2; i++)
|
||||
ue->scramblingID[i]=fp->Nid_cell;
|
||||
|
||||
nr_gold_pdsch(ue,ue->scramblingID);
|
||||
|
||||
// DLSCH
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
@@ -330,129 +362,119 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
ue->nr_srs_info->srs_estimated_channel_time_shifted[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
|
||||
}
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
||||
}
|
||||
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (j=0; j<4; j++) {
|
||||
const int idx = (j*fp->nb_antennas_rx)+i;
|
||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
||||
}
|
||||
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (j=0; j<4; j++) {
|
||||
const int idx = (j*fp->nb_antennas_rx)+i;
|
||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
//const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
for (k=0; k<8; k++) { //harq_pid
|
||||
for (l=0; l<8; l++) { //round
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
//const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
for (k=0; k<8; k++) { //harq_pid
|
||||
for (l=0; l<8; l++) { //round
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
for (int i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
|
||||
const int idx = (j*fp->nb_antennas_rx)+i;
|
||||
|
||||
for (int i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
|
||||
const int idx = (j*fp->nb_antennas_rx)+i;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
}
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
// Channel estimates
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
|
||||
|
||||
for (j=0; j<4; j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PBCH
|
||||
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
|
||||
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
// Channel estimates
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
|
||||
|
||||
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||
for (j=0; j<4; j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PBCH
|
||||
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
|
||||
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
|
||||
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
}
|
||||
}
|
||||
|
||||
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
|
||||
}
|
||||
|
||||
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||
}
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
}
|
||||
} else { //abstraction == 1
|
||||
ue->sinr_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||
ue->pdsch_vars[th_id][gNB_id] = malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
}
|
||||
|
||||
ue->sinr_CQI_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||
@@ -473,25 +495,224 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
|
||||
int abstraction_flag) {
|
||||
void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
{
|
||||
const NR_DL_FRAME_PARMS* fp = &ue->frame_parms;
|
||||
phy_term_nr_top();
|
||||
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
phy_term_nr_ue_PUSCH(ue->pusch_vars[th_id][gNB_id]);
|
||||
free_and_zero(ue->pusch_vars[th_id][gNB_id]);
|
||||
free_and_zero(ue->pucch_vars[th_id][gNB_id]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
|
||||
for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb][q]);
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs[slot]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pusch_dmrs);
|
||||
|
||||
NR_UE_COMMON* common_vars = &ue->common_vars;
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_tx; i++) {
|
||||
free_and_zero(common_vars->txdata[i]);
|
||||
free_and_zero(common_vars->txdataF[i]);
|
||||
}
|
||||
|
||||
free_and_zero(common_vars->txdata);
|
||||
free_and_zero(common_vars->txdataF);
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
free_and_zero(common_vars->rxdata[i]);
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++)
|
||||
free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i]);
|
||||
}
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF);
|
||||
}
|
||||
free_and_zero(common_vars->rxdata);
|
||||
|
||||
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
|
||||
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
|
||||
free_and_zero(ue->nr_gold_pdcch[0][slot][symb]);
|
||||
free_and_zero(ue->nr_gold_pdcch[0][slot]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pdcch[0]);
|
||||
|
||||
for (int slot=0; slot<fp->slots_per_frame; slot++) {
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
free_and_zero(ue->nr_gold_pdsch[0][slot][symb][q]);
|
||||
free_and_zero(ue->nr_gold_pdsch[0][slot][symb]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pdsch[0][slot]);
|
||||
}
|
||||
free_and_zero(ue->nr_gold_pdsch[0]);
|
||||
|
||||
for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
|
||||
// PDSCH
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (int k = 0; k < 8; k++) { //harq_pid
|
||||
for (int l = 0; l < 8; l++) { //round
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
for (int j = 0; j < 4; j++) { //frame_parms->nb_antennas_tx; j++)
|
||||
const int idx = j * fp->nb_antennas_rx + i;
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx]);
|
||||
}
|
||||
}
|
||||
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
const int idx = (j*fp->nb_antennas_rx)+i;
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx]);
|
||||
}
|
||||
}
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr_shifts);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext);
|
||||
|
||||
phy_term_nr_ue__PDSCH(ue->pdsch_vars[th_id][gNB_id], fp);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]);
|
||||
}
|
||||
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int idx = j * fp->nb_antennas_rx + i;
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx]);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx]);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx]);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx]);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx]);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx]);
|
||||
}
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho[i]);
|
||||
}
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr16);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->wbar);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->e_rx);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates);
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time);
|
||||
|
||||
free_and_zero(ue->pdcch_vars[th_id][gNB_id]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
free_and_zero(ue->nr_srs_info->srs_received_signal[i]);
|
||||
free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel[i]);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_freq[i]);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]);
|
||||
}
|
||||
free_and_zero(ue->nr_srs_info->srs_generated_signal);
|
||||
free_and_zero(ue->nr_srs_info->noise_power);
|
||||
free_and_zero(ue->nr_srs_info->srs_received_signal);
|
||||
free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_freq);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time);
|
||||
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted);
|
||||
free_and_zero(ue->nr_srs_info);
|
||||
|
||||
free_and_zero(ue->srs_vars[gNB_id]);
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_rx; i++) {
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext[i]);
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int idx = (j*fp->nb_antennas_rx)+i;
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time[idx]);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->llr);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]->decoded_output);
|
||||
free_and_zero(ue->pbch_vars[gNB_id]);
|
||||
|
||||
free_and_zero(ue->prach_vars[gNB_id]->prachF);
|
||||
free_and_zero(ue->prach_vars[gNB_id]->prach);
|
||||
free_and_zero(ue->prach_vars[gNB_id]);
|
||||
}
|
||||
|
||||
const int gNB_id = ue->n_connected_gNB;
|
||||
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]);
|
||||
free_and_zero(ue->pdsch_vars[th_id][gNB_id]);
|
||||
}
|
||||
|
||||
free_and_zero(ue->sinr_CQI_dB);
|
||||
}
|
||||
|
||||
void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||
{
|
||||
const int N_RB_DL = ue->frame_parms.N_RB_DL;
|
||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
for (int k = 0; k < RX_NB_TH_MAX; k++) {
|
||||
free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL);
|
||||
free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL);
|
||||
}
|
||||
}
|
||||
|
||||
free_nr_ue_dlsch(&ue->dlsch_SI[i], N_RB_DL);
|
||||
free_nr_ue_dlsch(&ue->dlsch_ra[i], N_RB_DL);
|
||||
}
|
||||
|
||||
free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL);
|
||||
}
|
||||
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||
{
|
||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||
for (int j=0; j<2; j++) {
|
||||
for (int k=0; k<RX_NB_TH_MAX; k++) {
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n");
|
||||
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]);
|
||||
AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
|
||||
AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n");
|
||||
LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
|
||||
ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
|
||||
ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL);
|
||||
ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL);
|
||||
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_gNB==1 ? 1 : 2;
|
||||
}
|
||||
|
||||
//ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
|
||||
ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL);
|
||||
|
||||
for(int i=0; i<5; i++)
|
||||
ue->dl_stats[i] = 0;
|
||||
@@ -555,3 +776,9 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) {
|
||||
//init_unscrambling_lut();
|
||||
//set_taus_seed(1328);
|
||||
}
|
||||
|
||||
void phy_term_nr_top(void)
|
||||
{
|
||||
free_ul_reference_signal_sequences();
|
||||
free_context_synchro_nr();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ int l1_north_init_eNB(void);
|
||||
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
void phy_init_nr_top(PHY_VARS_NR_UE *ue);
|
||||
void phy_term_nr_top(void);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -395,8 +396,9 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb);
|
||||
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
|
||||
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
|
||||
void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band);
|
||||
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);
|
||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB);
|
||||
void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB);
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue);
|
||||
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
|
||||
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 lowmem_flag);
|
||||
@@ -405,11 +407,13 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,
|
||||
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
|
||||
int l1_north_init_gNB(void);
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB);
|
||||
void reset_nr_transport(PHY_VARS_gNB *gNB);
|
||||
|
||||
void init_dfts(void);
|
||||
|
||||
void fill_subframe_mask(PHY_VARS_eNB *eNB);
|
||||
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
|
||||
void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -6481,7 +6481,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *c
|
||||
sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round);
|
||||
sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round);
|
||||
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_uespec_pilots[0],
|
||||
12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
|
||||
12*(ue->frame_parms.N_RB_DL),1,1);
|
||||
/*
|
||||
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB,1,1);
|
||||
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB,1,1);
|
||||
|
||||
@@ -122,23 +122,20 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
|
||||
*********************************************************************/
|
||||
|
||||
int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res) {
|
||||
|
||||
int16_t index = -1;
|
||||
|
||||
if (num_dmrs_res >= dmrs_ul_allocated_res[(MAX_INDEX_DMRS_UL_ALLOCATED_REs-1)])
|
||||
|
||||
int16_t index = num_dmrs_res/6 - 1;
|
||||
|
||||
if (index >= MAX_INDEX_DMRS_UL_ALLOCATED_REs)
|
||||
index = MAX_INDEX_DMRS_UL_ALLOCATED_REs-1;
|
||||
else
|
||||
index = (num_dmrs_res/6) -1;
|
||||
|
||||
for (;index >= 0; index--) {
|
||||
if (dmrs_ul_allocated_res[index] == num_dmrs_res)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
LOG_D(PHY, "num_dmrs_res: %d INDEX RETURNED: %d", num_dmrs_res, index);
|
||||
return index;
|
||||
LOG_D(PHY, "num_dmrs_res: %d INDEX RETURNED: %d", num_dmrs_res, index);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@@ -204,6 +201,11 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
|
||||
|
||||
void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling)
|
||||
{
|
||||
/* prevent multiple calls, relevant when both UE & gNB initialize this */
|
||||
static bool already_called = false;
|
||||
if (already_called) return;
|
||||
already_called = true;
|
||||
|
||||
unsigned int u,Msc_RS;
|
||||
unsigned int v = 0; // sequence hopping and group hopping are not supported yet
|
||||
|
||||
@@ -223,6 +225,11 @@ void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling)
|
||||
|
||||
void generate_ul_reference_signal_sequences(unsigned int scaling)
|
||||
{
|
||||
/* prevent multiple calls, relevant when both UE & gNB initialize this */
|
||||
static bool already_called = false;
|
||||
if (already_called) return;
|
||||
already_called = true;
|
||||
|
||||
unsigned int u,v,Msc_RS;
|
||||
|
||||
#if 0
|
||||
@@ -295,10 +302,10 @@ void free_ul_reference_signal_sequences(void)
|
||||
for (u=0; u < U_GROUP_NUMBER; u++) {
|
||||
for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) {
|
||||
if (rv_ul_ref_sig[u][v][Msc_RS])
|
||||
free16(rv_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*ul_allocated_re[Msc_RS]);
|
||||
free_and_zero(rv_ul_ref_sig[u][v][Msc_RS]);
|
||||
if ((v==0) && (Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs))
|
||||
if (dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS])
|
||||
free16(dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]);
|
||||
free_and_zero(dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,7 +328,7 @@ void free_gnb_lowpapr_sequences(void)
|
||||
v=0;
|
||||
for (u=0; u < U_GROUP_NUMBER; u++) {
|
||||
if (gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS])
|
||||
free16(gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]);
|
||||
free_and_zero(gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +130,8 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
uint16_t Nid = dci_pdu->ScramblingId;
|
||||
uint16_t scrambling_RNTI = dci_pdu->ScramblingRNTI;
|
||||
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
|
||||
dci_pdu->PayloadSizeBits,
|
||||
dci_pdu->AggregationLevel,
|
||||
0,NULL);
|
||||
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr);
|
||||
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1,
|
||||
NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel);
|
||||
#ifdef DEBUG_CHANNEL_CODING
|
||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel);
|
||||
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
||||
|
||||
@@ -55,42 +55,39 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
if (dlsch) {
|
||||
if (N_RB != 273) {
|
||||
a_segments = a_segments*N_RB;
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DLSCH_FREE
|
||||
LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
|
||||
#endif
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
|
||||
if (harq->b) {
|
||||
free16(harq->b, a_segments * 1056);
|
||||
harq->b = NULL;
|
||||
#ifdef DEBUG_DLSCH_FREE
|
||||
LOG_D(PHY, "Freeing harq->b (%p)\n", harq->b);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DLSCH_FREE
|
||||
LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
|
||||
#endif
|
||||
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
#ifdef DEBUG_DLSCH_FREE
|
||||
LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
|
||||
#endif
|
||||
|
||||
if (harq->c[r]) {
|
||||
free16(harq->c[r], 1056);
|
||||
harq->c[r] = NULL;
|
||||
}
|
||||
}
|
||||
free16(dlsch, sizeof(NR_gNB_DLSCH_t));
|
||||
*dlschptr = NULL;
|
||||
if (N_RB != 273) {
|
||||
a_segments = a_segments*N_RB;
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
if (harq->b) {
|
||||
free16(harq->b, a_segments * 1056);
|
||||
harq->b = NULL;
|
||||
}
|
||||
for (r = 0; r < a_segments; r++) {
|
||||
free(harq->c[r]);
|
||||
harq->c[r] = NULL;
|
||||
}
|
||||
free(harq->pdu);
|
||||
|
||||
for (int aa = 0; aa < 64; aa++)
|
||||
free(dlsch->calib_dl_ch_estimates[aa]);
|
||||
free(dlsch->calib_dl_ch_estimates);
|
||||
|
||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||
free(dlsch->mod_symbs[q]);
|
||||
|
||||
for (int layer = 0; layer < NR_MAX_NB_LAYERS; layer++) {
|
||||
free(dlsch->txdataF_precoding[layer]);
|
||||
free(dlsch->txdataF[layer]);
|
||||
for (int aa = 0; aa < 64; aa++)
|
||||
free(dlsch->ue_spec_bf_weights[layer][aa]);
|
||||
free(dlsch->ue_spec_bf_weights[layer]);
|
||||
}
|
||||
|
||||
free(dlsch);
|
||||
*dlschptr = NULL;
|
||||
}
|
||||
|
||||
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
@@ -299,8 +299,8 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
|
||||
|
||||
/// CRC, coding and rate matching
|
||||
polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, 0, 0,
|
||||
nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,0,NULL)
|
||||
);
|
||||
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
|
||||
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Channel coding:\n");
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t abstraction_flag,
|
||||
uint16_t N_RB);
|
||||
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
|
||||
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
|
||||
- RB extraction (signal and channel estimates)
|
||||
- channel compensation (matched filtering)
|
||||
@@ -296,6 +298,7 @@ int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type);
|
||||
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
|
||||
|
||||
NR_gNB_PUCCH_t *new_gNB_pucch(void);
|
||||
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch);
|
||||
|
||||
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
@@ -308,6 +311,7 @@ int nr_find_pucch(uint16_t rnti,
|
||||
PHY_VARS_gNB *gNB);
|
||||
|
||||
NR_gNB_SRS_t *new_gNB_srs(void);
|
||||
void free_gNB_srs(NR_gNB_SRS_t *srs);
|
||||
|
||||
int nr_find_srs(uint16_t rnti,
|
||||
int frame,
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
|
||||
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch,uint8_t N_RB_UL);
|
||||
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch, uint16_t N_RB_UL);
|
||||
|
||||
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint8_t abstraction_flag);
|
||||
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
|
||||
|
||||
|
||||
/*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2
|
||||
|
||||
@@ -54,60 +54,40 @@
|
||||
|
||||
//extern double cpuf;
|
||||
|
||||
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr,uint8_t N_RB_UL)
|
||||
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
|
||||
{
|
||||
|
||||
int i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
|
||||
NR_gNB_ULSCH_t *ulsch = *ulschptr;
|
||||
|
||||
if (ulsch) {
|
||||
if (N_RB_UL != 273) {
|
||||
a_segments = a_segments*N_RB_UL;
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
||||
|
||||
if (ulsch->harq_processes[i]) {
|
||||
if (ulsch->harq_processes[i]->b) {
|
||||
free16(ulsch->harq_processes[i]->b,a_segments*1056);
|
||||
ulsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
free16(ulsch->harq_processes[i]->c[r],(8448)*sizeof(uint8_t));
|
||||
ulsch->harq_processes[i]->c[r] = NULL;
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
if (ulsch->harq_processes[i]->d[r]) {
|
||||
free16(ulsch->harq_processes[i]->d[r],(68*384)*sizeof(int16_t));
|
||||
ulsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
if (ulsch->harq_processes[i]->w[r]) {
|
||||
free16(ulsch->harq_processes[i]->w[r],(3*(6144+64))*sizeof(int16_t));
|
||||
ulsch->harq_processes[i]->w[r] = NULL;
|
||||
}
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
if (ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]){
|
||||
nrLDPC_free_mem(ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
|
||||
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
|
||||
}
|
||||
}
|
||||
free16(ulsch->harq_processes[i],sizeof(NR_UL_gNB_HARQ_t));
|
||||
ulsch->harq_processes[i] = NULL;
|
||||
}
|
||||
}
|
||||
free16(ulsch,sizeof(NR_gNB_ULSCH_t));
|
||||
*ulschptr = NULL;
|
||||
if (N_RB_UL != 273) {
|
||||
a_segments = a_segments*N_RB_UL;
|
||||
a_segments = a_segments/273 +1;
|
||||
}
|
||||
|
||||
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
||||
if (ulsch->harq_processes[i]) {
|
||||
if (ulsch->harq_processes[i]->b) {
|
||||
free_and_zero(ulsch->harq_processes[i]->b);
|
||||
ulsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
free_and_zero(ulsch->harq_processes[i]->c[r]);
|
||||
free_and_zero(ulsch->harq_processes[i]->d[r]);
|
||||
free_and_zero(ulsch->harq_processes[i]->w[r]);
|
||||
nrLDPC_free_mem(ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
|
||||
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
|
||||
}
|
||||
free_and_zero(ulsch->harq_processes[i]);
|
||||
ulsch->harq_processes[i] = NULL;
|
||||
}
|
||||
}
|
||||
free_and_zero(*ulschptr);
|
||||
}
|
||||
|
||||
|
||||
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint8_t abstraction_flag)
|
||||
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
|
||||
{
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch;
|
||||
@@ -129,13 +109,11 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint
|
||||
|
||||
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
|
||||
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
|
||||
if (abstraction_flag == 0) {
|
||||
for (r=0; r<a_segments; r++) {
|
||||
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
|
||||
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
|
||||
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
|
||||
ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
|
||||
}
|
||||
for (r=0; r<a_segments; r++) {
|
||||
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
|
||||
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
|
||||
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
|
||||
ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,11 @@ NR_gNB_PUCCH_t *new_gNB_pucch(void){
|
||||
return (pucch);
|
||||
}
|
||||
|
||||
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
|
||||
{
|
||||
free_and_zero(pucch);
|
||||
}
|
||||
|
||||
int nr_find_pucch(uint16_t rnti,
|
||||
int frame,
|
||||
int slot,
|
||||
@@ -1533,7 +1538,6 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
else { // polar coded case
|
||||
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(2,nb_bit,pucch_pdu->prb_size,1,&gNB->uci_polarParams);
|
||||
__m64 *rp_re[Prx2][2];
|
||||
__m64 *rp2_re[Prx2][2];
|
||||
__m64 *rp_im[Prx2][2];
|
||||
@@ -1660,7 +1664,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
||||
} // half_prb
|
||||
} // symb
|
||||
// run polar decoder on llrs
|
||||
decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, currentPtr);
|
||||
decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, 2,nb_bit,pucch_pdu->prb_size);
|
||||
LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]);
|
||||
if (decoderState>0) decoderState=1;
|
||||
corr_dB = dB_fixed64(corr);
|
||||
|
||||
@@ -49,6 +49,11 @@ NR_gNB_SRS_t *new_gNB_srs(void){
|
||||
return (srs);
|
||||
}
|
||||
|
||||
void free_gNB_srs(NR_gNB_SRS_t *srs)
|
||||
{
|
||||
free_and_zero(srs);
|
||||
}
|
||||
|
||||
int nr_find_srs(uint16_t rnti,
|
||||
int frame,
|
||||
int slot,
|
||||
|
||||
@@ -832,14 +832,18 @@ void nr_pdcch_unscrambling(int16_t *z,
|
||||
/* This function compares the received DCI bits with
|
||||
* re-encoded DCI bits and returns the number of mismatched bits
|
||||
*/
|
||||
uint16_t nr_dci_false_detection(uint64_t *dci,
|
||||
int16_t *soft_in,
|
||||
const t_nrPolar_params *polar_param,
|
||||
int encoded_length,
|
||||
int rnti) {
|
||||
static uint16_t nr_dci_false_detection(uint64_t *dci,
|
||||
int16_t *soft_in,
|
||||
int encoded_length,
|
||||
int rnti,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
uint8_t aggregation_level
|
||||
) {
|
||||
|
||||
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
|
||||
polar_encoder_fast(dci, (void*)encoder_output, rnti, 1, (t_nrPolar_params *)polar_param);
|
||||
polar_encoder_fast(dci, (void*)encoder_output, rnti, 1,
|
||||
messageType, messageLength, aggregation_level);
|
||||
uint8_t *enout_p = (uint8_t*)encoder_output;
|
||||
uint16_t x = 0;
|
||||
|
||||
@@ -886,7 +890,6 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
if (dci_found==1) continue;
|
||||
int dci_length = rel15->dci_length_options[k];
|
||||
uint64_t dci_estimation[2]= {0};
|
||||
const t_nrPolar_params *currentPtrDCI = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L, 1, &ue->polarList);
|
||||
|
||||
LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n",
|
||||
j, rel15->number_of_candidates, CCEind, CCEind*9*6*2, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]);
|
||||
@@ -901,11 +904,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t crc = polar_decoder_int16(tmp_e,
|
||||
dci_estimation,
|
||||
1,
|
||||
currentPtrDCI);
|
||||
NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
|
||||
|
||||
n_rnti = rel15->rnti;
|
||||
LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n",
|
||||
@@ -913,7 +915,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
if (crc == n_rnti) {
|
||||
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation);
|
||||
uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,currentPtrDCI,L*108,n_rnti);
|
||||
uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,L*108,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
|
||||
ue->dci_thres = (ue->dci_thres + mb) / 2;
|
||||
if (mb > (ue->dci_thres+20)) {
|
||||
LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres);
|
||||
|
||||
@@ -79,7 +79,7 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) {
|
||||
free(params);
|
||||
}
|
||||
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
|
||||
int i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
NR_UE_DLSCH_t *dlsch=*dlschptr;
|
||||
@@ -131,7 +131,7 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
|
||||
}
|
||||
}
|
||||
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag) {
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL) {
|
||||
NR_UE_DLSCH_t *dlsch;
|
||||
uint8_t exit_flag = 0,i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||
@@ -167,30 +167,28 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
else
|
||||
exit_flag=3;
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
|
||||
for (r=0; r<a_segments; r++) {
|
||||
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
|
||||
|
||||
if (dlsch->harq_processes[i]->c[r])
|
||||
memset(dlsch->harq_processes[i]->c[r],0,1056);
|
||||
else
|
||||
exit_flag=2;
|
||||
if (dlsch->harq_processes[i]->c[r])
|
||||
memset(dlsch->harq_processes[i]->c[r],0,1056);
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->w[r])
|
||||
memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
}
|
||||
if (dlsch->harq_processes[i]->w[r])
|
||||
memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
}
|
||||
} else {
|
||||
exit_flag=1;
|
||||
|
||||
@@ -931,12 +931,12 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
for (aatx=0; aatx<nb_aatx; aatx++) {
|
||||
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12];
|
||||
|
||||
for (atx=0; atx<nb_aatx; atx++) {
|
||||
avg_rho_re[aarx][aatx*nb_aatx+atx] = 0;
|
||||
avg_rho_im[aarx][aatx*nb_aatx+atx] = 0;
|
||||
rho128 = (__m128i *)&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12];
|
||||
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12];
|
||||
dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[atx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12];
|
||||
|
||||
for (rb=0; rb<nb_rb_0; rb++) {
|
||||
|
||||
@@ -337,6 +337,22 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
sync_pos_frame = n_symb_prefix0*(fp->ofdm_symbol_size + fp->nb_prefix_samples0)+(ue->symbol_offset-n_symb_prefix0)*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
|
||||
// for a correct computation of frame number to sync with the one decoded at MIB we need to take into account in which of the n_frames we got sync
|
||||
ue->init_sync_frame = n_frames - 1 - is;
|
||||
|
||||
// compute the scramblingID_pdcch and the gold pdcch
|
||||
ue->scramblingID_pdcch = fp->Nid_cell;
|
||||
nr_gold_pdcch(ue,fp->Nid_cell);
|
||||
|
||||
// compute the scrambling IDs for PDSCH DMRS
|
||||
for (int i=0; i<2; i++)
|
||||
ue->scramblingID[i]=fp->Nid_cell;
|
||||
|
||||
nr_gold_pdsch(ue,ue->scramblingID);
|
||||
|
||||
// initialize the pusch dmrs
|
||||
uint16_t N_n_scid[2] = {fp->Nid_cell,fp->Nid_cell};
|
||||
int n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
|
||||
nr_init_pusch_dmrs(ue, N_n_scid, n_scid);
|
||||
|
||||
// we also need to take into account the shift by samples_per_frame in case the if is true
|
||||
if (ue->ssb_offset < sync_pos_frame){
|
||||
ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset;
|
||||
|
||||
@@ -533,8 +533,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0);
|
||||
//polar decoding de-rate matching
|
||||
const t_nrPolar_params *currentPtr = nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,1,&ue->polarList);
|
||||
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,currentPtr);
|
||||
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,
|
||||
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
|
||||
|
||||
if(decoderState) return(decoderState);
|
||||
|
||||
@@ -601,7 +601,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t *rx_ind = calloc(1, sizeof(*rx_ind));
|
||||
fapi_nr_rx_indication_t *rx_ind=calloc(sizeof(*rx_ind),1);
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
|
||||
@@ -609,6 +609,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
else
|
||||
free(rx_ind); // dl_indication would free(), so free() here if not called
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -50,24 +50,23 @@
|
||||
\brief This function frees memory allocated for a particular DLSCH at UE
|
||||
@param dlsch Pointer to DLSCH to be removed
|
||||
*/
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlsch,uint8_t N_RB_DL);
|
||||
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlsch, uint16_t N_RB_DL);
|
||||
|
||||
|
||||
/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
|
||||
/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft)
|
||||
\brief This function allocates structures for a particular DLSCH at UE
|
||||
@returns Pointer to DLSCH to be removed
|
||||
@param Kmimo Kmimo factor from 36-212/36-213
|
||||
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
|
||||
@param Nsoft Soft-LLR buffer size from UE-Category
|
||||
@params N_RB_DL total number of resource blocks (determine the operating BW)
|
||||
@param abstraction_flag Flag to indicate abstracted interface
|
||||
*/
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag);
|
||||
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint16_t N_RB_DL);
|
||||
|
||||
|
||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch,unsigned char N_RB_UL);
|
||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch, uint16_t N_RB_UL);
|
||||
|
||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag);
|
||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids);
|
||||
|
||||
/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception.
|
||||
@param stream0_in Input from channel compensated (MR combined) stream 0
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
//#define DEBUG_ULSCH_CODING
|
||||
|
||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL)
|
||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr, uint16_t N_RB_UL)
|
||||
|
||||
{
|
||||
int i, r;
|
||||
@@ -105,12 +105,8 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL)
|
||||
}
|
||||
|
||||
|
||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
|
||||
int number_of_harq_pids,
|
||||
uint8_t abstraction_flag)
|
||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids)
|
||||
{
|
||||
NR_UE_ULSCH_t *ulsch;
|
||||
unsigned char exit_flag = 0,i,r;
|
||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
|
||||
|
||||
if (N_RB_UL != 273) {
|
||||
@@ -120,97 +116,54 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
|
||||
|
||||
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||
|
||||
ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t));
|
||||
NR_UE_ULSCH_t *ulsch = malloc16(sizeof(NR_UE_ULSCH_t));
|
||||
DevAssert(ulsch);
|
||||
memset(ulsch, 0, sizeof(*ulsch));
|
||||
|
||||
if (ulsch) {
|
||||
memset(ulsch,0,sizeof(NR_UE_ULSCH_t));
|
||||
ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
|
||||
ulsch->Mlimit = 4; // maximum harq retransmissions
|
||||
|
||||
ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
|
||||
ulsch->Mlimit = 4; // maximum harq retransmissions
|
||||
//for (i=0; i<10; i++)
|
||||
//ulsch->harq_ids[i] = 0;
|
||||
|
||||
//for (i=0; i<10; i++)
|
||||
//ulsch->harq_ids[i] = 0;
|
||||
for (int i = 0; i < number_of_harq_pids; i++) {
|
||||
|
||||
for (i=0; i<number_of_harq_pids; i++) {
|
||||
ulsch->harq_processes[i] = malloc16(sizeof(NR_UL_UE_HARQ_t));
|
||||
DevAssert(ulsch->harq_processes[i]);
|
||||
memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
|
||||
|
||||
ulsch->harq_processes[i] = (NR_UL_UE_HARQ_t *)malloc16(sizeof(NR_UL_UE_HARQ_t));
|
||||
ulsch->harq_processes[i]->a = malloc16(ulsch_bytes);
|
||||
DevAssert(ulsch->harq_processes[i]->a);
|
||||
bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
|
||||
|
||||
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
|
||||
if (ulsch->harq_processes[i]) {
|
||||
memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
|
||||
ulsch->harq_processes[i]->b = (uint8_t*)malloc16(ulsch_bytes);
|
||||
ulsch->harq_processes[i]->a = (unsigned char*)malloc16(ulsch_bytes);
|
||||
ulsch->harq_processes[i]->b = malloc16(ulsch_bytes);
|
||||
DevAssert(ulsch->harq_processes[i]->b);
|
||||
bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
|
||||
|
||||
if (ulsch->harq_processes[i]->a) {
|
||||
bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
|
||||
} else {
|
||||
printf("Can't allocate PDU\n");
|
||||
exit_flag=1;
|
||||
}
|
||||
for (int r = 0; r < a_segments; r++) {
|
||||
// account for filler in first segment and CRCs for multiple segment case
|
||||
ulsch->harq_processes[i]->c[r] = malloc16(8448);
|
||||
DevAssert(ulsch->harq_processes[i]->c[r]);
|
||||
bzero(ulsch->harq_processes[i]->c[r],8448);
|
||||
|
||||
if (ulsch->harq_processes[i]->b)
|
||||
bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
|
||||
else {
|
||||
LOG_E(PHY,"Can't get b\n");
|
||||
exit_flag=1;
|
||||
}
|
||||
|
||||
if (abstraction_flag==0) {
|
||||
for (r=0; r<a_segments; r++) {
|
||||
// account for filler in first segment and CRCs for multiple segment case
|
||||
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
|
||||
ulsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
|
||||
|
||||
if (ulsch->harq_processes[i]->c[r]) {
|
||||
bzero(ulsch->harq_processes[i]->c[r],8448);
|
||||
} else {
|
||||
printf("Can't get c\n");
|
||||
exit_flag=2;
|
||||
}
|
||||
if (ulsch->harq_processes[i]->d[r]) {
|
||||
bzero(ulsch->harq_processes[i]->d[r],(68*384));
|
||||
} else {
|
||||
printf("Can't get d\n");
|
||||
exit_flag=2;
|
||||
}
|
||||
}
|
||||
ulsch->harq_processes[i]->e = (uint8_t*)malloc16(14*N_RB_UL*12*8);
|
||||
if (ulsch->harq_processes[i]->e) {
|
||||
bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
|
||||
} else {
|
||||
printf("Can't get e\n");
|
||||
exit_flag=1;
|
||||
}
|
||||
ulsch->harq_processes[i]->f = (uint8_t*)malloc16(14*N_RB_UL*12*8);
|
||||
if (ulsch->harq_processes[i]->f) {
|
||||
bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
|
||||
} else {
|
||||
printf("Can't get f\n");
|
||||
exit_flag=1;
|
||||
}
|
||||
}
|
||||
|
||||
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
|
||||
ulsch->harq_processes[i]->first_tx = 1;
|
||||
} else {
|
||||
LOG_E(PHY,"Can't get harq_p %d\n",i);
|
||||
exit_flag=3;
|
||||
}
|
||||
ulsch->harq_processes[i]->d[r] = malloc16(68*384); //max size for coded output
|
||||
DevAssert(ulsch->harq_processes[i]->d[r]);
|
||||
bzero(ulsch->harq_processes[i]->d[r],(68*384));
|
||||
}
|
||||
|
||||
if (exit_flag==0) {
|
||||
for (i=0; i<number_of_harq_pids; i++) {
|
||||
ulsch->harq_processes[i]->round=0;
|
||||
}
|
||||
return(ulsch);
|
||||
}
|
||||
ulsch->harq_processes[i]->e = malloc16(14*N_RB_UL*12*8);
|
||||
DevAssert(ulsch->harq_processes[i]->e);
|
||||
bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
|
||||
|
||||
ulsch->harq_processes[i]->f = malloc16(14*N_RB_UL*12*8);
|
||||
DevAssert(ulsch->harq_processes[i]->f);
|
||||
bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
|
||||
|
||||
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
|
||||
ulsch->harq_processes[i]->first_tx = 1;
|
||||
}
|
||||
|
||||
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
|
||||
free_nr_ue_ulsch(&ulsch,N_RB_UL);
|
||||
return(NULL);
|
||||
|
||||
|
||||
return(ulsch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
||||
|
||||
uint8_t num_of_codewords = 1; // tmp assumption
|
||||
int Nid_cell = 0;
|
||||
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
|
||||
@@ -153,7 +152,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||
start_sc -= frame_parms->ofdm_symbol_size;
|
||||
|
||||
ulsch_ue->Nid_cell = Nid_cell;
|
||||
ulsch_ue->Nid_cell = frame_parms->Nid_cell;
|
||||
|
||||
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||
if((ul_dmrs_symb_pos >> i) & 0x01)
|
||||
@@ -391,7 +390,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
|
||||
} else {
|
||||
dmrs_idx = 0;
|
||||
}
|
||||
|
||||
@@ -440,33 +440,10 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
|
||||
void free_context_pss_nr(void)
|
||||
{
|
||||
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
|
||||
|
||||
if (primary_synchro_time_nr[i] != NULL) {
|
||||
free(primary_synchro_time_nr[i]);
|
||||
primary_synchro_time_nr[i] = NULL;
|
||||
}
|
||||
else {
|
||||
LOG_E(PHY,"Fatal memory deallocation problem \n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (primary_synchro_nr[i] != NULL) {
|
||||
free(primary_synchro_nr[i]);
|
||||
primary_synchro_nr[i] = NULL;
|
||||
}
|
||||
else {
|
||||
LOG_E(PHY,"Fatal memory deallocation problem \n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (pss_corr_ue[i] != NULL) {
|
||||
free(pss_corr_ue[i]);
|
||||
pss_corr_ue[i] = NULL;
|
||||
}
|
||||
else {
|
||||
LOG_E(PHY,"Fatal memory deallocation problem \n");
|
||||
assert(0);
|
||||
}
|
||||
free_and_zero(primary_synchro_nr[i]);
|
||||
free_and_zero(primary_synchro_nr2[i]);
|
||||
free_and_zero(primary_synchro_time_nr[i]);
|
||||
free_and_zero(pss_corr_ue[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -850,7 +850,7 @@ static inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_
|
||||
printf("\t\t [nr_pucch2_3_4_scrambling] scrambling M_bit=%d bits\n", M_bit);
|
||||
#endif
|
||||
}
|
||||
void nr_uci_encoding(uint64_t payload,
|
||||
static void nr_uci_encoding(uint64_t payload,
|
||||
uint8_t nr_bit,
|
||||
int fmt,
|
||||
uint8_t is_pi_over_2_bpsk_enabled,
|
||||
@@ -946,12 +946,10 @@ void nr_uci_encoding(uint64_t payload,
|
||||
AssertFatal(nrofPRB<=16,"Number of PRB >16\n");
|
||||
} else if (A>=12) {
|
||||
AssertFatal(A<65,"Polar encoding not supported yet for UCI with more than 64 bits\n");
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_UCI_PUCCH_MESSAGE_TYPE,
|
||||
A,
|
||||
nrofPRB,
|
||||
1,
|
||||
NULL);
|
||||
polar_encoder_fast(&payload, b, 0,0,currentPtr);
|
||||
polar_encoder_fast(&payload, b, 0,0,
|
||||
NR_POLAR_UCI_PUCCH_MESSAGE_TYPE,
|
||||
A,
|
||||
nrofPRB);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
/// statistics for ULSCH measurement collection
|
||||
NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
|
||||
NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX];
|
||||
t_nrPolar_params *uci_polarParams;
|
||||
t_nrPolar_params **polarParams;
|
||||
|
||||
/// SRS variables
|
||||
nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX];
|
||||
|
||||
@@ -814,7 +814,6 @@ typedef struct {
|
||||
|
||||
fapi_nr_config_request_t nrUE_config;
|
||||
|
||||
t_nrPolar_params *polarList;
|
||||
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX+1]; // two RxTx Threads
|
||||
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
@@ -387,8 +387,6 @@ struct NR_DL_FRAME_PARMS {
|
||||
uint8_t N_ssb;
|
||||
/// SSB index
|
||||
uint8_t ssb_index;
|
||||
/// PBCH polar encoder params
|
||||
t_nrPolar_params pbch_polar_params;
|
||||
/// OFDM symbol offset divisor for UL
|
||||
uint32_t ofdm_offset_divisor;
|
||||
};
|
||||
|
||||
@@ -54,5 +54,6 @@ void nr_fep_full(RU_t *ru, int slot);
|
||||
void nr_fep_full_2thread(RU_t *ru, int slot);
|
||||
void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
|
||||
int nr_phy_init_RU(RU_t *ru);
|
||||
void nr_phy_free_RU(RU_t *ru);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -295,9 +295,6 @@ uint8_t nr_pdcch_alloc2ul_subframe(NR_DL_FRAME_PARMS *frame_parms,uint8_t n);
|
||||
uint32_t nr_pdcch_alloc2ul_frame(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n);
|
||||
|
||||
|
||||
uint16_t nr_get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
|
||||
|
||||
|
||||
int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
||||
|
||||
/*! \brief UL time alignment procedures for TA application
|
||||
|
||||
@@ -64,6 +64,13 @@
|
||||
void feptx_ofdm(RU_t *ru, int frame, int subframe);
|
||||
void feptx_prec(RU_t *ru, int frame, int subframe);
|
||||
|
||||
const char *__asan_default_options()
|
||||
{
|
||||
/* don't do leak checking in nr_ulsim, not finished yet */
|
||||
return "detect_leaks=0";
|
||||
}
|
||||
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
@@ -140,7 +147,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
|
||||
}
|
||||
|
||||
void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
|
||||
double *s_re[2],double *s_im[2],double *r_re[2],double *r_im[2],FILE *csv_fd) {
|
||||
double *s_re[NB_ANTENNAS_TX],double *s_im[NB_ANTENNAS_TX],double *r_re[NB_ANTENNAS_RX],double *r_im[NB_ANTENNAS_RX],FILE *csv_fd) {
|
||||
int i,u;
|
||||
int aa,aarx,aatx;
|
||||
double channelx,channely;
|
||||
@@ -1538,9 +1545,9 @@ int main(int argc, char **argv) {
|
||||
LOG_M("txsig0.m","txs0", &ru->common.txdata[0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1);
|
||||
|
||||
if (transmission_mode<7) {
|
||||
LOG_M("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
LOG_M("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][0],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
} else if (transmission_mode == 7) {
|
||||
LOG_M("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
LOG_M("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][0],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
LOG_M("txsigF0_BF.m","txsF0_BF", &ru->common.txdataF_BF[0][0],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,12 @@
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
|
||||
const char *__asan_default_options()
|
||||
{
|
||||
/* don't do leak checking in ulsim, not finished yet */
|
||||
return "detect_leaks=0";
|
||||
}
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
@@ -334,10 +340,10 @@ int main(int argc, char **argv) {
|
||||
double s_re1[30720],s_im1[30720],r_re1[30720],r_im1[30720];
|
||||
double r_re2[30720],r_im2[30720];
|
||||
double r_re3[30720],r_im3[30720];
|
||||
double *s_re[2]= {s_re0,s_re1};
|
||||
double *s_im[2]= {s_im0,s_im1};
|
||||
double *r_re[4]= {r_re0,r_re1,r_re2,r_re3};
|
||||
double *r_im[4]= {r_im0,r_im1,r_im2,r_im3};
|
||||
double *s_re[NB_ANTENNAS_TX]= {s_re0,s_re1, NULL, NULL};
|
||||
double *s_im[NB_ANTENNAS_TX]= {s_im0,s_im1, NULL, NULL};
|
||||
double *r_re[NB_ANTENNAS_RX]= {r_re0,r_re1,r_re2,r_re3};
|
||||
double *r_im[NB_ANTENNAS_RX]= {r_im0,r_im1,r_im2,r_im3};
|
||||
double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
|
||||
double iqim=0.0;
|
||||
int cqi_error,cqi_errors,ack_errors,cqi_crc_falsepositives,cqi_crc_falsenegatives;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "T.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
@@ -355,7 +356,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
initTpool(gNBthreads, gNB->threadPool, true);
|
||||
@@ -412,7 +413,7 @@ int main(int argc, char **argv)
|
||||
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
//phy_init_nr_top(frame_parms);
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(UE, 1) != 0) {
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -421,8 +422,7 @@ int main(int argc, char **argv)
|
||||
//init_nr_ue_transport(UE, 0);
|
||||
for (int sf = 0; sf < 2; sf++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL,
|
||||
0);
|
||||
UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL);
|
||||
|
||||
if (!UE->dlsch[sf][0][i]) {
|
||||
printf("Can't get ue dlsch structures\n");
|
||||
@@ -433,8 +433,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
UE->dlsch_SI[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
||||
processingData_L1tx_t msgDataTx;
|
||||
init_DLSCH_struct(gNB, &msgDataTx);
|
||||
@@ -472,16 +470,13 @@ int main(int argc, char **argv)
|
||||
rel15->dlDmrsSymbPos = 4;
|
||||
rel15->mcsIndex[0] = Imcs;
|
||||
rel15->numDmrsCdmGrpsNoData = 1;
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
|
||||
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
|
||||
double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
|
||||
short channel_output_fixed[16 * 68 * 384];
|
||||
//unsigned char *estimated_output;
|
||||
unsigned char *estimated_output_bit;
|
||||
unsigned char *test_input_bit;
|
||||
unsigned int errors_bit = 0;
|
||||
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
unsigned char test_input_bit[16 * 68 * 384];
|
||||
//estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
unsigned char estimated_output_bit[16 * 68 * 384];
|
||||
NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0][0];
|
||||
NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid];
|
||||
harq_process->mcs = Imcs;
|
||||
@@ -495,9 +490,10 @@ int main(int argc, char **argv)
|
||||
harq_process->dlDmrsSymbPos = 4;
|
||||
harq_process->n_dmrs_cdm_groups = 1;
|
||||
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
|
||||
|
||||
unsigned char *test_input;
|
||||
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
|
||||
|
||||
//unsigned char test_input[TBS / 8] __attribute__ ((aligned(16)));
|
||||
for (i = 0; i < TBS / 8; i++)
|
||||
test_input[i] = (unsigned char) rand();
|
||||
|
||||
@@ -554,12 +550,6 @@ int main(int argc, char **argv)
|
||||
i,modulated_input[i],
|
||||
i,channel_output_fixed[i]);
|
||||
*/
|
||||
|
||||
//Uncoded BER
|
||||
if (channel_output_fixed[i] < 0)
|
||||
channel_output_uncoded[i] = 1; //QPSK demod
|
||||
else
|
||||
channel_output_uncoded[i] = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CODER
|
||||
@@ -641,12 +631,22 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}*/
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
printf("gNB %d\n", i);
|
||||
free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL);
|
||||
printf("UE %d\n", i);
|
||||
free_nr_ue_dlsch(&(UE->dlsch[0][0][i]),N_RB_DL);
|
||||
}
|
||||
free(test_input);
|
||||
|
||||
free_channel_desc_scm(gNB2UE);
|
||||
|
||||
reset_DLSCH_struct(gNB, &msgDataTx);
|
||||
|
||||
phy_free_nr_gNB(gNB);
|
||||
free(gNB->threadPool);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
for (int sf = 0; sf < 2; sf++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
free_nr_ue_dlsch(&UE->dlsch[sf][0][i], N_RB_DL);
|
||||
term_nr_ue_signal(UE, 1);
|
||||
free(UE);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
free(s_re[i]);
|
||||
@@ -671,6 +671,9 @@ int main(int argc, char **argv)
|
||||
if (ouput_vcd)
|
||||
vcd_signal_dumper_close();
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return (n_errors);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,12 @@
|
||||
#include <executables/softmodem-common.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
|
||||
const char *__asan_default_options()
|
||||
{
|
||||
/* don't do leak checking in nr_ulsim, not finished yet */
|
||||
return "detect_leaks=0";
|
||||
}
|
||||
|
||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||
|
||||
@@ -917,16 +923,25 @@ int main(int argc, char **argv)
|
||||
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
if (init_nr_ue_signal(UE, 1) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
init_nr_ue_transport(UE,0);
|
||||
init_nr_ue_transport(UE);
|
||||
|
||||
nr_gold_pbch(UE);
|
||||
nr_gold_pdcch(UE,0);
|
||||
|
||||
// compute the scramblingID_pdcch and the gold pdcch
|
||||
UE->scramblingID_pdcch = frame_parms->Nid_cell;
|
||||
nr_gold_pdcch(UE, frame_parms->Nid_cell);
|
||||
|
||||
// compute the scrambling IDs for PDSCH DMRS
|
||||
for (int i = 0; i < 2; i++)
|
||||
UE->scramblingID[i] = frame_parms->Nid_cell;
|
||||
|
||||
nr_gold_pdsch(UE, UE->scramblingID);
|
||||
|
||||
nr_l2_init_ue(NULL);
|
||||
UE_mac = get_mac_inst(0);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "PHY/types.h"
|
||||
@@ -438,12 +439,13 @@ int main(int argc, char **argv)
|
||||
printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL);
|
||||
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
RC.gNB[0] = malloc16_clear(sizeof(*(RC.gNB[0])));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
frame_parms->nb_antenna_ports_gNB = n_tx;
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->Nid_cell = Nid_cell;
|
||||
frame_parms->nushift = Nid_cell%4;
|
||||
@@ -533,19 +535,13 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(s_re[i],frame_length_complex_samples*sizeof(double));
|
||||
s_im[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(s_im[i],frame_length_complex_samples*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(double));
|
||||
r_im[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(r_im[i],frame_length_complex_samples*sizeof(double));
|
||||
s_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
s_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
|
||||
r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(int));
|
||||
txdata[i] = malloc16_clear(frame_length_complex_samples*sizeof(int));
|
||||
}
|
||||
|
||||
if (pbch_file_fd!=NULL) {
|
||||
@@ -554,8 +550,8 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE = malloc16_clear(sizeof(*UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(UE->frame_parms));
|
||||
//phy_init_nr_top(UE); //called from init_nr_ue_signal
|
||||
if (run_initial_sync==1) UE->is_synchronized = 0;
|
||||
else UE->is_synchronized = 1;
|
||||
@@ -565,7 +561,7 @@ int main(int argc, char **argv)
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(UE, 1) != 0) {
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -780,6 +776,15 @@ int main(int argc, char **argv)
|
||||
|
||||
} // NSR
|
||||
|
||||
free_channel_desc_scm(gNB2UE);
|
||||
|
||||
phy_free_nr_gNB(gNB);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
term_nr_ue_signal(UE, 1);
|
||||
free(UE);
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -800,6 +805,9 @@ int main(int argc, char **argv)
|
||||
if (input_fd)
|
||||
fclose(input_fd);
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return(n_errors);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
@@ -662,7 +663,6 @@ int main(int argc, char **argv){
|
||||
RC.nb_nr_L1_inst=1;
|
||||
phy_init_nr_gNB(gNB,0,1); //lowmem
|
||||
nr_phy_init_RU(ru);
|
||||
gNB->common_vars.rxdata = ru->common.rxdata;
|
||||
set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4);
|
||||
|
||||
// Configure UE
|
||||
@@ -674,7 +674,7 @@ int main(int argc, char **argv){
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->nrUE_config.prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t));
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0){
|
||||
if (init_nr_ue_signal(UE, 1) != 0){
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -781,7 +781,7 @@ int main(int argc, char **argv){
|
||||
// multipath channel
|
||||
// dump_nr_prach_config(&gNB->frame_parms,subframe);
|
||||
|
||||
for (i = 0; i < frame_parms->samples_per_subframe<<1; i++) {
|
||||
for (i = 0; i < frame_parms->samples_per_subframe; i++) {
|
||||
for (aa=0; aa<1; aa++) {
|
||||
if (awgn_flag == 0) {
|
||||
s_re[aa][i] = ((double)(((short *)&txdata[aa][prach_start]))[(i<<1)]);
|
||||
@@ -879,7 +879,8 @@ int main(int argc, char **argv){
|
||||
|
||||
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
|
||||
|
||||
gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion];
|
||||
for (int i = 0; i < ru->nb_rx; ++i)
|
||||
gNB->prach_vars.rxsigF[i] = ru->prach_rxsigF[prachOccasion][i];
|
||||
if (n_frames == 1) printf("ncs %d,num_seq %d\n",prach_pdu->num_cs, prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
|
||||
rx_nr_prach(gNB, prach_pdu, prachOccasion, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
|
||||
|
||||
@@ -897,7 +898,7 @@ int main(int argc, char **argv){
|
||||
#ifdef NR_PRACH_DEBUG
|
||||
LOG_M("prach0.m","prach0", &txdata[0][prach_start], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1);
|
||||
LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1);
|
||||
LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
|
||||
@@ -922,6 +923,28 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
} //SNR loop
|
||||
|
||||
free_channel_desc_scm(UE2gNB);
|
||||
|
||||
nr_phy_free_RU(ru);
|
||||
free(RC.ru[0]);
|
||||
free(RC.ru);
|
||||
|
||||
phy_free_nr_gNB(gNB);
|
||||
// allocated in set_tdd_config_nr()
|
||||
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
free(gNB->gNB_config.prach_config.num_prach_fd_occasions_list);
|
||||
for (int i = 0; i < nb_slots_to_set; ++i)
|
||||
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
|
||||
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
term_nr_ue_signal(UE, 1);
|
||||
free(UE->nrUE_config.prach_config.num_prach_fd_occasions_list);
|
||||
free(UE);
|
||||
free(PHY_vars_UE_g[0]);
|
||||
free(PHY_vars_UE_g);
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -936,5 +959,8 @@ int main(int argc, char **argv){
|
||||
|
||||
if (input_fd) fclose(input_fd);
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/types.h"
|
||||
@@ -70,7 +71,6 @@ int main(int argc, char **argv)
|
||||
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
|
||||
double cfo=0;
|
||||
uint8_t snr1set=0;
|
||||
int **txdataF,**rxdataF;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
//int sync_pos, sync_pos_slot;
|
||||
//FILE *rx_frame_file;
|
||||
@@ -372,7 +372,7 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX);
|
||||
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB = calloc(1, sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->pucch0_thres = pucch_DTX_thres;
|
||||
@@ -441,24 +441,15 @@ int main(int argc, char **argv)
|
||||
s_im = malloc(n_tx*sizeof(double*));
|
||||
r_re = malloc(n_rx*sizeof(double*));
|
||||
r_im = malloc(n_rx*sizeof(double*));
|
||||
txdataF = malloc(n_tx*sizeof(int*));
|
||||
rxdataF = malloc(n_rx*sizeof(int*));
|
||||
gNB->common_vars.rxdataF=rxdataF;
|
||||
memcpy((void*)&gNB->frame_parms,(void*)frame_parms,sizeof(frame_parms));
|
||||
for (int aatx=0; aatx<n_tx; aatx++) {
|
||||
s_re[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
s_im[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for txdataF\n",frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size);
|
||||
txdataF[aatx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
bzero(txdataF[aatx],14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
}
|
||||
|
||||
for (int aarx=0; aarx<n_rx; aarx++) {
|
||||
r_re[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
r_im[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for rxdataF\n",frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size);
|
||||
rxdataF[aarx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
bzero(rxdataF[aarx],14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
}
|
||||
|
||||
uint8_t mcs=0;
|
||||
@@ -474,7 +465,6 @@ int main(int argc, char **argv)
|
||||
mcs=table2_mcs[actual_payload+shift];
|
||||
else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag);
|
||||
}
|
||||
else if (format == 2 && nr_bit > 11) gNB->uci_polarParams = nr_polar_params(2, nr_bit, nrofPRB, 1, NULL);
|
||||
|
||||
startingPRB_intraSlotHopping = N_RB_DL-1;
|
||||
uint32_t hopping_id = Nid_cell;
|
||||
@@ -490,7 +480,7 @@ int main(int argc, char **argv)
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
if (init_nr_ue_signal(UE, 1) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
@@ -536,6 +526,7 @@ int main(int argc, char **argv)
|
||||
ack_nack_errors=0;
|
||||
sr_errors=0;
|
||||
n_errors = 0;
|
||||
int **txdataF = gNB->common_vars.txdataF;
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
for (int aatx=0;aatx<1;aatx++)
|
||||
bzero(txdataF[aatx],frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
@@ -560,18 +551,17 @@ int main(int argc, char **argv)
|
||||
|
||||
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
|
||||
|
||||
int i0;
|
||||
double txr,txi,rxr,rxi,nr,ni;
|
||||
struct complex16 **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF;
|
||||
for (int symb=0; symb<gNB->frame_parms.symbols_per_slot;symb++) {
|
||||
if (symb<startingSymbolIndex || symb >= startingSymbolIndex+nrofSymbols) {
|
||||
i0 = symb*gNB->frame_parms.ofdm_symbol_size;
|
||||
int i0 = symb*gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int re=0;re<N_RB_DL*12;re++) {
|
||||
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
||||
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(nr)/sqrt((double)txlev));
|
||||
((int16_t*)rxdataF[aarx])[1+(i<<1)] = (int16_t)(100.0*(ni)/sqrt((double)txlev));
|
||||
double nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
double ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
rxdataF[aarx][i].r = (int16_t)(100.0*(nr)/sqrt((double)txlev));
|
||||
rxdataF[aarx][i].i = (int16_t)(100.0*(ni)/sqrt((double)txlev));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -579,43 +569,45 @@ int main(int argc, char **argv)
|
||||
|
||||
random_channel(UE2gNB,0);
|
||||
freq_channel(UE2gNB,N_RB_DL,2*N_RB_DL+1,scs/1000);
|
||||
struct complexd phasor;
|
||||
double rxr_tmp;
|
||||
for (int symb=0; symb<nrofSymbols; symb++) {
|
||||
i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
||||
int i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int re=0;re<N_RB_DL*12;re++) {
|
||||
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
||||
phasor.r = cos(2*M_PI*phase*re);
|
||||
struct complexd phasor;
|
||||
phasor.r = cos(2*M_PI*phase*re);
|
||||
phasor.i = sin(2*M_PI*phase*re);
|
||||
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||
txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
||||
txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
||||
rxr = txr*UE2gNB->chF[aarx][re].r - txi*UE2gNB->chF[aarx][re].i;
|
||||
rxi = txr*UE2gNB->chF[aarx][re].i + txi*UE2gNB->chF[aarx][re].r;
|
||||
rxr_tmp = rxr*phasor.r - rxi*phasor.i;
|
||||
double txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
||||
double txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
||||
double rxr={0},rxi={0};
|
||||
for (int l = 0; l<UE2gNB->channel_length; l++) {
|
||||
rxr = txr*UE2gNB->chF[aarx][l].r - txi*UE2gNB->chF[aarx][l].i;
|
||||
rxi = txr*UE2gNB->chF[aarx][l].i + txi*UE2gNB->chF[aarx][l].r;
|
||||
}
|
||||
double rxr_tmp = rxr*phasor.r - rxi*phasor.i;
|
||||
rxi = rxr*phasor.i + rxi*phasor.r;
|
||||
rxr = rxr_tmp;
|
||||
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
|
||||
((int16_t*)rxdataF[aarx])[1+(i<<1)]=(int16_t)(100.0*(rxi + ni)/sqrt((double)txlev));
|
||||
double nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
double ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
rxdataF[aarx][i].r = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
|
||||
rxdataF[aarx][i].i=(int16_t)(100.0*(rxi + ni)/sqrt((double)txlev));
|
||||
|
||||
if (n_trials==1 && abs(txr) > 0) printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
|
||||
symb, re, aarx, txr,txi,
|
||||
UE2gNB->chF[aarx][re].r,UE2gNB->chF[aarx][re].i,
|
||||
nr,ni, rxr,rxi,
|
||||
((int16_t*)rxdataF[aarx])[i<<1],((int16_t*)rxdataF[aarx])[1+(i<<1)]);
|
||||
rxdataF[aarx][i].r,rxdataF[aarx][i].i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int rxlev=0;
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy((int32_t*)&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size);
|
||||
|
||||
int rxlev_pucch=0;
|
||||
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev_pucch += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev_pucch += signal_energy((int32_t*)&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
12);
|
||||
|
||||
// set UL mask for pucch allocation
|
||||
@@ -660,25 +652,26 @@ int main(int argc, char **argv)
|
||||
if(sr_flag==1){
|
||||
if (uci_pdu.sr->sr_indication == 0 || uci_pdu.sr->sr_confidence_level == 1)
|
||||
sr_errors+=1;
|
||||
free(uci_pdu.sr);
|
||||
}
|
||||
// harq value 0 -> pass
|
||||
nfapi_nr_harq_t *harq_list = uci_pdu.harq->harq_list;
|
||||
// confidence value 0 -> good confidence
|
||||
const int harq_value0 = uci_pdu.harq->harq_list[0].harq_value;
|
||||
const int harq_value1 = uci_pdu.harq->harq_list[1].harq_value;
|
||||
const int confidence_lvl = uci_pdu.harq->harq_confidence_level;
|
||||
if(nr_bit>0){
|
||||
if (nr_bit==1 && do_DTX == 0)
|
||||
ack_nack_errors+=(actual_payload^(!harq_value0));
|
||||
ack_nack_errors+=(actual_payload^(!harq_list[0].harq_value));
|
||||
else if (do_DTX == 0)
|
||||
ack_nack_errors+=(((actual_payload&1)^(!harq_value0))+((actual_payload>>1)^(!harq_value1)));
|
||||
else if ((!confidence_lvl && !harq_value0) ||
|
||||
(!confidence_lvl && nr_bit == 2 && !harq_value1))
|
||||
ack_nack_errors+=(((actual_payload&1)^(!harq_list[0].harq_value))+((actual_payload>>1)^(!harq_list[1].harq_value)));
|
||||
else if ((!confidence_lvl && !harq_list[0].harq_value) ||
|
||||
(!confidence_lvl && nr_bit == 2 && !harq_list[1].harq_value))
|
||||
ack_nack_errors++;
|
||||
free(uci_pdu.harq->harq_list);
|
||||
}
|
||||
free(uci_pdu.harq);
|
||||
}
|
||||
else if (format==1) {
|
||||
nr_decode_pucch1(rxdataF,PUCCH_GroupHopping,hopping_id,
|
||||
nr_decode_pucch1((int32_t **)rxdataF,PUCCH_GroupHopping,hopping_id,
|
||||
&(payload_received),frame_parms,amp,nr_slot_tx,
|
||||
m0,nrofSymbols,startingSymbolIndex,startingPRB,
|
||||
startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
|
||||
@@ -734,26 +727,34 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
free_channel_desc_scm(UE2gNB);
|
||||
term_freq_channel();
|
||||
|
||||
phy_free_nr_gNB(gNB);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
term_nr_ue_signal(UE, 1);
|
||||
free(UE);
|
||||
|
||||
for (int aatx=0; aatx<n_tx; aatx++) {
|
||||
free(s_re[aatx]);
|
||||
free(s_im[aatx]);
|
||||
free(txdataF[aatx]);
|
||||
}
|
||||
for (int aarx=0; aarx<n_rx; aarx++) {
|
||||
free(r_re[aarx]);
|
||||
free(r_im[aarx]);
|
||||
free(rxdataF[aarx]);
|
||||
}
|
||||
free(s_re);
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
free(txdataF);
|
||||
free(rxdataF);
|
||||
|
||||
if (output_fd) fclose(output_fd);
|
||||
if (input_fd) fclose(input_fd);
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/types.h"
|
||||
@@ -372,7 +373,7 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
//gNB_config = &gNB->gNB_config;
|
||||
|
||||
@@ -400,7 +401,7 @@ int main(int argc, char **argv)
|
||||
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
//phy_init_nr_top(frame_parms);
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(UE, 1) != 0) {
|
||||
printf("Error at UE NR initialisation.\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -408,7 +409,7 @@ int main(int argc, char **argv)
|
||||
for (sf = 0; sf < 2; sf++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0);
|
||||
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8);
|
||||
|
||||
if (!UE->ulsch[sf][0][i]) {
|
||||
printf("Can't get ue ulsch structures.\n");
|
||||
@@ -454,46 +455,39 @@ int main(int argc, char **argv)
|
||||
rel15_ul->pusch_data.tb_size = TBS/8;
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
|
||||
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
|
||||
double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
|
||||
short channel_output_fixed[16 * 68 * 384];
|
||||
short channel_output_uncoded[16 * 68 * 384];
|
||||
unsigned int errors_bit_uncoded = 0;
|
||||
unsigned char *estimated_output_bit;
|
||||
unsigned char *test_input_bit;
|
||||
unsigned int errors_bit = 0;
|
||||
|
||||
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
|
||||
unsigned char *test_input;
|
||||
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
|
||||
|
||||
for (i = 0; i < TBS / 8; i++)
|
||||
test_input[i] = (unsigned char) rand();
|
||||
unsigned char test_input_bit[16 * 68 * 384];
|
||||
unsigned char estimated_output_bit[16 * 68 * 384];
|
||||
|
||||
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
|
||||
///////////
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||
DevAssert(harq_process_ul_ue);
|
||||
|
||||
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh;
|
||||
|
||||
if (harq_process_ul_ue) {
|
||||
harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
|
||||
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
|
||||
harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
|
||||
harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
|
||||
harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
|
||||
unsigned char *test_input = harq_process_ul_ue->a;
|
||||
|
||||
harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
|
||||
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
|
||||
harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
|
||||
harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
|
||||
harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
|
||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
|
||||
harq_process_ul_ue->a = &test_input[0];
|
||||
|
||||
}
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
for (i = 0; i < TBS / 8; i++)
|
||||
test_input[i] = (unsigned char) rand();
|
||||
|
||||
#ifdef DEBUG_NR_ULSCHSIM
|
||||
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
|
||||
#endif
|
||||
@@ -620,6 +614,19 @@ int main(int argc, char **argv)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
for (sf = 0; sf < 2; sf++)
|
||||
for (i = 0; i < 2; i++)
|
||||
free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL);
|
||||
term_nr_ue_signal(UE, 1);
|
||||
free(UE);
|
||||
|
||||
phy_free_nr_gNB(gNB);
|
||||
free(gNB->threadPool);
|
||||
free(gNB->respDecode);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
free_channel_desc_scm(gNB2UE);
|
||||
|
||||
if (output_fd)
|
||||
fclose(output_fd);
|
||||
@@ -627,6 +634,9 @@ int main(int argc, char **argv)
|
||||
if (input_fd)
|
||||
fclose(input_fd);
|
||||
|
||||
loader_reset();
|
||||
logTerm();
|
||||
|
||||
return (n_errors);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,12 @@
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
//#define DEBUG_ULSIM
|
||||
|
||||
const char *__asan_default_options()
|
||||
{
|
||||
/* don't do leak checking in nr_ulsim, not finished yet */
|
||||
return "detect_leaks=0";
|
||||
}
|
||||
|
||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||
|
||||
@@ -760,28 +766,17 @@ int main(int argc, char **argv)
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
//phy_init_nr_top(frame_parms);
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(UE, 1) != 0) {
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//nr_init_frame_parms_ue(&UE->frame_parms);
|
||||
init_nr_ue_transport(UE, 0);
|
||||
init_nr_ue_transport(UE);
|
||||
|
||||
/*
|
||||
for (int sf = 0; sf < 2; sf++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0);
|
||||
|
||||
if (!UE->ulsch[sf][0][i]) {
|
||||
printf("Can't get ue ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// initialize the pusch dmrs
|
||||
uint16_t N_n_scid[2] = {frame_parms->Nid_cell,frame_parms->Nid_cell};
|
||||
int n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
|
||||
nr_init_pusch_dmrs(UE, N_n_scid, n_scid);
|
||||
|
||||
//Configure UE
|
||||
NR_UE_RRC_INST_t rrcue;
|
||||
|
||||
@@ -71,7 +71,7 @@ static nfapi_config_request_t *config =&config_t;
|
||||
/*************** FUNCTIONS ****************************************/
|
||||
|
||||
//void phy_init_nr_top(NR_DL_FRAME_PARMS *frame_parms);
|
||||
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);
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@@ -248,7 +248,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
|
||||
|
||||
//phy_init_nr_top(frame_parms);
|
||||
|
||||
if (init_nr_ue_signal(PHY_vars_UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(PHY_vars_UE, 1) != 0) {
|
||||
LOG_E(PHY,"Error at UE NR initialisation : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -33,11 +33,26 @@
|
||||
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
|
||||
|
||||
double **cos_lut=NULL,* *sin_lut=NULL;
|
||||
static int freq_channel_init = 0;
|
||||
static int n_samples_max = 0;
|
||||
|
||||
|
||||
//#if 1
|
||||
|
||||
|
||||
void term_freq_channel(void)
|
||||
{
|
||||
for (int f = -(n_samples_max >> 1); f <= n_samples_max >> 1; f++) {
|
||||
const int idx = f + (n_samples_max >> 1);
|
||||
if (cos_lut[idx])
|
||||
free_and_zero(cos_lut[idx]);
|
||||
if (sin_lut[idx])
|
||||
free_and_zero(sin_lut[idx]);
|
||||
}
|
||||
free_and_zero(cos_lut);
|
||||
free_and_zero(sin_lut);
|
||||
freq_channel_init = 0;
|
||||
n_samples_max = 0;
|
||||
}
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) {
|
||||
double delta_f,freq; // 90 kHz spacing
|
||||
@@ -78,8 +93,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs)
|
||||
int16_t f,f2,d;
|
||||
uint8_t aarx,aatx,l;
|
||||
double *clut,*slut;
|
||||
static int freq_channel_init=0;
|
||||
static int n_samples_max=0;
|
||||
|
||||
// do some error checking
|
||||
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
|
||||
|
||||
@@ -125,7 +125,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(12*257 * sizeof(struct complexd)); // allocate for up to 257 RBs, 12 samples per RB
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(275 * 12 * sizeof(struct complexd)); // allocate for up to 275 RBs, 12 symbols per RB
|
||||
|
||||
LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps);
|
||||
|
||||
|
||||
@@ -479,6 +479,7 @@ void randominit(unsigned int seed_init);
|
||||
double uniformrandom(void);
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs);
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs);
|
||||
void term_freq_channel(void);
|
||||
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
|
||||
void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **tx_sig_re,
|
||||
|
||||
@@ -628,16 +628,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
|
||||
if (sched_ctrl->available_dl_harq.len == 0) {
|
||||
if (get_softmodem_params()->sa) {
|
||||
// add all available DL HARQ processes for this UE in SA
|
||||
create_dl_harq_list(sched_ctrl, pdsch);
|
||||
}
|
||||
else {
|
||||
const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
|
||||
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
|
||||
AssertFatal(sched_ctrl->available_dl_harq.len==nrofHARQ,
|
||||
"Reconfiguration of available harq processes not yet supported\n");
|
||||
}
|
||||
// update coreset/searchspace
|
||||
void *bwpd = NULL;
|
||||
NR_BWP_t *genericParameters = NULL;
|
||||
|
||||
@@ -1942,14 +1942,46 @@ void dump_nr_list(NR_list_t *listP)
|
||||
void create_nr_list(NR_list_t *list, int len)
|
||||
{
|
||||
list->head = -1;
|
||||
list->next = calloc(len, sizeof(*list->next));
|
||||
AssertFatal(list, "cannot calloc() memory for NR_list_t->next\n");
|
||||
list->next = malloc(len * sizeof(*list->next));
|
||||
LOG_W(NR_MAC, "NR list->next %p\n", list->next);
|
||||
AssertFatal(list->next, "cannot malloc() memory for NR_list_t->next\n");
|
||||
for (int i = 0; i < len; ++i)
|
||||
list->next[i] = -1;
|
||||
list->tail = -1;
|
||||
list->len = len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Resize an NR_list
|
||||
*/
|
||||
void resize_nr_list(NR_list_t *list, int new_len)
|
||||
{
|
||||
if (new_len == list->len)
|
||||
return;
|
||||
if (new_len > list->len) {
|
||||
/* list->head remains */
|
||||
const int old_len = list->len;
|
||||
int* n = realloc(list->next, new_len * sizeof(*list->next));
|
||||
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
|
||||
list->next = n;
|
||||
for (int i = old_len; i < new_len; ++i)
|
||||
list->next[i] = -1;
|
||||
/* list->tail remains */
|
||||
list->len = new_len;
|
||||
} else { /* new_len < len */
|
||||
AssertFatal(list->head < new_len, "shortened list head out of index %d (new len %d)\n", list->head, new_len);
|
||||
AssertFatal(list->tail < new_len, "shortened list tail out of index %d (new len %d)\n", list->head, new_len);
|
||||
for (int i = 0; i < list->len; ++i)
|
||||
AssertFatal(list->next[i] < new_len, "shortened list entry out of index %d (new len %d)\n", list->next[i], new_len);
|
||||
/* list->head remains */
|
||||
int *n = realloc(list->next, new_len * sizeof(*list->next));
|
||||
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
|
||||
list->next = n;
|
||||
/* list->tail remains */
|
||||
list->len = new_len;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy an NR_list
|
||||
*/
|
||||
@@ -2205,10 +2237,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
"no pdsch-ServingCellConfig found for UE %d\n",
|
||||
UE_id);
|
||||
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
|
||||
// add DL HARQ processes for this UE only in NSA
|
||||
// (SA still doesn't have information on nrofHARQ_ProcessesForPDSCH at this stage)
|
||||
if (!get_softmodem_params()->sa)
|
||||
create_dl_harq_list(sched_ctrl,pdsch);
|
||||
// pdsch == NULL in SA -> will create default (8) number of HARQ processes
|
||||
create_dl_harq_list(sched_ctrl, pdsch);
|
||||
// add all available UL HARQ processes for this UE
|
||||
// nb of ul harq processes not configurable
|
||||
create_nr_list(&sched_ctrl->available_ul_harq, 16);
|
||||
@@ -2236,11 +2266,23 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
|
||||
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
|
||||
// add all available DL HARQ processes for this UE
|
||||
create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
|
||||
for (int harq = 0; harq < nrofHARQ; harq++)
|
||||
add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
|
||||
create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
|
||||
create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
|
||||
AssertFatal(sched_ctrl->available_dl_harq.len == sched_ctrl->feedback_dl_harq.len
|
||||
&& sched_ctrl->available_dl_harq.len == sched_ctrl->retrans_dl_harq.len,
|
||||
"HARQ lists have different lengths (%d/%d/%d)\n",
|
||||
sched_ctrl->available_dl_harq.len,
|
||||
sched_ctrl->feedback_dl_harq.len,
|
||||
sched_ctrl->retrans_dl_harq.len);
|
||||
if (sched_ctrl->available_dl_harq.len == 0) {
|
||||
create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
|
||||
for (int harq = 0; harq < nrofHARQ; harq++)
|
||||
add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
|
||||
create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
|
||||
create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
|
||||
} else {
|
||||
resize_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
|
||||
resize_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
|
||||
resize_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
|
||||
}
|
||||
}
|
||||
|
||||
/* hack data to remove UE in the phy */
|
||||
|
||||
@@ -351,6 +351,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
|
||||
/* Functions to manage an NR_list_t */
|
||||
void dump_nr_list(NR_list_t *listP);
|
||||
void create_nr_list(NR_list_t *listP, int len);
|
||||
void resize_nr_list(NR_list_t *list, int new_len);
|
||||
void destroy_nr_list(NR_list_t *list);
|
||||
void add_nr_list(NR_list_t *listP, int id);
|
||||
void remove_nr_list(NR_list_t *listP, int id);
|
||||
|
||||
@@ -101,13 +101,6 @@ typedef struct {
|
||||
|
||||
static rlc_data_req_queue q;
|
||||
|
||||
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
static void *rlc_data_req_thread(void *_)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1044,7 +1044,7 @@ next_pdu:
|
||||
set_end_different_sdu:
|
||||
/* don't go more than rx_highest_status - 1 */
|
||||
if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) {
|
||||
ret.so_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
|
||||
ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
|
||||
entity->sn_modulus;
|
||||
ret.so_end = 0xffff;
|
||||
return ret;
|
||||
@@ -1305,9 +1305,8 @@ static int missing_size(nr_rlc_entity_am_t *entity, missing_data_t *m,
|
||||
missing_data_t m_nack;
|
||||
|
||||
/* be careful to limit a range to 255 SNs, that is: cut if needed */
|
||||
sn_count = m->sn_end - m->sn_start + 1;
|
||||
if (sn_count < 0)
|
||||
sn_count += entity->sn_modulus;
|
||||
sn_count = (m->sn_end - m->sn_start + entity->sn_modulus)
|
||||
% entity->sn_modulus + 1;
|
||||
|
||||
sn_start = m->sn_start;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) {
|
||||
const nfapi_nr_rx_data_pdu_t *rx = &UL_info->rx_ind.pdu_list[i];
|
||||
const nfapi_nr_crc_t *crc = &UL_info->crc_ind.crc_list[i];
|
||||
LOG_I(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
|
||||
LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
|
||||
"UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
|
||||
i, crc->rnti, i, rx->rnti);
|
||||
|
||||
|
||||
@@ -208,3 +208,24 @@ void
|
||||
rrc_gNB_generate_dedicatedRRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP);
|
||||
|
||||
rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
NR_SRB_ToAddModList_t *const srb2add_list,
|
||||
NR_DRB_ToAddModList_t *const drb2add_list,
|
||||
NR_DRB_ToReleaseList_t *const drb2release_list,
|
||||
const uint8_t security_modeP,
|
||||
uint8_t *const kRRCenc,
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
|
||||
#include <openair2/X2AP/x2ap_eNB.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||
|
||||
#include "BIT_STRING.h"
|
||||
#include "assertions.h"
|
||||
|
||||
@@ -42,27 +42,7 @@
|
||||
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include "UTIL/OSA/osa_defs.h"
|
||||
|
||||
extern boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
NR_SRB_ToAddModList_t *const srb2add_list,
|
||||
NR_DRB_ToAddModList_t *const drb2add_list,
|
||||
NR_DRB_ToReleaseList_t *const drb2release_list,
|
||||
const uint8_t security_modeP,
|
||||
uint8_t *const kRRCenc,
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||
|
||||
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) {
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include <executables/softmodem-common.h>
|
||||
|
||||
#include "nr_nas_msg_sim.h"
|
||||
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||
|
||||
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
|
||||
/* NAS Attach request with IMSI */
|
||||
@@ -178,27 +179,6 @@ static int nr_rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_NR_t subS
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern boolean_t nr_rrc_pdcp_config_asn1_req(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
NR_SRB_ToAddModList_t *const srb2add_list,
|
||||
NR_DRB_ToAddModList_t *const drb2add_list,
|
||||
NR_DRB_ToReleaseList_t *const drb2release_list,
|
||||
const uint8_t security_modeP,
|
||||
uint8_t *const kRRCenc,
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc,
|
||||
uint8_t *const kUPint
|
||||
,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
,rb_id_t *const defaultDRB,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
|
||||
const NR_SRB_ToAddModList_t * const srb2add_listP,
|
||||
const NR_DRB_ToAddModList_t * const drb2add_listP,
|
||||
const NR_DRB_ToReleaseList_t * const drb2release_listP,
|
||||
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
|
||||
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
|
||||
|
||||
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
|
||||
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
|
||||
const uint8_t *buffer,
|
||||
|
||||
@@ -1096,7 +1096,8 @@ static int _nas_message_decrypt(
|
||||
"Unknown security header type %u", security_header_type);
|
||||
LOG_FUNC_RETURN (0);
|
||||
};
|
||||
|
||||
LOG_FUNC_RETURN (0);
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user