Merge remote-tracking branch 'origin/NR_RRC_harq_hacks' into develop_integration_2020_w27
This commit is contained in:
@@ -2900,6 +2900,7 @@ target_link_libraries(ldpctest
|
||||
add_executable(nr_dlschsim
|
||||
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c
|
||||
${OPENAIR_DIR}/common/utils/system.c
|
||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||
${UTIL_SRC}
|
||||
${T_SOURCE}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
@@ -2912,6 +2913,7 @@ target_link_libraries(nr_dlschsim
|
||||
add_executable(nr_pbchsim
|
||||
${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c
|
||||
${OPENAIR_DIR}/common/utils/system.c
|
||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||
${UTIL_SRC}
|
||||
${T_SOURCE}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
@@ -2965,6 +2967,7 @@ target_link_libraries(nr_prachsim
|
||||
add_executable(nr_ulschsim
|
||||
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
|
||||
${OPENAIR_DIR}/common/utils/system.c
|
||||
${OPENAIR_DIR}/common/utils/nr/nr_common.c
|
||||
${UTIL_SRC}
|
||||
${T_SOURCE}
|
||||
${SHLIB_LOADER_SOURCES}
|
||||
|
||||
@@ -1071,9 +1071,9 @@
|
||||
<main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
|
||||
<main_exec_args>-s0 -S1 -n1000 -R106
|
||||
-s0 -S1 -n10 -I -R106
|
||||
-s0 -S1 -n1000 -R217
|
||||
-s0 -S1 -n1000 -R217
|
||||
-s0 -S1 -n10 -I -R217
|
||||
-s0 -S1 -n1000 -R273
|
||||
-s0 -S1 -n1000 -R273
|
||||
-s0 -S1 -n10 -I -R273</main_exec_args>
|
||||
<tags>nr_pbchsim.test1 nr_pbchsim.test2 nr_pbchsim.test3 nr_pbchsim.test4 nr_pbchsim.test5 nr_pbchsim.test6</tags>
|
||||
<search_expr_true>PBCH test OK</search_expr_true>
|
||||
@@ -1091,8 +1091,11 @@
|
||||
(Test6: 217 PRB 100 PDSCH-PRBs),
|
||||
(Test7: 217 PRB 80 PDSCH-Offset),
|
||||
(Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset),
|
||||
(Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27)
|
||||
(Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16)</desc>
|
||||
(Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27),
|
||||
(Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16),
|
||||
(Test11: HARQ test 25% TP (4 rounds),
|
||||
(Test12: HARQ test 33% TP (3 rounds),
|
||||
(Test13: HARQ test 50% TP (2 rounds)</desc>
|
||||
<pre_compile_prog></pre_compile_prog>
|
||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
@@ -1108,8 +1111,11 @@
|
||||
-n100 -R217 -a80 -s5
|
||||
-n100 -R217 -a110 -s5 -b100
|
||||
-n100 -e27 -s30
|
||||
-n100 -e16 -s10</main_exec_args>
|
||||
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10</tags>
|
||||
-n100 -e16 -s10
|
||||
-n100 -s1 -t25
|
||||
-n100 -s1 -t33
|
||||
-n100 -s1 -t50</main_exec_args>
|
||||
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13</tags>
|
||||
<search_expr_true>PDSCH test OK</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
<nruns>3</nruns>
|
||||
@@ -1217,11 +1223,9 @@
|
||||
-R 106 -i 1 -P 2 -b 11 -s6 -n1000
|
||||
-R 106 -i 1 -P 2 -q8 -b 12 -s-3 -n1000
|
||||
-R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n1000
|
||||
-R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n1000
|
||||
-R 106 -i 1 -P 2 -q8 -b 32 -s-3 -n1000
|
||||
-R 106 -i 1 -P 2 -q16 -b 32 -s-3 -n1000
|
||||
-R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n1000
|
||||
</main_exec_args>
|
||||
-R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n1000</main_exec_args>
|
||||
<tags>nr_pucchsim.test1 nr_pucchsim.test2 nr_pucchsim.test3 nr_pucchsim.test4 nr_pucchsim.test5 nr_pucchsim.test6 nr_pucchsim.test7 nr_pucchsim.test8 nr_pucchsim.test9 nr_pucchsim.test10 nr_pucchsim.test11 nr_pucchsim.test12 nr_pucchsim.test13 nr_pucchsim.test14 nr_pucchsim.test15 nr_pucchsim.test16 nr_pucchsim.test17</tags>
|
||||
<search_expr_true>PUCCH test OK</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
@@ -1292,19 +1296,21 @@
|
||||
|
||||
<testCase id="015112">
|
||||
<class>execution</class>
|
||||
<desc>nr_prachsim Test cases. (Test1: 106 PRBs),
|
||||
(Test2: 217 PRBs),
|
||||
(Test3: 273 PRBs)</desc>
|
||||
<desc>nr_prachsim Test cases. (Test1: 106 PRBs - Prach format A2),
|
||||
(Test2: 217 PRBs - Prach format A2),
|
||||
(Test3: 273 PRBs - Prach format A2),
|
||||
(Test4: 106 PRBs - Prach format 0)</desc>
|
||||
<pre_compile_prog></pre_compile_prog>
|
||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
||||
<pre_exec_args></pre_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/targets/bin/nr_prachsim.Rel15</main_exec>
|
||||
<main_exec_args>-a -s -30 -n 100 -p 16 -R 106
|
||||
-a -s -30 -n 100 -p 16 -R 217
|
||||
-a -s -30 -n 100 -p 16 -R 273</main_exec_args>
|
||||
<tags>nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3</tags>
|
||||
<main_exec_args>-a -s -30 -n 100 -p 63 -R 106
|
||||
-a -s -30 -n 100 -p 63 -R 217
|
||||
-a -s -30 -n 100 -p 63 -R 273
|
||||
-a -s -30 -n 100 -p 63 -R 106 -c 4</main_exec_args>
|
||||
<tags>nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4</tags>
|
||||
<search_expr_true>PRACH test OK</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
<nruns>3</nruns>
|
||||
|
||||
+2
-1
@@ -352,7 +352,8 @@ The following features are valid for the gNB and the 5G-NR UE.
|
||||
- Initial sync and MIB detection
|
||||
- MAC -> PHY configuration of PHY via UE FAPI P5 interface
|
||||
- Basic MAC to control PHY via UE FAPI P7 interface
|
||||
- Random ccess procedure
|
||||
- Random access procedure
|
||||
|
||||
|
||||
**RLC**
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
@@ -964,12 +963,14 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
|
||||
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
|
||||
LOG_I(PHY,"Setting indication lists\n");
|
||||
|
||||
gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list;
|
||||
gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list;
|
||||
/*gNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = gNB->sr_pdu_list;
|
||||
gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list;
|
||||
gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list;
|
||||
gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/
|
||||
|
||||
gNB->prach_energy_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||
|
||||
// initialize all signal buffers
|
||||
init_nr_ue_signal(ue, nb_connected_gNB, abstraction_flag);
|
||||
|
||||
// intialize transport
|
||||
init_nr_ue_transport(ue, abstraction_flag);
|
||||
}
|
||||
@@ -366,6 +367,7 @@ static void UE_synch(void *arg) {
|
||||
|
||||
void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
|
||||
|
||||
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
|
||||
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_tti_tx);
|
||||
uint8_t gNB_id = 0;
|
||||
@@ -436,6 +438,23 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
pdcp_run(&ctxt);
|
||||
}
|
||||
}
|
||||
|
||||
// no UL for now
|
||||
/*
|
||||
if (UE->mac_enabled==1) {
|
||||
// trigger L2 to run ue_scheduler thru IF module
|
||||
// [TODO] mapping right after NR initial sync
|
||||
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
|
||||
UE->ul_indication.module_id = 0;
|
||||
UE->ul_indication.gNB_index = 0;
|
||||
UE->ul_indication.cc_id = 0;
|
||||
UE->ul_indication.frame = proc->frame_rx;
|
||||
UE->ul_indication.slot = proc->nr_tti_rx;
|
||||
UE->if_inst->ul_indication(&UE->ul_indication);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -558,6 +577,12 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
|
||||
|
||||
int computeSamplesShift(PHY_VARS_NR_UE *UE) {
|
||||
|
||||
if (IS_SOFTMODEM_RFSIM) {
|
||||
LOG_D(PHY,"SET rx_offset %d \n",UE->rx_offset);
|
||||
//UE->rx_offset_diff=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// compute TO compensation that should be applied for this frame
|
||||
if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2 &&
|
||||
UE->rx_offset > 0 ) {
|
||||
|
||||
@@ -1560,7 +1560,7 @@ typedef struct
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t num_ucis;
|
||||
nfapi_nr_uci_t uci_list[NFAPI_MAX_NUM_UCI_INDICATION];
|
||||
nfapi_nr_uci_t *uci_list;
|
||||
|
||||
} nfapi_nr_uci_indication_t;
|
||||
|
||||
|
||||
@@ -324,6 +324,7 @@ int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type)
|
||||
AssertFatal(1,"Invalid crc_type \n");
|
||||
}
|
||||
|
||||
|
||||
if (crc == oldcrc)
|
||||
return(1);
|
||||
else
|
||||
|
||||
@@ -364,8 +364,8 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
|
||||
if (ind < Foffset) { // case where we have some bits before the filler and the rest after
|
||||
memcpy((void*)e,(void*)(w+ind),Foffset-ind);
|
||||
|
||||
if (E + F <= Ncb) { // E+F doesn't contain all coded bits
|
||||
memcpy((void*)(e+Foffset-ind),(void*)(w+Foffset+F-ind),E-Foffset+ind);
|
||||
if (E + F <= Ncb-ind) { // E+F doesn't contain all coded bits
|
||||
memcpy((void*)(e+Foffset-ind),(void*)(w+Foffset+F),E-Foffset+ind);
|
||||
k=E;
|
||||
}
|
||||
else {
|
||||
@@ -375,11 +375,12 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
|
||||
}
|
||||
else {
|
||||
if (E + F <= Ncb-ind) { //E+F doesn't contain all coded bits
|
||||
memcpy((void*)(e+Foffset-ind),(void*)(w+Foffset+F-ind),E-Foffset+ind);
|
||||
memcpy((void*)(e),(void*)(w+ind),E);
|
||||
k=E;
|
||||
}
|
||||
else {
|
||||
|
||||
memcpy((void*)(e),(void*)(w+ind),Ncb-ind);
|
||||
k=Ncb-ind;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
uint32_t Nid_pusch[2] = {cfg->cell_config.phy_cell_id.value,cfg->cell_config.phy_cell_id.value};
|
||||
LOG_D(PHY,"Initializing PUSCH DMRS Gold sequence with (%x,%x)\n",Nid_pusch[0],Nid_pusch[1]);
|
||||
nr_gold_pusch(gNB, &Nid_pusch[0]);
|
||||
|
||||
/// Transport init necessary for NR synchro
|
||||
@@ -503,6 +504,12 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
|
||||
for (i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n",i,NUMBER_OF_NR_PUCCH_MAX);
|
||||
gNB->pucch[i] = new_gNB_pucch();
|
||||
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
|
||||
}
|
||||
|
||||
for (i=0; i<NUMBER_OF_NR_DLSCH_MAX; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,NUMBER_OF_NR_DLSCH_MAX);
|
||||
|
||||
@@ -40,9 +40,6 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
int p;
|
||||
int re;
|
||||
|
||||
// For memory allocation of ru->prach_rxsigF
|
||||
int mu = fp->numerology_index;
|
||||
|
||||
LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d\n",ru_if_types[ru->if_south],ru->nb_tx);
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg;
|
||||
@@ -113,8 +110,8 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
|
||||
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
// for preamble format 1 and 2, more memory should be allocated
|
||||
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*(1<<mu)*2*sizeof(int16_t) );
|
||||
// largest size for PRACH FFT is 4x98304 (16*24576)
|
||||
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ void nr_modulation(uint32_t *in,
|
||||
offset = (mod_order==2)? NR_MOD_TABLE_QPSK_OFFSET : (mod_order==4)? NR_MOD_TABLE_QAM16_OFFSET : \
|
||||
(mod_order==6)? NR_MOD_TABLE_QAM64_OFFSET: (mod_order==8)? NR_MOD_TABLE_QAM256_OFFSET : 0;
|
||||
|
||||
LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order);
|
||||
|
||||
for (int i=0; i<length/mod_order; i++)
|
||||
{
|
||||
idx = 0;
|
||||
|
||||
@@ -465,6 +465,8 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
|
||||
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||
|
||||
// clear DC carrier from OFDM symbols
|
||||
rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "PHY/NR_UE_ESTIMATION/filt16a_32.h"
|
||||
|
||||
//#define DEBUG_CH
|
||||
|
||||
//#define DEBUG_PUSCH
|
||||
|
||||
int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
unsigned char Ns,
|
||||
@@ -116,7 +116,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
//------------------generate DMRS------------------//
|
||||
|
||||
if (pusch_pdu->transform_precoding) // if transform precoding is disabled
|
||||
if (pusch_pdu->transform_precoding==1) // if transform precoding is disabled
|
||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
|
||||
else
|
||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, 0, pusch_pdu->dmrs_config_type);
|
||||
@@ -132,8 +132,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size));
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("symbol_offset %d, nushift %d\n",symbol_offset,nushift);
|
||||
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], gNB->frame_parms.N_RB_UL);
|
||||
printf("k %d, first_carrier %d\n",k,gNB->frame_parms.first_carrier_offset);
|
||||
printf("bwp_start_subcarrier %d, k %d, first_carrier %d\n",bwp_start_subcarrier,k,gNB->frame_parms.first_carrier_offset);
|
||||
printf("rxF addr %p p %d\n", rxF,p);
|
||||
printf("ul_ch addr %p nushift %d\n",ul_ch,nushift);
|
||||
#endif
|
||||
@@ -148,7 +149,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
|
||||
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[2],rxF[3],&rxF[2],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data 0 : rxF - > (%d,%d)\n",rxF[2],rxF[3]);
|
||||
#endif
|
||||
|
||||
multadd_real_vector_complex_scalar(fl,
|
||||
@@ -166,6 +167,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data 1 : rxF - > (%d,%d)\n",rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fml,
|
||||
ch,
|
||||
@@ -181,6 +183,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data 2 : rxF - > (%d,%d)\n",rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fmm,
|
||||
ch,
|
||||
@@ -201,7 +204,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d)\n",pilot_cnt,rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fml,
|
||||
ch,
|
||||
@@ -217,6 +221,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d)\n",pilot_cnt+1,rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fmm,
|
||||
ch,
|
||||
@@ -238,6 +243,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d)\n",pilot_cnt,rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fm,
|
||||
ch,
|
||||
@@ -256,6 +262,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
|
||||
printf("pilot %u: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d)\n",pilot_cnt+1,rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fmr,
|
||||
ch,
|
||||
@@ -271,6 +278,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d)\n",pilot_cnt+2,rxF[2],rxF[3]);
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fr,
|
||||
ch,
|
||||
|
||||
@@ -33,7 +33,32 @@
|
||||
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
uint8_t allowed_xlsch_re_in_dmrs_symbol(uint16_t k,
|
||||
uint16_t start_sc,
|
||||
uint8_t numDmrsCdmGrpsNoData,
|
||||
uint8_t dmrs_type) {
|
||||
uint8_t delta;
|
||||
uint16_t diff;
|
||||
if (k>start_sc)
|
||||
diff = k-start_sc;
|
||||
else
|
||||
diff = start_sc-k;
|
||||
for (int i = 0; i<numDmrsCdmGrpsNoData; i++){
|
||||
if (dmrs_type==NFAPI_NR_DMRS_TYPE1) {
|
||||
delta = i;
|
||||
if (((diff)%2) == delta)
|
||||
return (0);
|
||||
}
|
||||
else {
|
||||
delta = i<<1;
|
||||
if ( (((diff)%6) == delta) || (((k-start_sc)%6) == (delta+1)) )
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
@@ -56,6 +56,11 @@ void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2
|
||||
void generate_dmrs_pbch(uint32_t dmrs_pbch_bitmap[DMRS_PBCH_I_SSB][DMRS_PBCH_N_HF][DMRS_BITMAP_SIZE], uint16_t Nid_cell);
|
||||
uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type);
|
||||
|
||||
uint8_t allowed_xlsch_re_in_dmrs_symbol(uint16_t k,
|
||||
uint16_t start_sc,
|
||||
uint8_t numDmrsCdmGrpsNoData,
|
||||
uint8_t dmrs_type);
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
#endif /* DMRS_NR_H */
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
//#define NR_PBCH_DMRS_LENGTH_DWORD 5
|
||||
//#define NR_PBCH_DMRS_LENGTH 144
|
||||
//#define DEBUG_PDCCH
|
||||
//#define DEBUG_PUSCH
|
||||
|
||||
#include "refsig_defs_ue.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
@@ -155,7 +155,7 @@ void nr_pdcch_scrambling(uint32_t *in,
|
||||
|
||||
|
||||
uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu,
|
||||
uint32_t **gold_pdcch_dmrs,
|
||||
int32_t *txdataF,
|
||||
int16_t amp,
|
||||
@@ -229,10 +229,11 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
|
||||
/// DCI payload processing
|
||||
// CRC attachment + Scrambling + Channel coding + Rate matching
|
||||
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
|
||||
|
||||
uint16_t n_RNTI = pdcch_pdu_rel15->dci_pdu.RNTI[d];
|
||||
uint16_t Nid = pdcch_pdu_rel15->dci_pdu.ScramblingId[d];
|
||||
uint16_t scrambling_RNTI = pdcch_pdu_rel15->dci_pdu.ScramblingRNTI[d];
|
||||
|
||||
|
||||
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
|
||||
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d],
|
||||
pdcch_pdu_rel15->dci_pdu.AggregationLevel[d],
|
||||
|
||||
@@ -212,7 +212,6 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
|
||||
|
||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu.Payload[i];
|
||||
|
||||
|
||||
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu.RNTI[i],gNB,SEARCH_EXIST_OR_FREE);
|
||||
if( (dlsch_id<0) || (dlsch_id>=NUMBER_OF_NR_DLSCH_MAX) ){
|
||||
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu.RNTI[i],dlsch_id);
|
||||
@@ -220,7 +219,8 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
dlsch = gNB->dlsch[dlsch_id][0];
|
||||
int harq_pid = 0;//extract_harq_pid(i,pdu_rel15);
|
||||
int num_slots_tdd = (gNB->frame_parms.slots_per_frame)>>(7-gNB->gNB_config.tdd_table.tdd_period.value);
|
||||
int harq_pid = slot % num_slots_tdd;
|
||||
|
||||
dlsch->slot_tx[slot] = 1;
|
||||
dlsch->harq_ids[frame%2][slot] = harq_pid;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "nr_dci.h"
|
||||
#include "nr_sch_dmrs.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
|
||||
//#define DEBUG_DLSCH
|
||||
//#define DEBUG_DLSCH_MAPPING
|
||||
@@ -126,26 +127,29 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
|
||||
time_stats_t *dlsch_interleaving_stats,
|
||||
time_stats_t *dlsch_segmentation_stats) {
|
||||
|
||||
int harq_pid = 0;
|
||||
int harq_pid = dlsch->harq_ids[frame%2][slot];
|
||||
NR_DL_gNB_HARQ_t *harq = dlsch->harq_processes[harq_pid];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs;
|
||||
int16_t **tx_layers = (int16_t**)dlsch->txdataF;
|
||||
int8_t Wf[2], Wt[2], l0, l_prime[2], delta;
|
||||
uint8_t nodata_dmrs = 1;
|
||||
uint8_t dmrs_Type = rel15->dmrsConfigType;
|
||||
int nb_re_dmrs = (dmrs_Type== NFAPI_NR_DMRS_TYPE1) ? 6:4;
|
||||
uint16_t n_dmrs = ((rel15->rbSize+rel15->rbStart)*nb_re_dmrs)<<1;
|
||||
int16_t mod_dmrs[n_dmrs<<1];
|
||||
|
||||
int nb_re_dmrs;
|
||||
uint16_t n_dmrs;
|
||||
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1) {
|
||||
nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData;
|
||||
n_dmrs = ((rel15->rbSize+rel15->rbStart)*6)<<1;
|
||||
}
|
||||
else {
|
||||
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
||||
n_dmrs = ((rel15->rbSize+rel15->rbStart)*4)<<1;
|
||||
}
|
||||
uint16_t nb_re;
|
||||
if (nodata_dmrs) // no data in dmrs symbol
|
||||
nb_re = ((12*rel15->NrOfSymbols)-12-xOverhead)*rel15->rbSize*rel15->NrOfCodewords;
|
||||
else
|
||||
nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-xOverhead)*rel15->rbSize*rel15->NrOfCodewords;
|
||||
nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-xOverhead)*rel15->rbSize*rel15->NrOfCodewords;
|
||||
uint8_t Qm = rel15->qamModOrder[0];
|
||||
uint32_t encoded_length = nb_re*Qm;
|
||||
int16_t mod_dmrs[n_dmrs<<1];
|
||||
|
||||
/// CRC, coding, interleaving and rate matching
|
||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||
@@ -301,7 +305,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
|
||||
}
|
||||
|
||||
else {
|
||||
if( (l != dmrs_symbol) || !nodata_dmrs) {
|
||||
if( (l != dmrs_symbol) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) {
|
||||
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
|
||||
@@ -335,12 +335,13 @@ int nr_dlsch_encoding(unsigned char *a,
|
||||
uint32_t E;
|
||||
uint8_t Ilbrm = 1;
|
||||
uint32_t Tbslbrm = 950984; //max tbs
|
||||
uint8_t nodata_dmrs = 1;
|
||||
uint8_t nb_re_dmrs;
|
||||
if (nodata_dmrs)
|
||||
nb_re_dmrs = 12;
|
||||
|
||||
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1)
|
||||
nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData;
|
||||
else
|
||||
nb_re_dmrs = rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1 ? 6:4;
|
||||
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
||||
|
||||
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||
uint16_t R=rel15->targetCodeRate[0];
|
||||
float Coderate = 0.0;
|
||||
@@ -464,6 +465,9 @@ int nr_dlsch_encoding(unsigned char *a,
|
||||
|
||||
}
|
||||
|
||||
F = dlsch->harq_processes[harq_pid]->F;
|
||||
|
||||
Kr = dlsch->harq_processes[harq_pid]->K;
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
if (F>0) {
|
||||
|
||||
@@ -150,6 +150,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
|
||||
int16_t **rxsigF=NULL;
|
||||
NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
|
||||
int slot2=slot;
|
||||
|
||||
int16_t *prach[ru->nb_rx];
|
||||
int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value;
|
||||
@@ -159,8 +160,11 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
rxsigF = ru->prach_rxsigF;
|
||||
|
||||
AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n");
|
||||
for (int aa=0; aa<ru->nb_rx; aa++)
|
||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot*fp->get_samples_per_slot(slot,fp))-ru->N_TA_offset];
|
||||
|
||||
for (int aa=0; aa<ru->nb_rx; aa++){
|
||||
if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe;
|
||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))-ru->N_TA_offset];
|
||||
}
|
||||
|
||||
int dftlen=0;
|
||||
int mu = fp->numerology_index;
|
||||
@@ -169,7 +173,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
|
||||
if (prach_sequence_length == 0) {
|
||||
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n",
|
||||
ru->idx,frame,slot,prachFormat,msg1_frequencystart);
|
||||
ru->idx,frame,slot2,prachFormat,msg1_frequencystart);
|
||||
AssertFatal(prachFormat<4,"Illegal prach format %d for length 839\n",prachFormat);
|
||||
switch (prachFormat) {
|
||||
case 0:
|
||||
@@ -282,7 +286,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
dft(DFT_49152,prach2,rxsigF[aa],1);
|
||||
}
|
||||
if (prachFormat == 1 || prachFormat == 2) {
|
||||
dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1);
|
||||
dft(DFT_49152,prach2+98304,rxsigF[aa]+98304,1);
|
||||
reps++;
|
||||
}
|
||||
if (prachFormat == 2) {
|
||||
@@ -348,7 +352,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
reps+=2;
|
||||
}
|
||||
if (prachFormat == 3) {
|
||||
dftlen=9216;
|
||||
dftlen=9216;
|
||||
for (int i=0;i<4;i++) dft(DFT_9216,prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1);
|
||||
reps=4;
|
||||
}
|
||||
@@ -358,7 +362,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
(mu==1 && prachStartSymbol == 0)) prach2+=48; // 24 samples @ 46.08 Ms/s in first symbol of each half subframe (15/30 kHz only)
|
||||
if (mu==0) AssertFatal(1==0,"Shouldn't get here\n");
|
||||
else if (mu==1) {
|
||||
dftlen=1536;
|
||||
dftlen=1536;
|
||||
dft(DFT_1536,prach2,rxsigF[aa],1);
|
||||
if (prachFormat != 7) {
|
||||
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
|
||||
@@ -366,13 +370,13 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
}
|
||||
|
||||
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) {
|
||||
dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1);
|
||||
dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1);
|
||||
dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1);
|
||||
dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1);
|
||||
reps+=2;
|
||||
}
|
||||
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) {
|
||||
dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1);
|
||||
dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1);
|
||||
dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1);
|
||||
dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1);
|
||||
reps+=2;
|
||||
}
|
||||
if (prachFormat == 6) {
|
||||
@@ -418,7 +422,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
|
||||
if (mu==0) AssertFatal(1==0,"Shouldn't get here\n");
|
||||
else if (mu==1) {
|
||||
dftlen=4096;
|
||||
dftlen=4096;
|
||||
dft(DFT_4096,prach2,rxsigF[aa],1);
|
||||
if (prachFormat != 7) { //!=C0
|
||||
dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1);
|
||||
@@ -470,7 +474,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
|
||||
if (mu==0) AssertFatal(1==0,"Shouldn't get here\n");
|
||||
else if (mu==1) {
|
||||
dftlen=3072;
|
||||
dftlen=3072;
|
||||
dft(DFT_3072,prach2,rxsigF[aa],1);
|
||||
if (prachFormat != 7) { //!=C0
|
||||
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
|
||||
@@ -500,6 +504,7 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
}
|
||||
|
||||
//Coherent combining of PRACH repetitions (assumes channel does not change, to be revisted for "long" PRACH)
|
||||
LOG_D(PHY,"Doing PRACH combining of %d reptitions N_ZC %d\n",reps,N_ZC);
|
||||
int16_t rxsigF_tmp[N_ZC<<1];
|
||||
// if (k+N_ZC > dftlen) { // PRACH signal is split around DC
|
||||
int16_t *rxsigF2=rxsigF[aa];
|
||||
@@ -578,9 +583,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
|
||||
restricted_set = cfg->restricted_set_config.value;
|
||||
|
||||
AssertFatal(prach_sequence_length == 1, "no support yet for long prachSequenceLength\n");
|
||||
|
||||
|
||||
uint8_t prach_fmt = prach_pdu->prach_format;
|
||||
uint16_t N_ZC = (prach_sequence_length==0)?839:139;
|
||||
|
||||
@@ -592,13 +594,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, rootSequenceIndex %d\n", subframe,msg1_frequencystart,rootSequenceIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
start_meas(&gNB->rx_prach);
|
||||
|
||||
|
||||
prach_root_sequence_map = (cfg->prach_sequence_length.value==0) ? prach_root_sequence_map_0_3 : prach_root_sequence_map_abc;
|
||||
|
||||
// PDP is oversampled, e.g. 1024 sample instead of 839
|
||||
@@ -619,7 +616,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)){
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],(N_ZC==839) ? 840: 140));
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d \n",frame,subframe,preamble_index);
|
||||
if (en>60) LOG_D(PHY,"frame %d, subframe %d : Trying preamble %d \n",frame,subframe,preamble_index);
|
||||
}
|
||||
if (restricted_set == 0) {
|
||||
// This is the relative offset in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
|
||||
@@ -745,22 +742,22 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])>>10;
|
||||
}
|
||||
|
||||
if (LOG_DUMPFLAG(PRACH)) {
|
||||
if (LOG_DUMPFLAG(PRACH)) {
|
||||
if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
|
||||
}
|
||||
}
|
||||
}// antennas_rx
|
||||
} // new dft
|
||||
|
||||
// check energy in nth time shift, for
|
||||
|
||||
preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
|
||||
|
||||
|
||||
|
||||
for (i=0; i<NCS2; i++) {
|
||||
lev = (int32_t)prach_ifft[(preamble_shift2+i)];
|
||||
levdB = dB_fixed_times10(lev);
|
||||
if (levdB>*max_preamble_energy) {
|
||||
LOG_D(PHY,"preamble_index %d, delay %d en %d dB > %d dB\n",preamble_index,i,levdB,*max_preamble_energy);
|
||||
*max_preamble_energy = levdB;
|
||||
*max_preamble_delay = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate
|
||||
*max_preamble = preamble_index;
|
||||
@@ -794,8 +791,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
|
||||
|
||||
if (LOG_DUMPFLAG(PRACH)) {
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if (en>60) {
|
||||
//int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
// if (en>60) {
|
||||
int k = (12*n_ra_prb) - 6*fp->N_RB_UL;
|
||||
|
||||
if (k<0) k+=fp->ofdm_symbol_size;
|
||||
@@ -809,7 +806,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
|
||||
LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
LOG_M("Xu.m","xu",Xu,N_ZC,1,1);
|
||||
LOG_M("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
|
||||
}
|
||||
// }
|
||||
} /* LOG_DUMPFLAG(PRACH) */
|
||||
stop_meas(&gNB->rx_prach);
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ void compute_nr_prach_seq(uint8_t short_sequence,
|
||||
}
|
||||
|
||||
u = prach_root_sequence_map[index];
|
||||
|
||||
LOG_D(PHY,"prach index %d => u=%d\n",index,u);
|
||||
inv_u = nr_ZC_inv[u]; // multiplicative inverse of u
|
||||
|
||||
|
||||
|
||||
@@ -50,4 +50,4 @@ uint16_t get_dmrs_freq_idx(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t d
|
||||
|
||||
uint8_t get_l0(uint16_t dlDmrsSymbPos);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -137,12 +137,12 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||
@param symbol Symbol on which to act (within-in nr_TTI_rx)
|
||||
@param harq_pid HARQ process ID
|
||||
*/
|
||||
void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
uint8_t UE_id,
|
||||
uint32_t frame,
|
||||
uint8_t nr_tti_rx,
|
||||
unsigned char symbol,
|
||||
unsigned char harq_pid);
|
||||
int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
uint8_t UE_id,
|
||||
uint32_t frame,
|
||||
uint8_t nr_tti_rx,
|
||||
unsigned char symbol,
|
||||
unsigned char harq_pid);
|
||||
|
||||
/** \brief This function performs RB extraction (signal and channel estimates) (currently signal only until channel estimation and compensation are implemented)
|
||||
@param rxdataF pointer to the received frequency domain signal
|
||||
@@ -309,10 +309,24 @@ void nr_fill_prach_ru(RU_t *ru,
|
||||
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, 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 nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu);
|
||||
|
||||
int nr_find_pucch(uint16_t rnti,
|
||||
int frame,
|
||||
int slot,
|
||||
PHY_VARS_gNB *gNB);
|
||||
|
||||
|
||||
void init_prach_list(PHY_VARS_gNB *gNB);
|
||||
void init_prach_ru_list(RU_t *ru);
|
||||
void free_nr_ru_prach_entry(RU_t *ru, int prach_id);
|
||||
|
||||
|
||||
void nr_decode_pucch1(int32_t **rxdataF,
|
||||
pucch_GroupHopping_t pucch_GroupHopping,
|
||||
uint32_t n_id, // hoppingID higher layer parameter
|
||||
|
||||
@@ -527,7 +527,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
if (r==0) {
|
||||
write_output("decoder_llr.m","decllr",ulsch_llr,G,1,0);
|
||||
write_output("decoder_in.m","dec",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,0);
|
||||
write_output("decoder_in.m","dec",&harq_process->d[0][0],E,1,0);
|
||||
}
|
||||
|
||||
printf("decoder input(segment %u) :", r);
|
||||
@@ -608,7 +608,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
#endif
|
||||
ret = ulsch->max_ldpc_iterations + 1;
|
||||
}
|
||||
|
||||
nb_total_decod++;
|
||||
|
||||
if (no_iteration_ldpc > ulsch->max_ldpc_iterations){
|
||||
|
||||
@@ -283,6 +283,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
is_dmrs_re = 0;
|
||||
|
||||
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
K_ptrs = (pusch_pdu->pusch_ptrs.ptrs_freq_density)?4:2;
|
||||
if(is_ptrs_symbol(symbol, pusch_vars->ptrs_symbols))
|
||||
is_ptrs_symbol_flag = is_ptrs_subcarrier((start_re + re) % frame_parms->ofdm_symbol_size,
|
||||
n_rnti,
|
||||
@@ -1009,12 +1010,12 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
|
||||
|
||||
}
|
||||
|
||||
void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
uint8_t UE_id,
|
||||
uint32_t frame,
|
||||
uint8_t nr_tti_rx,
|
||||
unsigned char symbol,
|
||||
unsigned char harq_pid)
|
||||
int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
uint8_t ulsch_id,
|
||||
uint32_t frame,
|
||||
uint8_t nr_tti_rx,
|
||||
unsigned char symbol,
|
||||
unsigned char harq_pid)
|
||||
{
|
||||
|
||||
uint8_t aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
|
||||
@@ -1023,22 +1024,21 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
int avgs;
|
||||
int avg[4];
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
uint8_t nodata_dmrs = 1; // FIXME to be properly configured from fapi
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
|
||||
dmrs_symbol_flag = 0;
|
||||
gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol = 0;
|
||||
gNB->pusch_vars[ulsch_id]->ptrs_sc_per_ofdm_symbol = 0;
|
||||
|
||||
if(symbol == rel15_ul->start_symbol_index){
|
||||
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol = 0;
|
||||
gNB->pusch_vars[UE_id]->cl_done = 0;
|
||||
gNB->pusch_vars[UE_id]->ptrs_symbols = 0;
|
||||
gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset = 0;
|
||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = 0;
|
||||
gNB->pusch_vars[ulsch_id]->cl_done = 0;
|
||||
gNB->pusch_vars[ulsch_id]->ptrs_symbols = 0;
|
||||
|
||||
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu
|
||||
L_ptrs = 1<<(rel15_ul->pusch_ptrs.ptrs_time_density);
|
||||
|
||||
set_ptrs_symb_idx(&gNB->pusch_vars[UE_id]->ptrs_symbols,
|
||||
set_ptrs_symb_idx(&gNB->pusch_vars[ulsch_id]->ptrs_symbols,
|
||||
rel15_ul->nr_of_symbols,
|
||||
rel15_ul->start_symbol_index,
|
||||
L_ptrs,
|
||||
@@ -1053,18 +1053,23 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
if (dmrs_symbol_flag == 1){
|
||||
if (((rel15_ul->ul_dmrs_symb_pos)>>((symbol+1)%frame_parms->symbols_per_slot))&0x01)
|
||||
AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
|
||||
if (nodata_dmrs)
|
||||
nb_re_pusch = 0;
|
||||
else
|
||||
nb_re_pusch = rel15_ul->rb_size * ((rel15_ul->dmrs_config_type==pusch_dmrs_type1)?6:8);
|
||||
gNB->pusch_vars[UE_id]->dmrs_symbol = symbol;
|
||||
|
||||
if (rel15_ul->dmrs_config_type == 0) {
|
||||
// if no data in dmrs cdm group is 1 only even REs have no data
|
||||
// if no data in dmrs cdm group is 2 both odd and even REs have no data
|
||||
nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6));
|
||||
}
|
||||
else {
|
||||
nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4));
|
||||
}
|
||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
|
||||
} else {
|
||||
nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
|
||||
}
|
||||
|
||||
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu
|
||||
if(is_ptrs_symbol(symbol, gNB->pusch_vars[UE_id]->ptrs_symbols))
|
||||
gNB->pusch_vars[UE_id]->ptrs_symbol_index = symbol;
|
||||
if(is_ptrs_symbol(symbol, gNB->pusch_vars[ulsch_id]->ptrs_symbols))
|
||||
gNB->pusch_vars[ulsch_id]->ptrs_symbol_index = symbol;
|
||||
}
|
||||
|
||||
|
||||
@@ -1088,25 +1093,25 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
|
||||
start_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
|
||||
gNB->pusch_vars[UE_id],
|
||||
gNB->pusch_vars[ulsch_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul,
|
||||
frame_parms);
|
||||
stop_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
|
||||
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
|
||||
frame_parms,
|
||||
gNB->ulsch[UE_id],
|
||||
gNB->ulsch[ulsch_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul->rb_size,
|
||||
rel15_ul->dmrs_config_type);
|
||||
|
||||
|
||||
if (gNB->pusch_vars[UE_id]->cl_done==0) {
|
||||
if (gNB->pusch_vars[ulsch_id]->cl_done==0) {
|
||||
|
||||
nr_ulsch_channel_level(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
|
||||
frame_parms,
|
||||
avg,
|
||||
symbol,
|
||||
@@ -1119,38 +1124,44 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
|
||||
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
|
||||
|
||||
gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1;
|
||||
gNB->pusch_vars[UE_id]->cl_done = 1;
|
||||
gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+1;
|
||||
gNB->pusch_vars[ulsch_id]->cl_done = 1;
|
||||
}
|
||||
|
||||
start_meas(&gNB->ulsch_channel_compensation_stats);
|
||||
nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_magb0,
|
||||
gNB->pusch_vars[UE_id]->rxdataF_comp,
|
||||
(frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[UE_id]->rho : NULL,
|
||||
nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
|
||||
gNB->pusch_vars[ulsch_id]->rxdataF_comp,
|
||||
(frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL,
|
||||
frame_parms,
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul->qam_mod_order,
|
||||
rel15_ul->rb_size,
|
||||
gNB->pusch_vars[UE_id]->log2_maxh);
|
||||
gNB->pusch_vars[ulsch_id]->log2_maxh);
|
||||
stop_meas(&gNB->ulsch_channel_compensation_stats);
|
||||
|
||||
|
||||
int rxsig = signal_energy(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][(symbol*rel15_ul->rb_size*12)],
|
||||
rel15_ul->rb_size*12);
|
||||
|
||||
if (rxsig==1) return (rxsig);
|
||||
|
||||
#ifdef NR_SC_FDMA
|
||||
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
|
||||
nr_idft(&((uint32_t*)gNB->pusch_vars[ulsch_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-------------------- LLRs computation --------------------
|
||||
//----------------------------------------------------------
|
||||
start_meas(&gNB->ulsch_llr_stats);
|
||||
AssertFatal(gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order+nb_re_pusch*rel15_ul->qam_mod_order < (8*((3*8*6144)+12)) , "Mysterious llr buffer size check");
|
||||
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB],
|
||||
gNB->pusch_vars[UE_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[UE_id]->ul_ch_magb0,
|
||||
&gNB->pusch_vars[UE_id]->llr[gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order],
|
||||
AssertFatal(gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order+nb_re_pusch*rel15_ul->qam_mod_order < (8*((3*8*6144)+12)) , "Mysterious llr buffer size check");
|
||||
nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB],
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
|
||||
&gNB->pusch_vars[ulsch_id]->llr[gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset * rel15_ul->qam_mod_order],
|
||||
rel15_ul->rb_size,
|
||||
nb_re_pusch,
|
||||
symbol,
|
||||
@@ -1159,6 +1170,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
|
||||
}
|
||||
|
||||
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re_pusch;
|
||||
|
||||
gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset = gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset + nb_re_pusch;
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,54 @@
|
||||
|
||||
//#define DEBUG_NR_PUCCH_RX 1
|
||||
|
||||
NR_gNB_PUCCH_t *new_gNB_pucch(void){
|
||||
NR_gNB_PUCCH_t *pucch;
|
||||
pucch = (NR_gNB_PUCCH_t *)malloc16(sizeof(NR_gNB_PUCCH_t));
|
||||
pucch->active = 0;
|
||||
return (pucch);
|
||||
}
|
||||
|
||||
int nr_find_pucch(uint16_t rnti,
|
||||
int frame,
|
||||
int slot,
|
||||
PHY_VARS_gNB *gNB) {
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
int index = -1;
|
||||
|
||||
for (int i=0; i<NUMBER_OF_NR_ULSCH_MAX; i++) {
|
||||
AssertFatal(gNB->pucch[i]!=NULL,"gNB->pucch[%d] is null\n",i);
|
||||
if ((gNB->pucch[i]->active >0) &&
|
||||
(gNB->pucch[i]->pucch_pdu.rnti==rnti) &&
|
||||
(gNB->pucch[i]->frame==frame) &&
|
||||
(gNB->pucch[i]->slot==slot)) return(i);
|
||||
else if ((gNB->pucch[i]->active == 0) && (index==-1)) index=i;
|
||||
}
|
||||
|
||||
if (index==-1)
|
||||
LOG_E(MAC,"PUCCH list is full\n");
|
||||
|
||||
return(index);
|
||||
}
|
||||
|
||||
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu) {
|
||||
|
||||
int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB);
|
||||
AssertFatal( (id>=0) && (id<NUMBER_OF_NR_PUCCH_MAX),
|
||||
"invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,id);
|
||||
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[id];
|
||||
pucch->frame = frame;
|
||||
pucch->slot = slot;
|
||||
pucch->active = 1;
|
||||
memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
|
||||
|
||||
}
|
||||
|
||||
|
||||
int get_pucch0_cs_lut_index(PHY_VARS_gNB *gNB,nfapi_nr_pucch_pdu_t* pucch_pdu) {
|
||||
|
||||
int i=0;
|
||||
@@ -319,9 +367,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
uint8_t xrtmag_dB = dB_fixed(xrtmag);
|
||||
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
//#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
index=maxpos;
|
||||
#endif
|
||||
@@ -361,8 +409,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
||||
|
||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||
uci_pdu->harq->harq_list[1].harq_value = (index>>1)&0x01;
|
||||
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
||||
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
||||
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "SCHED_NR_UE/harq_nr.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
@@ -133,6 +134,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
memset(dlsch,0,sizeof(NR_UE_DLSCH_t));
|
||||
dlsch->Kmimo = Kmimo;
|
||||
dlsch->Mdlharq = Mdlharq;
|
||||
dlsch->number_harq_processes_for_pdsch = Mdlharq;
|
||||
dlsch->Nsoft = Nsoft;
|
||||
dlsch->Mlimit = 4;
|
||||
dlsch->max_ldpc_iterations = max_ldpc_iterations;
|
||||
@@ -143,6 +145,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
|
||||
|
||||
if (dlsch->harq_processes[i]) {
|
||||
memset(dlsch->harq_processes[i],0,sizeof(NR_DL_UE_HARQ_t));
|
||||
init_downlink_harq_status(dlsch->harq_processes[i]);
|
||||
dlsch->harq_processes[i]->first_tx=1;
|
||||
dlsch->harq_processes[i]->b = (uint8_t*)malloc16(dlsch_bytes);
|
||||
|
||||
@@ -264,7 +267,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
uint8_t dmrs_Type = harq_process->dmrsConfigType;
|
||||
AssertFatal(dmrs_Type == 1 || dmrs_Type == 2,"Illegal dmrs_type %d\n",dmrs_Type);
|
||||
uint8_t nb_re_dmrs = 12;//(dmrs_Type==1)?6:4;
|
||||
uint8_t nb_re_dmrs = (dmrs_Type==1)?6:4; // should be changed based on MAC parameters
|
||||
uint16_t dmrs_length = get_num_dmrs(harq_process->dlDmrsSymbPos);
|
||||
AssertFatal(dmrs_length == 1 || dmrs_length == 2,"Illegal dmrs_length %d\n",dmrs_length);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#define NR_PRACH_DEBUG 1
|
||||
//#define NR_PRACH_DEBUG 1
|
||||
|
||||
extern uint16_t NCS_unrestricted_delta_f_RA_125[16];
|
||||
extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15];
|
||||
@@ -59,6 +59,7 @@ extern int64_t table_6_3_3_2_4_prachConfig_Index [256][10];
|
||||
extern uint16_t nr_du[838];
|
||||
extern int16_t nr_ru[2*839];
|
||||
extern const char *prachfmt[9];
|
||||
extern const char *prachfmt03[4];
|
||||
|
||||
// Note:
|
||||
// - prach_fmt_id is an ID used to map to the corresponding PRACH format value in prachfmt
|
||||
@@ -78,6 +79,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
|
||||
uint16_t rootSequenceIndex, prach_fmt_id, NCS, *prach_root_sequence_map, preamble_offset = 0;
|
||||
uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx;
|
||||
int16_t prach_tmp[98304*2*4] __attribute__((aligned(32)));
|
||||
|
||||
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
|
||||
int32_t Xu_re, Xu_im, samp_count;
|
||||
int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k;
|
||||
@@ -207,9 +209,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
|
||||
#ifdef NR_PRACH_DEBUG
|
||||
if (NCS>0)
|
||||
LOG_I(PHY, "PRACH [UE %d] generate PRACH for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d\n", Mod_id,
|
||||
rootSequenceIndex,
|
||||
preamble_index,
|
||||
prachfmt[prach_fmt_id],
|
||||
rootSequenceIndex,
|
||||
preamble_index,
|
||||
prach_sequence_length == 0 ? prachfmt03[prach_fmt_id] : prachfmt[prach_fmt_id],
|
||||
NCS,
|
||||
N_ZC,
|
||||
preamble_offset,
|
||||
@@ -557,7 +559,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
|
||||
Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
|
||||
prach2 = prach+(Ncp<<1);
|
||||
idft(IDFT_1536,prachF,prach2,1);
|
||||
|
||||
// here we have |empty | Prach1536 |
|
||||
if (prach_fmt_id != 7) {
|
||||
memmove(prach2+(1536<<1),prach2,(1536<<2));
|
||||
|
||||
@@ -1387,8 +1387,10 @@ void ulsch_modulation(int32_t **txdataF,
|
||||
NR_UE_ULSCH_t *ulsch);
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t allowed_ulsch_re_in_dmrs_symbol(uint16_t k,
|
||||
uint16_t start_sc,
|
||||
uint8_t numDmrsCdmGrpsNoData,
|
||||
uint8_t dmrs_type);
|
||||
|
||||
|
||||
int generate_ue_dlsch_params_from_dci(int frame,
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
|
||||
|
||||
|
||||
// structures below implement 36-211 and 36-212
|
||||
|
||||
/** @addtogroup _PHY_TRANSPORT_
|
||||
|
||||
@@ -98,6 +98,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
uint8_t thread_id,
|
||||
int gNB_id) {
|
||||
|
||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||
|
||||
uint32_t available_bits, TBS;
|
||||
uint8_t mod_order, cwd_index, num_of_codewords, l;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
@@ -114,7 +116,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
uint8_t data_existing =0;
|
||||
uint8_t L_ptrs, K_ptrs; // PTRS parameters
|
||||
uint16_t beta_ptrs; // PTRS parameter related to power control
|
||||
uint8_t no_data_in_dmrs = 1;
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue;
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue=NULL;
|
||||
@@ -128,7 +129,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
number_dmrs_symbols = 0;
|
||||
|
||||
|
||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
||||
|
||||
ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
|
||||
@@ -149,10 +149,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
rnti = harq_process_ul_ue->pusch_pdu.rnti;
|
||||
ulsch_ue->Nid_cell = Nid_cell;
|
||||
|
||||
if(no_data_in_dmrs)
|
||||
nb_dmrs_re_per_rb = 12;
|
||||
else
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data;
|
||||
|
||||
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
|
||||
|
||||
@@ -174,7 +171,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
0,
|
||||
harq_process_ul_ue->pusch_pdu.nrOfLayers);
|
||||
|
||||
|
||||
uint8_t access_mode = SCHEDULED_ACCESS;
|
||||
|
||||
//-----------------------------------------------------//
|
||||
@@ -186,10 +182,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
|
||||
slot, 0, ulsch_input_buffer, TBS/8, &access_mode);
|
||||
slot, 0, ulsch_input_buffer, TBS/8, &access_mode);
|
||||
//IP traffic to be transmitted
|
||||
if(data_existing){
|
||||
//harq_process_ul_ue->a = (unsigned char*)calloc(TBS/8, sizeof(unsigned char));
|
||||
//harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char));
|
||||
memcpy(harq_process_ul_ue->a, ulsch_input_buffer, TBS/8);
|
||||
}
|
||||
}
|
||||
@@ -372,7 +368,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
|
||||
uint8_t k_prime=0;
|
||||
uint8_t is_dmrs, is_ptrs;
|
||||
uint8_t is_dmrs, is_ptrs, is_dmrs_symbol;
|
||||
uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0;
|
||||
|
||||
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
||||
@@ -387,8 +383,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
is_dmrs = 0;
|
||||
is_ptrs = 0;
|
||||
is_dmrs_symbol = 0;
|
||||
|
||||
if((ul_dmrs_symb_pos >> l) & 0x01) {
|
||||
is_dmrs_symbol = 1;
|
||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
||||
is_dmrs = 1;
|
||||
}
|
||||
@@ -439,7 +437,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
ptrs_idx++;
|
||||
|
||||
} else if (((ul_dmrs_symb_pos >> l) & 0x01) == 0) {
|
||||
} else if (!is_dmrs_symbol || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data,dmrs_type)) {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
int32_t **txdataF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
||||
long pucch_GroupHopping,
|
||||
long hoppingId,
|
||||
int16_t amp,
|
||||
int nr_tti_tx,
|
||||
uint8_t m0,
|
||||
@@ -111,7 +112,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
for (int l=0; l<nrofSymbols; l++) {
|
||||
// if frequency hopping is enabled n_hop = 1 for second hop. Not sure frequency hopping concerns format 0. FIXME!!!
|
||||
// if ((PUCCH_Frequency_Hopping == 1)&&(l == (nrofSymbols-1))) n_hop = 1;
|
||||
nr_group_sequence_hopping(ue->pucch_config_common_nr->pucch_GroupHopping,ue->pucch_config_common_nr->hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value
|
||||
alpha = nr_cyclic_shift_hopping(ue->pucch_config_common_nr->hoppingId,m0,mcs,l,startingSymbolIndex,nr_tti_tx);
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u,v,alpha,l);
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
int32_t **txdataF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
||||
long pucch_GroupHopping,
|
||||
long hoppingId,
|
||||
int16_t amp,
|
||||
int nr_tti_tx,
|
||||
uint8_t m0,
|
||||
|
||||
+10
-10
@@ -1,16 +1,16 @@
|
||||
lte_dfts_sse4: lte_dfts.c
|
||||
gcc-7 -O3 -std=gnu99 -msse4.1 -o lte_dfts_sse4 lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
oai_dfts_sse4: oai_dfts.c
|
||||
gcc-7 -O3 -std=gnu99 -msse4.1 -o oai_dfts_sse4 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_TARGETS/ARCH/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
|
||||
lte_dfts_avx2: lte_dfts.c
|
||||
gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
oai_dfts_avx2: oai_dfts.c
|
||||
gcc -O2 -std=gnu99 -mavx2 -g -ggdb -o oai_dfts_avx2 oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_TARGETS/ARCH/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
|
||||
lte_dfts_avx2.s: lte_dfts.c
|
||||
gcc -O2 -std=gnu99 -mavx2 -S lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
oai_dfts_avx2.s: oai_dfts.c
|
||||
gcc -O2 -std=gnu99 -mavx2 -S oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_TARGETS/ARCH/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
|
||||
|
||||
lte_dfts_sse4.s: lte_dfts.c
|
||||
gcc -O2 -std=gnu99 -msse4.1 -S lte_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
oai_dfts_sse4.s: oai_dfts.c
|
||||
gcc -O2 -std=gnu99 -msse4.1 -S oai_dfts.c time_meas.c ../../SIMULATION/TOOLS/taus.c $$OPENAIR_HOME/common/utils/backtrace.c -I$$OPENAIR_HOME -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR_TARGETS/COMMON -I$$OPENAIR_TARGETS/ARCH/COMMON -I$$OPENAIR2_DIR -I$$OPENAIR2_DIR/COMMON -I$$OPENAIR_HOME/common/utils -I$$OPENAIR_HOME/common/utils/T -I$$OPENAIR_HOME/common/utils/msc -I$$OPENAIR_HOME/nfapi/open-nFAPI/nfapi/public_inc -DMR_MAIN -DNB_ANTENNAS_RX=1 -lm -lpthread # -DD256STATS #-DD64STATS
|
||||
|
||||
|
||||
dft_cycles_avx2: lte_dfts_avx2
|
||||
./lte_dfts_avx2 | egrep cycles
|
||||
dft_cycles_avx2: oai_dfts_avx2
|
||||
./oai_dfts_avx2 | egrep cycles
|
||||
|
||||
+867
-10
@@ -5353,6 +5353,607 @@ void idft8192(int16_t *x,int16_t *y,unsigned char scale)
|
||||
|
||||
#endif
|
||||
|
||||
int16_t tw16384[3*2*4096];
|
||||
|
||||
#ifndef __AVX2__
|
||||
void dft16384(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd_q15_t xtmp[4096],ytmp[4096],*tw16384_128p=(simd_q15_t *)tw16384,*x128=(simd_q15_t *)x,*y128=(simd_q15_t *)y,*y128p=(simd_q15_t *)y;
|
||||
simd_q15_t *ytmpp = &ytmp[0];
|
||||
int i,j;
|
||||
|
||||
for (i=0,j=0; i<4096; i+=4,j++) {
|
||||
transpose16_ooff(x128+i,xtmp+j,1024);
|
||||
}
|
||||
|
||||
|
||||
dft4096((int16_t*)(xtmp),(int16_t*)(ytmp),1);
|
||||
dft4096((int16_t*)(xtmp+1024),(int16_t*)(ytmp+1024),1);
|
||||
dft4096((int16_t*)(xtmp+2048),(int16_t*)(ytmp+2048),1);
|
||||
dft4096((int16_t*)(xtmp+3072),(int16_t*)(ytmp+3072),1);
|
||||
|
||||
for (i=0; i<1024; i++) {
|
||||
bfly4(ytmpp,ytmpp+1024,ytmpp+2048,ytmpp+3072,
|
||||
y128p,y128p+1024,y128p+2048,y128p+3072,
|
||||
tw16384_128p,tw16384_128p+1024,tw16384_128p+2048);
|
||||
tw16384_128p++;
|
||||
y128p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
y128[0] = shiftright_int16(y128[0],1);
|
||||
y128[1] = shiftright_int16(y128[1],1);
|
||||
y128[2] = shiftright_int16(y128[2],1);
|
||||
y128[3] = shiftright_int16(y128[3],1);
|
||||
y128[4] = shiftright_int16(y128[4],1);
|
||||
y128[5] = shiftright_int16(y128[5],1);
|
||||
y128[6] = shiftright_int16(y128[6],1);
|
||||
y128[7] = shiftright_int16(y128[7],1);
|
||||
y128[8] = shiftright_int16(y128[8],1);
|
||||
y128[9] = shiftright_int16(y128[9],1);
|
||||
y128[10] = shiftright_int16(y128[10],1);
|
||||
y128[11] = shiftright_int16(y128[11],1);
|
||||
y128[12] = shiftright_int16(y128[12],1);
|
||||
y128[13] = shiftright_int16(y128[13],1);
|
||||
y128[14] = shiftright_int16(y128[14],1);
|
||||
y128[15] = shiftright_int16(y128[15],1);
|
||||
|
||||
y128+=16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void idft16384(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd_q15_t xtmp[4096],ytmp[4096],*tw16384_128p=(simd_q15_t *)tw16384,*x128=(simd_q15_t *)x,*y128=(simd_q15_t *)y,*y128p=(simd_q15_t *)y;
|
||||
simd_q15_t *ytmpp = &ytmp[0];
|
||||
int i,j;
|
||||
|
||||
for (i=0,j=0; i<4096; i+=4,j++) {
|
||||
transpose16_ooff(x128+i,xtmp+j,1024);
|
||||
}
|
||||
|
||||
|
||||
idft4096((int16_t*)(xtmp),(int16_t*)(ytmp),1);
|
||||
idft4096((int16_t*)(xtmp+1024),(int16_t*)(ytmp+1024),1);
|
||||
idft4096((int16_t*)(xtmp+2048),(int16_t*)(ytmp+2048),1);
|
||||
idft4096((int16_t*)(xtmp+3072),(int16_t*)(ytmp+3072),1);
|
||||
|
||||
for (i=0; i<1024; i++) {
|
||||
ibfly4(ytmpp,ytmpp+1024,ytmpp+2048,ytmpp+3072,
|
||||
y128p,y128p+1024,y128p+2048,y128p+3072,
|
||||
tw16384_128p,tw16384_128p+1024,tw16384_128p+2048);
|
||||
tw16384_128p++;
|
||||
y128p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
y128[0] = shiftright_int16(y128[0],scale);
|
||||
y128[1] = shiftright_int16(y128[1],scale);
|
||||
y128[2] = shiftright_int16(y128[2],scale);
|
||||
y128[3] = shiftright_int16(y128[3],scale);
|
||||
y128[4] = shiftright_int16(y128[4],scale);
|
||||
y128[5] = shiftright_int16(y128[5],scale);
|
||||
y128[6] = shiftright_int16(y128[6],scale);
|
||||
y128[7] = shiftright_int16(y128[7],scale);
|
||||
y128[8] = shiftright_int16(y128[8],scale);
|
||||
y128[9] = shiftright_int16(y128[9],scale);
|
||||
y128[10] = shiftright_int16(y128[10],scale);
|
||||
y128[11] = shiftright_int16(y128[11],scale);
|
||||
y128[12] = shiftright_int16(y128[12],scale);
|
||||
y128[13] = shiftright_int16(y128[13],scale);
|
||||
y128[14] = shiftright_int16(y128[14],scale);
|
||||
y128[15] = shiftright_int16(y128[15],scale);
|
||||
|
||||
y128+=16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
#else //__AVX2__
|
||||
void dft16384(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd256_q15_t xtmp[2048],ytmp[2048],*tw16384_256p=(simd256_q15_t *)tw16384,*x256=(simd256_q15_t *)x,*y256=(simd256_q15_t *)y,*y256p=(simd256_q15_t *)y;
|
||||
simd256_q15_t *ytmpp = &ytmp[0];
|
||||
int i,j;
|
||||
|
||||
for (i=0,j=0; i<2048; i+=4,j++) {
|
||||
transpose16_ooff_simd256(x256+i,xtmp+j,512);
|
||||
}
|
||||
|
||||
|
||||
dft4096((int16_t*)(xtmp),(int16_t*)(ytmp),1);
|
||||
dft4096((int16_t*)(xtmp+512),(int16_t*)(ytmp+512),1);
|
||||
dft4096((int16_t*)(xtmp+1024),(int16_t*)(ytmp+1024),1);
|
||||
dft4096((int16_t*)(xtmp+1536),(int16_t*)(ytmp+1536),1);
|
||||
|
||||
for (i=0; i<512; i++) {
|
||||
bfly4_256(ytmpp,ytmpp+512,ytmpp+1024,ytmpp+1536,
|
||||
y256p,y256p+512,y256p+1024,y256p+1536,
|
||||
tw16384_256p,tw16384_256p+512,tw16384_256p+1024);
|
||||
tw16384_256p++;
|
||||
y256p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
|
||||
for (i=0; i<128; i++) {
|
||||
y256[0] = shiftright_int16_simd256(y256[0],1);
|
||||
y256[1] = shiftright_int16_simd256(y256[1],1);
|
||||
y256[2] = shiftright_int16_simd256(y256[2],1);
|
||||
y256[3] = shiftright_int16_simd256(y256[3],1);
|
||||
y256[4] = shiftright_int16_simd256(y256[4],1);
|
||||
y256[5] = shiftright_int16_simd256(y256[5],1);
|
||||
y256[6] = shiftright_int16_simd256(y256[6],1);
|
||||
y256[7] = shiftright_int16_simd256(y256[7],1);
|
||||
y256[8] = shiftright_int16_simd256(y256[8],1);
|
||||
y256[9] = shiftright_int16_simd256(y256[9],1);
|
||||
y256[10] = shiftright_int16_simd256(y256[10],1);
|
||||
y256[11] = shiftright_int16_simd256(y256[11],1);
|
||||
y256[12] = shiftright_int16_simd256(y256[12],1);
|
||||
y256[13] = shiftright_int16_simd256(y256[13],1);
|
||||
y256[14] = shiftright_int16_simd256(y256[14],1);
|
||||
y256[15] = shiftright_int16_simd256(y256[15],1);
|
||||
|
||||
y256+=16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
void idft16384(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd256_q15_t xtmp[2048],ytmp[2048],*tw16384_256p=(simd256_q15_t *)tw16384,*x256=(simd256_q15_t *)x,*y256=(simd256_q15_t *)y,*y256p=(simd256_q15_t *)y;
|
||||
simd256_q15_t *ytmpp = &ytmp[0];
|
||||
int i,j;
|
||||
|
||||
for (i=0,j=0; i<2048; i+=4,j++) {
|
||||
transpose16_ooff_simd256(x256+i,xtmp+j,512);
|
||||
}
|
||||
|
||||
|
||||
idft4096((int16_t*)(xtmp),(int16_t*)(ytmp),1);
|
||||
idft4096((int16_t*)(xtmp+512),(int16_t*)(ytmp+512),1);
|
||||
idft4096((int16_t*)(xtmp+1024),(int16_t*)(ytmp+1024),1);
|
||||
idft4096((int16_t*)(xtmp+1536),(int16_t*)(ytmp+1536),1);
|
||||
|
||||
for (i=0; i<512; i++) {
|
||||
ibfly4_256(ytmpp,ytmpp+512,ytmpp+1024,ytmpp+1536,
|
||||
y256p,y256p+512,y256p+1024,y256p+1536,
|
||||
tw16384_256p,tw16384_256p+512,tw16384_256p+1024);
|
||||
tw16384_256p++;
|
||||
y256p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
|
||||
for (i=0; i<128; i++) {
|
||||
y256[0] = shiftright_int16_simd256(y256[0],1);
|
||||
y256[1] = shiftright_int16_simd256(y256[1],1);
|
||||
y256[2] = shiftright_int16_simd256(y256[2],1);
|
||||
y256[3] = shiftright_int16_simd256(y256[3],1);
|
||||
y256[4] = shiftright_int16_simd256(y256[4],1);
|
||||
y256[5] = shiftright_int16_simd256(y256[5],1);
|
||||
y256[6] = shiftright_int16_simd256(y256[6],1);
|
||||
y256[7] = shiftright_int16_simd256(y256[7],1);
|
||||
y256[8] = shiftright_int16_simd256(y256[8],1);
|
||||
y256[9] = shiftright_int16_simd256(y256[9],1);
|
||||
y256[10] = shiftright_int16_simd256(y256[10],1);
|
||||
y256[11] = shiftright_int16_simd256(y256[11],1);
|
||||
y256[12] = shiftright_int16_simd256(y256[12],1);
|
||||
y256[13] = shiftright_int16_simd256(y256[13],1);
|
||||
y256[14] = shiftright_int16_simd256(y256[14],1);
|
||||
y256[15] = shiftright_int16_simd256(y256[15],1);
|
||||
|
||||
y256+=16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
#endif //__AVX2__
|
||||
|
||||
int16_t tw32768[2*16384] __attribute__((aligned(32)));
|
||||
|
||||
#ifndef __AVX2__
|
||||
void dft32768(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simdshort_q15_t xtmp[16384],*xtmpp,*x64 = (simdshort_q15_t *)x;
|
||||
simd_q15_t ytmp[8192],*tw32768_128p=(simd_q15_t *)tw32768,*y128=(simd_q15_t *)y,*y128p=(simd_q15_t *)y;
|
||||
simd_q15_t *ytmpp = &ytmp[0];
|
||||
int i;
|
||||
simd_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16(ONE_OVER_SQRT2_Q15);
|
||||
|
||||
xtmpp = xtmp;
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
transpose4_ooff(x64 ,xtmpp,8192);
|
||||
transpose4_ooff(x64+2,xtmpp+1,8192);
|
||||
transpose4_ooff(x64+4,xtmpp+2,8192);
|
||||
transpose4_ooff(x64+6,xtmpp+3,8192);
|
||||
transpose4_ooff(x64+8,xtmpp+4,8192);
|
||||
transpose4_ooff(x64+10,xtmpp+5,8192);
|
||||
transpose4_ooff(x64+12,xtmpp+6,8192);
|
||||
transpose4_ooff(x64+14,xtmpp+7,8192);
|
||||
transpose4_ooff(x64+16,xtmpp+8,8192);
|
||||
transpose4_ooff(x64+18,xtmpp+9,8192);
|
||||
transpose4_ooff(x64+20,xtmpp+10,8192);
|
||||
transpose4_ooff(x64+22,xtmpp+11,8192);
|
||||
transpose4_ooff(x64+24,xtmpp+12,8192);
|
||||
transpose4_ooff(x64+26,xtmpp+13,8192);
|
||||
transpose4_ooff(x64+28,xtmpp+14,8192);
|
||||
transpose4_ooff(x64+30,xtmpp+15,8192);
|
||||
transpose4_ooff(x64+32,xtmpp+16,8192);
|
||||
transpose4_ooff(x64+34,xtmpp+17,8192);
|
||||
transpose4_ooff(x64+36,xtmpp+18,8192);
|
||||
transpose4_ooff(x64+38,xtmpp+19,8192);
|
||||
transpose4_ooff(x64+40,xtmpp+20,8192);
|
||||
transpose4_ooff(x64+42,xtmpp+21,8192);
|
||||
transpose4_ooff(x64+44,xtmpp+22,8192);
|
||||
transpose4_ooff(x64+46,xtmpp+23,8192);
|
||||
transpose4_ooff(x64+48,xtmpp+24,8192);
|
||||
transpose4_ooff(x64+50,xtmpp+25,8192);
|
||||
transpose4_ooff(x64+52,xtmpp+26,8192);
|
||||
transpose4_ooff(x64+54,xtmpp+27,8192);
|
||||
transpose4_ooff(x64+56,xtmpp+28,8192);
|
||||
transpose4_ooff(x64+58,xtmpp+29,8192);
|
||||
transpose4_ooff(x64+60,xtmpp+30,8192);
|
||||
transpose4_ooff(x64+62,xtmpp+31,8192);
|
||||
x64+=64;
|
||||
xtmpp+=32;
|
||||
}
|
||||
|
||||
dft16384((int16_t*)(xtmp),(int16_t*)ytmp,1);
|
||||
dft16384((int16_t*)(xtmp+8192),(int16_t*)(ytmp+4096),1);
|
||||
|
||||
|
||||
for (i=0; i<4096; i++) {
|
||||
bfly2(ytmpp,ytmpp+4096,
|
||||
y128p,y128p+4096,
|
||||
tw32768_128p);
|
||||
tw32768_128p++;
|
||||
y128p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
y128p = y128;
|
||||
|
||||
for (i=0; i<512; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
void idft32768(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simdshort_q15_t xtmp[16384],*xtmpp,*x64 = (simdshort_q15_t *)x;
|
||||
simd_q15_t ytmp[8192],*tw32768_128p=(simd_q15_t *)tw32768,*y128=(simd_q15_t *)y,*y128p=(simd_q15_t *)y;
|
||||
simd_q15_t *ytmpp = &ytmp[0];
|
||||
int i;
|
||||
simd_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16(ONE_OVER_SQRT2_Q15);
|
||||
|
||||
xtmpp = xtmp;
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
transpose4_ooff(x64 ,xtmpp,8192);
|
||||
transpose4_ooff(x64+2,xtmpp+1,8192);
|
||||
transpose4_ooff(x64+4,xtmpp+2,8192);
|
||||
transpose4_ooff(x64+6,xtmpp+3,8192);
|
||||
transpose4_ooff(x64+8,xtmpp+4,8192);
|
||||
transpose4_ooff(x64+10,xtmpp+5,8192);
|
||||
transpose4_ooff(x64+12,xtmpp+6,8192);
|
||||
transpose4_ooff(x64+14,xtmpp+7,8192);
|
||||
transpose4_ooff(x64+16,xtmpp+8,8192);
|
||||
transpose4_ooff(x64+18,xtmpp+9,8192);
|
||||
transpose4_ooff(x64+20,xtmpp+10,8192);
|
||||
transpose4_ooff(x64+22,xtmpp+11,8192);
|
||||
transpose4_ooff(x64+24,xtmpp+12,8192);
|
||||
transpose4_ooff(x64+26,xtmpp+13,8192);
|
||||
transpose4_ooff(x64+28,xtmpp+14,8192);
|
||||
transpose4_ooff(x64+30,xtmpp+15,8192);
|
||||
transpose4_ooff(x64+32,xtmpp+16,8192);
|
||||
transpose4_ooff(x64+34,xtmpp+17,8192);
|
||||
transpose4_ooff(x64+36,xtmpp+18,8192);
|
||||
transpose4_ooff(x64+38,xtmpp+19,8192);
|
||||
transpose4_ooff(x64+40,xtmpp+20,8192);
|
||||
transpose4_ooff(x64+42,xtmpp+21,8192);
|
||||
transpose4_ooff(x64+44,xtmpp+22,8192);
|
||||
transpose4_ooff(x64+46,xtmpp+23,8192);
|
||||
transpose4_ooff(x64+48,xtmpp+24,8192);
|
||||
transpose4_ooff(x64+50,xtmpp+25,8192);
|
||||
transpose4_ooff(x64+52,xtmpp+26,8192);
|
||||
transpose4_ooff(x64+54,xtmpp+27,8192);
|
||||
transpose4_ooff(x64+56,xtmpp+28,8192);
|
||||
transpose4_ooff(x64+58,xtmpp+29,8192);
|
||||
transpose4_ooff(x64+60,xtmpp+30,8192);
|
||||
transpose4_ooff(x64+62,xtmpp+31,8192);
|
||||
x64+=64;
|
||||
xtmpp+=32;
|
||||
}
|
||||
|
||||
idft16384((int16_t*)(xtmp),(int16_t*)ytmp,1);
|
||||
idft16384((int16_t*)(xtmp+8192),(int16_t*)(ytmp+4096),1);
|
||||
|
||||
|
||||
for (i=0; i<4096; i++) {
|
||||
ibfly2(ytmpp,ytmpp+4096,
|
||||
y128p,y128p+4096,
|
||||
tw32768_128p);
|
||||
tw32768_128p++;
|
||||
y128p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
y128p = y128;
|
||||
|
||||
for (i=0; i<512; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT2_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
#else // __AVX2__
|
||||
void dft32768(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd256_q15_t xtmp[4096],*xtmpp,*x256 = (simd256_q15_t *)x;
|
||||
simd256_q15_t ytmp[4096],*tw32768_256p=(simd256_q15_t *)tw32768,*y256=(simd256_q15_t *)y,*y256p=(simd256_q15_t *)y;
|
||||
|
||||
simd256_q15_t *ytmpp = &ytmp[0];
|
||||
int i;
|
||||
simd256_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16_simd256(ONE_OVER_SQRT2_Q15);
|
||||
|
||||
xtmpp = xtmp;
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
transpose4_ooff_simd256(x256 ,xtmpp,2048);
|
||||
transpose4_ooff_simd256(x256+2,xtmpp+1,2048);
|
||||
transpose4_ooff_simd256(x256+4,xtmpp+2,2048);
|
||||
transpose4_ooff_simd256(x256+6,xtmpp+3,2048);
|
||||
transpose4_ooff_simd256(x256+8,xtmpp+4,2048);
|
||||
transpose4_ooff_simd256(x256+10,xtmpp+5,2048);
|
||||
transpose4_ooff_simd256(x256+12,xtmpp+6,2048);
|
||||
transpose4_ooff_simd256(x256+14,xtmpp+7,2048);
|
||||
transpose4_ooff_simd256(x256+16,xtmpp+8,2048);
|
||||
transpose4_ooff_simd256(x256+18,xtmpp+9,2048);
|
||||
transpose4_ooff_simd256(x256+20,xtmpp+10,2048);
|
||||
transpose4_ooff_simd256(x256+22,xtmpp+11,2048);
|
||||
transpose4_ooff_simd256(x256+24,xtmpp+12,2048);
|
||||
transpose4_ooff_simd256(x256+26,xtmpp+13,2048);
|
||||
transpose4_ooff_simd256(x256+28,xtmpp+14,2048);
|
||||
transpose4_ooff_simd256(x256+30,xtmpp+15,2048);
|
||||
transpose4_ooff_simd256(x256+32,xtmpp+16,2048);
|
||||
transpose4_ooff_simd256(x256+34,xtmpp+17,2048);
|
||||
transpose4_ooff_simd256(x256+36,xtmpp+18,2048);
|
||||
transpose4_ooff_simd256(x256+38,xtmpp+19,2048);
|
||||
transpose4_ooff_simd256(x256+40,xtmpp+20,2048);
|
||||
transpose4_ooff_simd256(x256+42,xtmpp+21,2048);
|
||||
transpose4_ooff_simd256(x256+44,xtmpp+22,2048);
|
||||
transpose4_ooff_simd256(x256+46,xtmpp+23,2048);
|
||||
transpose4_ooff_simd256(x256+48,xtmpp+24,2048);
|
||||
transpose4_ooff_simd256(x256+50,xtmpp+25,2048);
|
||||
transpose4_ooff_simd256(x256+52,xtmpp+26,2048);
|
||||
transpose4_ooff_simd256(x256+54,xtmpp+27,2048);
|
||||
transpose4_ooff_simd256(x256+56,xtmpp+28,2048);
|
||||
transpose4_ooff_simd256(x256+58,xtmpp+29,2048);
|
||||
transpose4_ooff_simd256(x256+60,xtmpp+30,2048);
|
||||
transpose4_ooff_simd256(x256+62,xtmpp+31,2048);
|
||||
x256+=64;
|
||||
xtmpp+=32;
|
||||
}
|
||||
|
||||
dft16384((int16_t*)(xtmp),(int16_t*)ytmp,1);
|
||||
dft16384((int16_t*)(xtmp+2048),(int16_t*)(ytmp+2048),1);
|
||||
|
||||
|
||||
for (i=0; i<2048; i++) {
|
||||
bfly2_256(ytmpp,ytmpp+2048,
|
||||
y256p,y256p+2048,
|
||||
tw32768_256p);
|
||||
tw32768_256p++;
|
||||
y256p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
y256p = y256;
|
||||
|
||||
for (i=0; i<64; i++) {
|
||||
y256p[0] = mulhi_int16_simd256(y256p[0],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[1] = mulhi_int16_simd256(y256p[1],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[2] = mulhi_int16_simd256(y256p[2],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[3] = mulhi_int16_simd256(y256p[3],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[4] = mulhi_int16_simd256(y256p[4],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[5] = mulhi_int16_simd256(y256p[5],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[6] = mulhi_int16_simd256(y256p[6],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[7] = mulhi_int16_simd256(y256p[7],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[8] = mulhi_int16_simd256(y256p[8],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[9] = mulhi_int16_simd256(y256p[9],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[10] = mulhi_int16_simd256(y256p[10],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[11] = mulhi_int16_simd256(y256p[11],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[12] = mulhi_int16_simd256(y256p[12],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[13] = mulhi_int16_simd256(y256p[13],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[14] = mulhi_int16_simd256(y256p[14],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[15] = mulhi_int16_simd256(y256p[15],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p+=16;
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
void idft32768(int16_t *x,int16_t *y,unsigned char scale)
|
||||
{
|
||||
|
||||
simd256_q15_t xtmp[4096],*xtmpp,*x256 = (simd256_q15_t *)x;
|
||||
simd256_q15_t ytmp[4096],*tw32768_256p=(simd256_q15_t *)tw32768,*y256=(simd256_q15_t *)y,*y256p=(simd256_q15_t *)y;
|
||||
simd256_q15_t *ytmpp = &ytmp[0];
|
||||
int i;
|
||||
simd256_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16_simd256(ONE_OVER_SQRT2_Q15);
|
||||
|
||||
xtmpp = xtmp;
|
||||
|
||||
for (i=0; i<64; i++) {
|
||||
transpose4_ooff_simd256(x256 ,xtmpp,2048);
|
||||
transpose4_ooff_simd256(x256+2,xtmpp+1,2048);
|
||||
transpose4_ooff_simd256(x256+4,xtmpp+2,2048);
|
||||
transpose4_ooff_simd256(x256+6,xtmpp+3,2048);
|
||||
transpose4_ooff_simd256(x256+8,xtmpp+4,2048);
|
||||
transpose4_ooff_simd256(x256+10,xtmpp+5,2048);
|
||||
transpose4_ooff_simd256(x256+12,xtmpp+6,2048);
|
||||
transpose4_ooff_simd256(x256+14,xtmpp+7,2048);
|
||||
transpose4_ooff_simd256(x256+16,xtmpp+8,2048);
|
||||
transpose4_ooff_simd256(x256+18,xtmpp+9,2048);
|
||||
transpose4_ooff_simd256(x256+20,xtmpp+10,2048);
|
||||
transpose4_ooff_simd256(x256+22,xtmpp+11,2048);
|
||||
transpose4_ooff_simd256(x256+24,xtmpp+12,2048);
|
||||
transpose4_ooff_simd256(x256+26,xtmpp+13,2048);
|
||||
transpose4_ooff_simd256(x256+28,xtmpp+14,2048);
|
||||
transpose4_ooff_simd256(x256+30,xtmpp+15,2048);
|
||||
transpose4_ooff_simd256(x256+32,xtmpp+16,2048);
|
||||
transpose4_ooff_simd256(x256+34,xtmpp+17,2048);
|
||||
transpose4_ooff_simd256(x256+36,xtmpp+18,2048);
|
||||
transpose4_ooff_simd256(x256+38,xtmpp+19,2048);
|
||||
transpose4_ooff_simd256(x256+40,xtmpp+20,2048);
|
||||
transpose4_ooff_simd256(x256+42,xtmpp+21,2048);
|
||||
transpose4_ooff_simd256(x256+44,xtmpp+22,2048);
|
||||
transpose4_ooff_simd256(x256+46,xtmpp+23,2048);
|
||||
transpose4_ooff_simd256(x256+48,xtmpp+24,2048);
|
||||
transpose4_ooff_simd256(x256+50,xtmpp+25,2048);
|
||||
transpose4_ooff_simd256(x256+52,xtmpp+26,2048);
|
||||
transpose4_ooff_simd256(x256+54,xtmpp+27,2048);
|
||||
transpose4_ooff_simd256(x256+56,xtmpp+28,2048);
|
||||
transpose4_ooff_simd256(x256+58,xtmpp+29,2048);
|
||||
transpose4_ooff_simd256(x256+60,xtmpp+30,2048);
|
||||
transpose4_ooff_simd256(x256+62,xtmpp+31,2048);
|
||||
x256+=64;
|
||||
xtmpp+=32;
|
||||
}
|
||||
|
||||
idft16384((int16_t*)(xtmp),(int16_t*)ytmp,1);
|
||||
idft16384((int16_t*)(xtmp+2048),(int16_t*)(ytmp+2048),1);
|
||||
|
||||
|
||||
for (i=0; i<2048; i++) {
|
||||
ibfly2_256(ytmpp,ytmpp+2048,
|
||||
y256p,y256p+2048,
|
||||
tw32768_256p);
|
||||
tw32768_256p++;
|
||||
y256p++;
|
||||
ytmpp++;
|
||||
}
|
||||
|
||||
if (scale>0) {
|
||||
y256p = y256;
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
y256p[0] = mulhi_int16_simd256(y256p[0],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[1] = mulhi_int16_simd256(y256p[1],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[2] = mulhi_int16_simd256(y256p[2],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[3] = mulhi_int16_simd256(y256p[3],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[4] = mulhi_int16_simd256(y256p[4],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[5] = mulhi_int16_simd256(y256p[5],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[6] = mulhi_int16_simd256(y256p[6],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[7] = mulhi_int16_simd256(y256p[7],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[8] = mulhi_int16_simd256(y256p[8],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[9] = mulhi_int16_simd256(y256p[9],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[10] = mulhi_int16_simd256(y256p[10],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[11] = mulhi_int16_simd256(y256p[11],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[12] = mulhi_int16_simd256(y256p[12],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[13] = mulhi_int16_simd256(y256p[13],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[14] = mulhi_int16_simd256(y256p[14],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p[15] = mulhi_int16_simd256(y256p[15],ONE_OVER_SQRT2_Q15_128);
|
||||
y256p+=16;
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int16_t twa1536[1024],twb1536[1024];
|
||||
|
||||
// 512 x 3
|
||||
@@ -6176,12 +6777,99 @@ int16_t twb49152[32768] __attribute__((aligned(32)));
|
||||
// 16384 x 3
|
||||
void dft49152(int16_t *input, int16_t *output,uint8_t scale) {
|
||||
|
||||
AssertFatal(1==0,"Need to do this ..\n");
|
||||
int i,i2,j;
|
||||
uint32_t tmp[3][16384] __attribute__((aligned(32)));
|
||||
uint32_t tmpo[3][16384] __attribute__((aligned(32)));
|
||||
simd_q15_t *y128p=(simd_q15_t*)output;
|
||||
simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15);
|
||||
|
||||
for (i=0,j=0; i<16384; i++) {
|
||||
tmp[0][i] = ((uint32_t *)input)[j++];
|
||||
tmp[1][i] = ((uint32_t *)input)[j++];
|
||||
tmp[2][i] = ((uint32_t *)input)[j++];
|
||||
}
|
||||
|
||||
dft16384((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1);
|
||||
dft16384((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
|
||||
dft16384((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
|
||||
|
||||
for (i=0,i2=0; i<32768; i+=8,i2+=4) {
|
||||
bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]),
|
||||
(simd_q15_t*)(output+i),(simd_q15_t*)(output+32768+i),(simd_q15_t*)(output+65536+i),
|
||||
(simd_q15_t*)(twa49152+i),(simd_q15_t*)(twb49152+i));
|
||||
}
|
||||
if (scale==1) {
|
||||
for (i=0; i<768; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
void idft49152(int16_t *input, int16_t *output,uint8_t scale) {
|
||||
|
||||
AssertFatal(1==0,"Need to do this ..\n");
|
||||
int i,i2,j;
|
||||
uint32_t tmp[3][16384] __attribute__((aligned(32)));
|
||||
uint32_t tmpo[3][16384] __attribute__((aligned(32)));
|
||||
simd_q15_t *y128p=(simd_q15_t*)output;
|
||||
simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15);
|
||||
|
||||
for (i=0,j=0; i<16384; i++) {
|
||||
tmp[0][i] = ((uint32_t *)input)[j++];
|
||||
tmp[1][i] = ((uint32_t *)input)[j++];
|
||||
tmp[2][i] = ((uint32_t *)input)[j++];
|
||||
}
|
||||
|
||||
idft16384((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1);
|
||||
idft16384((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
|
||||
idft16384((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
|
||||
|
||||
for (i=0,i2=0; i<32768; i+=8,i2+=4) {
|
||||
ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]),
|
||||
(simd_q15_t*)(output+i),(simd_q15_t*)(output+32768+i),(simd_q15_t*)(output+65536+i),
|
||||
(simd_q15_t*)(twa49152+i),(simd_q15_t*)(twb49152+i));
|
||||
}
|
||||
if (scale==1) {
|
||||
for (i=0; i<768; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
}
|
||||
|
||||
int16_t twa73728[49152] __attribute__((aligned(32)));
|
||||
@@ -6198,17 +6886,104 @@ void idft73728(int16_t *input, int16_t *output,uint8_t scale) {
|
||||
}
|
||||
|
||||
|
||||
int16_t twa98304[49152] __attribute__((aligned(32)));
|
||||
int16_t twb98304[49152] __attribute__((aligned(32)));
|
||||
int16_t twa98304[65536] __attribute__((aligned(32)));
|
||||
int16_t twb98304[65536] __attribute__((aligned(32)));
|
||||
// 32768 x 3
|
||||
void dft98304(int16_t *input, int16_t *output,uint8_t scale) {
|
||||
|
||||
AssertFatal(1==0,"Need to do this ..\n");
|
||||
int i,i2,j;
|
||||
uint32_t tmp[3][32768] __attribute__((aligned(32)));
|
||||
uint32_t tmpo[3][32768] __attribute__((aligned(32)));
|
||||
simd_q15_t *y128p=(simd_q15_t*)output;
|
||||
simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15);
|
||||
|
||||
for (i=0,j=0; i<32768; i++) {
|
||||
tmp[0][i] = ((uint32_t *)input)[j++];
|
||||
tmp[1][i] = ((uint32_t *)input)[j++];
|
||||
tmp[2][i] = ((uint32_t *)input)[j++];
|
||||
}
|
||||
|
||||
dft32768((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1);
|
||||
dft32768((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
|
||||
dft32768((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
|
||||
|
||||
for (i=0,i2=0; i<65536; i+=8,i2+=4) {
|
||||
bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]),
|
||||
(simd_q15_t*)(output+i),(simd_q15_t*)(output+65536+i),(simd_q15_t*)(output+131072+i),
|
||||
(simd_q15_t*)(twa98304+i),(simd_q15_t*)(twb98304+i));
|
||||
}
|
||||
if (scale==1) {
|
||||
for (i=0; i<1536; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
void idft98304(int16_t *input, int16_t *output,uint8_t scale) {
|
||||
|
||||
AssertFatal(1==0,"Need to do this ..\n");
|
||||
int i,i2,j;
|
||||
uint32_t tmp[3][32768] __attribute__((aligned(32)));
|
||||
uint32_t tmpo[3][32768] __attribute__((aligned(32)));
|
||||
simd_q15_t *y128p=(simd_q15_t*)output;
|
||||
simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15);
|
||||
|
||||
for (i=0,j=0; i<32768; i++) {
|
||||
tmp[0][i] = ((uint32_t *)input)[j++];
|
||||
tmp[1][i] = ((uint32_t *)input)[j++];
|
||||
tmp[2][i] = ((uint32_t *)input)[j++];
|
||||
}
|
||||
|
||||
idft32768((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1);
|
||||
idft32768((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
|
||||
idft32768((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
|
||||
|
||||
for (i=0,i2=0; i<65536; i+=8,i2+=4) {
|
||||
ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]),
|
||||
(simd_q15_t*)(output+i),(simd_q15_t*)(output+65536+i),(simd_q15_t*)(output+131072+i),
|
||||
(simd_q15_t*)(twa98304+i),(simd_q15_t*)(twb98304+i));
|
||||
}
|
||||
if (scale==1) {
|
||||
for (i=0; i<1536; i++) {
|
||||
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128);
|
||||
y128p+=16;
|
||||
}
|
||||
}
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -8823,6 +9598,8 @@ int dfts_autoinit(void)
|
||||
init_rad2(2048,tw2048);
|
||||
init_rad4(4096,tw4096);
|
||||
init_rad2(8192,tw8192);
|
||||
init_rad4(16384,tw16384);
|
||||
init_rad2(32768,tw32768);
|
||||
|
||||
init_rad3(1536,twa1536,twb1536);
|
||||
init_rad3(3072,twa3072,twb3072);
|
||||
@@ -8830,6 +9607,10 @@ int dfts_autoinit(void)
|
||||
init_rad3(12288,twa12288,twb12288);
|
||||
init_rad3(18432,twa18432,twb18432);
|
||||
init_rad3(24576,twa24576,twb24576);
|
||||
init_rad3(36864,twa36864,twb36864);
|
||||
init_rad3(49152,twa49152,twb49152);
|
||||
init_rad3(98304,twa98304,twb98304);
|
||||
|
||||
|
||||
init_rad2_rep(24,tw24);
|
||||
init_rad3_rep(36,twa36,twb36);
|
||||
@@ -8869,6 +9650,7 @@ int dfts_autoinit(void)
|
||||
|
||||
|
||||
|
||||
#ifndef MR_MAIN
|
||||
|
||||
void dft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
|
||||
AssertFatal((sizeidx>=0 && sizeidx<(int)DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx);
|
||||
@@ -8879,6 +9661,7 @@ void idft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
|
||||
AssertFatal((sizeidx>=0 && sizeidx<(int)IDFT_SIZE_IDXTABLESIZE),"Invalid idft size index %i\n",sizeidx);
|
||||
idft_ftab[sizeidx](sigF,sig,scale_flag);
|
||||
};
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -9049,9 +9832,9 @@ int main(int argc, char**argv)
|
||||
|
||||
time_stats_t ts;
|
||||
#ifdef __AVX2__
|
||||
simd256_q15_t x[4096],x2[4096],y[4096],tw0,tw1,tw2,tw3;
|
||||
simd256_q15_t x[16384],x2[16384],y[16384],tw0,tw1,tw2,tw3;
|
||||
#else
|
||||
simd_q15_t x[8192],y[8192],tw0,tw1,tw2,tw3;
|
||||
simd_q15_t x[32768],y[32768],tw0,tw1,tw2,tw3;
|
||||
#endif
|
||||
int i;
|
||||
simd_q15_t *x128=(simd_q15_t*)x,*y128=(simd_q15_t*)y;
|
||||
@@ -9613,10 +10396,34 @@ int main(int argc, char**argv)
|
||||
stop_meas(&ts);
|
||||
}
|
||||
|
||||
printf("\n\n1536-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
|
||||
printf("\n\n8192-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
|
||||
LOG_M("y8192.m","y8192",y,8192,1,1);
|
||||
LOG_M("x8192.m","x8192",x,8192,1,1);
|
||||
|
||||
memset((void*)x,0,16384*sizeof(int32_t));
|
||||
for (i=2;i<9602;i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
for (i=2*(16384-4800);i<32768;i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
reset_meas(&ts);
|
||||
for (i=0; i<10000; i++) {
|
||||
start_meas(&ts);
|
||||
dft16384((int16_t *)x,(int16_t *)y,1);
|
||||
stop_meas(&ts);
|
||||
}
|
||||
|
||||
printf("\n\n16384-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
|
||||
LOG_M("y16384.m","y16384",y,16384,1,1);
|
||||
LOG_M("x16384.m","x16384",x,16384,1,1);
|
||||
|
||||
memset((void*)x,0,1536*sizeof(int32_t));
|
||||
for (i=2;i<1202;i++) {
|
||||
if ((taus() & 1)==0)
|
||||
@@ -9765,6 +10572,56 @@ int main(int argc, char**argv)
|
||||
LOG_M("y24576.m","y24576",y,24576,1,1);
|
||||
LOG_M("x24576.m","x24576",x,24576,1,1);
|
||||
|
||||
|
||||
memset((void*)x,0,2*18432*sizeof(int32_t));
|
||||
for (i=2;i<(2*14402);i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
for (i=2*(36864-14400);i<(36864*2);i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
reset_meas(&ts);
|
||||
for (i=0; i<10000; i++) {
|
||||
start_meas(&ts);
|
||||
dft36864((int16_t *)x,(int16_t *)y,1);
|
||||
stop_meas(&ts);
|
||||
}
|
||||
|
||||
printf("\n\n36864-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
|
||||
LOG_M("y36864.m","y36864",y,36864,1,1);
|
||||
LOG_M("x36864.m","x36864",x,36864,1,1);
|
||||
|
||||
|
||||
memset((void*)x,0,49152*sizeof(int32_t));
|
||||
for (i=2;i<28402;i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
for (i=2*(49152-14400);i<98304;i++) {
|
||||
if ((taus() & 1)==0)
|
||||
((int16_t*)x)[i] = 364;
|
||||
else
|
||||
((int16_t*)x)[i] = -364;
|
||||
}
|
||||
reset_meas(&ts);
|
||||
for (i=0; i<10000; i++) {
|
||||
start_meas(&ts);
|
||||
idft49152((int16_t *)x,(int16_t *)y,1);
|
||||
stop_meas(&ts);
|
||||
}
|
||||
|
||||
printf("\n\n49152-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
|
||||
LOG_M("y49152.m","y49152",y,49152,1,1);
|
||||
LOG_M("x49152.m","x49152",x,49152,1,1);
|
||||
/*
|
||||
int dftsizes[33]={24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,768,864,900,960,972,1080,1152,1200};
|
||||
void (*dft)(int16_t *x,int16_t *y,uint8_t scale)[33] = {dft24,dft36,dft48,dft60,dft72,dft96,dft108,dft120,dft144,dft180,dft192,dft216,dft240,dft288,dft300,dft324,dft360,dft384,dft432,dft480,dft540,dft576,dft600,dft648,dft720,dft768,dft864,dft900,dft960,dft972,dft1080,dft1152,dft1200};
|
||||
for (int n=0;n<33;n++) {
|
||||
@@ -9797,7 +10654,7 @@ int main(int argc, char**argv)
|
||||
LOG_M(ystr,ystr2,y,dftsizes[n]*4,1,1);
|
||||
LOG_M(xstr,xstr2,x,dftsizes[n]*4,1,1);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -183,10 +183,6 @@ This function performs optimized fixed-point radix-2 FFT/IFFT.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef OAIDFTS_MAIN
|
||||
typedef void(*adftfunc_t)(int16_t *sigF,int16_t *sig,unsigned char scale_flag);
|
||||
typedef void(*aidftfunc_t)(int16_t *sigF,int16_t *sig,unsigned char scale_flag);
|
||||
|
||||
+13
-3
@@ -340,6 +340,15 @@ typedef struct {
|
||||
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
|
||||
} NR_gNB_ULSCH_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t active;
|
||||
/// Frame where current PUCCH pdu was sent
|
||||
uint32_t frame;
|
||||
/// Slot where current PUCCH pdu was sent
|
||||
uint32_t slot;
|
||||
/// ULSCH PDU
|
||||
nfapi_nr_pucch_pdu_t pucch_pdu;
|
||||
} NR_gNB_PUCCH_t;
|
||||
|
||||
typedef struct {
|
||||
/// \brief Pointers (dynamic) to the received data in the time domain.
|
||||
@@ -619,9 +628,9 @@ typedef struct {
|
||||
|
||||
#define MAX_NUM_NR_RX_RACH_PDUS 4
|
||||
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
|
||||
#define MAX_UL_PDUS_PER_SLOT 100
|
||||
#define MAX_NUM_NR_SRS_PDUS 100
|
||||
#define MAX_NUM_NR_UCI_PDUS 100
|
||||
#define MAX_UL_PDUS_PER_SLOT 8
|
||||
#define MAX_NUM_NR_SRS_PDUS 8
|
||||
#define MAX_NUM_NR_UCI_PDUS 8
|
||||
|
||||
/// Top-level PHY Data Structure for gNB
|
||||
typedef struct PHY_VARS_gNB_s {
|
||||
@@ -675,6 +684,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
NR_gNB_COMMON common_vars;
|
||||
NR_gNB_PRACH prach_vars;
|
||||
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
|
||||
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords]
|
||||
NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
|
||||
|
||||
@@ -757,11 +757,11 @@ typedef struct {
|
||||
#define MAX_NR_OF_SPATIAL_RELATION_INFOS (8)
|
||||
|
||||
typedef enum {
|
||||
pucch_format0_nr = 0,
|
||||
pucch_format1_nr = 1,
|
||||
pucch_format2_nr = 2,
|
||||
pucch_format3_nr = 3,
|
||||
pucch_format4_nr = 4,
|
||||
pucch_format0_nr = 1,
|
||||
pucch_format1_nr = 2,
|
||||
pucch_format2_nr = 3,
|
||||
pucch_format3_nr = 4,
|
||||
pucch_format4_nr = 5
|
||||
} pucch_format_nr_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -113,8 +113,6 @@ void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
|
||||
nr_fill_ul_dci(gNB,frame,slot);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
@@ -157,6 +155,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
|
||||
int pdcch_received=0;
|
||||
gNB->num_pdsch_rnti=0;
|
||||
for (int i=0; i<NUMBER_OF_NR_DLSCH_MAX; i++) {
|
||||
gNB->dlsch[i][0]->rnti=0;
|
||||
gNB->dlsch[i][0]->harq_mask=0;
|
||||
}
|
||||
gNB->pdcch_pdu = NULL;
|
||||
gNB->pbch_configured=0;
|
||||
|
||||
@@ -210,7 +212,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
// handle_nfapi_nr_pucch_pdu(gNB,frame,slot,UL_tti_req->pdus_list[i].pucch_pdu);
|
||||
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
//#define DEBUG_RXDATA
|
||||
|
||||
uint8_t SSB_Table[38]={0,2,4,6,8,10,12,14,254,254,16,18,20,22,24,26,28,30,254,254,32,34,36,38,40,42,44,46,254,254,48,50,52,54,56,58,60,62};
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
@@ -215,7 +217,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
|
||||
uint8_t ret, nodata_dmrs = 1;
|
||||
uint8_t ret;
|
||||
uint8_t l, number_dmrs_symbols = 0;
|
||||
uint32_t G;
|
||||
uint16_t start_symbol, number_symbols, nb_re_dmrs;
|
||||
@@ -226,11 +228,10 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
for (l = start_symbol; l < start_symbol + number_symbols; l++)
|
||||
number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;
|
||||
|
||||
if (nodata_dmrs)
|
||||
nb_re_dmrs = 12;
|
||||
if (pusch_pdu->dmrs_config_type==pusch_dmrs_type1)
|
||||
nb_re_dmrs = 6*pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
else
|
||||
nb_re_dmrs = ((pusch_pdu->dmrs_config_type == pusch_dmrs_type1)?6:4);
|
||||
|
||||
nb_re_dmrs = 4*pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
|
||||
G = nr_get_G(pusch_pdu->rb_size,
|
||||
number_symbols,
|
||||
@@ -265,6 +266,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
G);
|
||||
stop_meas(&gNB->ulsch_decoding_stats);
|
||||
|
||||
|
||||
if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations){
|
||||
LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id);
|
||||
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
|
||||
@@ -382,32 +384,83 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
|
||||
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
||||
|
||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||
if (pucch) {
|
||||
if ((pucch->active == 1) &&
|
||||
(pucch->frame == frame_rx) &&
|
||||
(pucch->slot == slot_rx) ) {
|
||||
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch[i].pucch_pdu;
|
||||
uint16_t num_ucis;
|
||||
|
||||
switch (pucch_pdu->format_type) {
|
||||
case 0:
|
||||
|
||||
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
|
||||
gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0];
|
||||
gNB->UL_INFO.uci_ind.sfn = frame_rx;
|
||||
gNB->UL_INFO.uci_ind.slot = slot_rx;
|
||||
gNB->uci_pdu_list[num_ucis].pdu_type = NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE;
|
||||
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t);
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
|
||||
|
||||
nr_decode_pucch0(gNB,
|
||||
slot_rx,
|
||||
uci_pdu_format0,
|
||||
pucch_pdu);
|
||||
|
||||
gNB->UL_INFO.uci_ind.num_ucis += 1;
|
||||
pucch->active = 0;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Only PUCCH format 0 is currently supported\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) {
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||
int harq_pid;
|
||||
int no_sig;
|
||||
NR_UL_gNB_HARQ_t *ulsch_harq;
|
||||
|
||||
if ((ulsch) &&
|
||||
(ulsch->rnti > 0)) {
|
||||
// for for an active HARQ process
|
||||
for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
||||
(ulsch_harq->frame == frame_rx) &&
|
||||
(ulsch_harq->slot == slot_rx) &&
|
||||
(ulsch_harq->handled == 0)){
|
||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
||||
(ulsch_harq->frame == frame_rx) &&
|
||||
(ulsch_harq->slot == slot_rx) &&
|
||||
(ulsch_harq->handled == 0)){
|
||||
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||
}
|
||||
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
|
||||
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
|
||||
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG_RXDATA
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
RU_t *ru = gNB->RU_list[0];
|
||||
int slot_offset = frame_parms->get_samples_slot_timestamp(slot_rx,frame_parms,0);
|
||||
slot_offset -= ru->N_TA_offset;
|
||||
char name[128];
|
||||
FILE *f;
|
||||
sprintf(name, "rxdata.%d.%d.raw", frame_rx,slot_rx);
|
||||
f = fopen(name, "w"); if (f == NULL) exit(1);
|
||||
fwrite(&ru->common.rxdata[0][slot_offset],2,frame_parms->get_samples_per_slot(slot_rx,frame_parms)*2, f);
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||
no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||
if (no_sig) return;
|
||||
}
|
||||
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
|
||||
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
|
||||
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "fapi_nr_ue_interface.h"
|
||||
#include "fapi_nr_ue_l1.h"
|
||||
#include "harq_nr.h"
|
||||
//#include "PHY/phy_vars_nr_ue.h"
|
||||
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "PHY/impl_defs_nr.h"
|
||||
@@ -54,12 +56,18 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
NR_UE_DLSCH_t *dlsch0 = NULL;
|
||||
NR_UE_PDCCH *pdcch_vars = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0];
|
||||
NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0];
|
||||
NR_DL_FRAME_PARMS frame_parms = PHY_vars_UE_g[module_id][cc_id]->frame_parms;
|
||||
//PRACH_RESOURCES_t *prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[0];
|
||||
|
||||
// PUCCH_ConfigCommon_nr_t *pucch_config_common = PHY_vars_UE_g[module_id][cc_id]->pucch_config_common_nr[0];
|
||||
// PUCCH_Config_t *pucch_config_dedicated = PHY_vars_UE_g[module_id][cc_id]->pucch_config_dedicated_nr[0];
|
||||
|
||||
if(scheduled_response->dl_config != NULL){
|
||||
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
||||
|
||||
LOG_D(PHY,"Received %d DL pdus\n",dl_config->number_pdus);
|
||||
pdcch_vars->nb_search_space = 0;
|
||||
|
||||
for (i = 0; i < dl_config->number_pdus; ++i){
|
||||
|
||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
|
||||
@@ -99,14 +107,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
dlsch0_harq->dlDmrsSymbPos = dlsch_config_pdu->dlDmrsSymbPos;
|
||||
dlsch0_harq->dmrsConfigType = dlsch_config_pdu->dmrsConfigType;
|
||||
dlsch0_harq->mcs = dlsch_config_pdu->mcs;
|
||||
dlsch0_harq->DCINdi = dlsch_config_pdu->ndi;
|
||||
dlsch0_harq->rvidx = dlsch_config_pdu->rv;
|
||||
dlsch0->g_pucch = dlsch_config_pdu->accumulated_delta_PUCCH;
|
||||
dlsch0_harq->harq_ack.pucch_resource_indicator = dlsch_config_pdu->pucch_resource_id;
|
||||
dlsch0_harq->harq_ack.slot_for_feedback_ack = dlsch_config_pdu->pdsch_to_harq_feedback_time_ind;
|
||||
dlsch0_harq->harq_ack.slot_for_feedback_ack = (slot+dlsch_config_pdu->pdsch_to_harq_feedback_time_ind)%frame_parms.slots_per_frame;
|
||||
dlsch0_harq->Nl=1;
|
||||
dlsch0_harq->mcs_table=0;
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type);
|
||||
dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai;
|
||||
LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs);
|
||||
}
|
||||
}
|
||||
@@ -215,6 +223,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
|
||||
|
||||
fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
//#include "PHY/extern.h"
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
|
||||
#include "SCHED_NR/extern.h"
|
||||
#include "SCHED_NR_UE/phy_sch_processing_time.h"
|
||||
//#include <sched.h>
|
||||
@@ -2226,6 +2227,8 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
||||
|
||||
memset(ue->common_vars.txdataF[0], 0, sizeof(int)*14*ue->frame_parms.ofdm_symbol_size);
|
||||
|
||||
LOG_I(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
@@ -2246,6 +2249,15 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
} // UE_mode==PUSCH
|
||||
*/
|
||||
|
||||
if (get_softmodem_params()->usim_test==0) {
|
||||
LOG_D(PHY, "Sending PUCCH\n");
|
||||
pucch_procedures_ue_nr(ue,
|
||||
gNB_id,
|
||||
proc,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
LOG_D(PHY, "Sending data \n");
|
||||
nr_ue_pusch_common_procedures(ue,
|
||||
harq_pid,
|
||||
slot_tx,
|
||||
@@ -2253,7 +2265,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
gNB_id,
|
||||
&ue->frame_parms);
|
||||
}
|
||||
|
||||
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
|
||||
|
||||
/* RACH */
|
||||
if (get_softmodem_params()->do_ra==1) {
|
||||
@@ -2762,9 +2774,9 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
nr_tti_rx,
|
||||
&dci_ind);
|
||||
|
||||
//#ifdef NR_PDCCH_SCHED_DEBUG
|
||||
#ifdef NR_PDCCH_SCHED_DEBUG
|
||||
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT);
|
||||
//LOG_D(PHY,"[UE %d][PUSCH] Frame %d nr_tti_rx %d PHICH RX\n",ue->Mod_id,frame_rx,nr_tti_rx);
|
||||
@@ -3085,7 +3097,17 @@ void nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB
|
||||
dlsch0->current_harq_pid);
|
||||
else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS)
|
||||
if (pdsch == RA_PDSCH) ue->pdsch_vars_ra[eNB_id]->llr_offset[m]=ue->pdsch_vars_ra[eNB_id]->llr_offset[m-1];
|
||||
else if (pdsch == PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1];
|
||||
else if (pdsch == PDSCH) nr_rx_pdsch(ue,
|
||||
pdsch,
|
||||
eNB_id,
|
||||
eNB_id_i,
|
||||
proc->frame_rx,
|
||||
nr_tti_rx, // nr_tti_rx,
|
||||
m,
|
||||
first_symbol_flag,
|
||||
dual_stream_UE,
|
||||
i_mod,
|
||||
dlsch0->current_harq_pid);
|
||||
else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n");
|
||||
}
|
||||
if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]);
|
||||
@@ -3262,16 +3284,15 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
int *dlsch_errors,
|
||||
runmode_t mode) {
|
||||
|
||||
int harq_pid;
|
||||
int harq_pid = dlsch0->current_harq_pid;
|
||||
int frame_rx = proc->frame_rx;
|
||||
int nr_tti_rx = proc->nr_tti_rx;
|
||||
int ret=0, ret1=0;
|
||||
NR_UE_PDSCH *pdsch_vars;
|
||||
uint8_t is_cw0_active = 0;
|
||||
uint8_t is_cw1_active = 0;
|
||||
//nfapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||
//uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value;
|
||||
uint8_t nb_re_dmrs = 12; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4;
|
||||
uint8_t dmrs_type = dlsch0->harq_processes[harq_pid]->dmrsConfigType;
|
||||
uint8_t nb_re_dmrs = (dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; // TODO: should changed my mac
|
||||
uint16_t length_dmrs = 1; //cfg->pdsch_config.dmrs_max_length.value;
|
||||
uint16_t nb_symb_sch = 9;
|
||||
nr_downlink_indication_t dl_indication;
|
||||
@@ -3294,7 +3315,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
if (dlsch0==NULL)
|
||||
AssertFatal(0,"dlsch0 should be defined at this level \n");
|
||||
|
||||
harq_pid = dlsch0->current_harq_pid;
|
||||
is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
|
||||
nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols;
|
||||
start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol;
|
||||
@@ -3354,13 +3374,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
|
||||
// start ldpc decode for CW 0
|
||||
dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb,
|
||||
nb_symb_sch,
|
||||
nb_re_dmrs,
|
||||
length_dmrs,
|
||||
dlsch0->harq_processes[harq_pid]->Qm,
|
||||
dlsch0->harq_processes[harq_pid]->Nl);
|
||||
// start ldpc decode for CW 0
|
||||
dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb,
|
||||
nb_symb_sch,
|
||||
nb_re_dmrs,
|
||||
length_dmrs,
|
||||
dlsch0->harq_processes[harq_pid]->Qm,
|
||||
dlsch0->harq_processes[harq_pid]->Nl);
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->dlsch_unscrambling_stats);
|
||||
#endif
|
||||
@@ -4012,6 +4032,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
int slot_pbch;
|
||||
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
|
||||
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||
|
||||
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
|
||||
uint8_t dci_cnt = 0;
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include <openair1/SCHED/sched_common.h>
|
||||
#include <openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h>
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
|
||||
#ifndef NO_RAT_NR
|
||||
|
||||
@@ -162,6 +161,8 @@ void nr_generate_pucch3_4(int32_t **txdataF,
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
static int bwp_id = 1;
|
||||
|
||||
bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq)
|
||||
{
|
||||
uint8_t sr_payload = 0;
|
||||
@@ -186,12 +187,18 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
int pucch_resource_id = MAX_NB_OF_PUCCH_RESOURCES;
|
||||
int pucch_resource_indicator = MAX_PUCCH_RESOURCE_INDICATOR;
|
||||
int n_HARQ_ACK;
|
||||
|
||||
uint16_t crnti=0x1234;
|
||||
int dmrs_scrambling_id=0,data_scrambling_id=0;
|
||||
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
NR_PUCCH_Resource_t *pucch_resource;
|
||||
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
|
||||
/* update current context */
|
||||
|
||||
int subframe_number = (proc->nr_tti_rx)/(ue->frame_parms.ttis_per_subframe);
|
||||
int subframe_number = (proc->nr_tti_rx)/(ue->frame_parms.slots_per_subframe);//ttis_per_subframe);
|
||||
nb_pucch_format_4_in_subframes[subframe_number] = 0; /* reset pucch format 4 counter at current rx position */
|
||||
|
||||
int dl_harq_pid = ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->current_harq_pid;
|
||||
@@ -214,11 +221,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
|
||||
/* sr_payload = 1 means that this is a positive SR, sr_payload = 0 means that it is a negative SR */
|
||||
sr_payload = nr_ue_get_SR(Mod_id,
|
||||
CC_id,
|
||||
frame_tx,
|
||||
gNB_id,
|
||||
0,//ue->pdcch_vars[ue->current_thread_id[proc->nr_tti_rx]][gNB_id]->crnti,
|
||||
nr_tti_tx); // nr_tti_rx used for meas gap
|
||||
CC_id,
|
||||
frame_tx,
|
||||
gNB_id,
|
||||
0,//ue->pdcch_vars[ue->current_thread_id[proc->nr_tti_rx]][gNB_id]->crnti,
|
||||
nr_tti_tx); // nr_tti_rx used for meas gap
|
||||
}
|
||||
else {
|
||||
sr_payload = 1;
|
||||
@@ -250,10 +257,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
}
|
||||
else {
|
||||
/* a resource set and a resource should be find according to payload size */
|
||||
pucch_resource_set = find_pucch_resource_set( ue, gNB_id, N_UCI);
|
||||
pucch_resource_set = find_pucch_resource_set( mac, gNB_id, N_UCI);
|
||||
if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) {
|
||||
pucch_resource_indicator = 0;
|
||||
pucch_resource_id = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set]->pucch_resource_id[pucch_resource_indicator]; /* get the first resource of the set */
|
||||
pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; /* get the first resource of the set */
|
||||
}
|
||||
else {
|
||||
LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
@@ -299,7 +306,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
|
||||
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack;
|
||||
|
||||
if (select_pucch_resource(ue, gNB_id, N_UCI, pucch_resource_indicator, &initial_pucch_id, &pucch_resource_set,
|
||||
if (select_pucch_resource(ue, mac, gNB_id, N_UCI, pucch_resource_indicator, &initial_pucch_id, &pucch_resource_set,
|
||||
&pucch_resource_id, harq_status) == TRUE) {
|
||||
/* use of initial pucch configuration provided by system information 1 */
|
||||
/***********************************************************************/
|
||||
@@ -340,33 +347,43 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
/**********************************************/
|
||||
else if ((pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) && (pucch_resource_id != MAX_NB_OF_PUCCH_RESOURCES)) {
|
||||
/* check that current configuration is supported */
|
||||
if ((ue->cell_group_config.physicalCellGroupConfig.harq_ACK_SpatialBundlingPUCCH != FALSE)
|
||||
|| (ue->cell_group_config.physicalCellGroupConfig.pdsch_HARQ_ACK_Codebook != dynamic)) {
|
||||
if ((mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL)
|
||||
|| (mac->scg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) {
|
||||
LOG_E(PHY,"PUCCH Unsupported cell group configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(FALSE);
|
||||
}
|
||||
else if (ue->PDSCH_ServingCellConfig.codeBlockGroupTransmission != NULL) {
|
||||
else if (mac->scg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
LOG_E(PHY,"PUCCH Unsupported code block group for serving cell config : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(FALSE);
|
||||
}
|
||||
format = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.format;
|
||||
nb_symbols_total = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.nrofSymbols;
|
||||
starting_symbol_index = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.startingSymbolIndex;
|
||||
starting_prb = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->startingPRB;
|
||||
pucch_resource = select_resource_by_id(pucch_resource_id, mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup);
|
||||
format = pucch_resource->format.present;
|
||||
nb_symbols_total = get_nb_symbols_pucch(pucch_resource, format);
|
||||
starting_symbol_index = get_starting_symb_idx(pucch_resource, format);
|
||||
starting_prb = pucch_resource->startingPRB;
|
||||
second_hop = starting_prb;
|
||||
time_domain_occ = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.timeDomainOCC; /* format 1 only */
|
||||
occ_length = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.occ_length; /* format 4 only */
|
||||
occ_Index = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.occ_Index; /* format 4 only */
|
||||
|
||||
if ((format == pucch_format0_nr) || (format == pucch_format1_nr)) {
|
||||
m_0 = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.initialCyclicShift;
|
||||
if (format==pucch_format1_nr)
|
||||
time_domain_occ = pucch_resource->format.choice.format1->timeDomainOCC;
|
||||
if (format==pucch_format4_nr) {
|
||||
occ_length = pucch_resource->format.choice.format4->occ_Length;
|
||||
occ_Index = pucch_resource->format.choice.format4->occ_Index;
|
||||
}
|
||||
else if ((format == pucch_format3_nr) || (format == pucch_format4_nr)) {
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1]->additionalDMRS == enable_feature) {
|
||||
|
||||
m_0 = get_ics_pucch(pucch_resource, format);
|
||||
AssertFatal(m_0 >= 0, "Invalid m_0\n");
|
||||
if (format == pucch_format3_nr) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->additionalDMRS[0] == 1) {
|
||||
index_additional_dmrs = I_PUCCH_ADDITIONAL_DMRS;
|
||||
}
|
||||
}
|
||||
else if (format == pucch_format4_nr) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->additionalDMRS[0] == 1) {
|
||||
index_additional_dmrs = I_PUCCH_ADDITIONAL_DMRS;
|
||||
}
|
||||
}
|
||||
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->intraSlotFrequencyHopping == feature_enabled) {
|
||||
if ((format == pucch_format3_nr) || (format == pucch_format4_nr)) {
|
||||
if (pucch_resource->intraSlotFrequencyHopping[0] == 1) {
|
||||
index_hopping = I_PUCCH_HOPING;
|
||||
}
|
||||
}
|
||||
@@ -385,6 +402,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
int O_CRC = 0;
|
||||
|
||||
nb_symbols = nb_symbols_total; /* by default, it can be reduced due to symbols reserved for dmrs */
|
||||
pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id];
|
||||
|
||||
switch(format) {
|
||||
case pucch_format0_nr:
|
||||
@@ -401,14 +419,14 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
}
|
||||
case pucch_format2_nr:
|
||||
{
|
||||
nb_of_prbs = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.nrofPRBs;
|
||||
nb_of_prbs = pucch_resource->format.choice.format2->nrofPRBs;
|
||||
N_sc_ctrl_RB = N_SC_RB - 4;
|
||||
break;
|
||||
}
|
||||
case pucch_format3_nr:
|
||||
{
|
||||
nb_of_prbs = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[pucch_resource_id]->format_parameters.nrofPRBs;
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1]->pi2PBSK == feature_enabled) {
|
||||
nb_of_prbs = pucch_resource->format.choice.format3->nrofPRBs;
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->pi2BPSK[0] == 1) {
|
||||
Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
|
||||
}
|
||||
N_sc_ctrl_RB = N_SC_RB;
|
||||
@@ -417,12 +435,12 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
}
|
||||
case pucch_format4_nr:
|
||||
{
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1]->pi2PBSK == feature_enabled) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->pi2BPSK[0] == 1) {
|
||||
Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
|
||||
}
|
||||
nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping];
|
||||
nb_of_prbs = 1;
|
||||
subframe_number = nr_tti_tx/(ue->frame_parms.ttis_per_subframe);
|
||||
subframe_number = nr_tti_tx/(ue->frame_parms.slots_per_subframe);//ttis_per_subframe);
|
||||
nb_pucch_format_4_in_subframes[subframe_number]++; /* increment number of transmit pucch 4 in current subframe */
|
||||
NR_TST_PHY_PRINTF("PUCCH Number of pucch format 4 in subframe %d is %d \n", subframe_number, nb_pucch_format_4_in_subframes[subframe_number]);
|
||||
N_sc_ctrl_RB = N_SC_RB/(nb_pucch_format_4_in_subframes[subframe_number]);
|
||||
@@ -434,10 +452,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
/* drop CSI report if simultaneous HARQ-ACK/SR and periodic/semi-periodic CSI cannot be transmitted at the same time */
|
||||
if (format != pucch_format0_nr) {
|
||||
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1] != NULL) {
|
||||
max_code_rate = code_rate_r_time_100[ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1]->maxCodeRate]; /* it is code rate * 10 */
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) {
|
||||
max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */
|
||||
|
||||
if ((O_ACK != 0) && (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format-1]->simultaneousHARQ_ACK_CSI == disable_feature)) {
|
||||
if ((O_ACK != 0) && (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) {
|
||||
N_UCI = N_UCI - O_CSI;
|
||||
O_CSI = cqi_status = ri_status = 0;
|
||||
csi_payload = 0; /* csi should be dropped in this case */
|
||||
@@ -563,7 +581,8 @@ 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,
|
||||
&ue->frame_parms,
|
||||
&ue->pucch_config_dedicated[gNB_id],
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping,
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0],
|
||||
tx_amp,
|
||||
nr_tti_tx,
|
||||
(uint8_t)m_0,
|
||||
@@ -679,8 +698,11 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
int U_DAI_c = 0;
|
||||
int N_m_c_rx = 0;
|
||||
int V_DAI_m_DL = 0;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
|
||||
if (ue->PDSCH_Config.maxNrofCodeWordsScheduledByDCI == nb_code_n2) {
|
||||
if (mac->DLbwp[0] == NULL) return 0;
|
||||
|
||||
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) {
|
||||
two_transport_blocks = TRUE;
|
||||
number_of_code_word = 2;
|
||||
}
|
||||
@@ -698,46 +720,49 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
|
||||
for (int dl_harq_pid = 0; dl_harq_pid < number_pid_dl; dl_harq_pid++) {
|
||||
|
||||
harq_status = &ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]->harq_ack;
|
||||
for (int thread_idx = 0; thread_idx < RX_NB_TH; thread_idx++) {
|
||||
|
||||
/* check if current tx slot should transmit downlink acknowlegment */
|
||||
if (harq_status->slot_for_feedback_ack == proc->nr_tti_tx) {
|
||||
harq_status = &ue->dlsch[thread_idx][gNB_id][code_word]->harq_processes[dl_harq_pid]->harq_ack;
|
||||
|
||||
if (harq_status->ack == DL_ACKNACK_NO_SET) {
|
||||
LOG_E(PHY,"PUCCH Downlink acknowledgment has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->vDAI_DL == DL_DAI_NO_SET) {
|
||||
LOG_E(PHY,"PUCCH Downlink DAI has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->vDAI_DL > NR_DL_MAX_DAI) {
|
||||
LOG_E(PHY,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->send_harq_status == 0) {
|
||||
LOG_E(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
/* check if current tx slot should transmit downlink acknowlegment */
|
||||
if (harq_status->slot_for_feedback_ack == proc->nr_tti_tx) {
|
||||
|
||||
dai_current = harq_status->vDAI_DL;
|
||||
|
||||
if (dai_current == 0) {
|
||||
LOG_E(PHY,"PUCCH Downlink dai is invalid : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(0);
|
||||
} else if (dai_current > dai_max) {
|
||||
dai_max = dai_current;
|
||||
if (harq_status->ack == DL_ACKNACK_NO_SET) {
|
||||
LOG_E(PHY,"PUCCH Downlink acknowledgment has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->vDAI_DL == DL_DAI_NO_SET) {
|
||||
LOG_E(PHY,"PUCCH Downlink DAI has not been set : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->vDAI_DL > NR_DL_MAX_DAI) {
|
||||
LOG_E(PHY,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
else if (harq_status->send_harq_status == 0) {
|
||||
LOG_E(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
|
||||
number_harq_feedback++;
|
||||
ack_data[code_word][dai_current - 1] = harq_status->ack;
|
||||
dai[code_word][dai_current - 1] = dai_current;
|
||||
dai_current = harq_status->vDAI_DL+1; // DCI DAI to counter DAI conversion
|
||||
|
||||
if (dai_current == 0) {
|
||||
LOG_E(PHY,"PUCCH Downlink dai is invalid : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(0);
|
||||
} else if (dai_current > dai_max) {
|
||||
dai_max = dai_current;
|
||||
}
|
||||
|
||||
number_harq_feedback++;
|
||||
ack_data[code_word][dai_current - 1] = harq_status->ack;
|
||||
dai[code_word][dai_current - 1] = dai_current;
|
||||
}
|
||||
if (do_reset == TRUE) {
|
||||
init_downlink_harq_status(ue->dlsch[thread_idx][gNB_id][code_word]->harq_processes[dl_harq_pid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,8 +781,8 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
U_DAI_c = number_harq_feedback/number_of_code_word;
|
||||
N_m_c_rx = number_harq_feedback;
|
||||
int N_SPS_c = 0; /* FFS TODO_NR multicells and SPS are not supported at the moment */
|
||||
if (ue->cell_group_config.physicalCellGroupConfig.harq_ACK_SpatialBundlingPUCCH == FALSE) {
|
||||
int N_TB_max_DL = ue->PDSCH_Config.maxNrofCodeWordsScheduledByDCI;
|
||||
if (mac->scg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH == NULL) {
|
||||
int N_TB_max_DL = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0];
|
||||
*n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c;
|
||||
NR_TST_PHY_PRINTF("PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", *n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx);
|
||||
}
|
||||
@@ -853,7 +878,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size, int pucch_resource_indicator,
|
||||
boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size, int pucch_resource_indicator,
|
||||
int *initial_pucch_id, int *resource_set_id, int *resource_id, NR_UE_HARQ_STATUS_t *harq_status)
|
||||
{
|
||||
boolean_t resource_set_found = FALSE;
|
||||
@@ -861,18 +886,19 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
int current_resource_id = MAX_NB_OF_PUCCH_RESOURCES;
|
||||
pucch_format_nr_t format_pucch;
|
||||
int ready_pucch_resource_id = FALSE; /* in the case that it is already given */
|
||||
NR_PUCCH_Resource_t *pucch_resource;
|
||||
|
||||
/* ini values to unset */
|
||||
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
||||
//*resource_set_id = MAX_NB_OF_PUCCH_RESOURCE_SETS;
|
||||
//*resource_id = MAX_NB_OF_PUCCH_RESOURCES;
|
||||
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[0] == NULL) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) {
|
||||
|
||||
/* No resource set has been already configured so pucch_configCommon from Sib1 should be used in this case */
|
||||
|
||||
if (ue->UE_mode[gNB_id] != PUSCH) {
|
||||
*initial_pucch_id = ue->pucch_config_common_nr[gNB_id].pucch_ResourceCommon;
|
||||
*initial_pucch_id = mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon[0];
|
||||
if (*initial_pucch_id >= NB_INITIAL_PUCCH_RESOURCE) {
|
||||
LOG_E(PHY,"PUCCH Invalid initial resource index : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
||||
@@ -897,7 +923,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
}
|
||||
nb_symbols_for_tx = initial_pucch_resource[*initial_pucch_id].nrofSymbols;
|
||||
format_pucch = initial_pucch_resource[*initial_pucch_id].format;
|
||||
if (check_pucch_format(ue, gNB_id, format_pucch, nb_symbols_for_tx, uci_size) == TRUE) {
|
||||
if (check_pucch_format(mac, gNB_id, format_pucch, nb_symbols_for_tx, uci_size) == TRUE) {
|
||||
return (TRUE);
|
||||
}
|
||||
else {
|
||||
@@ -917,7 +943,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
-- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2)
|
||||
*/
|
||||
/* look for the first resource set which supports uci_size number of bits for payload */
|
||||
pucch_resource_set_id = find_pucch_resource_set( ue, gNB_id, uci_size);
|
||||
pucch_resource_set_id = find_pucch_resource_set(mac, gNB_id, uci_size);
|
||||
if (pucch_resource_set_id != MAX_NB_OF_PUCCH_RESOURCE_SETS) {
|
||||
resource_set_found = TRUE;
|
||||
}
|
||||
@@ -932,13 +958,13 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
if (resource_set_found == TRUE) {
|
||||
if (pucch_resource_indicator < MAX_PUCCH_RESOURCE_INDICATOR) {
|
||||
/* check if resource indexing by pucch_resource_indicator of this set is compatible */
|
||||
if ((ready_pucch_resource_id == TRUE) || (ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set_id]->pucch_resource_id[pucch_resource_indicator] != MAX_NB_OF_PUCCH_RESOURCES)) {
|
||||
if ((ready_pucch_resource_id == TRUE) || (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0] != MAX_NB_OF_PUCCH_RESOURCES)) {
|
||||
|
||||
if (ready_pucch_resource_id == TRUE) {
|
||||
current_resource_id = *resource_id;
|
||||
}
|
||||
else {
|
||||
int R_PUCCH = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set_id]->first_resources_set_R_PUCCH;
|
||||
int R_PUCCH = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.count;
|
||||
/* is it the first resource and its size exceeds 8 */
|
||||
if ((pucch_resource_set_id == 0)
|
||||
&& (R_PUCCH > MAX_NB_OF_PUCCH_RESOURCES_PER_SET_NOT_0)) {
|
||||
@@ -960,15 +986,22 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
current_resource_id = r_PUCCH;
|
||||
}
|
||||
else {
|
||||
current_resource_id = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set_id]->pucch_resource_id[pucch_resource_indicator];
|
||||
current_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0];
|
||||
}
|
||||
}
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[current_resource_id] != NULL) {
|
||||
|
||||
nb_symbols_for_tx = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[current_resource_id]->format_parameters.nrofSymbols;
|
||||
format_pucch = ue->pucch_config_dedicated_nr[gNB_id].PUCCH_Resource[current_resource_id]->format_parameters.format;
|
||||
/*uint8_t pucch_resource_count = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.count;
|
||||
for (uint8_t i=0; i<pucch_resource_count; i++) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.array[i]->pucch_ResourceId == current_resource_id)
|
||||
pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList.list.array[i];
|
||||
}*/
|
||||
|
||||
if (check_pucch_format(ue, gNB_id, format_pucch, nb_symbols_for_tx, uci_size) == TRUE) {
|
||||
pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[current_resource_id];
|
||||
if (pucch_resource != NULL) {
|
||||
format_pucch = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[current_resource_id]->format.present;
|
||||
nb_symbols_for_tx = get_nb_symbols_pucch(pucch_resource, format_pucch);
|
||||
|
||||
if (check_pucch_format(mac, gNB_id, format_pucch, nb_symbols_for_tx, uci_size) == TRUE) {
|
||||
*resource_set_id = pucch_resource_set_id;
|
||||
*resource_id = current_resource_id;
|
||||
return (TRUE);
|
||||
@@ -1014,9 +1047,10 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
int find_pucch_resource_set(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size)
|
||||
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
|
||||
{
|
||||
int pucch_resource_set_id = 0;
|
||||
long *pucch_max_pl_bits = NULL;
|
||||
|
||||
/* from TS 38.331 field maxPayloadMinus1
|
||||
-- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE
|
||||
@@ -1027,8 +1061,9 @@ int find_pucch_resource_set(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size)
|
||||
*/
|
||||
/* look for the first resource set which supports uci_size number of bits for payload */
|
||||
while (pucch_resource_set_id < MAX_NB_OF_PUCCH_RESOURCE_SETS) {
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set_id] != NULL) {
|
||||
if (uci_size <= ue->pucch_config_dedicated_nr[gNB_id].PUCCH_ResourceSet[pucch_resource_set_id]->maxPayloadMinus1 + 1) {
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) {
|
||||
pucch_max_pl_bits = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->maxPayloadMinus1;
|
||||
if (uci_size <= (((pucch_max_pl_bits != NULL) ? *pucch_max_pl_bits : 1706) + 1)) {
|
||||
NR_TST_PHY_PRINTF("PUCCH found resource set %d \n", pucch_resource_set_id);
|
||||
return (pucch_resource_set_id);
|
||||
break;
|
||||
@@ -1057,18 +1092,40 @@ int find_pucch_resource_set(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size)
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
boolean_t check_pucch_format(PHY_VARS_NR_UE *ue, uint8_t gNB_id, pucch_format_nr_t format_pucch, int nb_symbols_for_tx, int uci_size)
|
||||
boolean_t check_pucch_format(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, pucch_format_nr_t format_pucch, int nb_symbols_for_tx, int uci_size)
|
||||
{
|
||||
pucch_format_nr_t selected_pucch_format;
|
||||
pucch_format_nr_t selected_pucch_format_second;
|
||||
NR_SetupRelease_PUCCH_FormatConfig_t *identified_format = NULL;
|
||||
|
||||
if (format_pucch != pucch_format0_nr) {
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format_pucch-1] != NULL) {
|
||||
if (ue->pucch_config_dedicated_nr[gNB_id].formatConfig[format_pucch-1]->nrofSlots != 1) {
|
||||
LOG_E(PHY,"PUCCH not implemented multislots transmission : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
switch (format_pucch) {
|
||||
case pucch_format1_nr:
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL)
|
||||
identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1;
|
||||
break;
|
||||
|
||||
case pucch_format2_nr:
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2 != NULL)
|
||||
identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format2;
|
||||
break;
|
||||
|
||||
case pucch_format3_nr:
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3 != NULL)
|
||||
identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3;
|
||||
break;
|
||||
|
||||
case pucch_format4_nr:
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4 != NULL)
|
||||
identified_format = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((identified_format != NULL) && (identified_format->choice.setup->nrofSlots[0] != 1)) {
|
||||
LOG_E(PHY,"PUCCH not implemented multislots transmission : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (nb_symbols_for_tx <= 2) {
|
||||
@@ -1160,7 +1217,7 @@ int trigger_periodic_scheduling_request(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_n
|
||||
return (1); /* period is slot */
|
||||
}
|
||||
|
||||
int16_t N_slot_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME * ue->frame_parms.ttis_per_subframe;
|
||||
int16_t N_slot_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME * ue->frame_parms.slots_per_subframe;//ttis_per_subframe;
|
||||
if (((proc->frame_tx * N_slot_frame) + proc->nr_tti_tx - SR_offset)%SR_periodicity == 0) {
|
||||
return (1);
|
||||
}
|
||||
@@ -1219,4 +1276,74 @@ void set_csi_nr(int csi_status, uint32_t csi_payload)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t get_nb_symbols_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type)
|
||||
{
|
||||
switch (format_type) {
|
||||
case pucch_format0_nr:
|
||||
return pucch_resource->format.choice.format0->nrofSymbols;
|
||||
|
||||
case pucch_format1_nr:
|
||||
return pucch_resource->format.choice.format1->nrofSymbols;
|
||||
|
||||
case pucch_format2_nr:
|
||||
return pucch_resource->format.choice.format2->nrofSymbols;
|
||||
|
||||
case pucch_format3_nr:
|
||||
return pucch_resource->format.choice.format3->nrofSymbols;
|
||||
|
||||
case pucch_format4_nr:
|
||||
return pucch_resource->format.choice.format4->nrofSymbols;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t get_starting_symb_idx(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type)
|
||||
{
|
||||
switch (format_type) {
|
||||
case pucch_format0_nr:
|
||||
return pucch_resource->format.choice.format0->startingSymbolIndex;
|
||||
|
||||
case pucch_format1_nr:
|
||||
return pucch_resource->format.choice.format1->startingSymbolIndex;
|
||||
|
||||
case pucch_format2_nr:
|
||||
return pucch_resource->format.choice.format2->startingSymbolIndex;
|
||||
|
||||
case pucch_format3_nr:
|
||||
return pucch_resource->format.choice.format3->startingSymbolIndex;
|
||||
|
||||
case pucch_format4_nr:
|
||||
return pucch_resource->format.choice.format4->startingSymbolIndex;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_ics_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type)
|
||||
{
|
||||
switch (format_type) {
|
||||
case pucch_format0_nr:
|
||||
return pucch_resource->format.choice.format0->initialCyclicShift;
|
||||
|
||||
case pucch_format1_nr:
|
||||
return pucch_resource->format.choice.format1->initialCyclicShift;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
NR_PUCCH_Resource_t *select_resource_by_id(int resource_id, NR_PUCCH_Config_t *pucch_config)
|
||||
{
|
||||
int n_list = pucch_config->resourceToAddModList->list.count;
|
||||
NR_PUCCH_Resource_t *pucchres;
|
||||
AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n");
|
||||
|
||||
for (int i=0; i<n_list; i++) {
|
||||
pucchres = pucch_config->resourceToAddModList->list.array[i];
|
||||
if (pucchres->pucch_ResourceId == resource_id)
|
||||
return pucchres;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
/************** INCLUDE *******************************************/
|
||||
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
|
||||
#ifdef DEFINE_VARIABLES_PUCCH_UE_NR_H
|
||||
#define EXTERN
|
||||
@@ -187,7 +190,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
@param resource_id pucch resource id if any
|
||||
@returns TRUE a pucch resource has been found FALSE no valid pucch resource */
|
||||
|
||||
boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size, int pucch_resource_indicator,
|
||||
boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size, int pucch_resource_indicator,
|
||||
int *initial_pucch_id, int *resource_set_id, int *resource_id, NR_UE_HARQ_STATUS_t *harq_status);
|
||||
|
||||
/** \brief This function select a pucch resource set
|
||||
@@ -196,7 +199,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size
|
||||
@param uci size number of uci bits
|
||||
@returns number of the pucch resource set */
|
||||
|
||||
int find_pucch_resource_set(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size);
|
||||
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size);
|
||||
|
||||
/** \brief This function check pucch format
|
||||
@param ue context
|
||||
@@ -206,7 +209,7 @@ int find_pucch_resource_set(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int uci_size);
|
||||
@param uci size number of uci bits
|
||||
@returns TRUE pucch format matched uci size and constraints, FALSE invalid pucch format */
|
||||
|
||||
boolean_t check_pucch_format(PHY_VARS_NR_UE *ue, uint8_t gNB_id, pucch_format_nr_t format_pucch, int nb_symbols_for_tx,
|
||||
boolean_t check_pucch_format(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, pucch_format_nr_t format_pucch, int nb_symbols_for_tx,
|
||||
int uci_size);
|
||||
|
||||
/** \brief This function selects a pucch resource
|
||||
@@ -232,4 +235,11 @@ int get_csi_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32_t *csi_payload);
|
||||
|
||||
void set_csi_nr(int csi_status, uint32_t csi_payload);
|
||||
|
||||
uint8_t get_nb_symbols_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type);
|
||||
|
||||
uint16_t get_starting_symb_idx(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type);
|
||||
|
||||
int get_ics_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_type);
|
||||
|
||||
NR_PUCCH_Resource_t *select_resource_by_id(int resource_id, NR_PUCCH_Config_t *pucch_config);
|
||||
#endif /* PUCCH_UCI_UE_NR_H */
|
||||
|
||||
@@ -66,6 +66,8 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
||||
uint16_t n_rnti = 0x1234;
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -428,7 +430,7 @@ int main(int argc, char **argv)
|
||||
uint8_t is_crnti = 0, llr8_flag = 0;
|
||||
unsigned int TBS = 8424;
|
||||
unsigned int available_bits;
|
||||
uint8_t nb_re_dmrs = 12; // No data in dmrs symbol
|
||||
uint8_t nb_re_dmrs = 6; // No data in dmrs symbol
|
||||
uint16_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
uint16_t rate;
|
||||
@@ -455,6 +457,7 @@ int main(int argc, char **argv)
|
||||
rel15->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
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);
|
||||
|
||||
+170
-118
@@ -137,6 +137,12 @@ int main(int argc, char **argv)
|
||||
int i,aa;//,l;
|
||||
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
|
||||
uint8_t snr1set=0;
|
||||
float roundStats[50];
|
||||
float effRate;
|
||||
//float psnr;
|
||||
float eff_tp_check = 0.7;
|
||||
uint8_t snrRun;
|
||||
uint32_t TBS;
|
||||
int **txdata;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
//double iqim = 0.0;
|
||||
@@ -152,6 +158,8 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
|
||||
//int n_errors2, n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint8_t round;
|
||||
uint8_t num_rounds = 4;
|
||||
|
||||
channel_desc_t *gNB2UE;
|
||||
//uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||
@@ -203,7 +211,7 @@ int main(int argc, char **argv)
|
||||
|
||||
FILE *scg_fd=NULL;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:w")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
scg_fd = fopen(optarg,"r");
|
||||
@@ -382,6 +390,14 @@ int main(int argc, char **argv)
|
||||
mu = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
eff_tp_check = (float)atoi(optarg)/100;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
output_fd = fopen("txdata.dat", "w+");
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
@@ -411,7 +427,9 @@ int main(int argc, char **argv)
|
||||
printf("-c Start symbol for PDSCH (fixed for now)\n");
|
||||
printf("-j Number of symbols for PDSCH (fixed for now)\n");
|
||||
printf("-e MSC index\n");
|
||||
printf("-t Acceptable effective throughput (in percentage)\n");
|
||||
printf("-P Print DLSCH performances\n");
|
||||
printf("-w Write txdata to binary file (one frame)\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
@@ -656,7 +674,7 @@ int main(int argc, char **argv)
|
||||
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
||||
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
|
||||
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,secondaryCellGroup->spCellConfig);
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,secondaryCellGroup);
|
||||
|
||||
|
||||
nr_dcireq_t dcireq;
|
||||
@@ -677,6 +695,9 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[0]->UE_list;
|
||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||
snrRun = 0;
|
||||
|
||||
for (SNR = snr0; SNR < snr1; SNR += .2) {
|
||||
|
||||
@@ -694,6 +715,7 @@ int main(int argc, char **argv)
|
||||
reset_meas(&gNB->toutput);
|
||||
|
||||
n_errors = 0;
|
||||
effRate = 0;
|
||||
//n_errors2 = 0;
|
||||
//n_alamouti = 0;
|
||||
errors_scrambling=0;
|
||||
@@ -704,94 +726,6 @@ int main(int argc, char **argv)
|
||||
//multipath channel
|
||||
//multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
|
||||
|
||||
memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
|
||||
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
|
||||
if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config);
|
||||
else nr_schedule_css_dlsch_phytest(0,frame,slot);
|
||||
|
||||
|
||||
Sched_INFO.module_id = 0;
|
||||
Sched_INFO.CC_id = 0;
|
||||
Sched_INFO.frame = frame;
|
||||
Sched_INFO.slot = slot;
|
||||
Sched_INFO.DL_req = &gNB_mac->DL_req[0];
|
||||
Sched_INFO.UL_tti_req = &gNB_mac->UL_tti_req[0];
|
||||
Sched_INFO.UL_dci_req = NULL;
|
||||
Sched_INFO.TX_req = &gNB_mac->TX_req[0];
|
||||
nr_schedule_response(&Sched_INFO);
|
||||
|
||||
if (run_initial_sync)
|
||||
nr_common_signal_procedures(gNB,frame,slot);
|
||||
else
|
||||
phy_procedures_gNB_TX(gNB,frame,slot,0);
|
||||
|
||||
int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
|
||||
}
|
||||
int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
if (n_trials==1) printf("samples_per_slot_wCP = %d\n", frame_parms->samples_per_slot_wCP);
|
||||
|
||||
//TODO: loop over slots
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
&txdata[aa][tx_offset],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
&txdata[aa][tx_offset],
|
||||
14,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", txdata[0],frame_length_complex_samples,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsig1.m","txs1", txdata[1],frame_length_complex_samples,1,1);
|
||||
}
|
||||
if (output_fd)
|
||||
fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd);
|
||||
|
||||
int txlev = signal_energy(&txdata[0][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
|
||||
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
|
||||
|
||||
for (i=(frame_parms->get_samples_slot_timestamp(slot,frame_parms,0));
|
||||
i<(frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0));
|
||||
i++) {
|
||||
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||
}
|
||||
}
|
||||
|
||||
NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t rel15 = gNB_dlsch->harq_processes[0]->pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
//AWGN
|
||||
sigma2_dB = 10 * log10((double)txlev * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15.rbSize))) - SNR;
|
||||
sigma2 = pow(10, sigma2_dB/10);
|
||||
if (n_trials==1) printf("sigma2 %f (%f dB), txlev %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15.rbSize));
|
||||
|
||||
for (i=frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
i<frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0);
|
||||
i++) {
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
UE->rx_offset=0;
|
||||
UE_proc.frame_rx = frame;
|
||||
UE_proc.nr_tti_rx= slot;
|
||||
@@ -799,43 +733,147 @@ int main(int argc, char **argv)
|
||||
|
||||
dcireq.frame = frame;
|
||||
dcireq.slot = slot;
|
||||
|
||||
NR_UE_DLSCH_t *dlsch0 = UE->dlsch[UE->current_thread_id[UE_proc.nr_tti_rx]][0][0];
|
||||
|
||||
int harq_pid = slot;
|
||||
NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid];
|
||||
|
||||
NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_processes[slot]->pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
UE_harq_process->harq_ack.ack = 0;
|
||||
round = 0;
|
||||
UE_harq_process->round = round;
|
||||
UE_harq_process->first_tx = 1;
|
||||
|
||||
while ((round<num_rounds) && (UE_harq_process->harq_ack.ack==0)) {
|
||||
memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
|
||||
memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int));
|
||||
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
|
||||
|
||||
UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].ndi = !(trial&1);
|
||||
|
||||
UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
|
||||
UE_list->UE_sched_ctrl[0].current_harq_pid = harq_pid;
|
||||
gNB->dlsch[0][0]->harq_processes[harq_pid]->round = round;
|
||||
|
||||
phy_procedures_nrUE_RX(UE,
|
||||
&UE_proc,
|
||||
0,
|
||||
do_pdcch_flag,
|
||||
normal_txrx);
|
||||
|
||||
if (UE->dlsch[UE->current_thread_id[slot]][0][0]->last_iteration_cnt >=
|
||||
UE->dlsch[UE->current_thread_id[slot]][0][0]->max_ldpc_iterations+1)
|
||||
n_errors++;
|
||||
if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config);
|
||||
else nr_schedule_css_dlsch_phytest(0,frame,slot);
|
||||
Sched_INFO.module_id = 0;
|
||||
Sched_INFO.CC_id = 0;
|
||||
Sched_INFO.frame = frame;
|
||||
Sched_INFO.slot = slot;
|
||||
Sched_INFO.DL_req = &gNB_mac->DL_req[0];
|
||||
Sched_INFO.UL_tti_req = &gNB_mac->UL_tti_req[0];
|
||||
Sched_INFO.UL_dci_req = NULL;
|
||||
Sched_INFO.TX_req = &gNB_mac->TX_req[0];
|
||||
nr_schedule_response(&Sched_INFO);
|
||||
|
||||
if (run_initial_sync)
|
||||
nr_common_signal_procedures(gNB,frame,slot);
|
||||
else
|
||||
phy_procedures_gNB_TX(gNB,frame,slot,0);
|
||||
|
||||
int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
|
||||
}
|
||||
int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
if (n_trials==1) printf("samples_per_slot_wCP = %d\n", frame_parms->samples_per_slot_wCP);
|
||||
|
||||
//TODO: loop over slots
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
&txdata[aa][tx_offset],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
&txdata[aa][tx_offset],
|
||||
14,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", txdata[0],frame_length_complex_samples,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsig1.m","txs1", txdata[1],frame_length_complex_samples,1,1);
|
||||
}
|
||||
if (output_fd) {
|
||||
printf("writing txdata to binary file\n");
|
||||
fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd);
|
||||
}
|
||||
|
||||
int txlev = signal_energy(&txdata[0][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
|
||||
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
|
||||
|
||||
for (i=(frame_parms->get_samples_slot_timestamp(slot,frame_parms,0));
|
||||
i<(frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0));
|
||||
i++) {
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||
}
|
||||
}
|
||||
|
||||
//AWGN
|
||||
sigma2_dB = 10 * log10((double)txlev * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR;
|
||||
sigma2 = pow(10, sigma2_dB/10);
|
||||
if (n_trials==1) printf("sigma2 %f (%f dB), txlev %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize));
|
||||
|
||||
for (i=frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
i<frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0);
|
||||
i++) {
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
|
||||
phy_procedures_nrUE_RX(UE,
|
||||
&UE_proc,
|
||||
0,
|
||||
do_pdcch_flag,
|
||||
normal_txrx);
|
||||
|
||||
//printf("dlsim round %d ends\n",round);
|
||||
round++;
|
||||
} // round
|
||||
|
||||
//----------------------------------------------------------
|
||||
//---------------------- count errors ----------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
NR_UE_DLSCH_t *dlsch0 = UE->dlsch[UE->current_thread_id[UE_proc.nr_tti_rx]][0][0];
|
||||
|
||||
int harq_pid = dlsch0->current_harq_pid;
|
||||
NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid];
|
||||
|
||||
if (UE->dlsch[UE->current_thread_id[slot]][0][0]->last_iteration_cnt >=
|
||||
UE->dlsch[UE->current_thread_id[slot]][0][0]->max_ldpc_iterations+1)
|
||||
n_errors++;
|
||||
|
||||
NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE->current_thread_id[UE_proc.nr_tti_rx]];
|
||||
int16_t *UE_llr = pdsch_vars[0]->llr[0];
|
||||
|
||||
|
||||
uint32_t TBS = rel15.TBSize[0];
|
||||
TBS = UE_harq_process->TBS;//rel15->TBSize[0];
|
||||
uint16_t length_dmrs = 1;
|
||||
uint16_t nb_rb = rel15.rbSize;
|
||||
uint8_t nb_re_dmrs = rel15.dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4;
|
||||
uint8_t mod_order = rel15.qamModOrder[0];
|
||||
uint8_t nb_symb_sch = rel15.NrOfSymbols;
|
||||
uint16_t nb_rb = rel15->rbSize;
|
||||
uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4;
|
||||
uint8_t mod_order = rel15->qamModOrder[0];
|
||||
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
||||
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15.nrOfLayers);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers);
|
||||
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
|
||||
@@ -875,15 +913,18 @@ int main(int argc, char **argv)
|
||||
if (n_trials == 1)
|
||||
printf("errors_bit = %u (trial %d)\n", errors_bit, trial);
|
||||
}
|
||||
|
||||
roundStats[snrRun]+=((float)round);
|
||||
if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round;
|
||||
} // noise trials
|
||||
|
||||
roundStats[snrRun]/=((float)n_trials);
|
||||
effRate /= n_trials;
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f, (false positive %f)\n", SNR,
|
||||
(float) n_errors / (float) n_trials);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d, Channel BER %e\n", SNR, n_errors, n_trials,(double)errors_scrambling/available_bits/n_trials);
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS);
|
||||
printf("\n");
|
||||
|
||||
if (n_trials == 1) {
|
||||
@@ -896,7 +937,8 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((float)n_errors/(float)n_trials <= target_error_rate) {
|
||||
//if ((float)n_errors/(float)n_trials <= target_error_rate) {
|
||||
if (effRate >= (eff_tp_check*TBS)) {
|
||||
printf("PDSCH test OK\n");
|
||||
break;
|
||||
}
|
||||
@@ -951,8 +993,18 @@ int main(int argc, char **argv)
|
||||
printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC");
|
||||
*/
|
||||
}
|
||||
snrRun++;
|
||||
} // NSR
|
||||
|
||||
/*if (n_trials>1) {
|
||||
printf("HARQ stats:\nSNR\tRounds\n");
|
||||
psnr = snr0;
|
||||
for (uint8_t i=0; i<snrRun; i++) {
|
||||
printf("%.1f\t%.2f\n",psnr,roundStats[i]);
|
||||
psnr+=0.2;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
|
||||
@@ -62,6 +62,8 @@ uint16_t NB_UE_INST = 1;
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
int N_RB_DL,
|
||||
int N_RB_UL,
|
||||
|
||||
@@ -83,20 +83,25 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, cons
|
||||
int main(int argc, char **argv){
|
||||
|
||||
char c;
|
||||
|
||||
double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0;
|
||||
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw;
|
||||
int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
||||
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
||||
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format = 0;
|
||||
uint8_t frame = 1, subframe = 19, config_index = 98, prach_sequence_length = 1, num_root_sequences = 16, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
||||
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
||||
uint8_t frame = 1, subframe = 9, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, num_root_sequences = 16, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
||||
uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1;
|
||||
uint32_t tx_lev = 10000, prach_errors = 0, samp_count; //,tx_lev_dB;
|
||||
uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000;
|
||||
|
||||
// int8_t interf1=-19,interf2=-19;
|
||||
// uint8_t abstraction_flag=0,calibration_flag=0;
|
||||
// double prach_sinr;
|
||||
// uint32_t nsymb;
|
||||
// uint16_t preamble_max, preamble_energy_max;
|
||||
FILE *input_fd=NULL;
|
||||
char* input_file=NULL;
|
||||
int n_bytes=0;
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
NR_PRACH_RESOURCES_t prach_resources;
|
||||
@@ -115,7 +120,7 @@ int main(int argc, char **argv){
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
@@ -124,6 +129,14 @@ int main(int argc, char **argv){
|
||||
//ntrials=1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
config_index = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
msg1_frequencystart = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
@@ -287,6 +300,14 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
input_file = optarg;
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -316,6 +337,13 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (config_index<67) { prach_sequence_length=0; slot = subframe*2; slot_gNB = 1+(subframe*2); }
|
||||
uint16_t N_ZC;
|
||||
N_ZC = prach_sequence_length == 0 ? 839 : 139;
|
||||
|
||||
printf("Config_index %d, prach_sequence_length %d\n",config_index,prach_sequence_length);
|
||||
|
||||
// Configure log
|
||||
logInit();
|
||||
set_glog(loglvl);
|
||||
@@ -376,11 +404,11 @@ int main(int argc, char **argv){
|
||||
gNB->gNB_config.prach_config.num_prach_fd_occasions.value = num_prach_fd_occasions;
|
||||
gNB->gNB_config.prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(num_prach_fd_occasions*sizeof(nfapi_nr_num_prach_fd_occasions_t));
|
||||
|
||||
gNB->proc.slot_rx = subframe;
|
||||
gNB->proc.slot_rx = slot;
|
||||
|
||||
get_nr_prach_info_from_index(config_index,
|
||||
int ret = get_nr_prach_info_from_index(config_index,
|
||||
(int)frame,
|
||||
(int)subframe,
|
||||
(int)slot_gNB,
|
||||
absoluteFrequencyPointA,
|
||||
mu,
|
||||
frame_parms->frame_type,
|
||||
@@ -389,20 +417,21 @@ int main(int argc, char **argv){
|
||||
&N_t_slot,
|
||||
&N_dur);
|
||||
|
||||
if (ret == 0) {printf("No prach in %d.%d, mu %d, config_index %d\n",frame,slot,mu,config_index); exit(-1);}
|
||||
format0 = format&0xff; // first column of format from table
|
||||
format1 = (format>>8)&0xff; // second column of format from table
|
||||
|
||||
if (format1 != 0xff) {
|
||||
switch(format0) {
|
||||
case 0xa1:
|
||||
prach_format = 9;
|
||||
break;
|
||||
case 0xa2:
|
||||
prach_format = 10;
|
||||
break;
|
||||
case 0xa3:
|
||||
prach_format = 11;
|
||||
break;
|
||||
case 0xa1:
|
||||
prach_format = 9;
|
||||
break;
|
||||
case 0xa2:
|
||||
prach_format = 10;
|
||||
break;
|
||||
case 0xa3:
|
||||
prach_format = 11;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
|
||||
}
|
||||
@@ -452,12 +481,14 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
|
||||
printf("PRACH format %d\n",prach_format);
|
||||
|
||||
prach_config->num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index.value = rootSequenceIndex;
|
||||
prach_config->num_prach_fd_occasions_list[fd_occasion].k1.value = msg1_frequencystart;
|
||||
prach_config->restricted_set_config.value = restrictedSetConfig;
|
||||
prach_config->prach_sequence_length.value = prach_sequence_length;
|
||||
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = num_root_sequences;
|
||||
prach_pdu->num_cs = get_NCS(NCS_config, format0, restrictedSetConfig);
|
||||
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = 1+(64/(N_ZC/prach_pdu->num_cs));
|
||||
prach_pdu->prach_format = prach_format;
|
||||
|
||||
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
|
||||
@@ -496,7 +527,7 @@ int main(int argc, char **argv){
|
||||
ue_prach_config->prach_sub_c_spacing = mu;
|
||||
ue_prach_config->prach_sequence_length = prach_sequence_length;
|
||||
ue_prach_config->restricted_set_config = restrictedSetConfig;
|
||||
ue_prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences = num_root_sequences;
|
||||
ue_prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences = prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value ;
|
||||
ue_prach_config->num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index = rootSequenceIndex;
|
||||
ue_prach_config->num_prach_fd_occasions_list[fd_occasion].k1 = msg1_frequencystart;
|
||||
|
||||
@@ -566,28 +597,23 @@ int main(int argc, char **argv){
|
||||
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
proc.frame_tx = frame;
|
||||
proc.nr_tti_tx = subframe;
|
||||
proc.nr_tti_tx = slot;
|
||||
nr_ue_prach_procedures(UE,&proc,0,0);
|
||||
|
||||
/* tx_lev_dB not used later, no need to set */
|
||||
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
if (mu == 0)
|
||||
samp_count = frame_parms->samples_per_subframe;
|
||||
else
|
||||
samp_count = (subframe%(frame_parms->slots_per_subframe/2)) ? frame_parms->samples_per_slotN0 : frame_parms->samples_per_slot0;
|
||||
|
||||
prach_start = subframe*samp_count - UE->N_TA_offset;
|
||||
prach_start = subframe*frame_parms->samples_per_subframe-UE->N_TA_offset;
|
||||
|
||||
#ifdef NR_PRACH_DEBUG
|
||||
LOG_M("txsig0.m", "txs0", &txdata[0][prach_start], samp_count, 1, 1);
|
||||
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
LOG_M("txsig0.m", "txs0", &txdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("txsig0_frame.m","txs0", txdata[0],frame_parms->samples_per_frame,1,1);
|
||||
#endif
|
||||
|
||||
// multipath channel
|
||||
// dump_nr_prach_config(&gNB->frame_parms,subframe);
|
||||
|
||||
for (i = 0; i < samp_count<<1; i++) {
|
||||
for (i = 0; i < frame_parms->samples_per_subframe<<1; i++) {
|
||||
for (aa=0; aa<1; aa++) {
|
||||
if (awgn_flag == 0) {
|
||||
s_re[aa][i] = ((double)(((short *)&txdata[aa][prach_start]))[(i<<1)]);
|
||||
@@ -622,7 +648,10 @@ int main(int argc, char **argv){
|
||||
ue_speed1 = ue_speed0 + 50;
|
||||
}
|
||||
|
||||
rx_prach_start = subframe*frame_parms->get_samples_per_slot(subframe,frame_parms);
|
||||
rx_prach_start = subframe*frame_parms->samples_per_subframe;
|
||||
if (n_frames==1) printf("slot %d, rx_prach_start %d\n",slot,rx_prach_start);
|
||||
uint16_t preamble_rx, preamble_energy;
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.1) {
|
||||
for (ue_speed=ue_speed0; ue_speed<ue_speed1; ue_speed+=10) {
|
||||
@@ -634,9 +663,8 @@ int main(int argc, char **argv){
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
uint16_t preamble_rx, preamble_energy, N_ZC;
|
||||
|
||||
sigma2_dB = 10*log10((double)tx_lev) - SNR;
|
||||
if (input_fd==NULL) {
|
||||
sigma2_dB = 10*log10((double)tx_lev) - SNR - 10*log10(N_RB_UL*12/N_ZC);
|
||||
|
||||
if (n_frames==1)
|
||||
printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f\n",sigma2_dB,SNR,10*log10((double)tx_lev));
|
||||
@@ -655,20 +683,29 @@ int main(int argc, char **argv){
|
||||
10*log10(tx_lev));
|
||||
}
|
||||
|
||||
for (i = 0; i< frame_parms->get_samples_per_slot(subframe,frame_parms); i++) {
|
||||
for (i = 0; i< frame_parms->samples_per_subframe; i++) {
|
||||
for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
|
||||
((short*) &gNB->common_vars.rxdata[aa][rx_prach_start])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &gNB->common_vars.rxdata[aa][rx_prach_start])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &ru->common.rxdata[aa][rx_prach_start])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &ru->common.rxdata[aa][rx_prach_start])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
n_bytes = fread(&ru->common.rxdata[0][rx_prach_start],sizeof(int32_t),frame_parms->samples_per_subframe,input_fd);
|
||||
printf("fread %d bytes from file %s\n",n_bytes,input_file);
|
||||
if (n_bytes!=frame_parms->samples_per_subframe) {
|
||||
printf("expected %d bytes\n",frame_parms->samples_per_subframe);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, frame, subframe);
|
||||
|
||||
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, frame, slot);
|
||||
|
||||
gNB->prach_vars.rxsigF = ru->prach_rxsigF;
|
||||
|
||||
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, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
|
||||
|
||||
printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx);
|
||||
// printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx);
|
||||
|
||||
if (preamble_rx != preamble_tx)
|
||||
prach_errors++;
|
||||
@@ -680,24 +717,30 @@ int main(int argc, char **argv){
|
||||
if (n_frames==1) {
|
||||
printf("preamble %d (tx %d) : energy %d, delay %d\n",preamble_rx,preamble_tx,preamble_energy,preamble_delay);
|
||||
#ifdef NR_PRACH_DEBUG
|
||||
LOG_M("prach0.m","prach0", &txdata[0][prach_start], samp_count, 1, 1);
|
||||
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][rx_prach_start], frame_parms->samples_per_subframe, 1, 1);
|
||||
//LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][rx_prach_start], frame_parms->samples_per_subframe, 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("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("rxsigF0.m","rxsF0", gNB->prach_vars.rxsigF[0], N_ZC, 1, 1);
|
||||
LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1);
|
||||
LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
printf("SNR %f dB, UE Speed %f km/h: errors %d/%d (delay %f)\n", SNR, ue_speed, prach_errors, n_frames, delay_avg/(double)(n_frames-prach_errors));
|
||||
if (input_fd)
|
||||
break;
|
||||
if (prach_errors)
|
||||
break;
|
||||
|
||||
} // UE Speed loop
|
||||
if (!prach_errors) {
|
||||
printf("PRACH test OK\n");
|
||||
break;
|
||||
}
|
||||
if (input_fd)
|
||||
break;
|
||||
} //SNR loop
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
@@ -712,5 +755,7 @@ int main(int argc, char **argv){
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
if (input_fd) fclose(input_fd);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ uint16_t NB_UE_INST = 1;
|
||||
// needed for some functions
|
||||
PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -477,7 +479,7 @@ int main(int argc, char **argv)
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
bzero(txdataF[aa],frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
if(format==0){
|
||||
nr_generate_pucch0(UE,txdataF,frame_parms,UE->pucch_config_dedicated,amp,nr_tti_tx,m0,mcs,nrofSymbols,startingSymbolIndex,startingPRB);
|
||||
nr_generate_pucch0(UE,txdataF,frame_parms,PUCCH_GroupHopping,hopping_id,amp,nr_tti_tx,m0,mcs,nrofSymbols,startingSymbolIndex,startingPRB);
|
||||
}
|
||||
else if (format == 1){
|
||||
nr_generate_pucch1(UE,txdataF,frame_parms,UE->pucch_config_dedicated,actual_payload,amp,nr_tti_tx,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,0,nr_bit);
|
||||
|
||||
@@ -54,6 +54,8 @@ PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
double cpuf;
|
||||
uint8_t nfapi_mode = 0;
|
||||
uint16_t NB_UE_INST = 1;
|
||||
|
||||
+357
-239
@@ -56,6 +56,7 @@
|
||||
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||
|
||||
@@ -110,9 +111,9 @@ int main(int argc, char **argv)
|
||||
int i;
|
||||
double SNR, snr0 = -2.0, snr1 = 2.0;
|
||||
double sigma, sigma_dB;
|
||||
double snr_step = 1;
|
||||
double snr_step = .2;
|
||||
uint8_t snr1set = 0;
|
||||
int slot = 0, frame = 0;
|
||||
int slot = 8, frame = 0;
|
||||
FILE *output_fd = NULL;
|
||||
//uint8_t write_output_file = 0;
|
||||
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0, delay = 0;
|
||||
@@ -126,7 +127,6 @@ int main(int argc, char **argv)
|
||||
SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
|
||||
uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
|
||||
//unsigned char frame_type = 0;
|
||||
int frame_length_complex_samples,frame_length_complex_samples_no_prefix;
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
//uint64_t SSB_positions=0x01;
|
||||
@@ -145,12 +145,13 @@ int main(int argc, char **argv)
|
||||
float target_error_rate = 0.01;
|
||||
int print_perf = 0;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
int msg3_flag = 0;
|
||||
|
||||
UE_nr_rxtx_proc_t UE_proc;
|
||||
FILE *scg_fd=NULL;
|
||||
|
||||
|
||||
int ibwps=24;
|
||||
int ibwp_rboffset=41;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) {
|
||||
exit_fun("[NR_ULSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
@@ -158,208 +159,235 @@ int main(int argc, char **argv)
|
||||
//logInit();
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:PR:S:L:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:M:N:PR:S:L:")) != -1) {
|
||||
printf("handling optarg %c\n",c);
|
||||
switch (c) {
|
||||
|
||||
/*case 'd':
|
||||
frame_type = 1;
|
||||
break;*/
|
||||
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
case 'a':
|
||||
start_symbol = atoi(optarg);
|
||||
AssertFatal(start_symbol >= 0 && start_symbol < 13,"start_symbol %d is not in 0..12\n",start_symbol);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
scg_fd = fopen(optarg, "r");
|
||||
case 'b':
|
||||
nb_symb_sch = atoi(optarg);
|
||||
AssertFatal(nb_symb_sch > 0 && nb_symb_sch < 15,"start_symbol %d is not in 1..14\n",nb_symb_sch);
|
||||
break;
|
||||
case 'c':
|
||||
n_rnti = atoi(optarg);
|
||||
AssertFatal(n_rnti > 0 && n_rnti<=65535,"Illegal n_rnti %x\n",n_rnti);
|
||||
break;
|
||||
|
||||
if (scg_fd == NULL) {
|
||||
printf("Error opening %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch ((char) *optarg) {
|
||||
case 'A':
|
||||
channel_model = SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model = SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model = SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model = SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model = EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model = EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model = ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
msg3_flag = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
scg_fd = fopen(optarg, "r");
|
||||
|
||||
if (scg_fd == NULL) {
|
||||
printf("Error opening %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch ((char) *optarg) {
|
||||
case 'A':
|
||||
channel_model = SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model = SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model = SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model = SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model = EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model = EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model = ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*case 'i':
|
||||
interf1 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
|
||||
case 'j':
|
||||
interf2 = atoi(optarg);
|
||||
break;*/
|
||||
|
||||
case 'l':
|
||||
nb_symb_sch = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
Imcs = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_trials = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag = 1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
nb_rb = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n", snr0);
|
||||
break;
|
||||
case 'k':
|
||||
printf("Setting threequarter_fs_flag\n");
|
||||
openair0_cfg[0].threequarter_fs= 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
nb_symb_sch = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
Imcs = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_trials = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag = 1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
nb_rb = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n", snr0);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
/*case 'x':
|
||||
transmission_mode = atoi(optarg);
|
||||
break;*/
|
||||
|
||||
case 'y':
|
||||
n_tx = atoi(optarg);
|
||||
|
||||
if ((n_tx == 0) || (n_tx > 2)) {
|
||||
printf("Unsupported number of tx antennas %d\n", n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx = atoi(optarg);
|
||||
|
||||
if ((n_rx == 0) || (n_rx > 2)) {
|
||||
printf("Unsupported number of rx antennas %d\n", n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg, "r");
|
||||
|
||||
if (input_fd == NULL) {
|
||||
printf("Problem with filename %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
// SSB_positions = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
// Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
N_RB_UL = N_RB_DL;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set = 1;
|
||||
printf("Setting SNR1 to %f\n", snr1);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
print_perf=1;
|
||||
opp_enabled=1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
loglvl = atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]);
|
||||
//printf("-d Use TDD\n");
|
||||
printf("-d Introduce delay in terms of number of samples\n");
|
||||
printf("-f Number of frames to simulate\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-h This message\n");
|
||||
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
|
||||
printf("-m MCS value\n");
|
||||
printf("-n Number of trials to simulate\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
//printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-G raw file containing RRC configuration (generated by gNB)\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-P Print ULSCH performances\n");
|
||||
exit(-1);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx = atoi(optarg);
|
||||
|
||||
if ((n_tx == 0) || (n_tx > 2)) {
|
||||
printf("Unsupported number of tx antennas %d\n", n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx = atoi(optarg);
|
||||
|
||||
if ((n_rx == 0) || (n_rx > 2)) {
|
||||
printf("Unsupported number of rx antennas %d\n", n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg, "r");
|
||||
|
||||
if (input_fd == NULL) {
|
||||
printf("Problem with filename %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
//SSB_positions = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
//Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
N_RB_UL = N_RB_DL;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set = 1;
|
||||
printf("Setting SNR1 to %f\n", snr1);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
print_perf=1;
|
||||
opp_enabled=1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
loglvl = atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]);
|
||||
//printf("-d Use TDD\n");
|
||||
printf("-d Introduce delay in terms of number of samples\n");
|
||||
printf("-f Number of frames to simulate\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-h This message\n");
|
||||
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
|
||||
printf("-m MCS value\n");
|
||||
printf("-n Number of trials to simulate\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
//printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-G raw file containing RRC configuration (generated by gNB)\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-P Print ULSCH performances\n");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
logInit();
|
||||
set_glog(loglvl);
|
||||
T_stdout = 1;
|
||||
|
||||
get_softmodem_params()->phy_test = 1;
|
||||
get_softmodem_params()->do_ra = 0;
|
||||
get_softmodem_params()->usim_test = 1;
|
||||
|
||||
|
||||
if (snr1set == 0)
|
||||
snr1 = snr0 + 10;
|
||||
@@ -385,12 +413,15 @@ int main(int argc, char **argv)
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
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->N_RB_DL = N_RB_DL;
|
||||
frame_parms->N_RB_UL = N_RB_UL;
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
|
||||
|
||||
RC.nb_nr_macrlc_inst = 1;
|
||||
RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int));
|
||||
for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||
@@ -419,6 +450,7 @@ int main(int argc, char **argv)
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
|
||||
|
||||
AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface");
|
||||
|
||||
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
// common configuration
|
||||
rrc_mac_config_req_gNB(0,0,1,scc,0,0,NULL);
|
||||
@@ -427,12 +459,14 @@ int main(int argc, char **argv)
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
|
||||
|
||||
|
||||
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0];
|
||||
|
||||
//crcTableInit();
|
||||
|
||||
//nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_UL, mu, Nid_cell, SSB_positions);
|
||||
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe;
|
||||
frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
@@ -480,7 +514,7 @@ int main(int argc, char **argv)
|
||||
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
||||
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
|
||||
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,secondaryCellGroup->spCellConfig);
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib,secondaryCellGroup);
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
|
||||
@@ -512,7 +546,7 @@ int main(int argc, char **argv)
|
||||
unsigned int TBS;
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
unsigned int available_bits;
|
||||
uint8_t nb_re_dmrs, no_data_in_dmrs = 1;
|
||||
uint8_t nb_re_dmrs;
|
||||
unsigned char mod_order;
|
||||
uint16_t code_rate;
|
||||
uint8_t ptrs_mcs1 = 2;
|
||||
@@ -540,6 +574,7 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("\n");
|
||||
|
||||
for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0));
|
||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||
|
||||
varArray_t *table_rx=initVarArray(1000,sizeof(double));
|
||||
@@ -581,19 +616,40 @@ int main(int argc, char **argv)
|
||||
UL_tti_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
|
||||
memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t));
|
||||
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
int ibwp_size = ibwps;
|
||||
int ibwp_start = ibwp_rboffset;
|
||||
if (msg3_flag == 1) {
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
pusch_pdu->bwp_start = ibwp_start;
|
||||
pusch_pdu->bwp_size = ibwp_size;
|
||||
start_rb += (ibwp_start - abwp_start);
|
||||
printf("msg3: ibwp_size %d, abwp_size %d, ibwp_start %d, abwp_start %d\n",
|
||||
ibwp_size,abwp_size,ibwp_start,abwp_start);
|
||||
}
|
||||
else {
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
pusch_pdu->bwp_size = abwp_size;
|
||||
}
|
||||
|
||||
pusch_pdu->pdu_bit_map = pdu_bit_map;
|
||||
pusch_pdu->rnti = n_rnti;
|
||||
pusch_pdu->mcs_index = Imcs;
|
||||
pusch_pdu->mcs_table = mcs_table;
|
||||
pusch_pdu->target_code_rate = code_rate;
|
||||
pusch_pdu->qam_mod_order = mod_order;
|
||||
pusch_pdu->transform_precoding = 0;
|
||||
pusch_pdu->data_scrambling_id = 0;
|
||||
pusch_pdu->transform_precoding = 1;
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol;
|
||||
pusch_pdu->dmrs_config_type = 0;
|
||||
pusch_pdu->ul_dmrs_scrambling_id = 0;
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->scid = 0;
|
||||
pusch_pdu->dmrs_ports = 1;
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
pusch_pdu->resource_alloc = 1;
|
||||
pusch_pdu->rb_start = start_rb;
|
||||
pusch_pdu->rb_size = nb_rb;
|
||||
@@ -611,6 +667,8 @@ int main(int argc, char **argv)
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
|
||||
|
||||
// prepare ULSCH/PUSCH reception
|
||||
nr_schedule_response(Sched_INFO);
|
||||
|
||||
// --------- setting parameters for UE --------
|
||||
|
||||
@@ -635,6 +693,7 @@ int main(int argc, char **argv)
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = 0;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = 1;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.new_data_indicator = 0;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.rv_index = 0;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers;
|
||||
@@ -646,83 +705,135 @@ int main(int argc, char **argv)
|
||||
//there are plenty of other parameters that we don't seem to be using for now. e.g.
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0;
|
||||
|
||||
if(no_data_in_dmrs)
|
||||
nb_re_dmrs = 12;
|
||||
else
|
||||
nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4);
|
||||
nb_re_dmrs = ((ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type == pusch_dmrs_type1) ? 6 : 4);
|
||||
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, 1);
|
||||
TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers);
|
||||
|
||||
pusch_pdu->pusch_data.tb_size = TBS>>3;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.pusch_data.tb_size = TBS;
|
||||
|
||||
// prepare ULSCH/PUSCH reception
|
||||
nr_schedule_response(Sched_INFO);
|
||||
nr_fill_ulsch(gNB,frame,slot,pusch_pdu);
|
||||
int slot_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);// - (int)(800*factor);
|
||||
int slot_length = slot_offset - frame_parms->get_samples_slot_timestamp(slot-1,frame_parms,0);
|
||||
|
||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
for (int i=0;i<(TBS>>3);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff;
|
||||
double scale = 1;
|
||||
|
||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||
///////////
|
||||
if (input_fd == NULL) {
|
||||
|
||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, 0);
|
||||
if (SNR==snr0) {
|
||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
|
||||
|
||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||
///////////
|
||||
|
||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, 0);
|
||||
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1);
|
||||
LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
}
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
|
||||
txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
|
||||
txlev_float = (double)txlev/scale; // output of signal_energy is fixed point representation
|
||||
|
||||
|
||||
//AWGN
|
||||
}
|
||||
}
|
||||
else n_trials = 1;
|
||||
|
||||
if (n_trials==1)
|
||||
LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_length_complex_samples,1,1);
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
|
||||
txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
|
||||
txlev_float = (double)txlev; // output of signal_energy is fixed point representation
|
||||
sigma_dB = 10*log10(txlev_float)-SNR;
|
||||
sigma = pow(10,sigma_dB/10);
|
||||
printf("txlev_float %f, sigma_dB %f\n",10*log10(txlev_float),sigma_dB);
|
||||
|
||||
n_errors = 0;
|
||||
n_false_positive = 0;
|
||||
|
||||
//AWGN
|
||||
sigma_dB = 10*log10(txlev_float)-SNR;
|
||||
sigma = pow(10,sigma_dB/10);
|
||||
errors_scrambling = 0;
|
||||
errors_decoding = 0;
|
||||
|
||||
int error_flag;
|
||||
for (trial = 0; trial < n_trials; trial++) {
|
||||
|
||||
error_flag = 0;
|
||||
//----------------------------------------------------------
|
||||
//------------------------ add noise -----------------------
|
||||
//----------------------------------------------------------
|
||||
if (input_fd == NULL ) {
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((double)(((int16_t *)&UE->common_vars.txdata[ap][slot_offset])[(i<<1)])/sqrt(scale) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((double)(((int16_t *)&UE->common_vars.txdata[ap][slot_offset])[(i<<1)+1])/sqrt(scale) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
AssertFatal(frame_parms->nb_antennas_rx == 1, "nb_ant != 1\n");
|
||||
// 800 samples is N_TA_OFFSET for FR1 @ 30.72 Ms/s,
|
||||
AssertFatal(frame_parms->subcarrier_spacing==30000,"only 30 kHz for file input for now (%d)\n",frame_parms->subcarrier_spacing);
|
||||
double factor = 1;
|
||||
if (openair0_cfg[0].threequarter_fs== 1) factor =.75;
|
||||
int ta_offset=1600;
|
||||
if (N_RB_DL <217) ta_offset=800;
|
||||
else if (N_RB_DL < 106) ta_offset = 400;
|
||||
|
||||
errors_scrambling = 0;
|
||||
errors_decoding = 0;
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------------ add noise -----------------------
|
||||
//----------------------------------------------------------
|
||||
for (i=0; i<frame_length_complex_samples; i++) {
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
|
||||
((short*) gNB->common_vars.rxdata[ap])[(2*i) + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)); // convert to fixed point
|
||||
((short*) gNB->common_vars.rxdata[ap])[2*i+1 + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)+1]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- gNB phy procedures -------------------
|
||||
//----------------------------------------------------------
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
fread((void*)&gNB->common_vars.rxdata[0][slot_offset],
|
||||
sizeof(int16_t),
|
||||
slot_length<<1,
|
||||
input_fd);
|
||||
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
|
||||
slot_offset,
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
|
||||
fclose(input_fd);
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- gNB phy procedures -------------------
|
||||
//----------------------------------------------------------
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
|
||||
start_meas(&gNB->phy_proc_rx);
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
if (n_trials==1)
|
||||
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
if (n_trials==1) {
|
||||
LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][0],frame_parms->samples_per_subframe*10,1,1);
|
||||
|
||||
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0]+start_symbol*frame_parms->ofdm_symbol_size,nb_symb_sch*frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
}
|
||||
phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
if (n_trials == 1) {
|
||||
LOG_M("rxsigF0_ext.m","rxsF0_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[0][(start_symbol+1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size,1,1);
|
||||
LOG_M("chestF0.m","chF0",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestF0_ext.m","chF0_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol+1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size,1,1);
|
||||
LOG_M("rxsigF0_comp.m","rxsF0_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[0][(start_symbol+1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size,1,1);
|
||||
}
|
||||
start_meas(&gNB->phy_proc_rx);
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (gNB->ulsch[0][0]->last_iteration_cnt >=
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1)
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) {
|
||||
error_flag = 1;
|
||||
n_errors++;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------- count and print errors -----------------
|
||||
//----------------------------------------------------------
|
||||
@@ -754,22 +865,30 @@ int main(int argc, char **argv)
|
||||
errors_decoding++;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors_decoding > 0) {
|
||||
if (n_trials == 1) {
|
||||
for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++)
|
||||
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
|
||||
if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************");
|
||||
printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
|
||||
i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i],
|
||||
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
|
||||
ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);
|
||||
}
|
||||
}
|
||||
if (errors_decoding > 0 && error_flag == 0) {
|
||||
n_false_positive++;
|
||||
if (n_trials==1)
|
||||
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding);
|
||||
}
|
||||
|
||||
} // trial loop
|
||||
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%d\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, n_trials);
|
||||
printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%u\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, available_bits*n_trials);
|
||||
printf("\n");
|
||||
printf("SNR %f: Channel BLER %e, Channel BER %e\n", SNR,(double)n_errors/n_trials,(double)errors_scrambling/available_bits/n_trials);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
|
||||
|
||||
if (print_perf==1) {
|
||||
printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx");
|
||||
printStatIndent(&gNB->ulsch_channel_estimation_stats,"ULSCH channel estimation time");
|
||||
@@ -795,7 +914,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
} // SNR loop
|
||||
|
||||
printf("\n");
|
||||
|
||||
free(test_input_bit);
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
//#include "SIMULATION/TOOLS/sim.h"
|
||||
|
||||
|
||||
unsigned int s0, s1, s2, b;
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
|
||||
#define NUMBER_OF_NR_DLSCH_MAX 2//16
|
||||
#define NUMBER_OF_NR_ULSCH_MAX 2//16
|
||||
#define NUMBER_OF_NR_PUCCH_MAX 2
|
||||
#define NUMBER_OF_NR_SR_MAX 16
|
||||
|
||||
|
||||
|
||||
@@ -128,11 +128,11 @@
|
||||
#define GNB_CONFIG_STRING_RARESPONSEWINDOW "ra_ResponseWindow"
|
||||
#define GNB_CONFIG_STRING_SSBPERRACHOCCASIONANDCBPREAMBLESPERSSBPR "ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR"
|
||||
#define GNB_CONFIG_STRING_SSBPERRACHOCCASIONANDCBPREAMBLESPERSSB "ssb_perRACH_OccasionAndCB_PreamblesPerSSB"
|
||||
#define GNB_CONFIG_STRING_RACONTENTIONRESOLUTIONTIMER "ra_ContentionResolutionTimer"
|
||||
#define GNB_CONFIG_STRING_RSRPTHRESHOLDSSB "rsrp_ThresholdSSB"
|
||||
#define GNB_CONFIG_STRING_PRACHROOTSEQUENCEINDEXPR "prach_RootSequenceIndex_PR"
|
||||
#define GNB_CONFIG_STRING_PRACHROOTSEQUENCEINDEX "prach_RootSequenceIndex"
|
||||
#define GNB_CONFIG_STRING_MSG1SUBCARRIERSPACING "msg1_SubcarrierSpacing"
|
||||
#define GNB_CONFIG_STRING_RACONTENTIONRESOLUTIONTIMER "ra_ContentionResolutionTimer"
|
||||
#define GNB_CONFIG_STRING_RSRPTHRESHOLDSSB "rsrp_ThresholdSSB"
|
||||
#define GNB_CONFIG_STRING_PRACHROOTSEQUENCEINDEXPR "prach_RootSequenceIndex_PR"
|
||||
#define GNB_CONFIG_STRING_PRACHROOTSEQUENCEINDEX "prach_RootSequenceIndex"
|
||||
#define GNB_CONFIG_STRING_MSG1SUBCARRIERSPACING "msg1_SubcarrierSpacing"
|
||||
#define GNB_CONFIG_STRING_RESTRICTEDSETCONFIG "restrictedSetConfig"
|
||||
#define GNB_CONFIG_STRING_MSG3TRANSFPREC "msg3_transformPrecoder"
|
||||
#define GNB_CONFIG_STRING_PUSCHTIMEDOMAINALLOCATIONLIST "puschTimeDomainAllocationList"
|
||||
|
||||
@@ -131,6 +131,7 @@ void *gNB_app_task(void *args_p)
|
||||
uint32_t gnb_nb = RC.nb_nr_inst;
|
||||
uint32_t gnb_id_start = 0;
|
||||
uint32_t gnb_id_end = gnb_id_start + gnb_nb;
|
||||
|
||||
uint32_t gnb_id;
|
||||
MessageDef *msg_p = NULL;
|
||||
const char *msg_name = NULL;
|
||||
|
||||
@@ -230,6 +230,70 @@ typedef struct {
|
||||
uint8_t TCRNTI_2: 8; // octet 7 [7:0]
|
||||
} __attribute__ ((__packed__)) NR_MAC_RAR;
|
||||
|
||||
// DCI pdu structures. Used by both gNB and UE.
|
||||
typedef struct {
|
||||
uint16_t val;
|
||||
uint8_t nbits;
|
||||
} dci_field_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t format_indicator; //1 bit
|
||||
uint8_t ra_preamble_index; //6 bits
|
||||
uint8_t ss_pbch_index; //6 bits
|
||||
uint8_t prach_mask_index; //4 bits
|
||||
uint8_t mcs; //5 bits
|
||||
uint8_t ndi; //1 bit
|
||||
uint8_t rv; //2 bits
|
||||
uint8_t harq_pid; //4 bits
|
||||
uint8_t tpc; //2 bits
|
||||
uint8_t short_messages_indicator; //2 bits
|
||||
uint8_t short_messages; //8 bits
|
||||
uint8_t tb_scaling; //2 bits
|
||||
uint8_t pucch_resource_indicator; //3 bits
|
||||
uint8_t dmrs_sequence_initialization; //1 bit
|
||||
uint8_t system_info_indicator; //1 bit
|
||||
|
||||
uint8_t slot_format_indicator_count;
|
||||
uint8_t *slot_format_indicators;
|
||||
|
||||
uint8_t pre_emption_indication_count;
|
||||
uint16_t *pre_emption_indications; //14 bit each
|
||||
|
||||
uint8_t block_number_count;
|
||||
uint8_t *block_numbers;
|
||||
uint8_t padding;
|
||||
|
||||
dci_field_t mcs2; //variable
|
||||
dci_field_t ndi2; //variable
|
||||
dci_field_t rv2; //variable
|
||||
dci_field_t frequency_domain_assignment; //variable
|
||||
dci_field_t time_domain_assignment; //variable
|
||||
dci_field_t frequency_hopping_flag; //variable
|
||||
dci_field_t vrb_to_prb_mapping; //variable
|
||||
dci_field_t dai[2]; //variable
|
||||
dci_field_t pdsch_to_harq_feedback_timing_indicator; //variable
|
||||
dci_field_t carrier_indicator; //variable
|
||||
dci_field_t bwp_indicator; //variable
|
||||
dci_field_t prb_bundling_size_indicator; //variable
|
||||
dci_field_t rate_matching_indicator; //variable
|
||||
dci_field_t zp_csi_rs_trigger; //variable
|
||||
dci_field_t transmission_configuration_indication; //variable
|
||||
dci_field_t srs_request; //variable
|
||||
dci_field_t cbgti; //variable
|
||||
dci_field_t cbgfi; //variable
|
||||
dci_field_t srs_resource_indicator; //variable
|
||||
dci_field_t precoding_information; //variable
|
||||
dci_field_t csi_request; //variable
|
||||
dci_field_t ptrs_dmrs_association; //variable
|
||||
dci_field_t beta_offset_indicator; //variable
|
||||
dci_field_t cloded_loop_indicator; //variable
|
||||
dci_field_t ul_sul_indicator; //variable
|
||||
dci_field_t antenna_ports; //variable
|
||||
dci_field_t reserved; //1_0/C-RNTI:10 bits, 1_0/P-RNTI: 6 bits, 1_0/SI-&RA-RNTI: 16 bits
|
||||
|
||||
} dci_pdu_rel15_t;
|
||||
|
||||
// 38.321 ch6.2.1, 38.331
|
||||
#define DL_SCH_LCID_CCCH 0x00
|
||||
#define DL_SCH_LCID_DCCH 0x01
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160};
|
||||
|
||||
// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
|
||||
uint16_t NCS_unrestricted_delta_f_RA_125[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
|
||||
uint16_t NCS_restricted_TypeA_delta_f_RA_125[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case set Type A
|
||||
@@ -46,11 +48,13 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8
|
||||
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
|
||||
|
||||
const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"};
|
||||
|
||||
const uint16_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160};
|
||||
const char *prachfmt03[]={"0","1","2","3"};
|
||||
|
||||
uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) {
|
||||
|
||||
LOG_D(MAC,"get_NCS: indx %d,format0 %d, restriced_set_config %d\n",
|
||||
index,format0,restricted_set_config);
|
||||
|
||||
if (format0 < 3) {
|
||||
switch(restricted_set_config){
|
||||
case 0:
|
||||
@@ -975,7 +979,7 @@ int get_nr_prach_info_from_index(uint8_t index,
|
||||
if ( (frame%x)==y || (frame%x)==y2 ) {
|
||||
slot_60khz = slot >> (mu-2); // in table slots are numbered wrt 60kHz
|
||||
s_map = table_6_3_3_2_4_prachConfig_Index[index][5];
|
||||
if ( (s_map>>slot_60khz)&0x01 ) {
|
||||
if ( ((s_map>>slot_60khz)&0x01) ) {
|
||||
if (mu == 3) {
|
||||
if ( (table_6_3_3_2_4_prachConfig_Index[index][7] == 1) && (slot%2 == 0) )
|
||||
return 0; // no prach in even slots @ 120kHz for 1 prach per 60khz slot
|
||||
@@ -1015,7 +1019,7 @@ int get_nr_prach_info_from_index(uint8_t index,
|
||||
s_map = table_6_3_3_2_3_prachConfig_Index[index][4];
|
||||
if ( (s_map>>subframe)&0x01 ) {
|
||||
if (mu == 1) {
|
||||
if ( (table_6_3_3_2_3_prachConfig_Index[index][6] == 1) && (slot%2 == 0) )
|
||||
if ( (table_6_3_3_2_3_prachConfig_Index[index][6] <= 1) && (slot%2 == 0) )
|
||||
return 0; // no prach in even slots @ 30kHz for 1 prach per subframe
|
||||
}
|
||||
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){
|
||||
@@ -1025,9 +1029,9 @@ int get_nr_prach_info_from_index(uint8_t index,
|
||||
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1)
|
||||
format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1];
|
||||
*format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8);
|
||||
LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", frame,
|
||||
LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %ld) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", frame,
|
||||
slot,
|
||||
index,
|
||||
index, table_6_3_3_2_3_prachConfig_Index[index][6],
|
||||
pointa,
|
||||
mu,
|
||||
unpaired,
|
||||
@@ -1051,7 +1055,7 @@ int get_nr_prach_info_from_index(uint8_t index,
|
||||
s_map = table_6_3_3_2_2_prachConfig_Index[index][4];
|
||||
if ( (s_map>>subframe)&0x01 ) {
|
||||
if (mu == 1) {
|
||||
if ( (table_6_3_3_2_2_prachConfig_Index[index][6] == 1) && (slot%2 == 0) )
|
||||
if ( (table_6_3_3_2_2_prachConfig_Index[index][6] <= 1) && (slot%2 == 0) )
|
||||
return 0; // no prach in even slots @ 30kHz for 1 prach per subframe
|
||||
}
|
||||
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){
|
||||
@@ -1136,7 +1140,7 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
|
||||
uint8_t ncs_index = rach_config->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
uint16_t format0 = get_format0(config_index, unpaired);
|
||||
uint16_t NCS = get_NCS(ncs_index, format0, rach_config->restrictedSetConfig);
|
||||
uint16_t L_ra = (rach_config->prach_RootSequenceIndex.present) ? 139 : 839;
|
||||
uint16_t L_ra = (rach_config->prach_RootSequenceIndex.present==NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139) ? 139 : 839;
|
||||
uint16_t r,u,index,q,d_u,n_shift_ra,n_shift_ra_bar,d_start;
|
||||
uint32_t w;
|
||||
uint8_t found_preambles = 0;
|
||||
@@ -1532,7 +1536,7 @@ int32_t get_nr_uldl_offset(int nr_bandP)
|
||||
|
||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead,
|
||||
uint8_t nodata_dmrs,
|
||||
uint8_t numdmrscdmgroupnodata,
|
||||
uint8_t tb_scaling) {
|
||||
|
||||
LOG_D(MAC, "TBS calculation\n");
|
||||
@@ -1540,10 +1544,14 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_rel15 = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
uint16_t N_PRB_oh = x_overhead;
|
||||
uint8_t N_PRB_DMRS;
|
||||
if (nodata_dmrs)
|
||||
N_PRB_DMRS = 12;
|
||||
else
|
||||
N_PRB_DMRS = (pdsch_rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1)?6:4; //This only works for antenna port 1000
|
||||
if (pdsch_rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) {
|
||||
// if no data in dmrs cdm group is 1 only even REs have no data
|
||||
// if no data in dmrs cdm group is 2 both odd and even REs have no data
|
||||
N_PRB_DMRS = numdmrscdmgroupnodata*6;
|
||||
}
|
||||
else {
|
||||
N_PRB_DMRS = numdmrscdmgroupnodata*4;
|
||||
}
|
||||
uint8_t N_sh_symb = pdsch_rel15->NrOfSymbols;
|
||||
uint8_t Imcs = pdsch_rel15->mcsIndex[0];
|
||||
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
|
||||
@@ -1723,6 +1731,48 @@ int get_num_dmrs(uint16_t dmrs_mask ) {
|
||||
return(num_dmrs);
|
||||
}
|
||||
|
||||
// Table 5.1.2.2.1-1 38.214
|
||||
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
|
||||
|
||||
AssertFatal(bwp_size<276,"BWP Size > 275\n");
|
||||
|
||||
if (bwp_size < 37) return (rbg_size_config ? 4 : 2);
|
||||
if (bwp_size < 73) return (rbg_size_config ? 8 : 4);
|
||||
if (bwp_size < 145) return (rbg_size_config ? 16 : 8);
|
||||
else return 16;
|
||||
}
|
||||
|
||||
uint8_t getNRBG(uint16_t bwp_size, uint16_t bwp_start, long rbg_size_config) {
|
||||
|
||||
uint8_t rbg_size = getRBGSize(bwp_size,rbg_size_config);
|
||||
|
||||
return (uint8_t)ceil((bwp_size+(bwp_start % rbg_size))/rbg_size);
|
||||
}
|
||||
|
||||
uint8_t getAntPortBitWidth(NR_SetupRelease_DMRS_DownlinkConfig_t *typeA, NR_SetupRelease_DMRS_DownlinkConfig_t *typeB) {
|
||||
|
||||
uint8_t nbitsA = 0;
|
||||
uint8_t nbitsB = 0;
|
||||
uint8_t type,length,nbits;
|
||||
|
||||
if (typeA != NULL) {
|
||||
type = (typeA->choice.setup->dmrs_Type==NULL) ? 1:2;
|
||||
length = (typeA->choice.setup->maxLength==NULL) ? 1:2;
|
||||
nbitsA = type + length + 2;
|
||||
if (typeB == NULL) return nbitsA;
|
||||
}
|
||||
if (typeB != NULL) {
|
||||
type = (typeB->choice.setup->dmrs_Type==NULL) ? 1:2;
|
||||
length = (typeB->choice.setup->maxLength==NULL) ? 1:2;
|
||||
nbitsB = type + length + 2;
|
||||
if (typeA == NULL) return nbitsB;
|
||||
}
|
||||
|
||||
nbits = (nbitsA > nbitsB) ? nbitsA : nbitsB;
|
||||
return nbits;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : get_l0_ul
|
||||
@@ -1829,11 +1879,17 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t nr_dci_size(nr_dci_format_t format,
|
||||
uint16_t nr_dci_size(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu,
|
||||
nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB) {
|
||||
uint16_t N_RB,
|
||||
int bwp_id) {
|
||||
|
||||
uint16_t size = 0;
|
||||
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
NR_PDSCH_Config_t *pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||
|
||||
switch(format) {
|
||||
/*Only sizes for 0_0 and 1_0 are correct at the moment*/
|
||||
@@ -1841,7 +1897,7 @@ uint16_t nr_dci_size(nr_dci_format_t format,
|
||||
/// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20
|
||||
size += 20;
|
||||
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated
|
||||
size += nr_dci_size(NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB) - size; // Padding to match 1_0 size
|
||||
size += nr_dci_size(secondaryCellGroup,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size
|
||||
// UL/SUL indicator assumed to be 0
|
||||
break;
|
||||
|
||||
@@ -1874,29 +1930,123 @@ uint16_t nr_dci_size(nr_dci_format_t format,
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
// General note: 0 bits condition is ignored as default nbits is 0.
|
||||
// Format identifier
|
||||
size = 1;
|
||||
// Carrier indicator
|
||||
size += 1; // Format identifier
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL) {
|
||||
dci_pdu->carrier_indicator.nbits=3;
|
||||
size += dci_pdu->carrier_indicator.nbits;
|
||||
}
|
||||
// BWP Indicator
|
||||
uint8_t n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
if (n_dl_bwp < 2)
|
||||
dci_pdu->bwp_indicator.nbits = n_dl_bwp;
|
||||
else
|
||||
dci_pdu->bwp_indicator.nbits = 2;
|
||||
size += dci_pdu->bwp_indicator.nbits;
|
||||
// Freq domain assignment
|
||||
// Time domain assignment
|
||||
// VRB to PRB mapping
|
||||
long rbg_size_config = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size;
|
||||
uint16_t numRBG = getNRBG(NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
rbg_size_config);
|
||||
if (pdsch_config->resourceAllocation == 0)
|
||||
dci_pdu->frequency_domain_assignment.nbits = numRBG;
|
||||
else if (pdsch_config->resourceAllocation == 1)
|
||||
dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
else
|
||||
dci_pdu->frequency_domain_assignment.nbits = ((int)ceil( log2( (N_RB*(N_RB+1))>>1 ) )>numRBG) ? (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) )+1 : numRBG+1;
|
||||
size += dci_pdu->frequency_domain_assignment.nbits;
|
||||
// Time domain assignment (see table 5.1.2.1.1-1 in 38.214
|
||||
int num_entries;
|
||||
if (pdsch_config->pdsch_TimeDomainAllocationList==NULL) {
|
||||
if (bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList==NULL)
|
||||
num_entries = 16; // num of entries in default table
|
||||
else
|
||||
num_entries = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;
|
||||
}
|
||||
else
|
||||
num_entries = pdsch_config->pdsch_TimeDomainAllocationList->choice.setup->list.count;
|
||||
dci_pdu->time_domain_assignment.nbits = (int)ceil(log2(num_entries));
|
||||
size += dci_pdu->time_domain_assignment.nbits;
|
||||
// VRB to PRB mapping
|
||||
if ((pdsch_config->resourceAllocation == 1) && (bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver != NULL)) {
|
||||
dci_pdu->vrb_to_prb_mapping.nbits = 1;
|
||||
size += dci_pdu->vrb_to_prb_mapping.nbits;
|
||||
}
|
||||
// PRB bundling size indicator
|
||||
if (pdsch_config->prb_BundlingType.present == NR_PDSCH_Config__prb_BundlingType_PR_dynamicBundling) {
|
||||
dci_pdu->prb_bundling_size_indicator.nbits = 1;
|
||||
size += dci_pdu->prb_bundling_size_indicator.nbits;
|
||||
}
|
||||
// Rate matching indicator
|
||||
NR_RateMatchPatternGroup_t *group1 = pdsch_config->rateMatchPatternGroup1;
|
||||
NR_RateMatchPatternGroup_t *group2 = pdsch_config->rateMatchPatternGroup2;
|
||||
if ((group1 != NULL) && (group2 != NULL))
|
||||
dci_pdu->rate_matching_indicator.nbits = 2;
|
||||
if ((group1 != NULL) != (group2 != NULL))
|
||||
dci_pdu->rate_matching_indicator.nbits = 1;
|
||||
size += dci_pdu->rate_matching_indicator.nbits;
|
||||
// ZP CSI-RS trigger
|
||||
/// TB1- MCS 5, NDI 1, RV 2
|
||||
if (pdsch_config->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList != NULL) {
|
||||
uint8_t nZP = pdsch_config->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList->list.count;
|
||||
dci_pdu->zp_csi_rs_trigger.nbits = (int)ceil(log2(nZP+1));
|
||||
}
|
||||
size += dci_pdu->zp_csi_rs_trigger.nbits;
|
||||
// TB1- MCS 5, NDI 1, RV 2
|
||||
size += 8;
|
||||
// TB2
|
||||
size += 4 ; // HARQ PID
|
||||
long *maxCWperDCI = pdsch_config->maxNrofCodeWordsScheduledByDCI;
|
||||
if ((maxCWperDCI != NULL) && (*maxCWperDCI == 2)) {
|
||||
size += 8;
|
||||
}
|
||||
// HARQ PID
|
||||
size += 4;
|
||||
// DAI
|
||||
size += 2; // TPC PUCCH
|
||||
size += 3; // PUCCH resource indicator
|
||||
size += 3; // PDSCH to HARQ timing indicator
|
||||
if (secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell
|
||||
dci_pdu->dai[0].nbits = 2;
|
||||
size += dci_pdu->dai[0].nbits;
|
||||
}
|
||||
// TPC PUCCH
|
||||
size += 2;
|
||||
// PUCCH resource indicator
|
||||
size += 3;
|
||||
// PDSCH to HARQ timing indicator
|
||||
uint8_t I = ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.count;
|
||||
dci_pdu->pdsch_to_harq_feedback_timing_indicator.nbits = (int)ceil(log2(I));
|
||||
size += dci_pdu->pdsch_to_harq_feedback_timing_indicator.nbits;
|
||||
// Antenna ports
|
||||
NR_SetupRelease_DMRS_DownlinkConfig_t *typeA = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA;
|
||||
NR_SetupRelease_DMRS_DownlinkConfig_t *typeB = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB;
|
||||
dci_pdu->antenna_ports.nbits = getAntPortBitWidth(typeA,typeB);
|
||||
size += dci_pdu->antenna_ports.nbits;
|
||||
// Tx Config Indication
|
||||
size += 2; // SRS request
|
||||
long *isTciEnable = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI;
|
||||
if (isTciEnable != NULL) {
|
||||
dci_pdu->transmission_configuration_indication.nbits = 3;
|
||||
size += dci_pdu->transmission_configuration_indication.nbits;
|
||||
}
|
||||
// SRS request
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink==NULL)
|
||||
dci_pdu->srs_request.nbits = 2;
|
||||
else
|
||||
dci_pdu->srs_request.nbits = 3;
|
||||
size += dci_pdu->srs_request.nbits;
|
||||
// CBGTI
|
||||
// CBGFI
|
||||
size += 1; // DMRS sequence init
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
|
||||
uint8_t maxCBGperTB = (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2;
|
||||
long *maxCWperDCI_rrc = pdsch_config->maxNrofCodeWordsScheduledByDCI;
|
||||
uint8_t maxCW = (maxCWperDCI_rrc == NULL) ? 1 : *maxCWperDCI_rrc;
|
||||
dci_pdu->cbgti.nbits = maxCBGperTB * maxCW;
|
||||
size += dci_pdu->cbgti.nbits;
|
||||
// CBGFI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) {
|
||||
dci_pdu->cbgfi.nbits = 1;
|
||||
size += dci_pdu->cbgfi.nbits;
|
||||
}
|
||||
}
|
||||
// DMRS sequence init
|
||||
size += 1;
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_2_0:
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#define __LAYER2_NR_MAC_COMMON_H__
|
||||
|
||||
#include "NR_PDSCH-Config.h"
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "nr_mac.h"
|
||||
|
||||
typedef enum {
|
||||
NR_DL_DCI_FORMAT_1_0 = 0,
|
||||
@@ -76,7 +77,12 @@ int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||
|
||||
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||
|
||||
uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB);
|
||||
uint16_t nr_dci_size(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu,
|
||||
nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB,
|
||||
int bwp_id);
|
||||
|
||||
void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss,
|
||||
uint16_t *slot_period,
|
||||
|
||||
@@ -334,7 +334,7 @@ int nr_rrc_mac_config_req_ue(
|
||||
// NR_ServingCellConfigCommon_t *sccP,
|
||||
// NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
|
||||
// NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
|
||||
NR_SpCellConfig_t *spCell_ConfigP ){
|
||||
NR_CellGroupConfig_t *cell_group_config ){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
@@ -345,18 +345,17 @@ int nr_rrc_mac_config_req_ue(
|
||||
if(mibP != NULL){
|
||||
mac->mib = mibP; // update by every reception
|
||||
}
|
||||
|
||||
|
||||
if(spCell_ConfigP != NULL ){
|
||||
mac->servCellIndex = *spCell_ConfigP->servCellIndex;
|
||||
if (spCell_ConfigP->reconfigurationWithSync) {
|
||||
mac->rach_ConfigDedicated = spCell_ConfigP->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
mac->scc = spCell_ConfigP->reconfigurationWithSync->spCellConfigCommon;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = spCell_ConfigP->reconfigurationWithSync->newUE_Identity;
|
||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||
|
||||
if(cell_group_config != NULL ){
|
||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||
mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||
}
|
||||
mac->scd = spCell_ConfigP->spCellConfigDedicated;
|
||||
mac->scg = cell_group_config;
|
||||
|
||||
/*
|
||||
if(mac_cell_group_configP != NULL){
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#include "NR_MIB.h"
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
#include "NR_PhysicalCellGroupConfig.h"
|
||||
#include "NR_SpCellConfig.h"
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "NR_ServingCellConfig.h"
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc;
|
||||
NR_ServingCellConfig_t *scd;
|
||||
NR_CellGroupConfig_t *scg;
|
||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated;
|
||||
int servCellIndex;
|
||||
//// MAC config
|
||||
|
||||
@@ -90,4 +90,6 @@ extern const int32_t table_38213_10_1_1_c2[5];
|
||||
// for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||
extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
// for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||
extern uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
extern uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
|
||||
extern dci_pdu_rel15_t *def_dci_pdu_rel15;
|
||||
|
||||
@@ -72,7 +72,7 @@ int nr_rrc_mac_config_req_ue(
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
//NR_ServingCellConfigCommon_t *sccP,
|
||||
NR_SpCellConfig_t *spCell_ConfigP);
|
||||
NR_CellGroupConfig_t *cell_group_config);
|
||||
|
||||
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
|
||||
@@ -101,7 +101,7 @@ uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index,fapi_nr_dci_indication_pdu_t *dci);
|
||||
|
||||
uint32_t get_ssb_frame(uint32_t test);
|
||||
@@ -161,7 +161,7 @@ void nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
uint8_t dci_length,
|
||||
uint16_t rnti,
|
||||
uint64_t *dci_pdu,
|
||||
nr_dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
|
||||
|
||||
uint8_t
|
||||
|
||||
@@ -52,7 +52,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
||||
//init mac here
|
||||
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
|
||||
if (rrc_inst) {
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config->spCellConfig);
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rlc_module_init(0) != 0) {
|
||||
|
||||
@@ -334,6 +334,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
||||
// - retrieve TBS
|
||||
// - add mac_rrc_nr_data_req_ue, etc ...
|
||||
// - add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
|
||||
uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
module_id_t mod_id,
|
||||
int CC_id,
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#endif
|
||||
#define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
|
||||
|
||||
dci_pdu_rel15_t *def_dci_pdu_rel15;
|
||||
|
||||
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
|
||||
|
||||
@@ -63,7 +64,8 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
||||
|
||||
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) {
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scd;
|
||||
def_dci_pdu_rel15 = calloc(1,sizeof(dci_pdu_rel15_t));
|
||||
|
||||
NR_BWP_Downlink_t *bwp;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common;
|
||||
NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated;
|
||||
@@ -76,6 +78,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
NR_ControlResourceSet_t *coreset;
|
||||
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15;
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
|
||||
uint8_t bwp_id = 1;
|
||||
int ss_id, sps;
|
||||
@@ -167,7 +170,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
AssertFatal(mac->scc != NULL, "scc is null\n");
|
||||
|
||||
scc = mac->scc;
|
||||
rel15->dci_format = NR_DL_DCI_FORMAT_1_0;
|
||||
rel15->dci_format = NR_DL_DCI_FORMAT_1_1;
|
||||
|
||||
// CoReSet configuration
|
||||
coreset = mac->coreset[0][0];
|
||||
@@ -220,7 +223,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); // NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
rel15->dci_length = nr_dci_size(rel15->dci_format, NR_RNTI_RA, rel15->BWPSize);
|
||||
rel15->dci_length = nr_dci_size(mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id);
|
||||
for (int i = 0; i < sps; i++)
|
||||
if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) {
|
||||
rel15->coreset.StartSymbolIndex = i;
|
||||
@@ -240,7 +243,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
rel15->dci_length = nr_dci_size(rel15->dci_format, NR_RNTI_C, rel15->BWPSize);
|
||||
rel15->dci_length = nr_dci_size(mac->scg,def_dci_pdu_rel15,rel15->dci_format,NR_RNTI_C,rel15->BWPSize,bwp_id);
|
||||
// get UE-specific search space
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[0][0][ss_id] != NULL; ss_id++){
|
||||
uss = mac->SSpace[0][0][ss_id];
|
||||
@@ -264,10 +267,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
rel15->coreset.scrambling_rnti = mac->t_crnti;
|
||||
} else {
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
|
||||
if(mac->ra_state == WAIT_RAR)
|
||||
rel15->coreset.scrambling_rnti = 0;
|
||||
else
|
||||
rel15->coreset.scrambling_rnti = rel15->rnti;
|
||||
rel15->coreset.scrambling_rnti = 0;
|
||||
}
|
||||
|
||||
if (add_dci){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -290,8 +290,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols);
|
||||
|
||||
if (return_tdd !=0){
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
@@ -374,6 +373,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
if (add_ue == 1) {
|
||||
UE_id = add_new_nr_ue(Mod_idP,rnti);
|
||||
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
uint8_t num_preamble = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.count;
|
||||
UE_list->preambles[UE_id].num_preambles = num_preamble;
|
||||
UE_list->preambles[UE_id].preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
|
||||
for (int i=0; i<num_preamble; i++) {
|
||||
UE_list->preambles[UE_id].preamble_list[i] = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
|
||||
}
|
||||
LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti);
|
||||
}
|
||||
else { // secondaryCellGroup has been updated
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160};
|
||||
uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
@@ -304,12 +305,14 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0];
|
||||
|
||||
NR_sched_pucch *curr_pucch = UE_list->UE_sched_ctrl[UE_id].sched_pucch;
|
||||
NR_sched_pucch *temp_pucch;
|
||||
int release_pucch = 0;
|
||||
NR_sched_pucch *curr_pucch;
|
||||
int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0)
|
||||
nr_ulmix_slots++;
|
||||
|
||||
if (curr_pucch != NULL) {
|
||||
if ((frameP == curr_pucch->frame) && (slotP == curr_pucch->ul_slot)) {
|
||||
for (int k=0; k<nr_ulmix_slots; k++) {
|
||||
curr_pucch = &UE_list->UE_sched_ctrl[UE_id].sched_pucch[k];
|
||||
if ((curr_pucch->dai_c > 0) && (frameP == curr_pucch->frame) && (slotP == curr_pucch->ul_slot)) {
|
||||
UL_tti_req->SFN = frameP;
|
||||
UL_tti_req->Slot = slotP;
|
||||
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE;
|
||||
@@ -320,6 +323,8 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
O_ack = curr_pucch->dai_c;
|
||||
O_uci = O_ack; // for now we are just sending acknacks in pucch
|
||||
|
||||
LOG_I(MAC, "Scheduling pucch reception for frame %d slot %d\n", frameP, slotP);
|
||||
|
||||
nr_configure_pucch(pucch_pdu,
|
||||
scc,
|
||||
ubwp,
|
||||
@@ -328,16 +333,9 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
O_ack,
|
||||
SR_flag);
|
||||
|
||||
release_pucch = 1;
|
||||
curr_pucch->dai_c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (release_pucch) {
|
||||
temp_pucch = UE_list->UE_sched_ctrl[UE_id].sched_pucch;
|
||||
UE_list->UE_sched_ctrl[UE_id].sched_pucch = UE_list->UE_sched_ctrl[UE_id].sched_pucch->next_sched_pucch;
|
||||
free(temp_pucch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot){
|
||||
@@ -358,11 +356,34 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame_txP, slot_txP,module_idP);
|
||||
int CC_id, UE_id = 0;
|
||||
|
||||
int CC_id;
|
||||
int UE_id;
|
||||
uint64_t *dlsch_in_slot_bitmap=NULL;
|
||||
uint64_t *ulsch_in_slot_bitmap=NULL;
|
||||
int pucch_sched;
|
||||
|
||||
UE_id=0;
|
||||
int bwp_id = 1;
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_UE_list_t *UE_list = &gNB->UE_list;
|
||||
NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
NR_sched_pucch *pucch_sched = (NR_sched_pucch*) malloc(sizeof(NR_sched_pucch));
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
int num_slots_per_tdd = (slots_per_frame[*scc->ssbSubcarrierSpacing])>>(7-scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
|
||||
|
||||
int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0)
|
||||
nr_ulmix_slots++;
|
||||
|
||||
if (slot_txP== 0 && (UE_list->fiveG_connected[UE_id] || get_softmodem_params()->phy_test)) {
|
||||
for (int k=0; k<nr_ulmix_slots; k++) {
|
||||
memset((void *) &UE_list->UE_sched_ctrl[UE_id].sched_pucch[k],
|
||||
0,
|
||||
sizeof(NR_sched_pucch));
|
||||
}
|
||||
}
|
||||
|
||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
|
||||
@@ -373,10 +394,29 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
RC.nrmac[module_idP]->frame = frame_rxP;
|
||||
RC.nrmac[module_idP]->slot = slot_rxP;
|
||||
|
||||
dlsch_in_slot_bitmap = &RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[UE_id].dlsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains dlsch
|
||||
ulsch_in_slot_bitmap = &RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[UE_id].ulsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains ulsch
|
||||
|
||||
// hardcoding dlsch to be in slot 1
|
||||
if (!(slot_txP%num_slots_per_tdd)) {
|
||||
if(slot_txP==0)
|
||||
*dlsch_in_slot_bitmap = 0x02;
|
||||
else
|
||||
*dlsch_in_slot_bitmap = 0x00;
|
||||
}
|
||||
|
||||
// hardcoding ulsch to be in slot 8
|
||||
if (!(slot_rxP%num_slots_per_tdd)) {
|
||||
if(slot_rxP==0)
|
||||
*ulsch_in_slot_bitmap = 0x100;
|
||||
else
|
||||
*ulsch_in_slot_bitmap = 0x00;
|
||||
}
|
||||
|
||||
// Check if there are downlink symbols in the slot,
|
||||
if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_txP)) {
|
||||
|
||||
memset(RC.nrmac[module_idP]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
//mbsfn_status[CC_id] = 0;
|
||||
|
||||
@@ -392,7 +432,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
for (i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||
if (UE_list->active[i]) {
|
||||
|
||||
nfapi_nr_config_request_t *cfg = &RC.nrmac[module_idP]->config[CC_id];
|
||||
nfapi_nr_config_request_t *cfg = &RC.nrmac[module_idP]->config[CC_id];
|
||||
|
||||
rnti = 0;//UE_RNTI(module_idP, i);
|
||||
CC_id = 0;//UE_PCCID(module_idP, i);
|
||||
@@ -406,9 +446,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
schedule_nr_mib(module_idP, frame_txP, slot_txP);
|
||||
}
|
||||
|
||||
if (get_softmodem_params()->phy_test == 0)
|
||||
nr_schedule_RA(module_idP, frame_txP, slot_txP);
|
||||
else
|
||||
UE_list->fiveG_connected[UE_id] = true;
|
||||
|
||||
// Phytest scheduling
|
||||
|
||||
if (get_softmodem_params()->phy_test) {
|
||||
NR_UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
|
||||
// TbD once RACH is available, start ta_timer when UE is connected
|
||||
if (ue_sched_ctl->ta_timer)
|
||||
@@ -424,16 +469,15 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
/* MAC CE flag indicating TA length */
|
||||
gNB->ta_len = 2;
|
||||
}
|
||||
|
||||
if (slot_txP == 1){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, pucch_sched, NULL);
|
||||
// resetting ta flag
|
||||
gNB->ta_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (get_softmodem_params()->phy_test == 0)
|
||||
nr_schedule_RA(module_idP, frame_txP, slot_txP);
|
||||
if (UE_list->fiveG_connected[UE_id] && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot_txP%num_slots_per_tdd))) {
|
||||
ue_sched_ctl->current_harq_pid = slot_txP % num_slots_per_tdd;
|
||||
nr_update_pucch_scheduling(module_idP, UE_id, frame_txP, slot_txP, num_slots_per_tdd,&pucch_sched);
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, &UE_list->UE_sched_ctrl[UE_id].sched_pucch[pucch_sched], NULL);
|
||||
// resetting ta flag
|
||||
gNB->ta_len = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// Allocate CCEs for good after scheduling is done
|
||||
@@ -446,11 +490,16 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
|
||||
|
||||
if (get_softmodem_params()->phy_test == 0) {
|
||||
if (UE_list->fiveG_connected[UE_id])
|
||||
nr_schedule_pucch(module_idP, UE_id, frame_rxP, slot_rxP);
|
||||
schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP);
|
||||
nr_schedule_reception_msg3(module_idP, 0, frame_rxP, slot_rxP);
|
||||
}
|
||||
if (get_softmodem_params()->phy_test && slot_rxP==8){
|
||||
nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP);
|
||||
if (get_softmodem_params()->phy_test){
|
||||
nr_schedule_pucch(module_idP, UE_id, frame_rxP, slot_rxP);
|
||||
if (is_xlsch_in_slot(*ulsch_in_slot_bitmap,slot_rxP%num_slots_per_tdd)){
|
||||
nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern const uint16_t nr_slots_per_frame[5];
|
||||
|
||||
const uint8_t nr_slots_per_frame_mac[5] = {10, 20, 40, 80, 160};
|
||||
|
||||
uint8_t DELTA[4]= {2,3,4,6};
|
||||
|
||||
void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
||||
@@ -183,7 +185,7 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
|
||||
tdd_period_slot++;
|
||||
|
||||
// computing start of next period
|
||||
uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu];
|
||||
uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame_mac[mu];
|
||||
*msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot
|
||||
*msg2_frame = (*msg2_slot>(rach_slot))? rach_frame : (rach_frame +1);
|
||||
|
||||
@@ -215,15 +217,16 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
|
||||
default:
|
||||
AssertFatal(1==0,"Invalid response window value %d\n",response_window);
|
||||
}
|
||||
AssertFatal(slot_window<=nr_slots_per_frame[mu],"Msg2 response window needs to be lower or equal to 10ms");
|
||||
AssertFatal(slot_window<=nr_slots_per_frame_mac[mu],"Msg2 response window needs to be lower or equal to 10ms");
|
||||
|
||||
// slot and frame limit to transmit msg2 according to response window
|
||||
uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu];
|
||||
uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame_mac[mu];
|
||||
//uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1);
|
||||
|
||||
|
||||
// go to previous slot if the current scheduled slot is beyond the response window
|
||||
// and if the slot is not among the PDCCH monitored ones (38.213 10.1)
|
||||
while ((*msg2_slot>slot_limit) || ((*msg2_frame*nr_slots_per_frame[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0)) {
|
||||
while ((*msg2_slot>slot_limit) || ((*msg2_frame*nr_slots_per_frame_mac[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0)) {
|
||||
if((*msg2_slot%tdd_period_slot) > 0)
|
||||
(*msg2_slot)--;
|
||||
else
|
||||
@@ -243,18 +246,35 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
|
||||
uint8_t ul_carrier_id = 0; // 0 for NUL 1 for SUL
|
||||
NR_SearchSpace_t *ss;
|
||||
|
||||
int UE_id = 0;
|
||||
// ra_rnti from 5.1.3 in 38.321
|
||||
uint16_t ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8);
|
||||
|
||||
uint16_t msg2_frame, msg2_slot,monitoring_slot_period,monitoring_offset;
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
NR_UE_list_t *UE_list = &nr_mac->UE_list;
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[0];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
|
||||
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
NR_RA_t *ra = &cc->ra[0];
|
||||
|
||||
// if the preamble received correspond to one of the listed
|
||||
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
|
||||
int pr_found=0;
|
||||
for (int i=0;i<UE_list->preambles[UE_id].num_preambles;i++) {
|
||||
if (preamble_index == UE_list->preambles[UE_id].preamble_list[i]) {
|
||||
pr_found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pr_found)
|
||||
UE_list->fiveG_connected[UE_id] = false;
|
||||
else {
|
||||
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated for UE_id %d\n",
|
||||
module_idP, preamble_index, UE_id);
|
||||
return; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
||||
}
|
||||
|
||||
// This should be handled differently when we use the initialBWP for RA
|
||||
ra->bwp_id=1;
|
||||
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
|
||||
@@ -304,7 +324,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
|
||||
ra->RA_rnti = ra_rnti;
|
||||
ra->preamble_index = preamble_index;
|
||||
|
||||
UE_list->tc_rnti[UE_id] = ra->rnti;
|
||||
|
||||
LOG_I(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x\n",
|
||||
module_idP,
|
||||
@@ -377,11 +397,11 @@ void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc,
|
||||
uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2;
|
||||
|
||||
temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213
|
||||
ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu];
|
||||
if (nr_slots_per_frame[mu]>temp_slot)
|
||||
ra->Msg3_slot = temp_slot%nr_slots_per_frame_mac[mu];
|
||||
if (nr_slots_per_frame_mac[mu]>temp_slot)
|
||||
ra->Msg3_frame = current_frame;
|
||||
else
|
||||
ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]);
|
||||
ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame_mac[mu]);
|
||||
|
||||
ra->msg3_nb_rb = 18;
|
||||
ra->msg3_first_rb = 0;
|
||||
@@ -402,6 +422,7 @@ void nr_schedule_reception_msg3(module_id_t module_idP, int CC_id, frame_t frame
|
||||
ul_req->pdus_list[ul_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
|
||||
ul_req->pdus_list[ul_req->n_pdus].pusch_pdu = ra->pusch_pdu;
|
||||
ul_req->n_pdus+=1;
|
||||
ra->state = RA_IDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -517,16 +538,15 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP){
|
||||
|
||||
int UE_id = 0, dci_formats[2], rnti_types[2], CCEIndex, mcsIndex;
|
||||
int UE_id = 0, dci_formats[2], rnti_types[2], mcsIndex;
|
||||
int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment;
|
||||
int coreset_id, aggregation , search_space_type = 0;
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc = &nr_mac->common_channels[0];
|
||||
NR_RA_t *ra = &cc->ra[0];
|
||||
NR_UE_list_t *UE_list = &nr_mac->UE_list;
|
||||
NR_SearchSpace_t *ss = ra->ra_ss;
|
||||
|
||||
uint16_t RA_rnti = ra->RA_rnti, numDlDci;
|
||||
uint16_t RA_rnti = ra->RA_rnti;
|
||||
long locationAndBandwidth;
|
||||
// uint8_t *vrb_map = cc[CC_id].vrb_map, CC_id;
|
||||
|
||||
@@ -561,20 +581,11 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu;
|
||||
numDlDci = pdcch_pdu_rel15->numDlDci;
|
||||
|
||||
aggregation = find_aggregation_level(ss);
|
||||
coreset_id = *ss->controlResourceSetId;
|
||||
|
||||
// Checking if the DCI allocation is feasible in current subframe
|
||||
if (dl_req->nPDUs == NFAPI_NR_MAX_DL_TTI_PDUS) {
|
||||
LOG_I(MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, RA_rnti);
|
||||
return;
|
||||
} else {
|
||||
LOG_D(MAC, "[RAPROC] Subframe %d: Checking CCE feasibility format : (%x,%d) \n", slotP, RA_rnti, aggregation);
|
||||
CCEIndex = allocate_nr_CCEs(nr_mac, ra->bwp_id, coreset_id, aggregation, search_space_type, UE_id, 0);
|
||||
AssertFatal(CCEIndex >= 0,"CCEIndex is negative %d\n",CCEIndex);
|
||||
}
|
||||
|
||||
LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state);
|
||||
@@ -645,34 +656,27 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols);
|
||||
|
||||
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
|
||||
dci_pdu_rel15[0].frequency_domain_assignment = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,dci10_bw);
|
||||
dci_pdu_rel15[0].time_domain_assignment = time_domain_assignment;
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping = 0;
|
||||
dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment;
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping.val = 0;
|
||||
dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0];
|
||||
dci_pdu_rel15[0].tb_scaling = 0;
|
||||
|
||||
LOG_I(MAC, "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
|
||||
dci_pdu_rel15[0].frequency_domain_assignment,
|
||||
dci_pdu_rel15[0].frequency_domain_assignment.val,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
dci10_bw,
|
||||
dci_pdu_rel15[0].time_domain_assignment,
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping,
|
||||
dci_pdu_rel15[0].time_domain_assignment.val,
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping.val,
|
||||
dci_pdu_rel15[0].mcs,
|
||||
dci_pdu_rel15[0].tb_scaling);
|
||||
|
||||
nr_configure_pdcch(pdcch_pdu_rel15, 0, ss, scc, bwp);
|
||||
nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, RA_rnti, 0, ss, scc, bwp);
|
||||
|
||||
LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x CCEIndex %d\n", frameP, slotP, RA_rnti, CCEIndex);
|
||||
LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x\n", frameP, slotP, RA_rnti);
|
||||
|
||||
dci_pdu->RNTI[numDlDci] = RA_rnti;
|
||||
dci_pdu->ScramblingId[numDlDci] = *scc->physCellId;
|
||||
dci_pdu->ScramblingRNTI[numDlDci] = 0;
|
||||
dci_pdu->AggregationLevel[numDlDci] = aggregation;
|
||||
dci_pdu->CceIndex[numDlDci] = CCEIndex;
|
||||
dci_pdu->beta_PDCCH_1_0[numDlDci] = 0;
|
||||
dci_pdu->powerControlOffsetSS[numDlDci] = 1;
|
||||
dci_formats[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
rnti_types[0] = NR_RNTI_RA;
|
||||
|
||||
@@ -684,9 +688,7 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
pdcch_pdu_rel15->StartSymbolIndex,
|
||||
pdcch_pdu_rel15->DurationSymbols);
|
||||
|
||||
pdcch_pdu_rel15->numDlDci++;
|
||||
dci_pdu->PayloadSizeBits[0] = nr_dci_size(dci_formats[0], rnti_types[0], dci10_bw);
|
||||
fill_dci_pdu_rel15(pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types,dci10_bw);
|
||||
fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types,dci10_bw,ra->bwp_id);
|
||||
|
||||
dl_req->nPDUs+=2;
|
||||
|
||||
@@ -698,7 +700,7 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
LOG_D(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
|
||||
|
||||
x_Overhead = 0;
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, 1, dci_pdu_rel15[0].tb_scaling);
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_pdu_rel15[0].tb_scaling);
|
||||
|
||||
// DL TX request
|
||||
tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0];
|
||||
|
||||
@@ -250,11 +250,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int configure_fapi_dl_pdu(int Mod_idP,
|
||||
int *CCEIndex,
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||
NR_sched_pucch *pucch_sched,
|
||||
uint8_t *mcsIndex,
|
||||
@@ -262,13 +258,18 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
uint16_t *rbStart) {
|
||||
|
||||
|
||||
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP];
|
||||
NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu;
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu;
|
||||
int TBS, bwp_id = 1, UE_id = 0;
|
||||
|
||||
int TBS;
|
||||
int bwp_id=1;
|
||||
int UE_id = 0;
|
||||
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
||||
|
||||
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
|
||||
@@ -280,10 +281,6 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
||||
"searchPsacesToAddModList is empty\n");
|
||||
NR_SearchSpace_t *ss;
|
||||
// TO BE FIXED we are just selecting the first search space here (only one is configured)
|
||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[0];
|
||||
|
||||
|
||||
dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
@@ -312,11 +309,12 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
|
||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||
int mcs = (mcsIndex!=NULL) ? *mcsIndex : 9;
|
||||
int current_harq_pid = UE_list->UE_sched_ctrl[UE_id].current_harq_pid;
|
||||
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcs,0);
|
||||
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
||||
pdsch_pdu_rel15->mcsIndex[0] = mcs;
|
||||
pdsch_pdu_rel15->mcsTable[0] = 0;
|
||||
pdsch_pdu_rel15->rvIndex[0] = 0;
|
||||
pdsch_pdu_rel15->rvIndex[0] = (get_softmodem_params()->phy_test==1) ? 0 : UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round;
|
||||
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||
@@ -347,52 +345,88 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
scc->dmrs_TypeA_Position,
|
||||
pdsch_pdu_rel15->NrOfSymbols);
|
||||
|
||||
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
|
||||
dci_pdu_rel15_t *dci_pdu_rel15 = calloc(MAX_DCI_CORESET,sizeof(dci_pdu_rel15_t));
|
||||
|
||||
dci_pdu_rel15[0].frequency_domain_assignment = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275));
|
||||
dci_pdu_rel15[0].time_domain_assignment = time_domain_assignment; // row index used here instead of SLIV;
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping = 1;
|
||||
// bwp indicator
|
||||
int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
if (n_dl_bwp < 4)
|
||||
dci_pdu_rel15[0].bwp_indicator.val = bwp_id;
|
||||
else
|
||||
dci_pdu_rel15[0].bwp_indicator.val = bwp_id - 1; // as per table 7.3.1.1.2-1 in 38.212
|
||||
// frequency domain assignment
|
||||
if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation==NR_PDSCH_Config__resourceAllocation_resourceAllocationType1)
|
||||
dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275));
|
||||
else
|
||||
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
|
||||
// time domain assignment
|
||||
dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment; // row index used here instead of SLIV;
|
||||
// mcs ndi and rv
|
||||
dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0];
|
||||
dci_pdu_rel15[0].tb_scaling = 1;
|
||||
|
||||
dci_pdu_rel15[0].ra_preamble_index = 25;
|
||||
dci_pdu_rel15[0].format_indicator = 1;
|
||||
dci_pdu_rel15[0].ndi = 1;
|
||||
dci_pdu_rel15[0].rv = 0;
|
||||
dci_pdu_rel15[0].harq_pid = 0;
|
||||
dci_pdu_rel15[0].dai = (pucch_sched->dai_c-1)&3;
|
||||
dci_pdu_rel15[0].tpc = 2;
|
||||
dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0];
|
||||
// harq pid
|
||||
dci_pdu_rel15[0].harq_pid = current_harq_pid;
|
||||
dci_pdu_rel15[0].ndi = UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].ndi;
|
||||
// DAI
|
||||
dci_pdu_rel15[0].dai[0].val = (pucch_sched->dai_c-1)&3;
|
||||
|
||||
// TPC for PUCCH
|
||||
dci_pdu_rel15[0].tpc = 1; // table 7.2.1-1 in 38.213
|
||||
// PUCCH resource indicator
|
||||
dci_pdu_rel15[0].pucch_resource_indicator = pucch_sched->resource_indicator;
|
||||
dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator = pucch_sched->timing_indicator;
|
||||
|
||||
// PDSCH to HARQ TI
|
||||
dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = pucch_sched->timing_indicator;
|
||||
UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].feedback_slot = pucch_sched->ul_slot;
|
||||
UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].is_waiting = 1;
|
||||
// antenna ports
|
||||
dci_pdu_rel15[0].antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0
|
||||
|
||||
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
dci_pdu_rel15[0].frequency_domain_assignment,
|
||||
dci_pdu_rel15[0].frequency_domain_assignment.val,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
dci_pdu_rel15[0].time_domain_assignment,
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping,
|
||||
dci_pdu_rel15[0].time_domain_assignment.val,
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping.val,
|
||||
dci_pdu_rel15[0].mcs,
|
||||
dci_pdu_rel15[0].tb_scaling,
|
||||
dci_pdu_rel15[0].ndi,
|
||||
dci_pdu_rel15[0].rv);
|
||||
|
||||
nr_configure_pdcch(pdcch_pdu_rel15,
|
||||
1, // ue-specific
|
||||
ss,
|
||||
scc,
|
||||
bwp);
|
||||
|
||||
pdcch_pdu_rel15->numDlDci = 1;
|
||||
pdcch_pdu_rel15->dci_pdu.AggregationLevel[0] = 4;
|
||||
pdcch_pdu_rel15->dci_pdu.RNTI[0]=UE_list->rnti[0];
|
||||
pdcch_pdu_rel15->dci_pdu.ScramblingRNTI[0]=UE_list->rnti[0];
|
||||
pdcch_pdu_rel15->dci_pdu.CceIndex[0] = CCEIndex[0];
|
||||
pdcch_pdu_rel15->dci_pdu.beta_PDCCH_1_0[0]=0;
|
||||
pdcch_pdu_rel15->dci_pdu.powerControlOffsetSS[0]=1;
|
||||
|
||||
|
||||
NR_SearchSpace_t *ss;
|
||||
int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
||||
"searchPsacesToAddModList is empty\n");
|
||||
|
||||
int found=0;
|
||||
|
||||
for (int i=0;i<bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) {
|
||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i];
|
||||
AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n");
|
||||
AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n");
|
||||
if (ss->searchSpaceType->present == target_ss) {
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AssertFatal(found==1,"Couldn't find an adequate searchspace\n");
|
||||
|
||||
int ret = nr_configure_pdcch(nr_mac,
|
||||
pdcch_pdu_rel15,
|
||||
UE_list->rnti[UE_id],
|
||||
1, // ue-specific
|
||||
ss,
|
||||
scc,
|
||||
bwp);
|
||||
if (ret < 0) {
|
||||
LOG_I(MAC,"CCE list not empty, couldn't schedule PDSCH\n");
|
||||
free(dci_pdu_rel15);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int dci_formats[2];
|
||||
int rnti_types[2];
|
||||
|
||||
@@ -403,8 +437,7 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
|
||||
rnti_types[0] = NR_RNTI_C;
|
||||
|
||||
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[0]=nr_dci_size(dci_formats[0],rnti_types[0],pdcch_pdu_rel15->BWPSize);
|
||||
fill_dci_pdu_rel15(pdcch_pdu_rel15,&dci_pdu_rel15[0],dci_formats,rnti_types,pdcch_pdu_rel15->BWPSize);
|
||||
fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,bwp_id);
|
||||
|
||||
LOG_D(MAC, "DCI params: rnti %x, rnti_type %d, dci_format %d\n \
|
||||
coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
||||
@@ -416,7 +449,7 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
pdcch_pdu_rel15->DurationSymbols);
|
||||
|
||||
int x_Overhead = 0; // should be 0 for initialBWP
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead,1,0);
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu,x_Overhead,pdsch_pdu_rel15->numDmrsCdmGrpsNoData,0);
|
||||
|
||||
// Hardcode it for now
|
||||
TBS = dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15.TBSize[0];
|
||||
@@ -430,17 +463,19 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
||||
pdsch_pdu_rel15->NrOfCodewords,
|
||||
pdsch_pdu_rel15->mcsIndex[0],
|
||||
TBS);
|
||||
|
||||
free(dci_pdu_rel15);
|
||||
return TBS; //Return TBS in bytes
|
||||
}
|
||||
|
||||
void config_uldci(NR_BWP_Uplink_t *ubwp,nfapi_nr_pusch_pdu_t *pusch_pdu,nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, dci_pdu_rel15_t *dci_pdu_rel15, int *dci_formats, int *rnti_types) {
|
||||
|
||||
dci_pdu_rel15->frequency_domain_assignment = PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size,
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size,
|
||||
pusch_pdu->rb_start,
|
||||
NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275));
|
||||
|
||||
dci_pdu_rel15->time_domain_assignment = 2; // row index used here instead of SLIV;
|
||||
dci_pdu_rel15->frequency_hopping_flag = 0;
|
||||
dci_pdu_rel15->time_domain_assignment.val = 2; // row index used here instead of SLIV;
|
||||
dci_pdu_rel15->frequency_hopping_flag.val = 0;
|
||||
dci_pdu_rel15->mcs = 9;
|
||||
|
||||
dci_pdu_rel15->format_indicator = 0;
|
||||
@@ -451,9 +486,9 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,nfapi_nr_pusch_pdu_t *pusch_pdu,nfapi_nr
|
||||
|
||||
LOG_D(MAC, "[gNB scheduler phytest] ULDCI type 0 payload: PDCCH CCEIndex %d, freq_alloc %d, time_alloc %d, freq_hop_flag %d, mcs %d tpc %d ndi %d rv %d\n",
|
||||
pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci],
|
||||
dci_pdu_rel15->frequency_domain_assignment,
|
||||
dci_pdu_rel15->time_domain_assignment,
|
||||
dci_pdu_rel15->frequency_hopping_flag,
|
||||
dci_pdu_rel15->frequency_domain_assignment.val,
|
||||
dci_pdu_rel15->time_domain_assignment.val,
|
||||
dci_pdu_rel15->frequency_hopping_flag.val,
|
||||
dci_pdu_rel15->mcs,
|
||||
dci_pdu_rel15->tpc,
|
||||
dci_pdu_rel15->ndi,
|
||||
@@ -510,11 +545,11 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
NR_sched_pucch *pucch_sched,
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dlsch_config){
|
||||
|
||||
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest \n");
|
||||
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest frame %d slot %d\n",frameP,slotP);
|
||||
|
||||
int post_padding = 0, ta_len = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0;
|
||||
int lcid, offset, i, header_length_last, TBS_bytes;
|
||||
int UE_id = 0, CCEIndex = -1, CC_id = 0;
|
||||
int UE_id = 0, CC_id = 0;
|
||||
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
|
||||
//NR_COMMON_channels_t *cc = nr_mac->common_channels;
|
||||
@@ -538,25 +573,15 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
|
||||
ta_len = gNB_mac->ta_len;
|
||||
|
||||
CCEIndex = allocate_nr_CCEs(gNB_mac,
|
||||
1, // bwp_id
|
||||
0, // coreset_id
|
||||
4, // aggregation,
|
||||
1, // search_space, 0 common, 1 ue-specific
|
||||
UE_id,
|
||||
0); // m
|
||||
|
||||
AssertFatal(CCEIndex>0,"CCEIndex is negative\n");
|
||||
int CCEIndices[2];
|
||||
CCEIndices[0] = CCEIndex;
|
||||
|
||||
TBS_bytes = configure_fapi_dl_pdu(module_idP,
|
||||
CCEIndices,
|
||||
dl_req,
|
||||
pucch_sched,
|
||||
dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL,
|
||||
dlsch_config!=NULL ? &dlsch_config->rbSize : NULL,
|
||||
dlsch_config!=NULL ? &dlsch_config->rbStart : NULL);
|
||||
|
||||
if (TBS_bytes == 0)
|
||||
return;
|
||||
|
||||
//The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving
|
||||
//through the LTE stack
|
||||
@@ -614,11 +639,13 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} //if (IS_SOFTMODEM_NOS1)
|
||||
else {
|
||||
|
||||
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
|
||||
//occur every time that the current function is called (dlsch phytest mode)
|
||||
|
||||
LOG_D(MAC,"Configuring DL_TX in %d.%d\n", frameP, slotP);
|
||||
|
||||
// fill dlsch_buffer with random data
|
||||
@@ -628,7 +655,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
}
|
||||
//Sending SDUs with size 1
|
||||
//Initialize elements of sdu_lcids and sdu_lengths
|
||||
sdu_lcids[0] = 0x05; // DRB
|
||||
sdu_lcids[0] = 0x3f; // DRB
|
||||
sdu_lengths[0] = TBS_bytes - ta_len - 3;
|
||||
header_length_total += 2 + (sdu_lengths[0] >= 128);
|
||||
sdu_length_total += sdu_lengths[0];
|
||||
@@ -728,9 +755,6 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
||||
"searchPsacesToAddModList is empty\n");
|
||||
NR_SearchSpace_t *ss;
|
||||
// TO BE FIXED we are just selecting the first search space here (only one is configured)
|
||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[0];
|
||||
|
||||
uint16_t rnti = UE_list->rnti[UE_id];
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu;
|
||||
@@ -776,6 +800,8 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
pusch_pdu->transform_precoding = 0;
|
||||
pusch_pdu->data_scrambling_id = 0; //It equals the higher-layer parameter Data-scrambling-Identity if configured and the RNTI equals the C-RNTI, otherwise L2 needs to set it to physical cell id.;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
|
||||
//Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2]
|
||||
pusch_pdu->resource_alloc = 1; //type 1
|
||||
//pusch_pdu->rb_bitmap;// for ressource alloc type 0
|
||||
pusch_pdu->rb_start = 0;
|
||||
@@ -797,7 +823,7 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
pusch_pdu->ul_dmrs_scrambling_id = 0; // If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id
|
||||
pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]
|
||||
// Should match what is sent in DCI 0_1, otherwise set to 0
|
||||
//pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
//pusch_pdu->dmrs_ports; // DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports
|
||||
// Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011,
|
||||
// and for each bit 0: DMRS port not used 1: DMRS port used
|
||||
@@ -826,21 +852,29 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
pusch_pdu->pusch_data.harq_process_id = 0;
|
||||
pusch_pdu->pusch_data.new_data_indicator = 0;
|
||||
|
||||
uint8_t no_data_in_dmrs = 1; // temp implementation
|
||||
uint8_t num_dmrs_symb = 0;
|
||||
|
||||
for(int dmrs_counter = pusch_pdu->start_symbol_index; dmrs_counter < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; dmrs_counter++)
|
||||
num_dmrs_symb += ((pusch_pdu->ul_dmrs_symb_pos >> dmrs_counter) & 1);
|
||||
|
||||
uint8_t N_PRB_DMRS;
|
||||
if (pusch_pdu->dmrs_config_type == 0) {
|
||||
N_PRB_DMRS = pusch_pdu->num_dmrs_cdm_grps_no_data*6;
|
||||
}
|
||||
else {
|
||||
N_PRB_DMRS = pusch_pdu->num_dmrs_cdm_grps_no_data*4;
|
||||
}
|
||||
|
||||
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->target_code_rate,
|
||||
pusch_pdu->rb_size,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
( no_data_in_dmrs ? 12 : ((pusch_pdu->dmrs_config_type == pusch_dmrs_type1) ? 6 : 4) ) * num_dmrs_symb,
|
||||
N_PRB_DMRS * num_dmrs_symb,
|
||||
0, //nb_rb_oh
|
||||
0,
|
||||
pusch_pdu->nrOfLayers)>>3;
|
||||
|
||||
|
||||
pusch_pdu->pusch_data.num_cb = 0; //CBG not supported
|
||||
//pusch_pdu->pusch_data.cb_present_and_position;
|
||||
//pusch_pdu->pusch_uci;
|
||||
@@ -859,34 +893,51 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
int dci_formats[2];
|
||||
int rnti_types[2];
|
||||
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac,
|
||||
1, // bwp_id
|
||||
0, // coreset_id
|
||||
4, // aggregation,
|
||||
1, // search_space, 0 common, 1 ue-specific
|
||||
UE_id,
|
||||
0); // m
|
||||
NR_SearchSpace_t *ss;
|
||||
int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
|
||||
"searchPsacesToAddModList is empty\n");
|
||||
|
||||
int found=0;
|
||||
|
||||
for (int i=0;i<bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) {
|
||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i];
|
||||
AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n");
|
||||
AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n");
|
||||
if (ss->searchSpaceType->present == target_ss) {
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AssertFatal(found==1,"Couldn't find an adequate searchspace\n");
|
||||
|
||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats)
|
||||
dci_formats[0] = NR_UL_DCI_FORMAT_0_1;
|
||||
else
|
||||
dci_formats[0] = NR_UL_DCI_FORMAT_0_0;
|
||||
|
||||
dci_formats[0] = NR_UL_DCI_FORMAT_0_0;
|
||||
rnti_types[0] = NR_RNTI_C;
|
||||
LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP);
|
||||
nr_configure_pdcch(pdcch_pdu_rel15,
|
||||
1, // ue-specific,
|
||||
ss,
|
||||
scc,
|
||||
bwp);
|
||||
|
||||
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
|
||||
|
||||
AssertFatal(CCEIndex>=0,"CCEIndex is negative \n");
|
||||
pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci] = CCEIndex;
|
||||
int ret = nr_configure_pdcch(nr_mac,
|
||||
pdcch_pdu_rel15,
|
||||
UE_list->rnti[UE_id],
|
||||
1, // ue-specific,
|
||||
ss,
|
||||
scc,
|
||||
bwp);
|
||||
|
||||
LOG_D(PHY,"CCEIndex %d\n",pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci]);
|
||||
|
||||
config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
|
||||
|
||||
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[0]=nr_dci_size(dci_formats[0],rnti_types[0],pdcch_pdu_rel15->BWPSize);
|
||||
fill_dci_pdu_rel15(pdcch_pdu_rel15,&dci_pdu_rel15[0],dci_formats,rnti_types,pdcch_pdu_rel15->BWPSize);
|
||||
|
||||
if (ret < 0) {
|
||||
LOG_I(MAC,"CCE list not empty, couldn't schedule PUSCH\n");
|
||||
UL_tti_req->n_pdus-=1;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
|
||||
config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
|
||||
fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,29 +129,9 @@ static inline uint8_t get_max_cces(uint8_t scs) {
|
||||
return (nr_max_number_of_cces_per_slot[scs]);
|
||||
}
|
||||
|
||||
int find_aggregation_level (NR_SearchSpace_t *ss){
|
||||
|
||||
int level = 0;
|
||||
|
||||
if( ss->nrofCandidates->aggregationLevel1 != NR_SearchSpace__nrofCandidates__aggregationLevel1_n0)
|
||||
level = 1;
|
||||
if( ss->nrofCandidates->aggregationLevel2 != NR_SearchSpace__nrofCandidates__aggregationLevel2_n0)
|
||||
level = 2;
|
||||
if( ss->nrofCandidates->aggregationLevel4 != NR_SearchSpace__nrofCandidates__aggregationLevel4_n0)
|
||||
level = 4;
|
||||
if( ss->nrofCandidates->aggregationLevel8 != NR_SearchSpace__nrofCandidates__aggregationLevel8_n0)
|
||||
level = 8;
|
||||
if( ss->nrofCandidates->aggregationLevel16 != NR_SearchSpace__nrofCandidates__aggregationLevel16_n0)
|
||||
level = 16;
|
||||
|
||||
AssertFatal(level!=0,"Unable to find aggregation level");
|
||||
return level;
|
||||
|
||||
}
|
||||
|
||||
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
int bwp_id,
|
||||
int coreset_id,
|
||||
int list_id,
|
||||
int aggregation,
|
||||
int search_space, // 0 common, 1 ue-specific
|
||||
int UE_id,
|
||||
@@ -172,15 +152,15 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
|
||||
if (search_space == 1) {
|
||||
coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[coreset_id];
|
||||
coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[list_id];
|
||||
}
|
||||
else {
|
||||
coreset = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
|
||||
}
|
||||
|
||||
int coreset_id = coreset->controlResourceSetId;
|
||||
int *cce_list = nr_mac->cce_list[bwp_id][coreset_id];
|
||||
|
||||
|
||||
int n_rb=0;
|
||||
for (int i=0;i<6;i++)
|
||||
for (int j=0;j<8;j++) {
|
||||
@@ -202,7 +182,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
}
|
||||
int first_cce = aggregation * (( Y + (m*N_cce)/(aggregation*M_s_max) + n_CI ) % CEILIDIV(N_cce,aggregation));
|
||||
|
||||
for (int i=0;i<aggregation;i++)
|
||||
for (int i=0;i<aggregation;i++)
|
||||
if (cce_list[first_cce+i] != 0) return(-1);
|
||||
|
||||
for (int i=0;i<aggregation;i++) cce_list[first_cce+i] = 1;
|
||||
@@ -429,12 +409,16 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
|
||||
}
|
||||
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
int ss_type,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp){
|
||||
|
||||
int nr_configure_pdcch(gNB_MAC_INST *nr_mac,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
uint16_t rnti,
|
||||
int ss_type,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp){
|
||||
|
||||
int CCEIndex = -1;
|
||||
int cid = 0;
|
||||
NR_ControlResourceSet_t *coreset = NULL;
|
||||
|
||||
if (bwp) { // This is not the InitialBWP
|
||||
@@ -455,6 +439,7 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
temp_coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[i];
|
||||
if (coresetid==temp_coreset->controlResourceSetId) {
|
||||
coreset = temp_coreset;
|
||||
cid = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -466,7 +451,6 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdcch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pdcch_pdu->CyclicPrefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
|
||||
|
||||
// first symbol
|
||||
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
||||
@@ -490,6 +474,7 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
|
||||
for (int i=0;i<6;i++)
|
||||
pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i];
|
||||
|
||||
|
||||
//cce-REG-MappingType
|
||||
pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved?
|
||||
@@ -511,17 +496,45 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
|
||||
//precoderGranularity
|
||||
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
||||
|
||||
if (ss_type) {
|
||||
for (int i=0;i<pdcch_pdu->numDlDci;i++) {
|
||||
//pdcch-DMRS-ScramblingID
|
||||
AssertFatal(coreset->pdcch_DMRS_ScramblingID != NULL,"coreset0->pdcch_DMRS_ScramblingID is null\n");
|
||||
pdcch_pdu->dci_pdu.ScramblingId[i] = *coreset->pdcch_DMRS_ScramblingID;
|
||||
}
|
||||
|
||||
pdcch_pdu->dci_pdu.RNTI[pdcch_pdu->numDlDci]=rnti;
|
||||
|
||||
if (coreset->pdcch_DMRS_ScramblingID != NULL &&
|
||||
ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *coreset->pdcch_DMRS_ScramblingID;
|
||||
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=rnti;
|
||||
}
|
||||
else {
|
||||
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *scc->physCellId;
|
||||
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=0;
|
||||
}
|
||||
|
||||
}
|
||||
uint8_t nr_of_candidates,aggregation_level;
|
||||
find_aggregation_candidates(&aggregation_level,
|
||||
&nr_of_candidates,
|
||||
ss);
|
||||
|
||||
CCEIndex = allocate_nr_CCEs(nr_mac,
|
||||
1, // bwp_id
|
||||
cid,
|
||||
aggregation_level,
|
||||
ss->searchSpaceType->present-1, // search_space, 0 common, 1 ue-specific
|
||||
0, // UE-id
|
||||
0); // m
|
||||
|
||||
if (CCEIndex<0)
|
||||
return (CCEIndex);
|
||||
|
||||
pdcch_pdu->dci_pdu.AggregationLevel[pdcch_pdu->numDlDci] = aggregation_level;
|
||||
pdcch_pdu->dci_pdu.CceIndex[pdcch_pdu->numDlDci] = CCEIndex;
|
||||
|
||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats==NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0)
|
||||
pdcch_pdu->dci_pdu.beta_PDCCH_1_0[pdcch_pdu->numDlDci]=0;
|
||||
|
||||
pdcch_pdu->dci_pdu.powerControlOffsetSS[pdcch_pdu->numDlDci]=1;
|
||||
pdcch_pdu->numDlDci++;
|
||||
return (0);
|
||||
}
|
||||
else { // this is for InitialBWP
|
||||
AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n");
|
||||
}
|
||||
@@ -713,25 +726,91 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
}
|
||||
|
||||
|
||||
void prepare_dci(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
nr_dci_format_t format,
|
||||
int bwp_id) {
|
||||
|
||||
void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int *dci_formats,
|
||||
int *rnti_types,
|
||||
int N_RB) {
|
||||
|
||||
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
|
||||
switch(format) {
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
// format indicator
|
||||
dci_pdu_rel15->format_indicator = 1;
|
||||
// carrier indicator
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig != NULL)
|
||||
AssertFatal(1==0,"Cross Carrier Scheduling Config currently not supported\n");
|
||||
//vrb to prb mapping
|
||||
if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver==NULL)
|
||||
dci_pdu_rel15->vrb_to_prb_mapping.val = 0;
|
||||
else
|
||||
dci_pdu_rel15->vrb_to_prb_mapping.val = 1;
|
||||
//bundling size indicator
|
||||
if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present == NR_PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
|
||||
AssertFatal(1==0,"Dynamic PRB bundling type currently not supported\n");
|
||||
//rate matching indicator
|
||||
uint16_t msb = (bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1==NULL)?0:1;
|
||||
uint16_t lsb = (bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2==NULL)?0:1;
|
||||
dci_pdu_rel15->rate_matching_indicator.val = lsb | (msb<<1);
|
||||
// aperiodic ZP CSI-RS trigger
|
||||
if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList != NULL)
|
||||
AssertFatal(1==0,"Aperiodic ZP CSI-RS currently not supported\n");
|
||||
// transmission configuration indication
|
||||
if (bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI != NULL)
|
||||
AssertFatal(1==0,"TCI in DCI currently not supported\n");
|
||||
//srs resource set
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching!=NULL) {
|
||||
NR_SRS_CarrierSwitching_t *cs = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching->choice.setup;
|
||||
if (cs->srs_TPC_PDCCH_Group!=NULL){
|
||||
switch(cs->srs_TPC_PDCCH_Group->present) {
|
||||
case NR_SRS_CarrierSwitching__srs_TPC_PDCCH_Group_PR_NOTHING:
|
||||
dci_pdu_rel15->srs_request.val = 0;
|
||||
break;
|
||||
case NR_SRS_CarrierSwitching__srs_TPC_PDCCH_Group_PR_typeA:
|
||||
AssertFatal(1==0,"SRS TPC PRCCH group type A currently not supported\n");
|
||||
break;
|
||||
case NR_SRS_CarrierSwitching__srs_TPC_PDCCH_Group_PR_typeB:
|
||||
AssertFatal(1==0,"SRS TPC PRCCH group type B currently not supported\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
dci_pdu_rel15->srs_request.val = 0;
|
||||
}
|
||||
else
|
||||
dci_pdu_rel15->srs_request.val = 0;
|
||||
// CBGTI and CBGFI
|
||||
if (secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL)
|
||||
AssertFatal(1==0,"CBG transmission currently not supported\n");
|
||||
// dmrs sequence initialization
|
||||
dci_pdu_rel15->dmrs_sequence_initialization = 0; // FIXME no information on what this bit should be in 38.212
|
||||
break;
|
||||
default :
|
||||
AssertFatal(1==0,"Prepare dci currently only implemented for 1_1 \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fill_dci_pdu_rel15(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int *dci_formats,
|
||||
int *rnti_types,
|
||||
int N_RB,
|
||||
int bwp_id) {
|
||||
|
||||
uint8_t fsize=0, pos=0;
|
||||
|
||||
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
||||
|
||||
uint64_t *dci_pdu = (uint64_t *)pdcch_pdu_rel15->dci_pdu.Payload[d];
|
||||
int dci_size = nr_dci_size(secondaryCellGroup,&dci_pdu_rel15[d],dci_formats[d],rnti_types[d],N_RB,bwp_id);
|
||||
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = dci_size;
|
||||
AssertFatal(pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d]<=64, "DCI sizes above 64 bits not yet supported");
|
||||
|
||||
int dci_size = pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d];
|
||||
|
||||
*dci_pdu=0;
|
||||
|
||||
if(dci_formats[d]==NR_DL_DCI_FORMAT_1_1)
|
||||
prepare_dci(secondaryCellGroup,&dci_pdu_rel15[d],dci_formats[d],bwp_id);
|
||||
|
||||
/// Payload generation
|
||||
switch(dci_formats[d]) {
|
||||
case NR_DL_DCI_FORMAT_1_0:
|
||||
@@ -740,23 +819,17 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos=fsize;
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment&((1<<fsize)-1)) << (dci_size-pos));
|
||||
#ifdef DEBUG_FILL_DCI
|
||||
LOG_I(MAC,"frequency-domain assignment %d (%d bits) N_RB_BWP %d=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment,fsize,N_RB,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val&((1<<fsize)-1)) << (dci_size-pos));
|
||||
LOG_D(MAC,"frequency-domain assignment %d (%d bits) N_RB_BWP %d=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment.val,fsize,N_RB,dci_size-pos,*dci_pdu);
|
||||
// Time domain assignment
|
||||
pos+=4;
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment&0xf) << (dci_size-pos));
|
||||
#ifdef DEBUG_FILL_DCI
|
||||
LOG_I(MAC,"time-domain assignment %d (4 bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val&0xf) << (dci_size-pos));
|
||||
LOG_D(MAC,"time-domain assignment %d (3 bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment.val,dci_size-pos,*dci_pdu);
|
||||
// VRB to PRB mapping
|
||||
|
||||
pos++;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping&0x1)<<(dci_size-pos);
|
||||
#ifdef DEBUG_FILL_DCI
|
||||
LOG_I(MAC,"vrb to prb mapping %d (1 bits)=> %d (0x%lx)\n",dci_pdu_rel15->vrb_to_prb_mapping,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&0x1)<<(dci_size-pos);
|
||||
LOG_D(MAC,"vrb to prb mapping %d (1 bits)=> %d (0x%lx)\n",dci_pdu_rel15->vrb_to_prb_mapping.val,dci_size-pos,*dci_pdu);
|
||||
// MCS
|
||||
pos+=5;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs&0x1f)<<(dci_size-pos);
|
||||
@@ -781,13 +854,13 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment (275rb >> fsize = 16)
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment&((1<<fsize)-1)) << (dci_size-pos));
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val&((1<<fsize)-1)) << (dci_size-pos));
|
||||
|
||||
LOG_D(MAC,"Freq domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment,fsize,dci_size-pos,*dci_pdu);
|
||||
LOG_D(MAC,"Freq domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment.val,fsize,dci_size-pos,*dci_pdu);
|
||||
|
||||
uint16_t is_ra = 1;
|
||||
for (int i=0; i<fsize; i++)
|
||||
if (!((dci_pdu_rel15->frequency_domain_assignment>>i)&1)) {
|
||||
if (!((dci_pdu_rel15->frequency_domain_assignment.val>>i)&1)) {
|
||||
is_ra = 0;
|
||||
break;
|
||||
}
|
||||
@@ -799,7 +872,7 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
|
||||
// UL/SUL indicator 1 bit
|
||||
pos++;
|
||||
*dci_pdu |= (dci_pdu_rel15->ul_sul_indicator&1)<<(dci_size-pos);
|
||||
*dci_pdu |= (dci_pdu_rel15->ul_sul_indicator.val&1)<<(dci_size-pos);
|
||||
|
||||
// SS/PBCH index 6 bits
|
||||
pos+=6;
|
||||
@@ -816,13 +889,13 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Time domain assignment 4bit
|
||||
|
||||
pos+=4;
|
||||
*dci_pdu |= ((dci_pdu_rel15->time_domain_assignment&0xf) << (dci_size-pos));
|
||||
LOG_D(MAC,"Time domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment,4,dci_size-pos,*dci_pdu);
|
||||
*dci_pdu |= ((dci_pdu_rel15->time_domain_assignment.val&0xf) << (dci_size-pos));
|
||||
LOG_D(MAC,"Time domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment.val,4,dci_size-pos,*dci_pdu);
|
||||
|
||||
// VRB to PRB mapping 1bit
|
||||
pos++;
|
||||
*dci_pdu |= (dci_pdu_rel15->vrb_to_prb_mapping&1)<<(dci_size-pos);
|
||||
LOG_D(MAC,"VRB to PRB %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->vrb_to_prb_mapping,1,dci_size-pos,*dci_pdu);
|
||||
*dci_pdu |= (dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos);
|
||||
LOG_D(MAC,"VRB to PRB %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->vrb_to_prb_mapping.val,1,dci_size-pos,*dci_pdu);
|
||||
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
pos+=5;
|
||||
@@ -846,8 +919,8 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
|
||||
// Downlink assignment index 2bit
|
||||
pos+=2;
|
||||
*dci_pdu |= ((dci_pdu_rel15->dai&3)<<(dci_size-pos));
|
||||
LOG_D(MAC,"DAI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->dai,2,dci_size-pos,*dci_pdu);
|
||||
*dci_pdu |= ((dci_pdu_rel15->dai[0].val&3)<<(dci_size-pos));
|
||||
LOG_D(MAC,"DAI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->dai[0].val,2,dci_size-pos,*dci_pdu);
|
||||
|
||||
// TPC command for scheduled PUCCH 2bit
|
||||
pos+=2;
|
||||
@@ -861,8 +934,8 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
|
||||
// PDSCH-to-HARQ_feedback timing indicator 3bit
|
||||
pos+=3;
|
||||
*dci_pdu |= ((dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator&0x7)<<(dci_size-pos));
|
||||
LOG_D(MAC,"PDSCH to HARQ TI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator,3,dci_size-pos,*dci_pdu);
|
||||
*dci_pdu |= ((dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val&0x7)<<(dci_size-pos));
|
||||
LOG_D(MAC,"PDSCH to HARQ TI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val,3,dci_size-pos,*dci_pdu);
|
||||
|
||||
} //end else
|
||||
break;
|
||||
@@ -878,12 +951,12 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
for (int i=0; i<fsize; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
// Time domain assignment 4 bit
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||
// VRB to PRB mapping 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
||||
// MCS 5 bit
|
||||
for (int i=0; i<5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||
@@ -899,12 +972,12 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
for (int i=0; i<fsize; i++)
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
// Time domain assignment 4 bit
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||
// VRB to PRB mapping 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
for (int i=0; i<5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||
@@ -920,12 +993,12 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment 0-16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
for (int i=0; i<fsize; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
// Time domain assignment 4 bit
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||
// VRB to PRB mapping 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++);
|
||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||
for (int i=0; i<5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||
@@ -940,7 +1013,7 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
|
||||
// Downlink assignment index – 2 bits
|
||||
for (int i=0; i<2; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->dai>>(1-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->dai[0].val>>(1-i))&1)<<(dci_size-pos++);
|
||||
|
||||
// TPC command for scheduled PUCCH – 2 bits
|
||||
for (int i=0; i<2; i++)
|
||||
@@ -953,7 +1026,7 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
|
||||
// PDSCH-to-HARQ_feedback timing indicator – 3 bits
|
||||
for (int i=0; i<3; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator>>(2-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val>>(2-i))&1)<<(dci_size-pos++);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -968,12 +1041,12 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment max 16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
for (int i=0; i<fsize; i++)
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
// Time domain assignment 4bit
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||
// Frequency hopping flag – 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val&1)<<(dci_size-pos++);
|
||||
// MCS 5 bit
|
||||
for (int i=0; i<5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||
@@ -997,7 +1070,7 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// UL/SUL indicator – 1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ul_sul_indicator&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ul_sul_indicator.val&1)<<(dci_size-pos++);
|
||||
*/
|
||||
break;
|
||||
|
||||
@@ -1008,12 +1081,12 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
// Freq domain assignment max 16 bit
|
||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
for (int i=0; i<fsize; i++)
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++);
|
||||
// Time domain assignment 4bit
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++);
|
||||
// Frequency hopping flag – 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val&1)<<(dci_size-pos++);
|
||||
// MCS 5 bit
|
||||
for (int i=0; i<5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++);
|
||||
@@ -1038,12 +1111,119 @@ void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
/*
|
||||
commented for now (RK): need to get this information from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ul_sul_indicator&1)<<(dci_size-pos++);
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ul_sul_indicator.val&1)<<(dci_size-pos++);
|
||||
*/
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
// Indicating a DL DCI format 1bit
|
||||
pos=1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator&0x1)<<(dci_size-pos);
|
||||
|
||||
// Carrier indicator
|
||||
pos+=dci_pdu_rel15->carrier_indicator.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->carrier_indicator.val&((1<<dci_pdu_rel15->carrier_indicator.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// BWP indicator
|
||||
pos+=dci_pdu_rel15->bwp_indicator.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->bwp_indicator.val&((1<<dci_pdu_rel15->bwp_indicator.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// Frequency domain resource assignment
|
||||
pos+=dci_pdu_rel15->frequency_domain_assignment.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val&((1<<dci_pdu_rel15->frequency_domain_assignment.nbits)-1)) << (dci_size-pos);
|
||||
|
||||
// Time domain resource assignment
|
||||
pos+=dci_pdu_rel15->time_domain_assignment.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->time_domain_assignment.val&((1<<dci_pdu_rel15->time_domain_assignment.nbits)-1)) << (dci_size-pos);
|
||||
|
||||
// VRB-to-PRB mapping
|
||||
pos+=dci_pdu_rel15->vrb_to_prb_mapping.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&((1<<dci_pdu_rel15->vrb_to_prb_mapping.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// PRB bundling size indicator
|
||||
pos+=dci_pdu_rel15->prb_bundling_size_indicator.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->prb_bundling_size_indicator.val&((1<<dci_pdu_rel15->prb_bundling_size_indicator.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// Rate matching indicator
|
||||
pos+=dci_pdu_rel15->rate_matching_indicator.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->rate_matching_indicator.val&((1<<dci_pdu_rel15->rate_matching_indicator.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// ZP CSI-RS trigger
|
||||
pos+=dci_pdu_rel15->zp_csi_rs_trigger.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->zp_csi_rs_trigger.val&((1<<dci_pdu_rel15->zp_csi_rs_trigger.nbits)-1)) << (dci_size-pos);
|
||||
|
||||
//TB1
|
||||
// MCS 5bit
|
||||
pos+=5;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs&0x1f)<<(dci_size-pos);
|
||||
|
||||
// New data indicator 1bit
|
||||
pos+=1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi&0x1)<<(dci_size-pos);
|
||||
|
||||
// Redundancy version 2bit
|
||||
pos+=2;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->rv&0x3)<<(dci_size-pos);
|
||||
|
||||
//TB2
|
||||
// MCS 5bit
|
||||
pos+=dci_pdu_rel15->mcs2.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs2.val&((1<<dci_pdu_rel15->mcs2.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// New data indicator 1bit
|
||||
pos+=dci_pdu_rel15->ndi2.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi2.val&((1<<dci_pdu_rel15->ndi2.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// Redundancy version 2bit
|
||||
pos+=dci_pdu_rel15->rv2.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->rv2.val&((1<<dci_pdu_rel15->rv2.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// HARQ process number 4bit
|
||||
pos+=4;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid&0xf)<<(dci_size-pos);
|
||||
|
||||
// Downlink assignment index
|
||||
pos+=dci_pdu_rel15->dai[0].nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->dai[0].val&((1<<dci_pdu_rel15->dai[0].nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// TPC command for scheduled PUCCH 2bit
|
||||
pos+=2;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->tpc&0x3)<<(dci_size-pos);
|
||||
|
||||
// PUCCH resource indicator 3bit
|
||||
pos+=3;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->pucch_resource_indicator&0x7)<<(dci_size-pos);
|
||||
|
||||
// PDSCH-to-HARQ_feedback timing indicator
|
||||
pos+=dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val&((1<<dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// Antenna ports
|
||||
pos+=dci_pdu_rel15->antenna_ports.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->antenna_ports.val&((1<<dci_pdu_rel15->antenna_ports.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// TCI
|
||||
pos+=dci_pdu_rel15->transmission_configuration_indication.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->transmission_configuration_indication.val&((1<<dci_pdu_rel15->transmission_configuration_indication.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// SRS request
|
||||
pos+=dci_pdu_rel15->srs_request.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->srs_request.val&((1<<dci_pdu_rel15->srs_request.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// CBG transmission information
|
||||
pos+=dci_pdu_rel15->cbgti.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->cbgti.val&((1<<dci_pdu_rel15->cbgti.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// CBG flushing out information
|
||||
pos+=dci_pdu_rel15->cbgfi.nbits;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->cbgfi.val&((1<<dci_pdu_rel15->cbgfi.nbits)-1))<<(dci_size-pos);
|
||||
|
||||
// DMRS sequence init
|
||||
pos+=1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->dmrs_sequence_initialization&0x1)<<(dci_size-pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1148,6 +1328,11 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
|
||||
int UE_id;
|
||||
int i;
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[mod_idP]->UE_list;
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[mod_idP]->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
int num_slots_ul = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols>0)
|
||||
num_slots_ul++;
|
||||
LOG_I(MAC, "[gNB %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",
|
||||
mod_idP,
|
||||
rntiP,
|
||||
@@ -1166,6 +1351,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
|
||||
memset((void *) &UE_list->UE_sched_ctrl[UE_id],
|
||||
0,
|
||||
sizeof(NR_UE_sched_ctrl_t));
|
||||
UE_list->UE_sched_ctrl[UE_id].sched_pucch = (NR_sched_pucch *)malloc(num_slots_ul*sizeof(NR_sched_pucch));
|
||||
LOG_I(MAC, "gNB %d] Add NR UE_id %d : rnti %x\n",
|
||||
mod_idP,
|
||||
UE_id,
|
||||
@@ -1182,7 +1368,6 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int UE_id,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type,
|
||||
@@ -1202,48 +1387,51 @@ void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
pdsch_to_harq_feedback[i] = i+1;
|
||||
}
|
||||
else {
|
||||
|
||||
// searching for a ue specific search space
|
||||
int found=0;
|
||||
|
||||
|
||||
for (int i=0;i<bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) {
|
||||
ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i];
|
||||
AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n");
|
||||
AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n");
|
||||
if (ss->searchSpaceType->present == ss_type) {
|
||||
found=1;
|
||||
break;
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AssertFatal(found==1,"Couldn't find a ue specific searchspace\n");
|
||||
|
||||
|
||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0) {
|
||||
for (int i=0; i<8; i++)
|
||||
pdsch_to_harq_feedback[i] = i+1;
|
||||
}
|
||||
else {
|
||||
if(ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK != NULL)
|
||||
pdsch_to_harq_feedback = (uint8_t *)ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK;
|
||||
if(ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK != NULL) {
|
||||
for (int i=0; i<8; i++)
|
||||
pdsch_to_harq_feedback[i] = *ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[i];
|
||||
}
|
||||
else
|
||||
AssertFatal(found==1,"There is no allocated dl_DataToUL_ACK for pdsch to harq feedback\n");
|
||||
AssertFatal(0==1,"There is no allocated dl_DataToUL_ACK for pdsch to harq feedback\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// function to update pucch scheduling parameters in UE list when a USS DL is scheduled
|
||||
void nr_update_pucch_scheduling(int Mod_idP,
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
int slots_per_tdd,
|
||||
NR_sched_pucch *sched_pucch) {
|
||||
int *pucch_id) {
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
||||
int first_ul_slot_tdd,k;
|
||||
NR_sched_pucch *curr_pucch;
|
||||
int first_ul_slot_tdd,k,i;
|
||||
uint8_t pdsch_to_harq_feedback[8];
|
||||
int found = 0;
|
||||
int i = 0;
|
||||
int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0)
|
||||
nr_ulmix_slots++;
|
||||
@@ -1252,98 +1440,59 @@ void nr_update_pucch_scheduling(int Mod_idP,
|
||||
NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback);
|
||||
|
||||
// if the list of pucch to be scheduled is empty
|
||||
if (UE_list->UE_sched_ctrl[UE_id].sched_pucch == NULL) {
|
||||
sched_pucch->frame = frameP;
|
||||
sched_pucch->next_sched_pucch = NULL;
|
||||
sched_pucch->dai_c = 1;
|
||||
sched_pucch->resource_indicator = 0; // in phytest with only 1 UE we are using just the 1st resource
|
||||
if ( nr_ulmix_slots > 0 ) {
|
||||
// for each possible ul or mixed slot
|
||||
for (k=0; k<nr_ulmix_slots; k++) {
|
||||
curr_pucch = &UE_list->UE_sched_ctrl[UE_id].sched_pucch[k];
|
||||
// if there is free room in current pucch structure
|
||||
if (curr_pucch->dai_c<MAX_ACK_BITS) {
|
||||
curr_pucch->frame = frameP;
|
||||
curr_pucch->dai_c++;
|
||||
curr_pucch->resource_indicator = 0; // in phytest with only 1 UE we are using just the 1st resource
|
||||
// first pucch occasion in first UL or MIXED slot
|
||||
first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots;
|
||||
for (k=0; k<nr_ulmix_slots; k++) { // for each possible UL or mixed slot
|
||||
while (i<8 && found == 0) { // look if timing indicator is among allowed values
|
||||
if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd))
|
||||
found = 1;
|
||||
if (found == 0) i++;
|
||||
}
|
||||
if (found == 1) break;
|
||||
}
|
||||
if (found == 1) {
|
||||
// computing slot in which pucch is scheduled
|
||||
sched_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd));
|
||||
sched_pucch->timing_indicator = pdsch_to_harq_feedback[i];
|
||||
}
|
||||
else
|
||||
AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n");
|
||||
}
|
||||
else
|
||||
AssertFatal(1==0,"No Uplink Slots in this Frame\n");
|
||||
|
||||
UE_list->UE_sched_ctrl[UE_id].sched_pucch = sched_pucch;
|
||||
}
|
||||
else { // to be tested
|
||||
curr_pucch = UE_list->UE_sched_ctrl[UE_id].sched_pucch;
|
||||
if (curr_pucch->dai_c<MAX_ACK_BITS) { // we are scheduling at most MAX_UCI_BITS harq-ack in the same pucch
|
||||
while (i<8 && found == 0) { // look if timing indicator is among allowed values for current pucch
|
||||
if (pdsch_to_harq_feedback[i]==(curr_pucch->ul_slot % slots_per_tdd)-(slotP % slots_per_tdd))
|
||||
i = 0;
|
||||
while (i<8 && found == 0) { // look if timing indicator is among allowed values
|
||||
if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd))
|
||||
found = 1;
|
||||
if (found == 0) i++;
|
||||
}
|
||||
if (found == 1) { // scheduling this harq-ack in current pucch
|
||||
sched_pucch = curr_pucch;
|
||||
sched_pucch->dai_c = 1 + sched_pucch->dai_c;
|
||||
sched_pucch->timing_indicator = pdsch_to_harq_feedback[i];
|
||||
}
|
||||
}
|
||||
if (curr_pucch->dai_c==MAX_ACK_BITS || found == 0) { // if current pucch is full or no timing indicator allowed
|
||||
// look for pucch occasions in other UL of mixed slots
|
||||
for (k=scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; k<slots_per_tdd; k++) { // for each possible UL or mixed slot
|
||||
if (k!=(curr_pucch->ul_slot % slots_per_tdd)) { // skip current scheduled slot (already checked)
|
||||
i = 0;
|
||||
while (i<8 && found == 0) { // look if timing indicator is among allowed values
|
||||
if (pdsch_to_harq_feedback[i]==k-(slotP % slots_per_tdd))
|
||||
found = 1;
|
||||
if (found == 0) i++;
|
||||
}
|
||||
if (found == 1) {
|
||||
if (k<(curr_pucch->ul_slot % slots_per_tdd)) { // we need to add a pucch occasion before current pucch
|
||||
sched_pucch->frame = frameP;
|
||||
sched_pucch->ul_slot = k + (slotP - (slotP % slots_per_tdd));
|
||||
sched_pucch->next_sched_pucch = curr_pucch;
|
||||
sched_pucch->dai_c = 1;
|
||||
sched_pucch->resource_indicator = 0; // in phytest with only 1 UE we are using just the 1st resource
|
||||
sched_pucch->timing_indicator = pdsch_to_harq_feedback[i];
|
||||
UE_list->UE_sched_ctrl[UE_id].sched_pucch = sched_pucch;
|
||||
}
|
||||
else {
|
||||
while (curr_pucch->next_sched_pucch != NULL && k!=(curr_pucch->ul_slot % slots_per_tdd))
|
||||
curr_pucch = curr_pucch->next_sched_pucch;
|
||||
if (curr_pucch == NULL) { // creating a new item in the list
|
||||
sched_pucch->frame = frameP;
|
||||
sched_pucch->next_sched_pucch = NULL;
|
||||
sched_pucch->dai_c = 1;
|
||||
sched_pucch->timing_indicator = pdsch_to_harq_feedback[i];
|
||||
sched_pucch->resource_indicator = 0; // in phytest with only 1 UE we are using just the 1st resource
|
||||
sched_pucch->ul_slot = k + (slotP - (slotP % slots_per_tdd));
|
||||
curr_pucch->next_sched_pucch = (NR_sched_pucch*) malloc(sizeof(NR_sched_pucch));
|
||||
curr_pucch->next_sched_pucch = sched_pucch;
|
||||
}
|
||||
else {
|
||||
if (curr_pucch->dai_c==MAX_ACK_BITS)
|
||||
found = 0; // if pucch at index k is already full we have to find a new one in a following occasion
|
||||
else { // scheduling this harq-ack in current pucch
|
||||
sched_pucch = curr_pucch;
|
||||
sched_pucch->dai_c = 1 + sched_pucch->dai_c;
|
||||
sched_pucch->timing_indicator = pdsch_to_harq_feedback[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == 1) {
|
||||
// computing slot in which pucch is scheduled
|
||||
curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd));
|
||||
curr_pucch->timing_indicator = i; // index in the list of timing indicators
|
||||
*pucch_id = k;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n");
|
||||
}
|
||||
|
||||
|
||||
void find_aggregation_candidates(uint8_t *aggregation_level,
|
||||
uint8_t *nr_of_candidates,
|
||||
NR_SearchSpace_t *ss) {
|
||||
|
||||
if (ss->nrofCandidates->aggregationLevel1 != NR_SearchSpace__nrofCandidates__aggregationLevel1_n0) {
|
||||
*aggregation_level = 1;
|
||||
*nr_of_candidates = ss->nrofCandidates->aggregationLevel1;
|
||||
}
|
||||
if (ss->nrofCandidates->aggregationLevel2 != NR_SearchSpace__nrofCandidates__aggregationLevel2_n0) {
|
||||
*aggregation_level = 2;
|
||||
*nr_of_candidates = ss->nrofCandidates->aggregationLevel2;
|
||||
}
|
||||
if (ss->nrofCandidates->aggregationLevel4 != NR_SearchSpace__nrofCandidates__aggregationLevel4_n0) {
|
||||
*aggregation_level = 4;
|
||||
*nr_of_candidates = ss->nrofCandidates->aggregationLevel4;
|
||||
}
|
||||
if (ss->nrofCandidates->aggregationLevel8 != NR_SearchSpace__nrofCandidates__aggregationLevel8_n0) {
|
||||
*aggregation_level = 8;
|
||||
*nr_of_candidates = ss->nrofCandidates->aggregationLevel8;
|
||||
}
|
||||
if (ss->nrofCandidates->aggregationLevel16 != NR_SearchSpace__nrofCandidates__aggregationLevel16_n0) {
|
||||
*aggregation_level = 16;
|
||||
*nr_of_candidates = ss->nrofCandidates->aggregationLevel16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -306,5 +306,20 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
nr_process_mac_pdu(gnb_mod_idP, CC_idP, frameP, sduP, sdu_lenP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// random access pusch with TC-RNTI
|
||||
if (sduP != NULL) { // if the CRC passed
|
||||
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||
if (UE_list->active[i] == TRUE) {
|
||||
if (UE_list->tc_rnti[i] == current_rnti) {
|
||||
// for now the only thing we are doing is set the UE as 5G connected
|
||||
UE_list->fiveG_connected[i] = true;
|
||||
LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly and UE_id %d is now 5G connected\n",
|
||||
gnb_mod_idP, current_rnti, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
sub_frame_t subframeP);
|
||||
|
||||
int configure_fapi_dl_pdu(int Mod_id,
|
||||
int *CCEIndeces,
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||
NR_sched_pucch *pucch_sched,
|
||||
uint8_t *mcsIndex,
|
||||
@@ -158,7 +157,7 @@ void nr_update_pucch_scheduling(int Mod_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
int slots_per_tdd,
|
||||
NR_sched_pucch *sched_pucch);
|
||||
int *pucch_id);
|
||||
|
||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int UE_id,
|
||||
@@ -183,6 +182,7 @@ int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space,
|
||||
uint16_t slot,
|
||||
nfapi_nr_config_request_scf_t cfg);
|
||||
*/
|
||||
|
||||
void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Uplink_t *bwp,
|
||||
@@ -190,17 +190,35 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
uint16_t O_uci,
|
||||
uint16_t O_ack,
|
||||
uint8_t SR_flag);
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
int ss_type,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp);
|
||||
|
||||
void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
void find_search_space(int ss_type,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
NR_SearchSpace_t *ss);
|
||||
|
||||
int nr_configure_pdcch(gNB_MAC_INST *nr_mac,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
uint16_t rnti,
|
||||
int ss_type,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp);
|
||||
|
||||
void fill_dci_pdu_rel15(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int *dci_formats,
|
||||
int *rnti_types,
|
||||
int N_RB);
|
||||
int N_RB,
|
||||
int bwp_id);
|
||||
|
||||
void prepare_dci(NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
nr_dci_format_t format,
|
||||
int bwp_id);
|
||||
|
||||
void find_aggregation_candidates(uint8_t *aggregation_level,
|
||||
uint8_t *nr_of_candidates,
|
||||
NR_SearchSpace_t *ss);
|
||||
|
||||
int get_spf(nfapi_nr_config_request_scf_t *cfg);
|
||||
|
||||
@@ -208,7 +226,7 @@ int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot);
|
||||
|
||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead,
|
||||
uint8_t nodata_dmrs,
|
||||
uint8_t numdmrscdmgroupnodata,
|
||||
uint8_t tb_scaling);
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
@@ -263,7 +281,6 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
|
||||
void nr_schedule_reception_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP);
|
||||
|
||||
int find_aggregation_level (NR_SearchSpace_t *ss);
|
||||
|
||||
void nr_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
|
||||
@@ -113,6 +113,11 @@ void mac_top_init_gNB(void)
|
||||
UE_list->next[list_el] = list_el + 1;
|
||||
UE_list->next_ul[list_el] = list_el + 1;
|
||||
UE_list->active[list_el] = FALSE;
|
||||
for (int list_harq = 0; list_harq < NR_MAX_NB_HARQ_PROCESSES; list_harq++) {
|
||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
|
||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
|
||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].is_waiting = 0;
|
||||
}
|
||||
}
|
||||
|
||||
UE_list->next[list_el] = -1;
|
||||
|
||||
@@ -251,9 +251,14 @@ typedef struct NR_sched_pucch {
|
||||
uint8_t dai_c;
|
||||
uint8_t timing_indicator;
|
||||
uint8_t resource_indicator;
|
||||
struct NR_sched_pucch *next_sched_pucch;
|
||||
} NR_sched_pucch;
|
||||
|
||||
typedef struct NR_UE_harq {
|
||||
uint8_t is_waiting;
|
||||
uint8_t ndi;
|
||||
uint8_t round;
|
||||
uint16_t feedback_slot;
|
||||
} NR_UE_harq_t;
|
||||
|
||||
/*! \brief scheduling control information set through an API */
|
||||
typedef struct {
|
||||
@@ -262,10 +267,17 @@ typedef struct {
|
||||
NR_sched_pucch *sched_pucch;
|
||||
uint16_t ta_timer;
|
||||
int16_t ta_update;
|
||||
uint8_t current_harq_pid;
|
||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||
int dummy;
|
||||
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information
|
||||
} NR_UE_sched_ctrl_t;
|
||||
|
||||
typedef struct NR_preamble_ue {
|
||||
uint8_t num_preambles;
|
||||
uint8_t *preamble_list;
|
||||
} NR_preamble_ue;
|
||||
|
||||
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
||||
typedef struct {
|
||||
DLSCH_PDU DLSCH_pdu[4][MAX_MOBILES_PER_GNB];
|
||||
@@ -278,7 +290,10 @@ typedef struct {
|
||||
int avail;
|
||||
int num_UEs;
|
||||
boolean_t active[MAX_MOBILES_PER_GNB];
|
||||
boolean_t fiveG_connected[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
rnti_t tc_rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_preamble_ue preambles[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_list_t;
|
||||
|
||||
@@ -348,65 +363,4 @@ typedef struct gNB_MAC_INST_s {
|
||||
int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE];
|
||||
} gNB_MAC_INST;
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t format_indicator; //1 bit
|
||||
uint16_t frequency_domain_assignment; //up to 16 bits
|
||||
uint8_t time_domain_assignment; // 4 bits
|
||||
uint8_t frequency_hopping_flag; //1 bit
|
||||
|
||||
uint8_t ra_preamble_index; //6 bits
|
||||
uint8_t ss_pbch_index; //6 bits
|
||||
uint8_t prach_mask_index; //4 bits
|
||||
|
||||
uint8_t vrb_to_prb_mapping; //0 or 1 bit
|
||||
uint8_t mcs; //5 bits
|
||||
uint8_t ndi; //1 bit
|
||||
uint8_t rv; //2 bits
|
||||
uint8_t harq_pid; //4 bits
|
||||
uint8_t dai; //0, 2 or 4 bits
|
||||
uint8_t dai1; //1 or 2 bits
|
||||
uint8_t dai2; //0 or 2 bits
|
||||
uint8_t tpc; //2 bits
|
||||
uint8_t pucch_resource_indicator; //3 bits
|
||||
uint8_t pdsch_to_harq_feedback_timing_indicator; //0, 1, 2 or 3 bits
|
||||
|
||||
uint8_t short_messages_indicator; //2 bits
|
||||
uint8_t short_messages; //8 bits
|
||||
uint8_t tb_scaling; //2 bits
|
||||
|
||||
uint8_t carrier_indicator; //0 or 3 bits
|
||||
uint8_t bwp_indicator; //0, 1 or 2 bits
|
||||
uint8_t prb_bundling_size_indicator; //0 or 1 bits
|
||||
uint8_t rate_matching_indicator; //0, 1 or 2 bits
|
||||
uint8_t zp_csi_rs_trigger; //0, 1 or 2 bits
|
||||
uint8_t transmission_configuration_indication; //0 or 3 bits
|
||||
uint8_t srs_request; //2 bits
|
||||
uint8_t cbgti; //CBG Transmission Information: 0, 2, 4, 6 or 8 bits
|
||||
uint8_t cbgfi; //CBG Flushing Out Information: 0 or 1 bit
|
||||
uint8_t dmrs_sequence_initialization; //0 or 1 bit
|
||||
|
||||
uint8_t srs_resource_indicator;
|
||||
uint8_t precoding_information;
|
||||
uint8_t csi_request;
|
||||
uint8_t ptrs_dmrs_association;
|
||||
uint8_t beta_offset_indicator; //0 or 2 bits
|
||||
|
||||
uint8_t slot_format_indicator_count;
|
||||
uint8_t *slot_format_indicators;
|
||||
|
||||
uint8_t pre_emption_indication_count;
|
||||
uint16_t *pre_emption_indications; //14 bit
|
||||
|
||||
uint8_t block_number_count;
|
||||
uint8_t *block_numbers;
|
||||
|
||||
uint8_t ul_sul_indicator; //0 or 1 bit
|
||||
uint8_t antenna_ports;
|
||||
|
||||
uint16_t reserved; //1_0/C-RNTI:10 bits, 1_0/P-RNTI: 6 bits, 1_0/SI-&RA-RNTI: 16 bits
|
||||
uint16_t padding;
|
||||
|
||||
} dci_pdu_rel15_t;
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
#define MAX_IF_MODULES 100
|
||||
|
||||
@@ -76,76 +77,60 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
|
||||
}
|
||||
|
||||
|
||||
void handle_nr_sr(NR_UL_IND_t *UL_info) {
|
||||
void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
// TODO
|
||||
int max_harq_rounds = 4; // TODO define macro
|
||||
int num_ucis = UL_info->uci_ind.num_ucis;
|
||||
nfapi_nr_uci_t *uci_list = UL_info->uci_ind.uci_list;
|
||||
|
||||
for (int i = 0; i < num_ucis; i++) {
|
||||
switch (uci_list[i].pdu_type) {
|
||||
case NFAPI_NR_UCI_PDCCH_PDU_TYPE: break;
|
||||
|
||||
/* if (nfapi_mode == 1) // PNF
|
||||
{
|
||||
if (UL_info->sr_ind.sr_indication_body.number_of_srs>0)
|
||||
{
|
||||
// oai_nfapi_sr_indication(&UL_info->sr_ind);
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||
if (get_softmodem_params()->phy_test == 0) {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1;
|
||||
// handle harq
|
||||
int harq_idx_s = 0;
|
||||
// iterate over received harq bits
|
||||
for (int harq_bit = 0; harq_bit < uci_pdu->harq->num_harq; harq_bit++) {
|
||||
// search for the right harq process
|
||||
for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) {
|
||||
if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) {
|
||||
if (uci_pdu->harq->harq_list[harq_bit].harq_value == 0)
|
||||
sched_ctrl->harq_processes[harq_idx].round++;
|
||||
if ((uci_pdu->harq->harq_list[harq_bit].harq_value == 1) ||
|
||||
(sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds)) {
|
||||
sched_ctrl->harq_processes[harq_idx].ndi ^= 1;
|
||||
sched_ctrl->harq_processes[harq_idx].round = 0;
|
||||
}
|
||||
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
|
||||
harq_idx_s = harq_idx + 1;
|
||||
break;
|
||||
}
|
||||
// if gNB fails to receive a ACK/NACK
|
||||
else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) &&
|
||||
(sched_ctrl->harq_processes[harq_idx].is_waiting)) {
|
||||
sched_ctrl->harq_processes[harq_idx].round++;
|
||||
if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) {
|
||||
sched_ctrl->harq_processes[harq_idx].ndi ^= 1;
|
||||
sched_ctrl->harq_processes[harq_idx].round = 0;
|
||||
}
|
||||
sched_ctrl->harq_processes[harq_idx].is_waiting = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
for (int i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++)
|
||||
SR_indication(UL_info->module_id,
|
||||
UL_info->CC_id,
|
||||
UL_info->frame,
|
||||
UL_info->slot,
|
||||
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti,
|
||||
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
UL_info->sr_ind.sr_indication_body.number_of_srs=0;*/
|
||||
UL_info->uci_ind.num_ucis = 0;
|
||||
}
|
||||
|
||||
void handle_nr_cqi(NR_UL_IND_t *UL_info) {
|
||||
|
||||
/*
|
||||
for (int i=0;i<UL_info->cqi_ind.number_of_cqis;i++)
|
||||
cqi_indication(UL_info->module_id,
|
||||
UL_info->CC_id,
|
||||
UL_info->frame,
|
||||
UL_info->slot,
|
||||
UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti,
|
||||
&UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
|
||||
UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
|
||||
&UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
|
||||
|
||||
UL_info->cqi_ind.number_of_cqis=0;*/
|
||||
|
||||
}
|
||||
|
||||
void handle_nr_harq(NR_UL_IND_t *UL_info) {
|
||||
/* if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) { // PNF
|
||||
//LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
|
||||
int retval = oai_nfapi_harq_indication(&UL_info->harq_ind);
|
||||
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval);
|
||||
}
|
||||
|
||||
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++)
|
||||
harq_indication(UL_info->module_id,
|
||||
UL_info->CC_id,
|
||||
NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf),
|
||||
NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf),
|
||||
&UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]);
|
||||
|
||||
UL_info->harq_ind.harq_indication_body.number_of_harqs=0;
|
||||
}*/
|
||||
}
|
||||
|
||||
void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
|
||||
if(nfapi_mode == 1) {
|
||||
@@ -245,9 +230,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
||||
// clear DL/UL info for new scheduling round
|
||||
clear_nr_nfapi_information(mac,CC_id,UL_info->frame,UL_info->slot);
|
||||
handle_nr_rach(UL_info);
|
||||
handle_nr_sr(UL_info);
|
||||
handle_nr_cqi(UL_info);
|
||||
handle_nr_harq(UL_info);
|
||||
handle_nr_uci(UL_info, &mac->UE_list.UE_sched_ctrl[0]);
|
||||
// clear HI prior to handling ULSCH
|
||||
mac->UL_dci_req[CC_id].numPdus = 0;
|
||||
handle_nr_ulsch(UL_info);
|
||||
|
||||
@@ -283,7 +283,7 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) {
|
||||
dl_config->slot=UE_mac->dl_config_request.slot;
|
||||
dl_config->number_pdus=0;
|
||||
|
||||
printf(" UE_mac->dl_config_request.slot %d VS dcireq->slot %d \n", UE_mac->dl_config_request.slot, dcireq->slot);
|
||||
//printf(" UE_mac->dl_config_request.slot %d VS dcireq->slot %d \n", UE_mac->dl_config_request.slot, dcireq->slot);
|
||||
|
||||
LOG_D(PHY, "Entering UE DCI configuration frame %d slot %d \n", dcireq->frame, dcireq->slot);
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@ typedef enum UE_STATE_e {
|
||||
RRC_RECONFIGURED,
|
||||
RRC_HO_EXECUTION,
|
||||
RRC_NR_NSA,
|
||||
RRC_NR_NSA_RECONFIGURED
|
||||
} UE_STATE_t;
|
||||
|
||||
typedef enum HO_STATE_e {
|
||||
|
||||
+75
-61
@@ -3251,8 +3251,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
||||
|
||||
MeasObj2->measObjectId = 2;
|
||||
MeasObj2->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectNR_r15;
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 =
|
||||
642256; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016)
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 =641272; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016)
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
|
||||
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
|
||||
@@ -3400,7 +3399,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.present = LTE_ReportConfigInterRAT__triggerType_PR_event;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.present = LTE_ReportConfigInterRAT__triggerType__event__eventId_PR_eventB1_NR_r15;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.present = LTE_ThresholdNR_r15_PR_nr_RSRP_r15;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.choice.nr_RSRP_r15 = 46;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.choice.nr_RSRP_r15 = 0;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.reportOnLeave_r15 = FALSE;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.hysteresis = 2;
|
||||
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.timeToTrigger = LTE_TimeToTrigger_ms80;
|
||||
@@ -4614,7 +4613,7 @@ rrc_eNB_process_MeasurementReport(
|
||||
|
||||
/* TODO: improve NR triggering */
|
||||
if (measResults2->measId == 7) {
|
||||
if (ue_context_pP->ue_context.Status != RRC_NR_NSA) {
|
||||
if ((ue_context_pP->ue_context.Status != RRC_NR_NSA) && (ue_context_pP->ue_context.Status != RRC_NR_NSA_RECONFIGURED)) {
|
||||
MessageDef *msg;
|
||||
ue_context_pP->ue_context.Status = RRC_NR_NSA;
|
||||
|
||||
@@ -4637,7 +4636,7 @@ rrc_eNB_process_MeasurementReport(
|
||||
for (int e_rab=0; e_rab < X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded; e_rab++) {
|
||||
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
|
||||
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].gtp_teid = ue_context_pP->ue_context.e_rab[e_rab].param.gtp_teid;
|
||||
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].drb_ID = 1;
|
||||
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].drb_ID = ue_context_pP->ue_context.DRB_configList->list.array[e_rab]->drb_Identity;
|
||||
memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr,
|
||||
&ue_context_pP->ue_context.e_rab[e_rab].param.sgw_addr,
|
||||
sizeof(transport_layer_addr_t));
|
||||
@@ -7774,7 +7773,37 @@ rrc_eNB_decode_dcch(
|
||||
LOG_I(RRC,
|
||||
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_HO_EXECUTION (xid %ld)\n",
|
||||
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
|
||||
} else {
|
||||
}
|
||||
else if(ue_context_p->ue_context.Status == RRC_NR_NSA){
|
||||
//Looking for a condition to trigger S1AP E-RAB-Modification-indication, based on the reception of RRCConnectionReconfigurationComplete
|
||||
//including NR specific elements.
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
|
||||
->scg_ConfigResponseNR_r15!=NULL) {
|
||||
ue_context_p->ue_context.Status = RRC_NR_NSA_RECONFIGURED;
|
||||
/*Trigger E-RAB Modification Indication */
|
||||
rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dedicated_DRB = 0;
|
||||
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
|
||||
LOG_I(RRC,
|
||||
@@ -7784,39 +7813,6 @@ rrc_eNB_decode_dcch(
|
||||
|
||||
ue_context_p->ue_context.reestablishment_xid = -1;
|
||||
|
||||
//Looking for a condition to trigger S1AP E-RAB-Modification-indication, based on the reception of RRCConnectionReconfigurationComplete
|
||||
//including NR specific elements. Not sure if this is the correct one and the correct placement
|
||||
/*if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->
|
||||
scg_ConfigResponseNR_r15->buf!=NULL){
|
||||
//Trigger E-RAB Modification Indication
|
||||
rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p);
|
||||
}*/
|
||||
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL) {
|
||||
if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.
|
||||
nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
|
||||
->scg_ConfigResponseNR_r15!=NULL) {
|
||||
/*Trigger E-RAB Modification Indication */
|
||||
rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dedicated_DRB = 1;
|
||||
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
|
||||
@@ -8371,36 +8367,54 @@ rrc_eNB_decode_dcch(
|
||||
return 0;
|
||||
//TTN for D2D
|
||||
} else if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_messageClassExtension) {
|
||||
LOG_I(RRC, "THINH [LTE_UL_DCCH_MessageType_PR_messageClassExtension]\n");
|
||||
LOG_I(RRC, "[LTE_UL_DCCH_MessageType_PR_messageClassExtension]\n");
|
||||
|
||||
switch (ul_dcch_msg->message.choice.messageClassExtension.present) {
|
||||
case LTE_UL_DCCH_MessageType__messageClassExtension_PR_NOTHING: /* No components present */
|
||||
break;
|
||||
|
||||
case LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2: //SidelinkUEInformation
|
||||
//case UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12: //SidelinkUEInformation
|
||||
LOG_I(RRC,"THINH [LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2]\n");
|
||||
LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
|
||||
if(ul_dcch_msg->message.choice.messageClassExtension.choice.c2.present ==
|
||||
LTE_UL_DCCH_MessageType__messageClassExtension__c2_PR_scgFailureInformationNR_r15){
|
||||
if (ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.scgFailureInformationNR_r15.
|
||||
criticalExtensions.present == LTE_SCGFailureInformationNR_r15__criticalExtensions_PR_c1){
|
||||
if (ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.scgFailureInformationNR_r15.criticalExtensions.
|
||||
choice.c1.present == LTE_SCGFailureInformationNR_r15__criticalExtensions__c1_PR_scgFailureInformationNR_r15){
|
||||
if (ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.scgFailureInformationNR_r15.criticalExtensions.
|
||||
choice.c1.choice.scgFailureInformationNR_r15.failureReportSCG_NR_r15!=NULL) {
|
||||
LOG_E(RRC, "Received NR scgFailureInformation from UE, failure type: %ld \n",
|
||||
ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.scgFailureInformationNR_r15.criticalExtensions.
|
||||
choice.c1.choice.scgFailureInformationNR_r15.failureReportSCG_NR_r15->failureType_r15);
|
||||
xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(ul_dcch_msg->message.choice.messageClassExtension.choice.c2.present == LTE_UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12){
|
||||
//case UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12: //SidelinkUEInformation
|
||||
LOG_I(RRC,"THINH [LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2]\n");
|
||||
LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
|
||||
"[MSG] RRC SidelinkUEInformation \n");
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
MSC_RRC_ENB,
|
||||
MSC_RRC_UE,
|
||||
Rx_sdu,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT" SidelinkUEInformation UE %x size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ue_context_p->ue_context.rnti,
|
||||
sdu_sizeP);
|
||||
LOG_I(RRC,
|
||||
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
|
||||
"(SidelinkUEInformation) ---> RRC_eNB\n",
|
||||
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
DCCH,
|
||||
MSC_LOG_RX_MESSAGE(
|
||||
MSC_RRC_ENB,
|
||||
MSC_RRC_UE,
|
||||
Rx_sdu,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT" SidelinkUEInformation UE %x size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ue_context_p->ue_context.rnti,
|
||||
sdu_sizeP);
|
||||
rrc_eNB_process_SidelinkUEInformation(
|
||||
ctxt_pP,
|
||||
ue_context_p,
|
||||
&ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12);
|
||||
LOG_I(RRC,
|
||||
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
|
||||
"(SidelinkUEInformation) ---> RRC_eNB\n",
|
||||
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
DCCH,
|
||||
sdu_sizeP);
|
||||
rrc_eNB_process_SidelinkUEInformation(
|
||||
ctxt_pP,
|
||||
ue_context_p,
|
||||
&ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -42,10 +42,12 @@
|
||||
|
||||
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_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;
|
||||
OCTET_STRING_t *ueCapabilityRAT_Container_nr = NULL;
|
||||
OCTET_STRING_t *ueCapabilityRAT_Container_MRDC = NULL;
|
||||
int list_size;
|
||||
|
||||
OCTET_STRING_t *ueCapabilityRAT_Container_nr=NULL;
|
||||
OCTET_STRING_t *ueCapabilityRAT_Container_MRDC=NULL;
|
||||
asn_dec_rval_t dec_rval;
|
||||
int list_size=0;
|
||||
|
||||
AssertFatal(UE_CapabilityRAT_ContainerList!=NULL,"UE_CapabilityRAT_ContainerList is null\n");
|
||||
AssertFatal((list_size=UE_CapabilityRAT_ContainerList->list.count) >= 2, "UE_CapabilityRAT_ContainerList->list.size %d < 2\n",UE_CapabilityRAT_ContainerList->list.count);
|
||||
|
||||
@@ -116,6 +118,10 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_Container
|
||||
rrc_add_nsa_user(rrc,ue_context_p, m);
|
||||
}
|
||||
|
||||
/* generate prototypes for the tree management functions (RB_INSERT used in rrc_add_nsa_user) */
|
||||
RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries,
|
||||
rrc_gNB_compare_ue_rnti_id);
|
||||
|
||||
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m) {
|
||||
// generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331)
|
||||
rrc_gNB_carrier_data_t *carrier=&rrc->carrier;
|
||||
|
||||
+1784
-1677
File diff suppressed because it is too large
Load Diff
@@ -144,9 +144,9 @@ int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint3
|
||||
length,
|
||||
0,
|
||||
0);
|
||||
//if (asn1_xer_print) {
|
||||
if (asn1_xer_print) {
|
||||
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, pdu);
|
||||
//}
|
||||
}
|
||||
|
||||
if (dec_ret.code != RC_OK) {
|
||||
X2AP_ERROR("Failed to decode pdu\n");
|
||||
|
||||
@@ -1768,8 +1768,7 @@ LOG_I(RRC,"x2u tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\
|
||||
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest,
|
||||
X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer, true);
|
||||
|
||||
|
||||
if (ie->value.choice.MeNBtoSgNBContainer.size > 8192 )
|
||||
if (ie->value.choice.MeNBtoSgNBContainer.size > 8192 ) // TODO: this is the size of rrc_buffer in struct x2ap_handover_req_s
|
||||
{ printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); }
|
||||
|
||||
memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer, ie->value.choice.MeNBtoSgNBContainer.buf, ie->value.choice.MeNBtoSgNBContainer.size);
|
||||
|
||||
@@ -129,9 +129,9 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
|
||||
return -1;
|
||||
}
|
||||
|
||||
//if (asn1_xer_print) {
|
||||
if (asn1_xer_print) {
|
||||
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
|
||||
//}
|
||||
}
|
||||
|
||||
memset(&res, 0, sizeof(res));
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
Active_eNBs = ( "eNB-Eurecom-LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
# real_time choice in {hard, rt-preempt, no}
|
||||
real_time = "no";
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe01;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB-Eurecom-LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = (
|
||||
{ mcc = 222; mnc = 01; mnc_length = 2; }
|
||||
);
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
nb_antenna_ports = 1;
|
||||
ue_TransmissionMode = 1;
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 7;
|
||||
downlink_frequency = 2680000000L; //2655000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25; //100;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
prach_root = 0;
|
||||
tx_gain = 90;
|
||||
rx_gain = 115;
|
||||
pbch_repetition = "FALSE";
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 0;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -96;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -96;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
//Parameters for SIB18
|
||||
rxPool_sc_CP_Len = "normal";
|
||||
rxPool_sc_Period = "sf40";
|
||||
rxPool_data_CP_Len = "normal";
|
||||
rxPool_ResourceConfig_prb_Num = 20;
|
||||
rxPool_ResourceConfig_prb_Start = 5;
|
||||
rxPool_ResourceConfig_prb_End = 44;
|
||||
rxPool_ResourceConfig_offsetIndicator_present = "prSmall";
|
||||
rxPool_ResourceConfig_offsetIndicator_choice = 0;
|
||||
rxPool_ResourceConfig_subframeBitmap_present = "prBs40";
|
||||
rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000";
|
||||
rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
|
||||
rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
|
||||
/* rxPool_dataHoppingConfig_hoppingParameter = 0;
|
||||
rxPool_dataHoppingConfig_numSubbands = "ns1";
|
||||
rxPool_dataHoppingConfig_rbOffset = 0;
|
||||
rxPool_commTxResourceUC-ReqAllowed = "TRUE";
|
||||
*/
|
||||
// Parameters for SIB19
|
||||
discRxPool_cp_Len = "normal"
|
||||
discRxPool_discPeriod = "rf32"
|
||||
discRxPool_numRetx = 1;
|
||||
discRxPool_numRepetition = 2;
|
||||
discRxPool_ResourceConfig_prb_Num = 5;
|
||||
discRxPool_ResourceConfig_prb_Start = 3;
|
||||
discRxPool_ResourceConfig_prb_End = 21;
|
||||
discRxPool_ResourceConfig_offsetIndicator_present = "prSmall";
|
||||
discRxPool_ResourceConfig_offsetIndicator_choice = 0;
|
||||
discRxPool_ResourceConfig_subframeBitmap_present = "prBs40";
|
||||
discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff";
|
||||
discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
|
||||
discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
enable_measurement_reports = "yes";
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.18.99";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
///X2
|
||||
enable_x2 = "yes";
|
||||
t_reloc_prep = 1000; /* unit: millisecond */
|
||||
tx2_reloc_overall = 2000; /* unit: millisecond */
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.199/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth1";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.18.199/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.18.199/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="high";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="debug";
|
||||
rlc_log_verbosity ="high";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="high";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
MACRLCs = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_s_preference = "local_L1";
|
||||
tr_n_preference = "local_RRC";
|
||||
phy_test_mode = 0;
|
||||
puSch10xSnr = 160;
|
||||
puCch10xSnr = 160;
|
||||
}
|
||||
);
|
||||
|
||||
THREAD_STRUCT = (
|
||||
{
|
||||
parallel_config = "PARALLEL_RU_L1_TRX_SPLITaaaaaa";
|
||||
worker_config = "ENABLE";
|
||||
}
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
nb_tx = 1
|
||||
nb_rx = 1
|
||||
att_tx = 0
|
||||
att_rx = 0;
|
||||
bands = [7];
|
||||
max_pdschReferenceSignalPower = -27;
|
||||
max_rxgain = 118;
|
||||
eNB_instances = [0];
|
||||
clock_src = "external";
|
||||
}
|
||||
);
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="high";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="high";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="high";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
@@ -0,0 +1,293 @@
|
||||
Active_gNBs = ( "gNB-Eurecom-5GNRBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
gNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
gNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_GNB";
|
||||
|
||||
gNB_name = "gNB-Eurecom-5GNRBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
|
||||
plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;});
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
ssb_SubcarrierOffset = 31; //0;
|
||||
pdsch_AntennaPorts = 1;
|
||||
|
||||
servingCellConfigCommon = (
|
||||
{
|
||||
#spCellConfigCommon
|
||||
|
||||
physCellId = 0;
|
||||
|
||||
# downlinkConfigCommon
|
||||
#frequencyInfoDL
|
||||
# this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
|
||||
absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell
|
||||
dl_frequencyBand = 78;
|
||||
# this is 3600 MHz
|
||||
dl_absoluteFrequencyPointA = 640000;
|
||||
#scs-SpecificCarrierList
|
||||
dl_offstToCarrier = 0;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
dl_subcarrierSpacing = 1;
|
||||
dl_carrierBandwidth = 106;
|
||||
#initialDownlinkBWP
|
||||
#genericParameters
|
||||
# this is RBstart=84,L=13 (275*(L-1))+RBstart
|
||||
initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialDLBWPsubcarrierSpacing = 1;
|
||||
#pdcch-ConfigCommon
|
||||
initialDLBWPcontrolResourceSetZero = 0;
|
||||
initialDLBWPsearchSpaceZero = 0;
|
||||
#pdsch-ConfigCommon
|
||||
#pdschTimeDomainAllocationList (up to 16 entries)
|
||||
initialDLBWPk0_0 = 0;
|
||||
#initialULBWPmappingType
|
||||
#0=typeA,1=typeB
|
||||
initialDLBWPmappingType_0 = 0;
|
||||
#this is SS=1,L=13
|
||||
initialDLBWPstartSymbolAndLength_0 = 40;
|
||||
|
||||
initialDLBWPk0_1 = 0;
|
||||
initialDLBWPmappingType_1 = 0;
|
||||
#this is SS=2,L=12
|
||||
initialDLBWPstartSymbolAndLength_1 = 53;
|
||||
|
||||
initialDLBWPk0_2 = 0;
|
||||
initialDLBWPmappingType_2 = 0;
|
||||
#this is SS=1,L=12
|
||||
initialDLBWPstartSymbolAndLength_2 = 54;
|
||||
|
||||
initialDLBWPk0_3 = 0;
|
||||
initialDLBWPmappingType_3 = 0;
|
||||
#this is SS=1,L=4 //5 (4 is for 43, 5 is for 57)
|
||||
initialDLBWPstartSymbolAndLength_3 = 57; //43; //57;
|
||||
#uplinkConfigCommon
|
||||
#frequencyInfoUL
|
||||
ul_frequencyBand = 78;
|
||||
#scs-SpecificCarrierList
|
||||
ul_offstToCarrier = 0;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
ul_subcarrierSpacing = 1;
|
||||
ul_carrierBandwidth = 106;
|
||||
pMax = 20;
|
||||
#initialUplinkBWP
|
||||
#genericParameters
|
||||
initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialULBWPsubcarrierSpacing = 1;
|
||||
#rach-ConfigCommon
|
||||
#rach-ConfigGeneric
|
||||
prach_ConfigurationIndex = 98;
|
||||
#prach_msg1_FDM
|
||||
#0 = one, 1=two, 2=four, 3=eight
|
||||
prach_msg1_FDM = 0;
|
||||
prach_msg1_FrequencyStart = 0;
|
||||
zeroCorrelationZoneConfig = 13;
|
||||
preambleReceivedTargetPower = -100;
|
||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||
preambleTransMax = 6;
|
||||
#powerRampingStep
|
||||
# 0=dB0,1=dB2,2=dB4,3=dB6
|
||||
powerRampingStep = 1;
|
||||
#ra_ReponseWindow
|
||||
#1,2,4,8,10,20,40,80
|
||||
ra_ResponseWindow = 5;
|
||||
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
|
||||
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
|
||||
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
|
||||
#oneHalf (0..15) 4,8,12,16,...60,64
|
||||
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15;
|
||||
#ra_ContentionResolutionTimer
|
||||
#(0..7) 8,16,24,32,40,48,56,64
|
||||
ra_ContentionResolutionTimer = 7;
|
||||
rsrp_ThresholdSSB = 19;
|
||||
#prach-RootSequenceIndex_PR
|
||||
#1 = 839, 2 = 139
|
||||
prach_RootSequenceIndex_PR = 2;
|
||||
prach_RootSequenceIndex = 1;
|
||||
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
|
||||
#
|
||||
msg1_SubcarrierSpacing = 1,
|
||||
|
||||
# restrictedSetConfig
|
||||
# 0=unrestricted, 1=restricted type A, 2=restricted type B
|
||||
restrictedSetConfig = 0,
|
||||
# pusch-ConfigCommon (up to 16 elements)
|
||||
initialULBWPk2_0 = 2;
|
||||
initialULBWPmappingType_0 = 1
|
||||
# this is SS=0 L=11
|
||||
initialULBWPstartSymbolAndLength_0 = 55;
|
||||
|
||||
initialULBWPk2_1 = 2;
|
||||
initialULBWPmappingType_1 = 1;
|
||||
# this is SS=0 L=12
|
||||
initialULBWPstartSymbolAndLength_1 = 69;
|
||||
|
||||
initialULBWPk2_2 = 7;
|
||||
initialULBWPmappingType_2 = 1;
|
||||
# this is SS=10 L=4
|
||||
initialULBWPstartSymbolAndLength_2 = 52;
|
||||
|
||||
msg3_DeltaPreamble = 1;
|
||||
p0_NominalWithGrant =-90;
|
||||
|
||||
# pucch-ConfigCommon setup :
|
||||
# pucchGroupHopping
|
||||
# 0 = neither, 1= group hopping, 2=sequence hopping
|
||||
pucchGroupHopping = 0;
|
||||
hoppingId = 40;
|
||||
p0_nominal = -90;
|
||||
# ssb_PositionsInBurs_BitmapPR
|
||||
# 1=short, 2=medium, 3=long
|
||||
ssb_PositionsInBurst_PR = 2;
|
||||
ssb_PositionsInBurst_Bitmap = 1; #0x80;
|
||||
|
||||
# ssb_periodicityServingCell
|
||||
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
|
||||
ssb_periodicityServingCell = 2;
|
||||
|
||||
# dmrs_TypeA_position
|
||||
# 0 = pos2, 1 = pos3
|
||||
dmrs_TypeA_Position = 0;
|
||||
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
subcarrierSpacing = 1;
|
||||
|
||||
|
||||
#tdd-UL-DL-ConfigurationCommon
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
referenceSubcarrierSpacing = 1;
|
||||
# pattern1
|
||||
# dl_UL_TransmissionPeriodicity
|
||||
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
|
||||
dl_UL_TransmissionPeriodicity = 6;
|
||||
nrofDownlinkSlots = 7; //8; //7;
|
||||
nrofDownlinkSymbols = 6; //0; //6;
|
||||
nrofUplinkSlots = 2;
|
||||
nrofUplinkSymbols = 4; //0; //4;
|
||||
|
||||
ssPBCH_BlockPower = -25;
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.18.99";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
///X2
|
||||
enable_x2 = "yes";
|
||||
t_reloc_prep = 1000; /* unit: millisecond */
|
||||
tx2_reloc_overall = 2000; /* unit: millisecond */
|
||||
target_enb_x2_ip_address = (
|
||||
{ ipv4 = "192.168.18.199";
|
||||
ipv6 = "192:168:30::17";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
GNB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24";
|
||||
GNB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24";
|
||||
GNB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24";
|
||||
GNB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
MACRLCs = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_s_preference = "local_L1";
|
||||
tr_n_preference = "local_RRC";
|
||||
}
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
nb_tx = 1
|
||||
nb_rx = 1
|
||||
att_tx = 0
|
||||
att_rx = 0;
|
||||
bands = [7];
|
||||
max_pdschReferenceSignalPower = -27;
|
||||
max_rxgain = 114;
|
||||
eNB_instances = [0];
|
||||
clock_src = "external";
|
||||
}
|
||||
);
|
||||
|
||||
THREAD_STRUCT = (
|
||||
{
|
||||
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
|
||||
//parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
|
||||
parallel_config = "PARALLEL_SINGLE_THREAD";
|
||||
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
|
||||
worker_config = "WORKER_ENABLE";
|
||||
}
|
||||
);
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user