Commit f1e30d57 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'ocp_nrsimulator' into 'develop-nr'

Critical bugs from compilation, Ocp nrsimulator

See merge request oai/openairinterface5g!512
parents f7583ef4 165c39da
This diff is collapsed.
...@@ -43,10 +43,10 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ...@@ -43,10 +43,10 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
MSC_GEN=0 MSC_GEN=0
XFORMS="True" XFORMS="True"
UE_EXPANSION="False" UE_EXPANSION="False"
UESIM_EXPANSION="False"
PRINT_STATS="False" PRINT_STATS="False"
VCD_TIMING="False" VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER="False" DEADLINE_SCHEDULER_FLAG_USER=""
FORCE_DEADLINE_SCHEDULER_FLAG_USER=""
CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False
REL="Rel15" REL="Rel15"
NR_REL="NR_Rel15" NR_REL="NR_Rel15"
...@@ -78,7 +78,7 @@ trap handle_ctrl_c INT ...@@ -78,7 +78,7 @@ trap handle_ctrl_c INT
function print_help() { function print_help() {
echo_info " echo_info "
This program installs OpenAirInterface Software This program installs OpenAirInterface Software
You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14 You should have ubuntu 16.xx or 18.04 updated
Options Options
-h -h
This help This help
...@@ -116,7 +116,7 @@ Options ...@@ -116,7 +116,7 @@ Options
Rel8 limits the implementation to 3GPP Release 8 version Rel8 limits the implementation to 3GPP Release 8 version
Rel10 limits the implementation to 3GPP Release 10 version Rel10 limits the implementation to 3GPP Release 10 version
-w | --hardware -w | --hardware
EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, ADRV9371_ZC706, None (Default) EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, ADRV9371_ZC706, SIMU, None (Default)
Adds this RF board support (in external packages installation and in compilation) Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol -t | --transport protocol
ETHERNET , None ETHERNET , None
...@@ -175,6 +175,9 @@ Options ...@@ -175,6 +175,9 @@ Options
--basic-simulator --basic-simulator
Generates a basic [1 UE + 1 eNB + no channel] simulator. Generates a basic [1 UE + 1 eNB + no channel] simulator.
See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation. See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation.
--rfsimulator
Generate virtual RF driver
to use it, set the environement variable RFSIMULATOR to \"enb\" in the eNB and to the eNB IP address in the UEs
Usage (first build): Usage (first build):
NI/ETTUS B201 + COTS UE : ./build_oai -I --eNB -x --install-system-files -w USRP NI/ETTUS B201 + COTS UE : ./build_oai -I --eNB -x --install-system-files -w USRP
Usage (Regular): Usage (Regular):
...@@ -250,7 +253,7 @@ function main() { ...@@ -250,7 +253,7 @@ function main() {
-w | --hardware) -w | --hardware)
HW="$2" #"${i#*=}" HW="$2" #"${i#*=}"
# Use OAI_USRP as the key word USRP is used inside UHD driver # Use OAI_USRP as the key word USRP is used inside UHD driver
if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" -a "$HW" != "ADRV9371_ZC706" ] ; then if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" -a "$HW" != "ADRV9371_ZC706" -a "$HW" != "SIMU" ] ; then
echo_fatal "Unknown HW type $HW will exit..." echo_fatal "Unknown HW type $HW will exit..."
else else
if [ "$HW" == "USRP" ] ; then if [ "$HW" == "USRP" ] ; then
...@@ -265,6 +268,9 @@ function main() { ...@@ -265,6 +268,9 @@ function main() {
if [ "$HW" == "LMSSDR" ] ; then if [ "$HW" == "LMSSDR" ] ; then
HW="OAI_LMSSDR" HW="OAI_LMSSDR"
fi fi
if [ "$HW" == "SIMU" ] ; then
HW="OAI_SIMU"
fi
echo_info "Setting hardware to: $HW" echo_info "Setting hardware to: $HW"
fi fi
shift 2;; shift 2;;
...@@ -331,13 +337,13 @@ function main() { ...@@ -331,13 +337,13 @@ function main() {
BUILD_DOXYGEN=1 BUILD_DOXYGEN=1
echo_info "Will build doxygen support" echo_info "Will build doxygen support"
shift;; shift;;
--disable-deadline) --disable-deadline)
FORCE_DEADLINE_SCHEDULER_FLAG_USER="False" DEADLINE_SCHEDULER_FLAG_USER="False"
echo_info "Disabling the usage of deadline scheduler" echo_info "Disabling the usage of deadline scheduler"
shift 1;; shift 1;;
--enable-deadline) --enable-deadline)
FORCE_DEADLINE_SCHEDULER_FLAG_USER="True" DEADLINE_SCHEDULER_FLAG_USER="True"
echo_info "Enabling the usage of deadline scheduler" echo_info "Enabling the usage of deadline scheduler"
shift 1;; shift 1;;
--enable-cpu-affinity) --enable-cpu-affinity)
CPU_AFFINITY_FLAG_USER="True" CPU_AFFINITY_FLAG_USER="True"
...@@ -400,7 +406,11 @@ function main() { ...@@ -400,7 +406,11 @@ function main() {
BASIC_SIMULATOR=1 BASIC_SIMULATOR=1
echo_info "Compiling the basic simulator" echo_info "Compiling the basic simulator"
shift 1;; shift 1;;
-h | --help) --rfsimulator)
RFSIMULATOR=true
echo_info "Compiling the RF simulator"
shift 1;;
-h | --help)
print_help print_help
exit 1;; exit 1;;
*) *)
...@@ -441,33 +451,18 @@ function main() { ...@@ -441,33 +451,18 @@ function main() {
fi fi
fi fi
echo_info "RF HW set to $HW" echo_info "RF HW set to $HW"
#Now we set flags to enable deadline scheduler settings # If the user doesn't specify the Linux scheduler to use, we set a value
#By default: USRP: disable, if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
#By default: BLADERF: enable, case "$HW" in
#By default: EXMIMO: enable "EXMIMO")
if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then DEADLINE_SCHEDULER_FLAG_USER="True"
if [ "$HW" = "EXMIMO" ] ; then ;;
DEADLINE_SCHEDULER_FLAG_USER="True" *)
elif [ "$HW" = "ETHERNET" ] ; then DEADLINE_SCHEDULER_FLAG_USER="False"
DEADLINE_SCHEDULER_FLAG_USER="False" ;;
elif [ "$HW" = "OAI_USRP" ] ; then esac
DEADLINE_SCHEDULER_FLAG_USER="False" fi
elif [ "$HW" = "OAI_ADRV9371_ZC706" ] ; then
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "OAI_BLADERF" ] ; then
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "OAI_LMSSDR" ] ; then
DEADLINE_SCHEDULER_FLAG_USER="False"
elif [ "$HW" = "None" ] ; then
DEADLINE_SCHEDULER_FLAG_USER="False"
else
echo_error "Unknown HW type $HW. Exiting now..."
exit
fi
else
DEADLINE_SCHEDULER_FLAG_USER=$FORCE_DEADLINE_SCHEDULER_FLAG_USER
fi
#Disable CPU Affinity for deadline scheduler #Disable CPU Affinity for deadline scheduler
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
......
#!/bin/bash
GENERATED_FULL_DIR=$1
shift
ASN1_SOURCE_DIR=$1
shift
export ASN1C_PREFIX=$1
shift
options=$*
done_flag="$GENERATED_FULL_DIR"/done
if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
fi
touch $done_flag
...@@ -23,9 +23,16 @@ ...@@ -23,9 +23,16 @@
#ifndef BACKTRACE_H_ #ifndef BACKTRACE_H_
#define BACKTRACE_H_ #define BACKTRACE_H_
#ifdef __cplusplus
extern "C" {
#endif
void display_backtrace(void); void display_backtrace(void);
void backtrace_handle_signal(siginfo_t *info); void backtrace_handle_signal(siginfo_t *info);
#ifdef __cplusplus
}
#endif
#endif /* BACKTRACE_H_ */ #endif /* BACKTRACE_H_ */
...@@ -919,7 +919,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) { ...@@ -919,7 +919,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) {
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) { for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) { for (j=0; j<2; j++) {
for (k=0; k<2; k++) { for (k=0; k<RX_NB_TH_MAX; k++) {
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,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,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
......
...@@ -421,6 +421,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, ...@@ -421,6 +421,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
#ifdef NR_PDCCH_DCI_DEBUG #ifdef NR_PDCCH_DCI_DEBUG
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> c_rb=%d\n",c_rb); printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> c_rb=%d\n",c_rb);
#endif #endif
rxF=NULL;
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start) // first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
......
...@@ -516,7 +516,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -516,7 +516,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
p_nrLDPC_procBuf[r], p_nrLDPC_procBuf[r],
p_procTime); p_procTime);
if (check_crc(llrProcBuf,harq_process->B,harq_process->F,crc_type)) { // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t*)llrProcBuf,harq_process->B,harq_process->F,crc_type)) {
printf("CRC OK\n"); printf("CRC OK\n");
ret = 2; ret = 2;
} }
......
...@@ -1350,7 +1350,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1350,7 +1350,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
unsigned char aatx,aarx,pilots=0; unsigned char aatx,aarx,pilots=0;
__m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
QAM_amp128b = _mm_setzero_si128();
if (symbol == 2){ if (symbol == 2){
pilots=1; pilots=1;
......
...@@ -266,123 +266,33 @@ void nr_pbch_channel_compensation(int **rxdataF_ext, ...@@ -266,123 +266,33 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
int **rxdataF_comp, int **rxdataF_comp,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint32_t symbol, uint32_t symbol,
uint8_t output_shift) uint8_t output_shift) {
{
short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
//short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
#if defined(__x86_64__) || defined(__i386__)
__m128i mmtmpP0,mmtmpP1,mmtmpP2,mmtmpP3;
#elif defined(__arm__)
int16x8_t mmtmpP0,mmtmpP1,mmtmpP2,mmtmpP3;
#endif
uint16_t nb_re=180;
uint8_t aarx;
#if defined(__x86_64__) || defined(__i386__)
__m128i *dl_ch128,*rxdataF128,*rxdataF_comp128;
#elif defined(__arm__)
#endif
const uint16_t nb_re=symbol == 2 ? 72 : 180;
AssertFatal((symbol > 0 && symbol < 4), AssertFatal((symbol > 0 && symbol < 4),
"symbol %d is illegal for PBCH DM-RS\n", "symbol %d is illegal for PBCH DM-RS\n",
symbol); symbol);
if (symbol == 2) nb_re = 72;
// printf("comp: symbol %d : nb_re %d\n",symbol,nb_re); // printf("comp: symbol %d : nb_re %d\n",symbol,nb_re);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
#if defined(__x86_64__) || defined(__i386__) vect128 *dl_ch128 = (vect128 *)&dl_ch_estimates_ext[aarx][symbol*20*12];
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*20*12]; vect128 *rxdataF128 = (vect128 *)&rxdataF_ext[aarx][symbol*20*12];
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*20*12]; vect128 *rxdataF_comp128 = (vect128 *)&rxdataF_comp[aarx][symbol*20*12];
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aarx][symbol*20*12];
/* /*
printf("ch compensation dl_ch ext addr %p \n", &dl_ch_estimates_ext[aarx][symbol*20*12]); printf("ch compensation dl_ch ext addr %p \n", &dl_ch_estimates_ext[aarx][symbol*20*12]);
printf("rxdataf ext addr %p symbol %d\n", &rxdataF_ext[aarx][symbol*20*12], symbol); printf("rxdataf ext addr %p symbol %d\n", &rxdataF_ext[aarx][symbol*20*12], symbol);
printf("rxdataf_comp addr %p\n",&rxdataF_comp[aarx][symbol*20*12]); printf("rxdataf_comp addr %p\n",&rxdataF_comp[aarx][symbol*20*12]);
*/ */
#elif defined(__arm__)
// to be filled in
#endif
for (int re=0; re<nb_re; re+=12) { for (int re=0; re<nb_re; re+=12) {
// printf("******re %d\n",re); *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
#if defined(__x86_64__) || defined(__i386__) *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
// multiply by conjugated channel *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
mmtmpP0 = _mm_madd_epi16(dl_ch128[0],rxdataF128[0]);
// print_ints("re",&mmtmpP0);
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
// print_ints("im",&mmtmpP1);
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[0]);
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
// print_ints("re(shift)",&mmtmpP0);
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
// print_ints("im(shift)",&mmtmpP1);
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
// print_ints("c0",&mmtmpP2);
// print_ints("c1",&mmtmpP3);
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
/*
print_shorts("rx:",rxdataF128);
print_shorts("ch:",dl_ch128);
print_shorts("pack:",rxdataF_comp128);
*/
// multiply by conjugated channel
mmtmpP0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]);
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[1]);
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
rxdataF_comp128[1] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
// print_shorts("rx:",rxdataF128+1);
// print_shorts("ch:",dl_ch128+1);
// print_shorts("pack:",rxdataF_comp128+1);
// multiply by conjugated channel
mmtmpP0 = _mm_madd_epi16(dl_ch128[2],rxdataF128[2]);
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[2]);
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
rxdataF_comp128[2] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
// print_shorts("rx:",rxdataF128+2);
// print_shorts("ch:",dl_ch128+2);
// print_shorts("pack:",rxdataF_comp128+2);
dl_ch128+=3;
rxdataF128+=3;
rxdataF_comp128+=3;
#elif defined(__arm__)
// to be filled in
#endif
} }
} }
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
} }
void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
......
...@@ -577,7 +577,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -577,7 +577,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex;
//uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; //uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index;
int16_t *prachF = ue->prach_vars[eNB_id]->prachF; int16_t *prachF = ue->prach_vars[eNB_id]->prachF;
static int16_t prach_tmp[45600*2] __attribute__((aligned(32))); static int16_t prach_tmp[45600*4] __attribute__((aligned(32)));
int16_t *prach = prach_tmp; int16_t *prach = prach_tmp;
int16_t *prach2; int16_t *prach2;
int16_t amp = ue->prach_vars[eNB_id]->amp; int16_t amp = ue->prach_vars[eNB_id]->amp;
......
This diff is collapsed.
...@@ -399,7 +399,7 @@ typedef struct RU_t_s{ ...@@ -399,7 +399,7 @@ typedef struct RU_t_s{
/// function pointer to release function for radio interface /// function pointer to release function for radio interface
int (*stop_rf)(struct RU_t_s *ru); int (*stop_rf)(struct RU_t_s *ru);
/// function pointer to initialization function for radio interface /// function pointer to initialization function for radio interface
int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB); int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB);
/// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL) /// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL)
void (*feprx)(struct RU_t_s *ru); void (*feprx)(struct RU_t_s *ru);
/// function pointer to TX front-end processing routine (IDFTs and prefix removal or NULL) /// function pointer to TX front-end processing routine (IDFTs and prefix removal or NULL)
......
...@@ -1021,11 +1021,13 @@ typedef struct { ...@@ -1021,11 +1021,13 @@ typedef struct {
NR_UE_COMMON common_vars; NR_UE_COMMON common_vars;
nr_ue_if_module_t *if_inst; nr_ue_if_module_t *if_inst;
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
nr_uplink_indication_t ul_indication; nr_uplink_indication_t ul_indication;
/// UE FAPI DCI request /// UE FAPI DCI request
nr_dcireq_t dcireq; nr_dcireq_t dcireq;
// CHECK if we need those as they are also included in dl_indictation
/// UE FAPI indication for DLSCH reception /// UE FAPI indication for DLSCH reception
fapi_nr_rx_indication_t rx_ind; fapi_nr_rx_indication_t rx_ind;
/// UE FAPI indication for DCI reception /// UE FAPI indication for DCI reception
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
* The host CPU needs to have support for SSE2 at least. SSE3 and SSE4.1 functions are emulated if the CPU lacks support for them. * The host CPU needs to have support for SSE2 at least. SSE3 and SSE4.1 functions are emulated if the CPU lacks support for them.
* This will slow down the softmodem, but may be valuable if only offline signal processing is required. * This will slow down the softmodem, but may be valuable if only offline signal processing is required.
* *
* \author S. Held * \author S. Held, Laurent THOMAS
* \email sebastian.held@imst.de * \email sebastian.held@imst.de, laurent.thomas@open-cells.com
* \company IMST GmbH * \company IMST GmbH, Open Cells Project
* \date 2015 * \date 2019
* \version 0.1 * \version 0.2
*/ */
#ifndef SSE_INTRIN_H #ifndef SSE_INTRIN_H
...@@ -40,23 +40,23 @@ ...@@ -40,23 +40,23 @@
#if defined(__x86_64) || defined(__i386__) #if defined(__x86_64) || defined(__i386__)
#ifndef __SSE2__ #ifndef __SSE2__
# error SSE2 processor intrinsics disabled # error SSE2 processor intrinsics disabled
#endif #endif
#include <emmintrin.h> #include <emmintrin.h>
#include <xmmintrin.h> #include <xmmintrin.h>
#ifdef __SSE3__ #ifdef __SSE3__
# include <pmmintrin.h> #include <pmmintrin.h>
# include <tmmintrin.h> #include <tmmintrin.h>
#endif #endif
#ifdef __SSE4_1__ #ifdef __SSE4_1__
# include <smmintrin.h> #include <smmintrin.h>
#endif #endif
#ifdef __AVX2__ #ifdef __AVX2__
# include <immintrin.h> #include <immintrin.h>
#endif #endif
// ------------------------------------------------ // ------------------------------------------------
...@@ -108,8 +108,7 @@ typedef union { ...@@ -108,8 +108,7 @@ typedef union {
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_comge_epi8_SSE2(__m128i a, __m128i b) static inline __m128i ssp_comge_epi8_SSE2(__m128i a, __m128i b) {
{
__m128i c; __m128i c;
c = _mm_cmpgt_epi8( a, b ); c = _mm_cmpgt_epi8( a, b );
a = _mm_cmpeq_epi8( a, b ); a = _mm_cmpeq_epi8( a, b );
...@@ -126,13 +125,11 @@ static inline __m128i ssp_comge_epi8_SSE2(__m128i a, __m128i b) ...@@ -126,13 +125,11 @@ static inline __m128i ssp_comge_epi8_SSE2(__m128i a, __m128i b)
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask) static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask) {
{
ssp_m128 A,B, MASK, maskZero; ssp_m128 A,B, MASK, maskZero;
A.i = a; A.i = a;
maskZero.i = ssp_comge_epi8_SSE2( mask, _mm_setzero_si128() ); maskZero.i = ssp_comge_epi8_SSE2( mask, _mm_setzero_si128() );
MASK.i = _mm_and_si128 ( mask, _mm_set1_epi8( (char)0x0F) ); MASK.i = _mm_and_si128 ( mask, _mm_set1_epi8( (char)0x0F) );
B.s8[ 0] = A.s8[ (MASK.s8[ 0]) ]; B.s8[ 0] = A.s8[ (MASK.s8[ 0]) ];
B.s8[ 1] = A.s8[ (MASK.s8[ 1]) ]; B.s8[ 1] = A.s8[ (MASK.s8[ 1]) ];
B.s8[ 2] = A.s8[ (MASK.s8[ 2]) ]; B.s8[ 2] = A.s8[ (MASK.s8[ 2]) ];
...@@ -149,7 +146,6 @@ static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask) ...@@ -149,7 +146,6 @@ static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask)
B.s8[13] = A.s8[ (MASK.s8[13]) ]; B.s8[13] = A.s8[ (MASK.s8[13]) ];
B.s8[14] = A.s8[ (MASK.s8[14]) ]; B.s8[14] = A.s8[ (MASK.s8[14]) ];
B.s8[15] = A.s8[ (MASK.s8[15]) ]; B.s8[15] = A.s8[ (MASK.s8[15]) ];
B.i = _mm_and_si128( B.i, maskZero.i ); B.i = _mm_and_si128( B.i, maskZero.i );
return B.i; return B.i;
} }
...@@ -182,8 +178,7 @@ static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask) ...@@ -182,8 +178,7 @@ static inline __m128i ssp_shuffle_epi8_SSE2 (__m128i a, __m128i mask)
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx ) static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx ) {
{
ssp_m128 Ahi, Alo; ssp_m128 Ahi, Alo;
b = b & 0xFF; /* Convert to 8-bit integer */ b = b & 0xFF; /* Convert to 8-bit integer */
Ahi.i = _mm_unpackhi_epi8( a, _mm_setzero_si128() ); /* Ahi = a_8[8:15] Simulate 8bit integers as 16-bit integers */ Ahi.i = _mm_unpackhi_epi8( a, _mm_setzero_si128() ); /* Ahi = a_8[8:15] Simulate 8bit integers as 16-bit integers */
...@@ -191,72 +186,71 @@ static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx ) ...@@ -191,72 +186,71 @@ static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx )
/* Insert b as a 16-bit integer to upper or lower half of a */ /* Insert b as a 16-bit integer to upper or lower half of a */
switch( ndx & 0xF ) { switch( ndx & 0xF ) {
case 0: case 0:
Alo.i = _mm_insert_epi16( Alo.i, b, 0 ); Alo.i = _mm_insert_epi16( Alo.i, b, 0 );
break; break;
case 1: case 1:
Alo.i = _mm_insert_epi16( Alo.i, b, 1 ); Alo.i = _mm_insert_epi16( Alo.i, b, 1 );
break; break;
case 2: case 2:
Alo.i = _mm_insert_epi16( Alo.i, b, 2 ); Alo.i = _mm_insert_epi16( Alo.i, b, 2 );
break; break;
case 3: case 3:
Alo.i = _mm_insert_epi16( Alo.i, b, 3 ); Alo.i = _mm_insert_epi16( Alo.i, b, 3 );
break; break;
case 4: case 4:
Alo.i = _mm_insert_epi16( Alo.i, b, 4 ); Alo.i = _mm_insert_epi16( Alo.i, b, 4 );
break; break;
case 5: case 5:
Alo.i = _mm_insert_epi16( Alo.i, b, 5 ); Alo.i = _mm_insert_epi16( Alo.i, b, 5 );
break; break;
case 6: case 6:
Alo.i = _mm_insert_epi16( Alo.i, b, 6 ); Alo.i = _mm_insert_epi16( Alo.i, b, 6 );
break; break;
case 7: case 7:
Alo.i = _mm_insert_epi16( Alo.i, b, 7 ); Alo.i = _mm_insert_epi16( Alo.i, b, 7 );
break; break;
case 8: case 8:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 0 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 0 );
break; break;
case 9: case 9:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 1 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 1 );
break; break;
case 10: case 10:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 2 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 2 );
break; break;
case 11: case 11:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 3 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 3 );
break; break;
case 12: case 12:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 4 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 4 );
break; break;
case 13: case 13:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 5 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 5 );
break; break;
case 14: case 14:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 6 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 6 );
break; break;
default: default:
Ahi.i = _mm_insert_epi16( Ahi.i, b, 7 ); Ahi.i = _mm_insert_epi16( Ahi.i, b, 7 );
} }
return _mm_packus_epi16( Alo.i, Ahi.i ); // Pack the 16-bit integers to 8bit again. return _mm_packus_epi16( Alo.i, Ahi.i ); // Pack the 16-bit integers to 8bit again.
///* Another implementation, but slower: */ ///* Another implementation, but slower: */
//ssp_m128 A, B, mask; //ssp_m128 A, B, mask;
//mask.i = _mm_setzero_si128(); //mask.i = _mm_setzero_si128();
...@@ -277,16 +271,13 @@ static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx ) ...@@ -277,16 +271,13 @@ static inline __m128i ssp_insert_epi8_SSE2( __m128i a, int b, const int ndx )
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_cvtepi8_epi16_SSE2 ( __m128i a) static inline __m128i ssp_cvtepi8_epi16_SSE2 ( __m128i a) {
{
__m128i b = _mm_setzero_si128 (); __m128i b = _mm_setzero_si128 ();
__m128i c = _mm_unpacklo_epi8(a, b); __m128i c = _mm_unpacklo_epi8(a, b);
__m128i d = _mm_set1_epi16 (128); __m128i d = _mm_set1_epi16 (128);
b = _mm_and_si128(d, c); b = _mm_and_si128(d, c);
d = _mm_set1_epi16(0x1FE); d = _mm_set1_epi16(0x1FE);
b = _mm_mullo_epi16(b, d); b = _mm_mullo_epi16(b, d);
return _mm_add_epi16(c, b); return _mm_add_epi16(c, b);
} }
...@@ -299,8 +290,7 @@ static inline __m128i ssp_cvtepi8_epi16_SSE2 ( __m128i a) ...@@ -299,8 +290,7 @@ static inline __m128i ssp_cvtepi8_epi16_SSE2 ( __m128i a)
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_logical_bitwise_select_SSE2( __m128i a, __m128i b, __m128i mask ) // Bitwise (mask ? a : b) static inline __m128i ssp_logical_bitwise_select_SSE2( __m128i a, __m128i b, __m128i mask ) { // Bitwise (mask ? a : b)
{
a = _mm_and_si128 ( a, mask ); // clear a where mask = 0 a = _mm_and_si128 ( a, mask ); // clear a where mask = 0
b = _mm_andnot_si128( mask, b ); // clear b where mask = 1 b = _mm_andnot_si128( mask, b ); // clear b where mask = 1
a = _mm_or_si128 ( a, b ); // a = a OR b a = _mm_or_si128 ( a, b ); // a = a OR b
...@@ -316,8 +306,7 @@ static inline __m128i ssp_logical_bitwise_select_SSE2( __m128i a, __m128i b, __m ...@@ -316,8 +306,7 @@ static inline __m128i ssp_logical_bitwise_select_SSE2( __m128i a, __m128i b, __m
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_max_epi8_SSE2( __m128i a, __m128i b ) static inline __m128i ssp_max_epi8_SSE2( __m128i a, __m128i b ) {
{
__m128i mask = _mm_cmpgt_epi8( a, b ); // FFFFFFFF where a > b __m128i mask = _mm_cmpgt_epi8( a, b ); // FFFFFFFF where a > b
a = ssp_logical_bitwise_select_SSE2( a, b, mask ); a = ssp_logical_bitwise_select_SSE2( a, b, mask );
return a; return a;
...@@ -332,15 +321,12 @@ static inline __m128i ssp_max_epi8_SSE2( __m128i a, __m128i b ) ...@@ -332,15 +321,12 @@ static inline __m128i ssp_max_epi8_SSE2( __m128i a, __m128i b )
* \date 2006-2008 * \date 2006-2008
* \copyright Apache License 2.0 * \copyright Apache License 2.0
*/ */
static inline __m128i ssp_cvtepi16_epi32_SSE2 ( __m128i a) static inline __m128i ssp_cvtepi16_epi32_SSE2 ( __m128i a) {
{
__m128i b = _mm_set1_epi32 (-1); //0xFFFFFFFF __m128i b = _mm_set1_epi32 (-1); //0xFFFFFFFF
__m128i c = _mm_unpacklo_epi16(a, b); //FFFFa0**FFFFa1**.... __m128i c = _mm_unpacklo_epi16(a, b); //FFFFa0**FFFFa1**....
__m128i d = _mm_set1_epi32 (0x8000); //0x8000 __m128i d = _mm_set1_epi32 (0x8000); //0x8000
b = _mm_andnot_si128(c, d); // 0x80 for positive, 0x00 for negative b = _mm_andnot_si128(c, d); // 0x80 for positive, 0x00 for negative
d = _mm_slli_epi32(b, 1); // 0x100 for positive, 0x000 for negative d = _mm_slli_epi32(b, 1); // 0x100 for positive, 0x000 for negative
return _mm_add_epi32(c, d); return _mm_add_epi32(c, d);
} }
#endif // __SSE4_1__ #endif // __SSE4_1__
...@@ -350,5 +336,46 @@ static inline __m128i ssp_cvtepi16_epi32_SSE2 ( __m128i a) ...@@ -350,5 +336,46 @@ static inline __m128i ssp_cvtepi16_epi32_SSE2 ( __m128i a)
#endif // x86_64 || i386 #endif // x86_64 || i386
#endif // SSE_INTRIN_H #if defined(__x86_64__) || defined(__i386__)
#define vect128 __m128i
#elif defined(__arm__)
#define vect128 int16x8_t
#endif
static const short minusConjug128[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
static inline vect128 mulByConjugate128(vect128 *a, vect128 *b, int8_t output_shift) {
#if defined(__x86_64__) || defined(__i386__)
vect128 realPart = _mm_madd_epi16(*a,*b);
realPart = _mm_srai_epi32(realPart,output_shift);
vect128 imagPart = _mm_shufflelo_epi16(*b,_MM_SHUFFLE(2,3,0,1));
imagPart = _mm_shufflehi_epi16(imagPart,_MM_SHUFFLE(2,3,0,1));
imagPart = _mm_sign_epi16(imagPart,*(vect128 *)minusConjug128);
imagPart = _mm_madd_epi16(imagPart,*a);
imagPart = _mm_srai_epi32(imagPart,output_shift);
vect128 lowPart = _mm_unpacklo_epi32(realPart,imagPart);
vect128 highPart = _mm_unpackhi_epi32(realPart,imagPart);
return ( _mm_packs_epi32(lowPart,highPart));
#elif defined(__arm__)
AssertFatal(false, "not developped\n");
#endif
}
#if defined(__x86_64__) || defined(__i386__)
#define displaySamples128(vect) {\
__m128i x=vect; \
printf("vector: %s = (%hd,%hd) (%hd,%hd) (%hd,%hd) (%hd,%hd)\n", #vect, \
_mm_extract_epi16(x,0), \
_mm_extract_epi16(x,1),\
_mm_extract_epi16(x,2),\
_mm_extract_epi16(x,3),\
_mm_extract_epi16(x,4),\
_mm_extract_epi16(x,5),\
_mm_extract_epi16(x,6),\
_mm_extract_epi16(x,7));\
}
#elif defined(__arm__)
displaySamples128(vect) {}
//TBD
#endif
#endif // SSE_INTRIN_H
...@@ -36,4 +36,6 @@ nr_subframe_t nr_slot_select(nfapi_nr_config_request_t *cfg,unsigned char slot) ...@@ -36,4 +36,6 @@ nr_subframe_t nr_slot_select(nfapi_nr_config_request_t *cfg,unsigned char slot)
{ {
if (cfg->subframe_config.duplex_mode.value == FDD) if (cfg->subframe_config.duplex_mode.value == FDD)
return(SF_DL); return(SF_DL);
LOG_E(PHY,"Not developped TDD mode\n");
return -1;
} }
...@@ -1595,22 +1595,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1595,22 +1595,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
int harq_pid; int harq_pid;
int frame_tx=proc->frame_tx; int frame_tx=proc->frame_tx;
int nr_tti_tx=proc->nr_tti_tx; int nr_tti_tx=proc->nr_tti_tx;
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
uint8_t Msg3_flag=0;
uint16_t first_rb, nb_rb;
unsigned int input_buffer_length; unsigned int input_buffer_length;
int i; int i;
int aa; int aa;
int tx_amp; int tx_amp;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode;
uint8_t Nbundled=0;
uint8_t NbundledCw1=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t cqi_status = 0;
uint8_t ri_status = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN);
/* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */ /* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */
...@@ -1621,6 +1609,18 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1621,6 +1609,18 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
#if 0 #if 0
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
uint8_t Msg3_flag=0;
uint16_t first_rb, nb_rb;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode;
uint8_t Nbundled=0;
uint8_t NbundledCw1=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t cqi_status = 0;
uint8_t ri_status = 0;
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
if ((ue->ulsch_Msg3_active[eNB_id] == 1) && if ((ue->ulsch_Msg3_active[eNB_id] == 1) &&
(ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) &&
...@@ -3081,7 +3081,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3081,7 +3081,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
pdcch_vars[eNB_id]->crnti = 0x1234; //to be check how to set when using loop memory pdcch_vars[eNB_id]->crnti = 0x1234; //to be check how to set when using loop memory
uint16_t c_rnti=pdcch_vars[eNB_id]->crnti; uint16_t c_rnti=pdcch_vars[eNB_id]->crnti;
uint16_t cs_rnti,new_rnti,tc_rnti; uint16_t cs_rnti=0,new_rnti=0,tc_rnti;
uint16_t p_rnti=P_RNTI; uint16_t p_rnti=P_RNTI;
uint16_t si_rnti=SI_RNTI; uint16_t si_rnti=SI_RNTI;
uint16_t ra_rnti=99; uint16_t ra_rnti=99;
...@@ -3354,7 +3354,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3354,7 +3354,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
} // end for loop dci_cnt } // end for loop dci_cnt
// TODO: check where should we send up this message. // TODO: check where should we send up this message.
ue->if_inst->dl_indication(&ue->dl_indication); //ue->if_inst->dl_indication(&ue->dl_indication);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "SCHED_NR_UE/pucch_power_control_ue_nr.h" #include "SCHED_NR_UE/pucch_power_control_ue_nr.h"
#include <openair1/PHY/LTE_ESTIMATION/lte_estimation.h>
/**************** defines **************************************/ /**************** defines **************************************/
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "PHY/NR_REFSIG/ss_pbch_nr.h" #include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include <openair1/SCHED/sched_common.h>
#include <openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h>
#ifndef NO_RAT_NR #ifndef NO_RAT_NR
...@@ -278,7 +280,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -278,7 +280,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
/* Part - III */ /* Part - III */
/* Choice PUCCH format and its related parameters */ /* Choice PUCCH format and its related parameters */
pucch_format_nr_t format = pucch_format0_nr; pucch_format_nr_t format = pucch_format0_nr;
uint8_t starting_symbol_index; uint8_t starting_symbol_index=0;
uint8_t nb_symbols_total = 0; uint8_t nb_symbols_total = 0;
uint8_t nb_symbols = 0; uint8_t nb_symbols = 0;
uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */ uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */
...@@ -558,7 +560,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -558,7 +560,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
{ {
nr_generate_pucch0(ue,ue->common_vars.txdataF, nr_generate_pucch0(ue,ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated[gNB_id],
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
(uint8_t)m_0, (uint8_t)m_0,
...@@ -572,7 +574,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -572,7 +574,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
{ {
nr_generate_pucch1(ue,ue->common_vars.txdataF, nr_generate_pucch1(ue,ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated[gNB_id],
pucch_payload, pucch_payload,
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
...@@ -591,7 +593,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -591,7 +593,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
ue->pdcch_vars[ue->current_thread_id[proc->nr_tti_rx]][gNB_id]->crnti, ue->pdcch_vars[ue->current_thread_id[proc->nr_tti_rx]][gNB_id]->crnti,
ue->common_vars.txdataF, ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated[gNB_id],
pucch_payload, pucch_payload,
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
...@@ -610,7 +612,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -610,7 +612,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
ue->common_vars.txdataF, ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
format, format,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated[gNB_id],
pucch_payload, pucch_payload,
tx_amp, tx_amp,
nr_tti_tx, nr_tti_tx,
...@@ -729,7 +731,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t ...@@ -729,7 +731,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
} }
} }
if (do_reset == TRUE) { if (do_reset == TRUE) {
init_downlink_harq_status(&ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]); init_downlink_harq_status(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]);
} }
} }
} }
......
...@@ -322,10 +322,10 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) ...@@ -322,10 +322,10 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
// if contention resolution fails, go back to PRACH // if contention resolution fails, go back to PRACH
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti_is_temporary = 0;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti = 0;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti = 0; }
LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id); LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id);
} }
...@@ -336,16 +336,18 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) ...@@ -336,16 +336,18 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id); LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id);
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti_is_temporary = 0;
}
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0;
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH;
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
if (PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]) { if (PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]) {
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->status=SCH_IDLE; PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->status=SCH_IDLE;
PHY_vars_UE_g[Mod_id][CC_id]->dlsch[0][eNB_index][0]->harq_processes[i]->round=0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->dlsch[1][eNB_index][0]->harq_processes[i]->round=0; PHY_vars_UE_g[Mod_id][CC_id]->dlsch[i][eNB_index][0]->harq_processes[i]->round=0;
}
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->subframe_scheduling_flag=0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->subframe_scheduling_flag=0;
} }
} }
...@@ -2885,10 +2887,10 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint ...@@ -2885,10 +2887,10 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
{ {
ue->dlsch[th_id][eNB_id][0]->g_pucch += delta_pucch; ue->dlsch[th_id][eNB_id][0]->g_pucch += delta_pucch;
} }
LOG_D(PHY,"update TPC for PUCCH %d.%d / pid %d delta_PUCCH %d g_pucch %d %d \n",frame_rx, subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid, LOG_D(PHY,"update TPC for PUCCH %d.%d / pid %d delta_PUCCH %d g_pucch %d\n",
frame_rx, subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid,
delta_pucch, delta_pucch,
ue->dlsch[0][eNB_id][0]->g_pucch, ue->dlsch[0][eNB_id][0]->g_pucch
ue->dlsch[1][eNB_id][0]->g_pucch
//ue->dlsch[2][eNB_id][0]->g_pucch //ue->dlsch[2][eNB_id][0]->g_pucch
); );
} }
......
...@@ -65,7 +65,7 @@ typedef struct { ...@@ -65,7 +65,7 @@ typedef struct {
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
typedef struct { typedef struct {
uint8_t LCID:5; // octet 1 [5:0] uint8_t LCID:6; // octet 1 [5:0]
uint8_t R:2; // octet 1 [7:6] uint8_t R:2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#endif #endif
#include "assertions.h" #include "assertions.h"
#include <openair1/PHY/LTE_TRANSPORT/transport_proto.h>
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
...@@ -392,7 +393,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -392,7 +393,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
} }
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) { for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
LTE_eNB_DLSCH_t *dlsch = RC.gNB[module_idP][CC_id]->dlsch[ii][0]; NR_gNB_DLSCH_t *dlsch = RC.gNB[module_idP][CC_id]->dlsch[ii][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){ if((dlsch != NULL) && (dlsch->rnti == rnti)){
LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
clean_eNb_dlsch(dlsch); clean_eNb_dlsch(dlsch);
......
...@@ -74,7 +74,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n ...@@ -74,7 +74,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n
return nr_ue_process_dlsch( module_id, return nr_ue_process_dlsch( module_id,
cc_id, cc_id,
gNB_index, gNB_index,
&dci_ind, dci_ind,
pduP, pduP,
pdu_len); pdu_len);
...@@ -308,4 +308,5 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) { ...@@ -308,4 +308,5 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) {
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106; dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106;
return 0;
} }
...@@ -34,40 +34,42 @@ ...@@ -34,40 +34,42 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include "common_lib.h" #include "common_lib.h"
#include "common/utils/load_module_shlib.h" #include "common/utils/load_module_shlib.h"
#include <common/utils/LOG/log.h>
int set_device(openair0_device *device) { int set_device(openair0_device *device) {
switch (device->type) { switch (device->type) {
case EXMIMO_DEV: case EXMIMO_DEV:
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case USRP_B200_DEV: case USRP_B200_DEV:
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case USRP_X300_DEV: case USRP_X300_DEV:
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case BLADERF_DEV: case BLADERF_DEV:
printf("[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case LMSSDR_DEV: case LMSSDR_DEV:
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case NONE_DEV: case NONE_DEV:
printf("[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_W(HW,"[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case ADRV9371_ZC706_DEV: case ADRV9371_ZC706_DEV:
printf("[%s] has loaded ADRV9371_ZC706 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded ADRV9371_ZC706 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
case UEDv2_DEV: case UEDv2_DEV:
printf("[%s] has loaded UEDv2 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded UEDv2 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break; break;
default: default:
printf("[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_E(HW,"[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return -1; return -1;
} }
return 0; return 0;
...@@ -78,15 +80,15 @@ int set_transport(openair0_device *device) { ...@@ -78,15 +80,15 @@ int set_transport(openair0_device *device) {
switch (device->transp_type) { switch (device->transp_type) {
case ETHERNET_TP: case ETHERNET_TP:
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_I(HW,"[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return 0; return 0;
break; break;
case NONE_TP: case NONE_TP:
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_W(HW,"[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return 0; return 0;
break; break;
default: default:
printf("[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); LOG_E(HW,"[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return -1; return -1;
break; break;
} }
...@@ -100,6 +102,9 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param ...@@ -100,6 +102,9 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
int ret=0; int ret=0;
char *libname; char *libname;
if (flag == RAU_LOCAL_RADIO_HEAD) { if (flag == RAU_LOCAL_RADIO_HEAD) {
if (getenv("RFSIMULATOR") != NULL)
libname="rfsimulator";
else
libname=OAI_RF_LIBNAME; libname=OAI_RF_LIBNAME;
shlib_fdesc[0].fname="device_init"; shlib_fdesc[0].fname="device_init";
} else { } else {
...@@ -108,7 +113,7 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param ...@@ -108,7 +113,7 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
} }
ret=load_module_shlib(libname,shlib_fdesc,1,NULL); ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
if (ret < 0) { if (ret < 0) {
fprintf(stderr,"Library %s couldn't be loaded\n",libname); LOG_E(HW,"Library %s couldn't be loaded\n",libname);
} else { } else {
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg); ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
} }
...@@ -124,7 +129,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf ...@@ -124,7 +129,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
if ( rc >= 0) { if ( rc >= 0) {
if ( set_device(device) < 0) { if ( set_device(device) < 0) {
fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__); LOG_E(HW,"Unsupported radio head\n");
return -1; return -1;
} }
} }
...@@ -136,7 +141,7 @@ int openair0_transport_load(openair0_device *device, openair0_config_t *openair0 ...@@ -136,7 +141,7 @@ int openair0_transport_load(openair0_device *device, openair0_config_t *openair0
rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD); rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
if ( rc >= 0) { if ( rc >= 0) {
if ( set_transport(device) < 0) { if ( set_transport(device) < 0) {
fprintf(stderr, "%s %d:Unsupported transport protocol\n",__FILE__, __LINE__); LOG_E(HW,"Unsupported transport protocol\n");
return -1; return -1;
} }
} }
......
#General
This is a RF simulator that allows to test OAI without a RF board.
It replaces a actual RF board driver.
As much as possible, it works like a RF board, but not in realtime: it can run faster than realtime if there is enough CPU or slower (it is CPU bound instead of real time RF sampling bound)
#build
## From build_oai
You can build it the same way, and together with actual RF driver
Example:
```bash
./build_oai --ue-nas-use-tun --UE --eNB -w SIMU
```
It is also possible to build actual RF and use choose on each run:
```bash
./build_oai --ue-nas-use-tun --UE --eNB -w USRP --rfsimulator
```
Will build both the eNB (lte-softmodem) and the UE (lte-uesoftmodem)
We recommend to use the option --ue-nas-use-tun that is much simpler to use than the OAI kernel driver.
## Add the rfsimulator after initial build
After any regular build, you can compile the driver
```bash
cd <the_compilation_dir_from_bouild_oai_script>/build
make rfsimulator
```
Then, you can use it freely
# Usage
Setting the env variable RFSIMULATOR enables the RF board simulator
It should the set to "enb" in the eNB
## 4G case
For the UE, it should be set to the IP address of the eNB
example:
```bash
sudo RFSIMULATOR=192.168.2.200 ./lte-uesoftmodem -C 2685000000 -r 50
```
Except this, the UE and the eNB can be used as it the RF is real
If you reach 'RA not active' on UE, be careful to generate a valid SIM
```bash
$OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .
```
## 5G case
After regular build, add the simulation driver
(don't use ./build_oai -w SIMU until we merge 4G and 5G branches)
```bash
cd ran_build/build
make rfsimulator
```
### Launch gNB in one window
```bash
sudo RFSIMULATOR=enb ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config PARALLEL_SINGLE_THREAD
```
### Launch UE in another window
```bash
sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --numerology 1 -r 106 -C 3510000000
```
Of course, set the gNB machine IP address if the UE and the gNB are not on the same machine
In UE, you can add "-d" to get the softscope
#Caveacts
Still issues in power control: txgain, rxgain are not used
no S1 mode is currently broken, so we were not able to test the simulator in noS1 mode
This diff is collapsed.
...@@ -429,9 +429,12 @@ static void *scope_thread(void *arg) { ...@@ -429,9 +429,12 @@ static void *scope_thread(void *arg) {
for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if ((ue_cnt<scope_enb_num_ue)) { if ((ue_cnt<scope_enb_num_ue)) {
phy_scope_eNB(form_enb[CC_id][ue_cnt], /*
//this function needs to be written
phy_scope_gNB(form_enb[CC_id][ue_cnt],
RC.gNB[0][CC_id], RC.gNB[0][CC_id],
UE_id); UE_id);
*/
ue_cnt++; ue_cnt++;
} }
} }
......
...@@ -628,7 +628,6 @@ static void *UE_thread_rxn_txnp4(void *arg) { ...@@ -628,7 +628,6 @@ static void *UE_thread_rxn_txnp4(void *arg) {
struct nr_rxtx_thread_data *rtd = arg; struct nr_rxtx_thread_data *rtd = arg;
UE_nr_rxtx_proc_t *proc = rtd->proc; UE_nr_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_NR_UE *UE = rtd->UE; PHY_VARS_NR_UE *UE = rtd->UE;
int ret;
//proc->counter_decoder = 0; //proc->counter_decoder = 0;
proc->instance_cnt_rxtx=-1; proc->instance_cnt_rxtx=-1;
...@@ -781,16 +780,14 @@ void *UE_thread(void *arg) { ...@@ -781,16 +780,14 @@ void *UE_thread(void *arg) {
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
// int tx_enabled = 0; // int tx_enabled = 0;
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_subframe] __attribute__((aligned(32)));
openair0_timestamp timestamp; openair0_timestamp timestamp;
void* rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; void* rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream = 0; int start_rx_stream = 0;
int i; int i;
char threadname[128]; char threadname[128];
int th_id; int th_id;
UE->proc.proc_rxtx[0].counter_decoder = 0; for (int i=0; i< RX_NB_TH_MAX; i++ )
UE->proc.proc_rxtx[1].counter_decoder = 0; UE->proc.proc_rxtx[i].counter_decoder = 0;
UE->proc.proc_rxtx[2].counter_decoder = 0;
static uint8_t thread_idx = 0; static uint8_t thread_idx = 0;
uint16_t table_sf_slot[20] = {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9}; uint16_t table_sf_slot[20] = {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9};
...@@ -833,48 +830,54 @@ void *UE_thread(void *arg) { ...@@ -833,48 +830,54 @@ void *UE_thread(void *arg) {
usleep(500*1000); usleep(500*1000);
} }
#endif #endif
LOG_W(PHY,"is_synchro %d\n" , is_synchronized );
if (instance_cnt_synch < 0) { // we can invoke the synch if (instance_cnt_synch < 0) { // we can invoke the synch
// grab 10 ms of signal and wakeup synch thread // grab 10 ms of signal and wakeup synch thread
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) if (UE->mode != loop_through_memory) {
rxp[i] = (void*)&UE->common_vars.rxdata[i][0]; void *dummy_tx[UE->frame_parms.nb_antennas_tx];
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
if (UE->mode != loop_through_memory) dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4);
AssertFatal( UE->frame_parms.samples_per_subframe*10== for(int x=0; x<10; x++) {
UE->rfdevice.trx_read_func(&UE->rfdevice, for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
&timestamp, rxp[i] = ((void*)&UE->common_vars.rxdata[i][0]) + 4*x*UE->frame_parms.samples_per_subframe;
rxp, AssertFatal( UE->frame_parms.samples_per_subframe ==
UE->frame_parms.samples_per_subframe*10, UE->rfdevice.trx_read_func(&UE->rfdevice,
UE->frame_parms.nb_antennas_rx), "error reading samples"); &timestamp,
rxp,
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); UE->frame_parms.samples_per_subframe,
instance_cnt_synch = ++UE->proc.instance_cnt_synch; UE->frame_parms.nb_antennas_rx), "");
if (instance_cnt_synch == 0) { }
AssertFatal( 0 == pthread_cond_signal(&UE->proc.cond_synch), ""); for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
} else { free(dummy_tx[i]);
LOG_E( PHY, "[SCHED][UE] UE sync thread busy!!\n" ); }
exit_fun("nothing to add"); AssertFatal( 0 == pthread_mutex_lock(&UE->proc.mutex_synch), "");
} AssertFatal( 0 == ++UE->proc.instance_cnt_synch, "[SCHED][UE] UE sync thread busy!!\n" );
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); AssertFatal( 0 == pthread_cond_signal(&UE->proc.cond_synch), "");
} else { AssertFatal( 0 == pthread_mutex_unlock(&UE->proc.mutex_synch), "");
#if OAISIM } else {
(void)dummy_rx; /* avoid gcc warnings */ // grab 10 ms of signal into dummy buffer to wait result of sync detection
usleep(500); if (UE->mode != loop_through_memory) {
#else void *dummy_tx[UE->frame_parms.nb_antennas_tx];
// grab 10 ms of signal into dummy buffer for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
if (UE->mode != loop_through_memory) { dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4);
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) void *dummy_rx[UE->frame_parms.nb_antennas_rx];
rxp[i] = (void*)&dummy_rx[i][0]; for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
for (int sf=0; sf<NR_NUMBER_OF_SUBFRAMES_PER_FRAME; sf++) dummy_rx[i]=malloc16(UE->frame_parms.samples_per_subframe*4);
// printf("Reading dummy sf %d\n",sf); for (int sf=0; sf<NR_NUMBER_OF_SUBFRAMES_PER_FRAME; sf++) {
AssertFatal(UE->frame_parms.samples_per_subframe== // printf("Reading dummy sf %d\n",sf);
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp, &timestamp,
rxp, dummy_rx,
UE->frame_parms.samples_per_subframe, UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx), "error reading samples"); UE->frame_parms.nb_antennas_rx);
} usleep(500); // this sleep improves in the case of simulated RF and doesn't harm with true radio
#endif
}
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]);
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
free(dummy_rx[i]);
}
} }
} // UE->is_synchronized==0 } // UE->is_synchronized==0
...@@ -884,12 +887,20 @@ void *UE_thread(void *arg) { ...@@ -884,12 +887,20 @@ void *UE_thread(void *arg) {
if (UE->mode != loop_through_memory) { if (UE->mode != loop_through_memory) {
if (UE->no_timing_correction==0) { if (UE->no_timing_correction==0) {
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
AssertFatal(UE->rx_offset == void *dummy_tx[UE->frame_parms.nb_antennas_tx];
UE->rfdevice.trx_read_func(&UE->rfdevice, for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
&timestamp, dummy_tx[i]=malloc16_clear(UE->frame_parms.samples_per_subframe*4);
(void**)UE->common_vars.rxdata, for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) {
UE->rx_offset, int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ;
UE->frame_parms.nb_antennas_rx),""); AssertFatal(unitTransfer ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
(void**)UE->common_vars.rxdata,
unitTransfer,
UE->frame_parms.nb_antennas_rx),"");
}
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]);
} }
UE->rx_offset=0; UE->rx_offset=0;
UE->time_sync_cell=0; UE->time_sync_cell=0;
...@@ -965,7 +976,13 @@ void *UE_thread(void *arg) { ...@@ -965,7 +976,13 @@ void *UE_thread(void *arg) {
UE->rx_offset < 10*UE->frame_parms.samples_per_slot ) UE->rx_offset < 10*UE->frame_parms.samples_per_slot )
UE->rx_offset_diff = 1; UE->rx_offset_diff = 1;
LOG_D(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,slot_nr,UE->rx_offset_diff,UE->rx_offset);
if ( getenv("RFSIMULATOR") != 0) {
LOG_E(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",
proc->frame_rx,slot_nr,UE->rx_offset_diff,UE->rx_offset);
//UE->rx_offset_diff=0;
}
readBlockSize=UE->frame_parms.samples_per_slot - readBlockSize=UE->frame_parms.samples_per_slot -
UE->frame_parms.ofdm_symbol_size - UE->frame_parms.ofdm_symbol_size -
UE->frame_parms.nb_prefix_samples0 - UE->frame_parms.nb_prefix_samples0 -
...@@ -1055,6 +1072,14 @@ void *UE_thread(void *arg) { ...@@ -1055,6 +1072,14 @@ void *UE_thread(void *arg) {
#ifdef SAIF_ENABLED #ifdef SAIF_ENABLED
g_ue_rx_thread_busy++; g_ue_rx_thread_busy++;
#endif #endif
if ( getenv("RFSIMULATOR") != NULL ) {
do {
AssertFatal (pthread_mutex_unlock(&proc->mutex_rxtx) == 0, "");
usleep(100);
AssertFatal (pthread_mutex_lock(&proc->mutex_rxtx) == 0, "");
} while ( proc->instance_cnt_rxtx >= 0);
} else
LOG_E( PHY, "[SCHED][UE %d] !! UE RX thread busy (IC %d)!!\n", UE->Mod_id, proc->instance_cnt_rxtx); LOG_E( PHY, "[SCHED][UE %d] !! UE RX thread busy (IC %d)!!\n", UE->Mod_id, proc->instance_cnt_rxtx);
if (proc->instance_cnt_rxtx > 4) if (proc->instance_cnt_rxtx > 4)
{ {
......
...@@ -986,23 +986,16 @@ int main( int argc, char **argv ) { ...@@ -986,23 +986,16 @@ int main( int argc, char **argv ) {
for (uint8_t i=0; i<RX_NB_TH_MAX; i++) { for (uint8_t i=0; i<RX_NB_TH_MAX; i++) {
//UE[CC_id]->pdcch_vars[i][0]->agregationLevel = agregation_Level; //UE[CC_id]->pdcch_vars[i][0]->agregationLevel = agregation_Level;
//UE[CC_id]->pdcch_vars[i][0]->dciFormat = dci_Format; //UE[CC_id]->pdcch_vars[i][0]->dciFormat = dci_Format;
}
/*compute_prach_seq(&UE[CC_id]->frame_parms.prach_config_common, /*compute_prach_seq(&UE[CC_id]->frame_parms.prach_config_common,
UE[CC_id]->frame_parms.frame_type, UE[CC_id]->frame_parms.frame_type,
UE[CC_id]->X_u);*/ UE[CC_id]->X_u);*/
if (UE[CC_id]->mac_enabled == 1) if (UE[CC_id]->mac_enabled == 1)
{ UE[CC_id]->pdcch_vars[i][0]->crnti = 0x1234;
UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1234;
UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1234;
}
else else
{ UE[CC_id]->pdcch_vars[i][0]->crnti = 0x1235;
UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1235; }
UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1235;
}
UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id]; UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment