Commit 7462e43c authored by WEI-TAI CHEN's avatar WEI-TAI CHEN

merge develop-nr

parents c9eb16cc 4f379330
...@@ -1122,7 +1122,7 @@ set(PHY_POLARSRC ...@@ -1122,7 +1122,7 @@ set(PHY_POLARSRC
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_crc_byte.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_crc_byte.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_channel_interleaver_pattern.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_channel_interleaver_pattern.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_crc.c # ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_crc.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_info_bit_pattern.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_info_bit_pattern.c
${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c
...@@ -1137,7 +1137,13 @@ set(PHY_POLARSRC ...@@ -1137,7 +1137,13 @@ set(PHY_POLARSRC
) )
set(PHY_TURBOIF set(PHY_TURBOIF
${OPENAIR1_DIR}/PHY/CODING/coding_load.c ${OPENAIR1_DIR}/PHY/CODING/coding_load.c
) )
set(PHY_LDPCSRC
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
)
add_library(coding MODULE ${PHY_TURBOSRC} ) add_library(coding MODULE ${PHY_TURBOSRC} )
...@@ -1299,6 +1305,7 @@ set(PHY_SRC_UE ...@@ -1299,6 +1305,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR1_DIR}/PHY/TOOLS/lut.c ${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${PHY_POLARSRC} ${PHY_POLARSRC}
${PHY_LDPCSRC}
) )
set(PHY_NR_UE_SRC set(PHY_NR_UE_SRC
...@@ -1336,6 +1343,7 @@ set(PHY_SRC_UE ...@@ -1336,6 +1343,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/lut.c ${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c ${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c
${PHY_POLARSRC} ${PHY_POLARSRC}
${PHY_LDPCSRC}
) )
...@@ -1348,6 +1356,10 @@ if (${COMPILATION_AVX2} STREQUAL "True") ...@@ -1348,6 +1356,10 @@ if (${COMPILATION_AVX2} STREQUAL "True")
set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c) set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
endif () endif ()
if (${COMPILATION_AVX2} STREQUAL "True")
set(PHY_NR_UE_SRC ${PHY_NR_UE_SRC} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
endif ()
add_library(PHY_COMMON ${PHY_SRC_COMMON}) add_library(PHY_COMMON ${PHY_SRC_COMMON})
add_library(PHY ${PHY_SRC}) add_library(PHY ${PHY_SRC})
add_library(PHY_UE ${PHY_SRC_UE}) add_library(PHY_UE ${PHY_SRC_UE})
...@@ -1597,6 +1609,7 @@ set ( NR_LTE_UE_REUSE_SRC ...@@ -1597,6 +1609,7 @@ set ( NR_LTE_UE_REUSE_SRC
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
#${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
) )
add_library( NR_LTE_UE_REUSE_LIB add_library( NR_LTE_UE_REUSE_LIB
...@@ -2485,7 +2498,10 @@ target_link_libraries (dlsim_tm4 ...@@ -2485,7 +2498,10 @@ target_link_libraries (dlsim_tm4
) )
add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c) add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c)
target_link_libraries(polartest m SIMU PHY PHY_NR -lm ${ATLAS_LIBRARIES}) target_link_libraries(polartest m SIMU PHY PHY_NR PHY_COMMON -lm ${ATLAS_LIBRARIES})
add_executable(ldpctest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c)
target_link_libraries(ldpctest m SIMU PHY PHY_NR ${ATLAS_LIBRARIES})
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
......
...@@ -682,7 +682,7 @@ function main() { ...@@ -682,7 +682,7 @@ function main() {
echo_info "Compiling unitary tests simulators" echo_info "Compiling unitary tests simulators"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
#simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim" #simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
simlist="dlsim ulsim" simlist="dlsim ulsim polartest ldpctest"
for f in $simlist ; do for f in $simlist ; do
compilations \ compilations \
lte-simulators $f \ lte-simulators $f \
......
...@@ -10,10 +10,35 @@ ...@@ -10,10 +10,35 @@
#define FAPI_NR_MAX_RA_OCCASION_PER_CSIRS 64 #define FAPI_NR_MAX_RA_OCCASION_PER_CSIRS 64
/// RX_IND
#define FAPI_NR_RX_PDU_TYPE_MIB 0x01 #define FAPI_NR_RX_PDU_TYPE_MIB 0x01
#define FAPI_NR_RX_PDU_TYPE_SIB 0x02 #define FAPI_NR_RX_PDU_TYPE_SIB 0x02
#define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03 #define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03
#define FAPI_NR_DCI_IND 0x04
#define FAPI_NR_SIBS_MASK_SIB1 0x1
/// DCI_IND
#define FAPI_NR_DCI_TYPE_0_0 0x01
#define FAPI_NR_DCI_TYPE_0_1 0x02
#define FAPI_NR_DCI_TYPE_1_0 0x03
#define FAPI_NR_DCI_TYPE_1_1 0x04
#define FAPI_NR_DCI_TYPE_2_0 0x05
#define FAPI_NR_DCI_TYPE_2_1 0x06
#define FAPI_NR_DCI_TYPE_2_2 0x07
#define FAPI_NR_DCI_TYPE_2_3 0x08
/// TX_REQ
/// DL_CONFIG_REQ
#define FAPI_NR_DL_CONFIG_LIST_NUM 10
#define FAPI_NR_DL_CONFIG_TYPE_DCI 0x01
#define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02
#define CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
#define CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 #define CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
...@@ -21,5 +46,13 @@ ...@@ -21,5 +46,13 @@
#define PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE 0x01 #define PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE 0x01
#define PRECODER_GRANULARITY_ALL_CONTIGUOUS_RBS 0x02 #define PRECODER_GRANULARITY_ALL_CONTIGUOUS_RBS 0x02
/// UL_CONFIG_REQ
#define FAPI_NR_UL_CONFIG_LIST_NUM 10
#define FAPI_NR_UL_CONFIG_TYPE_PRACH 0x01
#define FAPI_NR_UL_CONFIG_TYPE_PUCCH 0x02
#define FAPI_NR_UL_CONFIG_TYPE_PUSCH 0x03
#define FAPI_NR_UL_CONFIG_TYPE_SRS 0x04
#endif #endif
\ No newline at end of file
This diff is collapsed.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "SIMULATION/TOOLS/sim.h" #include "SIMULATION/TOOLS/sim.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
...@@ -32,7 +33,7 @@ int main(int argc, char *argv[]) { ...@@ -32,7 +33,7 @@ int main(int argc, char *argv[]) {
uint8_t decoderListSize = 8, pathMetricAppr = 0; //0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12) uint8_t decoderListSize = 8, pathMetricAppr = 0; //0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:")) != -1) while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:h")) != -1)
switch (arguments) switch (arguments)
{ {
case 's': case 's':
...@@ -64,22 +65,34 @@ int main(int argc, char *argv[]) { ...@@ -64,22 +65,34 @@ int main(int argc, char *argv[]) {
pathMetricAppr = (uint8_t) atoi(optarg); pathMetricAppr = (uint8_t) atoi(optarg);
break; break;
case 'h':
printf("./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=DCI|1=PBCH|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr\n");
exit(-1);
default: default:
perror("[polartest.c] Problem at argument parsing with getopt"); perror("[polartest.c] Problem at argument parsing with getopt");
abort (); exit(-1);
} }
if (polarMessageType == 0) { //DCI if (polarMessageType == 0) { //DCI
//testLength = ; //testLength = ;
//coderLength = ; //coderLength = ;
printf("polartest for DCI not supported yet\n");
exit(-1);
} else if (polarMessageType == 1) { //PBCH } else if (polarMessageType == 1) { //PBCH
testLength = NR_POLAR_PBCH_PAYLOAD_BITS; testLength = NR_POLAR_PBCH_PAYLOAD_BITS;
coderLength = NR_POLAR_PBCH_E; coderLength = NR_POLAR_PBCH_E;
printf("running polartest for PBCH\n");
} else if (polarMessageType == 2) { //UCI } else if (polarMessageType == 2) { //UCI
//testLength = ; testLength = NR_POLAR_PUCCH_PAYLOAD_BITS;
//coderLength = ; coderLength = NR_POLAR_PUCCH_E;
printf("running polartest for UCI");
} else {
printf("unsupported polarMessageType %d (0=DCI, 1=PBCH, 2=UCI)\n",polarMessageType);
exit(-1);
} }
//Logging //Logging
time_t currentTime; time_t currentTime;
time (&currentTime); time (&currentTime);
...@@ -121,7 +134,8 @@ int main(int argc, char *argv[]) { ...@@ -121,7 +134,8 @@ int main(int argc, char *argv[]) {
SNR_lin = pow(10, SNR/10); SNR_lin = pow(10, SNR/10);
for (itr = 1; itr <= iterations; itr++) { for (itr = 1; itr <= iterations; itr++) {
for(int i=0; i<testLength; i++) testInput[i]=(uint8_t) (rand() % 2); for(int i=0; i<testLength; i++)
testInput[i]=(uint8_t) (rand() % 2);
start_meas(&timeEncoder); start_meas(&timeEncoder);
polar_encoder(testInput, encoderOutput, &nrPolar_params); polar_encoder(testInput, encoderOutput, &nrPolar_params);
......
This diff is collapsed.
...@@ -31,6 +31,18 @@ ...@@ -31,6 +31,18 @@
#include "PHY/TOOLS/time_meas.h" #include "PHY/TOOLS/time_meas.h"
/*ldpc_encoder.c*/
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
/*ldpc_encoder2.c*/
void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb);
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
/*ldpc_generate_coefficient.c*/
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,unsigned char gen_code);
/*
int encode_parity_check_part(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb); int encode_parity_check_part(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb);
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length); int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length, double rate); int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length, double rate);
...@@ -38,4 +50,4 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -38,4 +50,4 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments); int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput); int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput); int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
*/
...@@ -50,14 +50,14 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh ...@@ -50,14 +50,14 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
int i1,i2,i3,i4,i5,temp_prime; int i1,i2,i3,i4,i5,temp_prime;
unsigned char channel_temp,temp; unsigned char channel_temp,temp;
//if (BG==1) if (BG==1)
{ {
no_shift_values=(short *) no_shift_values_BG1; no_shift_values=(short *) no_shift_values_BG1;
pointer_shift_values=(short *) pointer_shift_values_BG1; pointer_shift_values=(short *) pointer_shift_values_BG1;
nrows=46; //parity check bits nrows=46; //parity check bits
ncols=22; //info bits ncols=22; //info bits
} }
/*else if (BG==2) else if (BG==2)
{ {
no_shift_values=(short *) no_shift_values_BG2; no_shift_values=(short *) no_shift_values_BG2;
pointer_shift_values=(short *) pointer_shift_values_BG2; pointer_shift_values=(short *) pointer_shift_values_BG2;
...@@ -68,7 +68,7 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh ...@@ -68,7 +68,7 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
printf("problem with BG\n"); printf("problem with BG\n");
return(-1); return(-1);
} }
*/
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc; no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
......
...@@ -198,10 +198,10 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho ...@@ -198,10 +198,10 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
} }
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput) int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{ {
short BG,Zc,Kb,nrows,ncols; short Kb,Zc,nrows,ncols;
int i,i1; int i,i1;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
...@@ -211,16 +211,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -211,16 +211,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int simd_size; int simd_size;
//determine number of bits in codeword //determine number of bits in codeword
//if (block_length>3840) if (BG==1)
{ {
BG=1;
Kb = 22; Kb = 22;
nrows=46; //parity check bits nrows=46; //parity check bits
ncols=22; //info bits ncols=22; //info bits
} }
/*else if (block_length<=3840) else if (BG==2)
{ {
BG=2;
nrows=42; //parity check bits nrows=42; //parity check bits
ncols=10; // info bits ncols=10; // info bits
...@@ -232,7 +230,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -232,7 +230,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
Kb = 8; Kb = 8;
else else
Kb = 6; Kb = 6;
}*/ }
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0; Zc=0;
...@@ -315,10 +313,10 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -315,10 +313,10 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
return 0; return 0;
} }
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput) int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{ {
short BG,Zc,Kb,nrows,ncols; short Kb,Zc,nrows,ncols;
int i,i1,j; int i,i1,j;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
//Table of possible lifting sizes //Table of possible lifting sizes
...@@ -345,16 +343,14 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -345,16 +343,14 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
AssertFatal(n_segments>0&&n_segments<=8,"0 < n_segments %d <= 8\n",n_segments); AssertFatal(n_segments>0&&n_segments<=8,"0 < n_segments %d <= 8\n",n_segments);
//determine number of bits in codeword //determine number of bits in codeword
//if (block_length>3840) if (BG==1)
{ {
BG=1;
Kb = 22; Kb = 22;
nrows=46; //parity check bits nrows=46; //parity check bits
ncols=22; //info bits ncols=22; //info bits
} }
/*else if (block_length<=3840) else if (BG==2)
{ {
BG=2;
nrows=42; //parity check bits nrows=42; //parity check bits
ncols=10; // info bits ncols=10; // info bits
...@@ -366,7 +362,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -366,7 +362,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
Kb = 8; Kb = 8;
else else
Kb = 6; Kb = 6;
}*/ }
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0; Zc=0;
......
...@@ -361,13 +361,13 @@ short *choose_generator_matrix(short BG,short Zc) ...@@ -361,13 +361,13 @@ short *choose_generator_matrix(short BG,short Zc)
return Gen_shift_values; return Gen_shift_values;
} }
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code) int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,unsigned char gen_code)
{ {
unsigned char c[22*384]; //padded input, unpacked, max size unsigned char c[22*384]; //padded input, unpacked, max size
unsigned char d[68*384]; //coded output, unpacked, max size unsigned char d[68*384]; //coded output, unpacked, max size
unsigned char channel_temp,temp; unsigned char channel_temp,temp;
short *Gen_shift_values, *no_shift_values, *pointer_shift_values; short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
short BG,Zc,Kb,nrows,ncols; short Zc,Kb,nrows,ncols;
int i,i1,i2,i3,i4,i5,temp_prime,var; int i,i1,i2,i3,i4,i5,temp_prime,var;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
//Table of possible lifting sizes //Table of possible lifting sizes
...@@ -378,16 +378,14 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -378,16 +378,14 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
int indlist2[1000]; int indlist2[1000];
//determine number of bits in codeword //determine number of bits in codeword
//if (block_length>3840) if (BG==1)
{ {
BG=1;
Kb = 22; Kb = 22;
nrows=46; //parity check bits nrows=46; //parity check bits
ncols=22; //info bits ncols=22; //info bits
} }
/*else if (block_length<=3840) else if (BG==2)
{ {
BG=2;
nrows=42; //parity check bits nrows=42; //parity check bits
ncols=10; // info bits ncols=10; // info bits
...@@ -399,7 +397,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -399,7 +397,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
Kb = 8; Kb = 8;
else else
Kb = 6; Kb = 6;
}*/ }
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0; Zc=0;
...@@ -417,6 +415,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -417,6 +415,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
return(-1); return(-1);
} }
int K = ncols*Zc;
Gen_shift_values=choose_generator_matrix(BG,Zc); Gen_shift_values=choose_generator_matrix(BG,Zc);
if (Gen_shift_values==NULL) { if (Gen_shift_values==NULL) {
printf("ldpc_encoder_orig: could not find generator matrix\n"); printf("ldpc_encoder_orig: could not find generator matrix\n");
...@@ -438,9 +438,15 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -438,9 +438,15 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
} }
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc; no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
//nrows - no_punctured_columns = 2 +2*block_length/Zc
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*3); removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*3);
// ((nrows-no_punctured_columns) * Zc-removed_bit) =
// 2Zc + 2*block_length
//printf("%d\n",no_punctured_columns); //printf("%d\n",no_punctured_columns);
//printf("%d\n",removed_bit); //printf("%d\n",removed_bit);
//printf("%d\n",nrows-no_punctured_columns);
//printf("%d\n",((nrows-no_punctured_columns) * Zc-removed_bit));
// unpack input // unpack input
memset(c,0,sizeof(unsigned char) * ncols * Zc); memset(c,0,sizeof(unsigned char) * ncols * Zc);
memset(d,0,sizeof(unsigned char) * nrows * Zc); memset(d,0,sizeof(unsigned char) * nrows * Zc);
...@@ -608,8 +614,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -608,8 +614,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
} }
// information part and puncture columns // information part and puncture columns
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char)); memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char)); //systematic bits
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char)); memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char)); //systematic bits 2Zc + 2*block_length
//memcpy(channel_input,c,Kb*Zc*sizeof(unsigned char)); //memcpy(channel_input,c,Kb*Zc*sizeof(unsigned char));
return 0; return 0;
} }
...@@ -21,9 +21,17 @@ ...@@ -21,9 +21,17 @@
#include "nrPolar_tools/nr_polar_defs.h" #include "nrPolar_tools/nr_polar_defs.h"
#include "nrPolar_tools/nr_polar_pbch_defs.h" #include "nrPolar_tools/nr_polar_pbch_defs.h"
#include "nrPolar_tools/nr_polar_uci_defs.h"
void nr_polar_init(t_nrPolar_params* polarParams, int messageType) { void nr_polar_init(t_nrPolar_params* polarParams, int messageType) {
uint32_t poly6 = 0x84000000; // 1000100000... -> D^6+D^5+1
uint32_t poly11 = 0x63200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
uint32_t poly16 = 0x81080000; //100000010000100... - > D^16+D^12+D^5+1
uint32_t poly24a = 0x864cfb00; //100001100100110011111011 -> D^24+D^23+D^18+D^17+D^14+D^11+D^10+D^7+D^6+D^5+D^4+D^3+D+1
uint32_t poly24b = 0x80006300; //100000000000000001100011 -> D^24+D^23+D^6+D^5+D+1
uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
if (messageType == 0) { //DCI if (messageType == 0) { //DCI
} else if (messageType == 1) { //PBCH } else if (messageType == 1) { //PBCH
...@@ -36,13 +44,13 @@ void nr_polar_init(t_nrPolar_params* polarParams, int messageType) { ...@@ -36,13 +44,13 @@ void nr_polar_init(t_nrPolar_params* polarParams, int messageType) {
polarParams->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS; polarParams->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
polarParams->encoderLength = NR_POLAR_PBCH_E; polarParams->encoderLength = NR_POLAR_PBCH_E;
polarParams->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS; polarParams->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
polarParams->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode. polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode.
polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max); polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max);
polarParams->n = log2(polarParams->N); polarParams->n = log2(polarParams->N);
polarParams->crc_generator_matrix=crc24c_generator_matrix(polarParams->payloadBits); polarParams->crc_generator_matrix=crc24c_generator_matrix(polarParams->payloadBits);
polarParams->crc_polynomial = poly24c;
polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n); polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n);
//polar_encoder vectors: //polar_encoder vectors:
...@@ -55,9 +63,80 @@ void nr_polar_init(t_nrPolar_params* polarParams, int messageType) { ...@@ -55,9 +63,80 @@ void nr_polar_init(t_nrPolar_params* polarParams, int messageType) {
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat
polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat
} else if (messageType == 2) { //UCI } else if (messageType == 2) { //UCI
polarParams->payloadBits = NR_POLAR_PUCCH_PAYLOAD_BITS; //A depends on what they carry...
polarParams->encoderLength = NR_POLAR_PUCCH_E ; //E depends on other standards 6.3.1.4
if (polarParams->payloadBits <= 11) //Ref. 38-212, Section 6.3.1.2.2
polarParams->crcParityBits = 0; //K=A
else //Ref. 38-212, Section 6.3.1.2.1
{
if (polarParams->payloadBits < 20)
polarParams->crcParityBits = NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT;
else
polarParams->crcParityBits = NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG;
if (polarParams->payloadBits >= 360 && polarParams->encoderLength >= 1088)
polarParams->i_seg = NR_POLAR_PUCCH_I_SEG_LONG; // -> C=2
else
polarParams->i_seg = NR_POLAR_PUCCH_I_SEG_SHORT; // -> C=1
}
polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode.
//K_r = K/C ; C = I_seg+1
if((polarParams->K)/(polarParams->i_seg+1)>=18 && (polarParams->K)/(polarParams->i_seg+1)<=25) //Ref. 38-212, Section 6.3.1.3.1
{
polarParams->n_max = NR_POLAR_PUCCH_N_MAX;
polarParams->i_il =NR_POLAR_PUCCH_I_IL;
polarParams->n_pc = NR_POLAR_PUCCH_N_PC_SHORT;
if( (polarParams->encoderLength - polarParams->K)/(polarParams->i_seg + 1) + 3 > 192 )
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_LONG;
else
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_SHORT;
}
if( (polarParams->K)/(polarParams->i_seg + 1) > 30 ) //Ref. 38-212, Section 6.3.1.3.1
{
polarParams->n_max = NR_POLAR_PUCCH_N_MAX;
polarParams->i_il =NR_POLAR_PUCCH_I_IL;
polarParams->n_pc = NR_POLAR_PUCCH_N_PC_LONG;
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_LONG;
}
polarParams->i_bil = NR_POLAR_PUCCH_I_BIL; //Ref. 38-212, Section 6.3.1.4.1
polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max);
polarParams->n = log2(polarParams->N);
if((polarParams->payloadBits) <= 19)
{
polarParams->crc_generator_matrix=crc6_generator_matrix(polarParams->payloadBits);
polarParams->crc_polynomial = poly6;
}
else
{
polarParams->crc_generator_matrix=crc11_generator_matrix(polarParams->payloadBits);
polarParams->crc_polynomial = poly11;
} }
polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n);
//polar_encoder vectors:
polarParams->nr_polar_crc = malloc(sizeof(uint8_t) * polarParams->crcParityBits);
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K);
polarParams->nr_polar_d = malloc(sizeof(uint8_t) * polarParams->N);
//Polar Coding vectors
polarParams->nr_polar_u = malloc(sizeof(uint8_t) * polarParams->N); //Decoder: nr_polar_uHat
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat
polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat
}
polarParams->crcCorrectionBits = NR_POLAR_CRC_ERROR_CORRECTION_BITS;
polarParams->crc256Table = malloc(sizeof(uint32_t)*256);
crcTable256Init(polarParams->crc_polynomial, polarParams->crc256Table);
polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n); polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n);
polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K); polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K);
......
...@@ -21,6 +21,133 @@ ...@@ -21,6 +21,133 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
/*
// ----- New implementation ----
uint32_t poly6 = 0x84000000; // 10000100000... -> D^6+D^5+1
uint32_t poly11 = 0xc4200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
uint32_t poly16 = 0x10210000; //00100000010000100... - > D^16+D^12+D^5+1
uint32_t poly24a = 0x864cfb00; //100001100100110011111011 -> D^24+D^23+D^18+D^17+D^14+D^11+D^10+D^7+D^6+D^5+D^4+D^3+D+1
uint32_t poly24b = 0x80006300; //100000000000000001100011 -> D^24+D^23+D^6+D^5+D+1
uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
//static unsigned int crc256Table[256];
void nr_crc_computation(uint8_t* input, uint8_t* output, uint16_t payloadBits, uint16_t crcParityBits, uint32_t* crc256Table)
{
//Create payload in bit
uint8_t* input2 = (uint8_t*)malloc(payloadBits); //divided by 8 (in bits)
uint8_t mask = 128; // 10000000
for(uint8_t ind=0; ind<(payloadBits/8); ind++)
{
input2[ind]=0;
for(uint8_t ind2=0; ind2<8; ind2++)
{
if(input[8*ind+ind2])
{
input2[ind] = input2[ind] | mask;
}
mask= mask >> 1;
}
mask=128;
}
//crcTable256Init(poly);
unsigned int crcBits;
crcBits = crcPayload(input2, payloadBits, crc256Table);
//create crc in byte
unsigned int mask2=0x80000000; //100...
output = (uint8_t*)malloc(sizeof(uint8_t)*crcParityBits);
for(uint8_t ind=0; ind<crcParityBits; ind++)
{
if(crcBits & mask2)
output[ind]=1;
else
output[ind]=0;
mask2 = mask2 >> 1;
}
}
unsigned int crcbit (unsigned char* inputptr, int octetlen, unsigned int poly)
{
unsigned int i, crc = 0, c;
while (octetlen-- > 0) {
c = (*inputptr++) << 24;
for (i = 8; i != 0; i--) {
if ((1 << 31) & (c ^ crc))
crc = (crc << 1) ^ poly;
else
crc <<= 1;
c <<= 1;
}
}
return crc;
}
void crcTableInit (void)
{
unsigned char c = 0;
do {
crc6Table[c] = crcbit(&c, 1, poly6);
crc11Table[c]= crcbit(&c, 1, poly11);
crc16Table[c] =crcbit(&c, 1, poly16);
crc24aTable[c]=crcbit(&c, 1, poly24a);
crc24bTable[c]=crcbit(&c, 1, poly24b);
crc24cTable[c]=crcbit(&c, 1, poly24c);
} while (++c);
}
void crcTable256Init (uint32_t poly, uint32_t* crc256Table)
{
unsigned char c = 0;
// crc256Table = malloc(sizeof(uint32_t)*256);
do {
crc256Table[c] = crcbit(&c, 1, poly);
// crc6Table[c] = crcbit(&c, 1, poly6);
// crc11Table[c]= crcbit(&c, 1, poly11);
// crc16Table[c] =crcbit(&c, 1, poly16);
// crc24aTable[c]=crcbit(&c, 1, poly24a);
// crc24bTable[c]=crcbit(&c, 1, poly24b);
// crc24cTable[c]=crcbit(&c, 1, poly24c);
} while (++c);
//return crc256Table;
}
unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen/8; // Change in bytes
resbit = (bitlen % 8);
while (octetlen-- > 0)
{
crc = (crc << 8) ^ crc256Table[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
{
crc = (crc << resbit) ^ crc256Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
}
return crc;
}
*/
// ----- Old implementation ----
uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits){ uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits){
uint8_t crcPolynomialPattern[25] = {1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1}; uint8_t crcPolynomialPattern[25] = {1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1};
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#define NR_POLAR_CRC_ERROR_CORRECTION_BITS 3
#ifndef __NR_POLAR_DEFS__H__ #ifndef __NR_POLAR_DEFS__H__
#define __NR_POLAR_DEFS__H__ #define __NR_POLAR_DEFS__H__
...@@ -53,9 +55,11 @@ struct nrPolar_params { ...@@ -53,9 +55,11 @@ struct nrPolar_params {
int16_t *Q_PC_N; int16_t *Q_PC_N;
uint8_t *information_bit_pattern; uint8_t *information_bit_pattern;
uint16_t *channel_interleaver_pattern; uint16_t *channel_interleaver_pattern;
uint32_t crc_polynomial;
uint8_t **crc_generator_matrix; //G_P uint8_t **crc_generator_matrix; //G_P
uint8_t **G_N; uint8_t **G_N;
uint32_t* crc256Table;
//polar_encoder vectors: //polar_encoder vectors:
uint8_t *nr_polar_crc; uint8_t *nr_polar_crc;
...@@ -68,6 +72,8 @@ typedef struct nrPolar_params t_nrPolar_params; ...@@ -68,6 +72,8 @@ typedef struct nrPolar_params t_nrPolar_params;
void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_params* polarParams); void polar_encoder(uint8_t *input, uint8_t *output, t_nrPolar_params* polarParams);
void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N);
int8_t polar_decoder(double *input, uint8_t *output, t_nrPolar_params *polarParams, int8_t polar_decoder(double *input, uint8_t *output, t_nrPolar_params *polarParams,
uint8_t listSize, double *aPrioriPayload, uint8_t pathMetricAppr); uint8_t listSize, double *aPrioriPayload, uint8_t pathMetricAppr);
...@@ -135,6 +141,11 @@ uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits); ...@@ -135,6 +141,11 @@ uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits);
uint8_t **crc11_generator_matrix(uint16_t payloadSizeBits); uint8_t **crc11_generator_matrix(uint16_t payloadSizeBits);
uint8_t **crc6_generator_matrix(uint16_t payloadSizeBits); uint8_t **crc6_generator_matrix(uint16_t payloadSizeBits);
void crcTable256Init (uint32_t poly, uint32_t* crc256Table);
void nr_crc_computation(uint8_t* input, uint8_t* output, uint16_t payloadBits, uint16_t crcParityBits, uint32_t* crc256Table);
unsigned int crcbit (unsigned char* inputptr, int octetlen, uint32_t poly);
unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table);
static inline void nr_polar_rate_matcher(uint8_t *input, unsigned char *output, uint16_t *pattern, uint16_t size) { static inline void nr_polar_rate_matcher(uint8_t *input, unsigned char *output, uint16_t *pattern, uint16_t size) {
for (int i=0; i<size; i++) output[i]=input[pattern[i]]; for (int i=0; i<size; i++) output[i]=input[pattern[i]];
} }
......
...@@ -33,9 +33,14 @@ void polar_encoder( ...@@ -33,9 +33,14 @@ void polar_encoder(
*/ */
//Calculate CRC. //Calculate CRC.
nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(input, polarParams->crc_generator_matrix, // --- OLD ---
polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits); //nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(input, polarParams->crc_generator_matrix,
for (uint8_t i = 0; i < polarParams->crcParityBits; i++) polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2); // polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits);
//for (uint8_t i = 0; i < polarParams->crcParityBits; i++) polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
// --- NEW ---
nr_crc_computation(input, polarParams->nr_polar_crc, polarParams->payloadBits, polarParams->crcParityBits, polarParams->crc256Table);
//Attach CRC to the Transport Block. (a to b) //Attach CRC to the Transport Block. (a to b)
for (uint16_t i = 0; i < polarParams->payloadBits; i++) polarParams->nr_polar_b[i] = input[i]; for (uint16_t i = 0; i < polarParams->payloadBits; i++) polarParams->nr_polar_b[i] = input[i];
...@@ -50,8 +55,19 @@ void polar_encoder( ...@@ -50,8 +55,19 @@ void polar_encoder(
polarParams->Q_I_N, polarParams->Q_PC_N, polarParams->n_pc); polarParams->Q_I_N, polarParams->Q_PC_N, polarParams->n_pc);
//Encoding (u to d) //Encoding (u to d)
nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(polarParams->nr_polar_u, polarParams->G_N, polarParams->nr_polar_d, polarParams->N, polarParams->N); // --- OLD ---
for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2); //nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(polarParams->nr_polar_u, polarParams->G_N, polarParams->nr_polar_d, polarParams->N, polarParams->N);
//for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2);
//printf("\nd old: ");
//for (uint16_t i = 0; i < polarParams->N; i++)
//printf("%i ", polarParams->nr_polar_d[i]);
// --- NEW ---
nr_polar_kernal_operation(polarParams->nr_polar_u, polarParams->nr_polar_d, polarParams->N);
//printf("\nd new: ");
//for (uint16_t i = 0; i < polarParams->N; i++)
// printf("%i ", polarParams->nr_polar_d[i]);
//for (uint16_t i = 0; i < polarParams->N; i++) polarParams->nr_polar_d[i] = (polarParams->nr_polar_d[i] % 2);
//Rate matching //Rate matching
//Sub-block interleaving (d to y) and Bit selection (y to e) //Sub-block interleaving (d to y) and Bit selection (y to e)
......
...@@ -3,21 +3,73 @@ ...@@ -3,21 +3,73 @@
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
void nr_polar_kernel_operation(uint8_t *u, uint8_t *d, uint16_t N) #include <immintrin.h>
void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N)
{ {
// Martino's algorithm to avoid multiplication for the generating matrix // Martino's algorithm to avoid multiplication for the generating matrix of polar codes
uint32_t i,j;
#ifdef __AVX2__
__m256i A,B,C,D,E,U,zerosOnly, OUT;
__m256i inc;
uint32_t dTest[8];
uint32_t uArray[8];
uint32_t k;
uint32_t incArray[8];
int i,j; //initialisation
printf("\nd = "); for(k=0; k<8; k++)
for(i=0; i<N; i++) incArray[k]=k;
inc=_mm256_loadu_si256((__m256i const*)incArray); // 0, 1, ..., 7 to increase
zerosOnly=_mm256_setzero_si256(); // for comparison
for(i=0; i<N; i+=8)
{ {
d[i]=0; B=_mm256_set1_epi32((int)i); // i, ..., i
B=_mm256_add_epi32(B, inc); // i, i+1, ..., i+7
OUT=_mm256_setzero_si256(); // it will contain the result of all the XORs for the d(i)s
for(j=0; j<N; j++) for(j=0; j<N; j++)
{ {
d[i]=d[i]+(( (j-i)& i )==0)*u[j]; A=_mm256_set1_epi32((int)(j)); //j, j, ..., j
A=_mm256_sub_epi32(A, B); //(j-i), (j-(i+1)), ... (j-(i+7))
U=_mm256_set1_epi32((int)u[j]);
_mm256_storeu_si256((__m256i*)uArray, U); //u(j) ... u(j) for the maskload
C=_mm256_and_si256(A, B); //(j-i)&i -> If zero, then XOR with the u(j)
D=_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask
E=_mm256_maskload_epi32((int const*)uArray, D); // load only some u(j)s for the XOR
OUT=_mm256_xor_si256(OUT, E); //32 bit x 8
} }
d[i]=d[i]%2; _mm256_storeu_si256((__m256i*)dTest, OUT);
printf("%i", d[i]); for(k=0; k<8; k++) // Conversion from 32 bits to 8 bits
{
d[i+k]=(uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it
}
}
#else
for(i=0; i<N; i++) // Create the elements of d=u*G_N ...
{
d[i]=0;
for(j=0; j<N; j++) // ... looking at all the elements of u
{
d[i]=d[i] ^ (!( (j-i)& i ))*u[j];
// it's like ((j-i)&i)==0
} }
}
#endif
} }
...@@ -33,4 +33,27 @@ ...@@ -33,4 +33,27 @@
#ifndef __NR_POLAR_UCI_DEFS__H__ #ifndef __NR_POLAR_UCI_DEFS__H__
#define __NR_POLAR_UCI_DEFS__H__ #define __NR_POLAR_UCI_DEFS__H__
#define NR_POLAR_PUCCH_PAYLOAD_BITS 32
#define NR_POLAR_PUCCH_E 32
//Ref. 38-212, Section 6.3.1.2.1
#define NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT 6
#define NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG 11
#define NR_POLAR_PUCCH_I_SEG_LONG 1
#define NR_POLAR_PUCCH_I_SEG_SHORT 0
//Ref. 38-212, Section 6.3.1.3.1
#define NR_POLAR_PUCCH_N_MAX 10
#define NR_POLAR_PUCCH_I_IL 0
#define NR_POLAR_PUCCH_N_PC_SHORT 3
#define NR_POLAR_PUCCH_N_PC_LONG 0
#define NR_POLAR_PUCCH_N_PC_WM_LONG 0
#define NR_POLAR_PUCCH_N_PC_WM_SHORT 1
//Ref. 38-212, Section 6.3.1.4.1
#define NR_POLAR_PUCCH_I_BIL 1
#endif #endif
...@@ -658,6 +658,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -658,6 +658,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
//phy_init_nr_top(&ue->frame_parms);
//nr_init_frame_parms_ue(&ue->frame_parms);
// many memory allocation sizes are hard coded // many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" ); AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" ); AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
......
...@@ -151,8 +151,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config, ...@@ -151,8 +151,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
return 0; return 0;
} }
int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config, int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms)
NR_DL_FRAME_PARMS *frame_parms)
{ {
int N_RB = 106; int N_RB = 106;
...@@ -275,7 +274,7 @@ int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config, ...@@ -275,7 +274,7 @@ int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config,
frame_parms->ofdm_symbol_size = 2048; frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720; frame_parms->samples_per_tti = 30720;
frame_parms->samples_per_subframe = 30720 * frame_parms->ttis_per_subframe; frame_parms->samples_per_subframe = 30720 * frame_parms->ttis_per_subframe;
frame_parms->first_carrier_offset = 2048-600; //frame_parms->first_carrier_offset = 2048-600;
frame_parms->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats frame_parms->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
frame_parms->samples_per_subframe_wCP = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_slot * frame_parms->slots_per_subframe; frame_parms->samples_per_subframe_wCP = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_slot * frame_parms->slots_per_subframe;
......
...@@ -375,7 +375,8 @@ void phy_config_request(PHY_Config_t *phy_config); ...@@ -375,7 +375,8 @@ void phy_config_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request(NR_PHY_Config_t *gNB);
......
...@@ -50,7 +50,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -50,7 +50,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10; unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset; unsigned int rx_offset;
//NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0]; //NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[Ns>>1]][0];
uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset; uint16_t coreset_start_subcarrier = frame_parms->first_carrier_offset+516;
uint16_t nb_rb_coreset = 24; uint16_t nb_rb_coreset = 24;
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset; uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset;
uint16_t nb_rb_pdsch = 100; uint16_t nb_rb_pdsch = 100;
...@@ -239,7 +239,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -239,7 +239,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) { for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l); printf("PDCCH Channel estimation eNB %d, aatx %d, slot %d, symbol %d start_sc %d\n",eNB_id,aa,Ns,l,coreset_start_subcarrier);
#endif #endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
......
...@@ -53,7 +53,7 @@ int wt2[12][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1 ...@@ -53,7 +53,7 @@ int wt2[12][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1
short nr_rx_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; short nr_rx_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170};
int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, /*int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset, uint8_t eNB_offset,
unsigned int Ns, unsigned int Ns,
unsigned int nr_gold_pdcch[7][20][3][10], unsigned int nr_gold_pdcch[7][20][3][10],
...@@ -65,8 +65,6 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -65,8 +65,6 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
int32_t qpsk[4],n; int32_t qpsk[4],n;
int w,ind,l,ind_dword,ind_qpsk_symb,kp,k; int w,ind,l,ind_dword,ind_qpsk_symb,kp,k;
short pamp; short pamp;
// Compute the correct pilot amplitude, sqrt_rho_b = Q3.13
pamp = ONE_OVER_SQRT2_Q15; pamp = ONE_OVER_SQRT2_Q15;
// This includes complex conjugate for channel estimation // This includes complex conjugate for channel estimation
...@@ -80,7 +78,6 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -80,7 +78,6 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
((short *)&qpsk[3])[1] = pamp; ((short *)&qpsk[3])[1] = pamp;
if (p==2000) { if (p==2000) {
// r_n from 38.211 7.4.1.3
for (n=0; n<nb_rb_coreset*3; n++) { for (n=0; n<nb_rb_coreset*3; n++) {
for (l =0; l<length_dmrs; l++){ for (l =0; l<length_dmrs; l++){
for (kp=0; kp<3; kp++){ for (kp=0; kp<3; kp++){
...@@ -106,7 +103,7 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -106,7 +103,7 @@ int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
} }
return(0); return(0);
} }*/
int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset, uint8_t eNB_offset,
...@@ -189,6 +186,35 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -189,6 +186,35 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
return(0); return(0);
} }
int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset,
unsigned int Ns,
unsigned int *nr_gold_pdcch,
int32_t *output,
unsigned short p,
unsigned short nb_rb_coreset)
{
uint8_t idx=0;
uint8_t pdcch_rb_offset =0;
//nr_gold_pdcch += ((int)floor(ue->frame_parms.ssb_start_subcarrier/12)+pdcch_rb_offset)*3/32;
if (p==2000) {
for (int i=0; i<((nb_rb_coreset*6)>>1); i++) {
idx = ((((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1);
((int16_t*)output)[i<<1] = nr_rx_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
((int16_t*)output)[(i<<1)+1] = nr_rx_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
#ifdef DEBUG_PDCCH
if (i<8)
printf("i %d idx %d pdcch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pdcch[(i<<1)>>5], (((nr_gold_pdcch[(i<<1)>>5])>>((i<<1)&0x1f))&1),
(((nr_gold_pdcch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1],&output[0]);
#endif
}
}
return(0);
}
int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch, int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch,
int32_t *output ) int32_t *output )
{ {
......
...@@ -64,7 +64,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) ...@@ -64,7 +64,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue)
} }
void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_idDMRS, unsigned short length_dmrs) void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned short n_idDMRS, unsigned short length_dmrs)
{ {
unsigned char ns,l; unsigned char ns,l;
...@@ -74,7 +74,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id ...@@ -74,7 +74,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id
if (n_idDMRS) if (n_idDMRS)
nid = n_idDMRS; nid = n_idDMRS;
else else
nid = Nid_cell; nid = ue->frame_parms.Nid_cell;
for (ns=0; ns<20; ns++) { for (ns=0; ns<20; ns++) {
...@@ -95,7 +95,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id ...@@ -95,7 +95,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id
//printf("x1 : %x, x2 : %x\n",x1,x2); //printf("x1 : %x, x2 : %x\n",x1,x2);
} }
for (n=0; n<10; n++) { for (n=0; n<52; n++) {
x1 = (x1>>1) ^ (x1>>4); x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28); x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
...@@ -107,7 +107,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id ...@@ -107,7 +107,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,unsigned int Nid_cell, unsigned short n_id
} }
} }
void nr_gold_pdsch(PHY_VARS_NR_UE* ue,unsigned short lbar,unsigned int Nid_cell, unsigned short *n_idDMRS, unsigned short length_dmrs) void nr_gold_pdsch(PHY_VARS_NR_UE* ue,unsigned short lbar,unsigned short *n_idDMRS, unsigned short length_dmrs)
{ {
unsigned char ns,l; unsigned char ns,l;
...@@ -122,7 +122,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,unsigned short lbar,unsigned int Nid_cell, ...@@ -122,7 +122,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,unsigned short lbar,unsigned int Nid_cell,
if (n_idDMRS) if (n_idDMRS)
nid = n_idDMRS[nscid]; nid = n_idDMRS[nscid];
else else
nid = Nid_cell; nid = ue->frame_parms.Nid_cell;
for (ns=0; ns<20; ns++) { for (ns=0; ns<20; ns++) {
......
...@@ -37,10 +37,9 @@ int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch, int32_t *output ); ...@@ -37,10 +37,9 @@ int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch, int32_t *output );
int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdcch_dmrs_rx(PHY_VARS_NR_UE *ue,
uint8_t eNB_offset, uint8_t eNB_offset,
unsigned int Ns, unsigned int Ns,
unsigned int nr_gold_pdcch[7][20][3][10], unsigned int *nr_gold_pdcch,
int32_t *output, int32_t *output,
unsigned short p, unsigned short p,
int length_dmrs,
unsigned short nb_rb_corset); unsigned short nb_rb_corset);
int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
...@@ -55,13 +54,11 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -55,13 +54,11 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
void nr_gold_pbch(PHY_VARS_NR_UE* ue); void nr_gold_pbch(PHY_VARS_NR_UE* ue);
void nr_gold_pdcch(PHY_VARS_NR_UE* ue, void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
unsigned int Nid_cell,
unsigned short n_idDMRS, unsigned short n_idDMRS,
unsigned short length_dmrs); unsigned short length_dmrs);
void nr_gold_pdsch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
unsigned short lbar, unsigned short lbar,
unsigned int Nid_cell,
unsigned short *n_idDMRS, unsigned short *n_idDMRS,
unsigned short length_dmrs); unsigned short length_dmrs);
......
...@@ -51,10 +51,16 @@ ...@@ -51,10 +51,16 @@
#define PSS_SC_START_NR (52) /* see from TS 38.211 table 7.4.3.1-1: Resources within an SS/PBCH block for PSS... */ #define PSS_SC_START_NR (52) /* see from TS 38.211 table 7.4.3.1-1: Resources within an SS/PBCH block for PSS... */
/* define ofdm symbol offset in the SS/PBCH block of NR synchronisation */ /* define ofdm symbol offset in the SS/PBCH block of NR synchronisation */
#define PSS_SYMBOL_NB (4) /* symbol numbers for each element */ #ifdef NR_UNIT_TEST
#define PBCH_SYMBOL_NB (5) #define OFFSET_SS_PBCH (0)
#define SSS_SYMBOL_NB (6) #else
#define PBCH_LAST_SYMBOL_NB (7) #define OFFSET_SS_PBCH (4)
#endif
#define PSS_SYMBOL_NB ((0) + OFFSET_SS_PBCH) /* symbol numbers for each element */
#define PBCH_SYMBOL_NB ((1) + OFFSET_SS_PBCH)
#define SSS_SYMBOL_NB ((2) + OFFSET_SS_PBCH)
#define PBCH_LAST_SYMBOL_NB ((3) + OFFSET_SS_PBCH)
/* SS/PBCH parameters */ /* SS/PBCH parameters */
#define N_RB_SS_PBCH_BLOCK (20) #define N_RB_SS_PBCH_BLOCK (20)
......
...@@ -219,6 +219,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -219,6 +219,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
uint8_t nushift; uint8_t nushift;
uint8_t *xbyte = pbch->pbch_a; uint8_t *xbyte = pbch->pbch_a;
memset((void*) xbyte, 0, 1); memset((void*) xbyte, 0, 1);
uint8_t pbch_a_b[32];
LOG_I(PHY, "PBCH generation started\n"); LOG_I(PHY, "PBCH generation started\n");
...@@ -281,6 +282,10 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -281,6 +282,10 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
printf("pbch_a_prime[%d]: 0x%02x\n", i, pbch->pbch_a_prime[i]); printf("pbch_a_prime[%d]: 0x%02x\n", i, pbch->pbch_a_prime[i]);
#endif #endif
for (int m=0;m<32;m++){
pbch_a_b[m] = ((pbch->pbch_a_prime[m/8]>>(m&7))&01);
//printf("pbch_a_b[%d] %d\n", m, pbch_a_b[m] );
}
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder (pbch->pbch_a_prime, pbch->pbch_e, &frame_parms->pbch_polar_params); polar_encoder (pbch->pbch_a_prime, pbch->pbch_e, &frame_parms->pbch_polar_params);
......
...@@ -113,12 +113,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -113,12 +113,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
1,ue->frame_parms.ofdm_symbol_size); 1,ue->frame_parms.ofdm_symbol_size);
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL); printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p\n", rxF); printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p\n",dl_ch);
#endif #endif
if ((ue->frame_parms.N_RB_DL&1)==0) { //if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
...@@ -214,7 +214,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -214,7 +214,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
} }
} //}
} }
...@@ -257,7 +257,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -257,7 +257,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
k = coreset_start_subcarrier; k = coreset_start_subcarrier;
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("PBCH Channel Estimation : ThreadId %d, eNB_offset %d cell_id %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,Nid_cell,ch_offset,ue->frame_parms.ofdm_symbol_size, printf("PDCCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,l,Ns,k, symbol); ue->frame_parms.Ncp,l,Ns,k, symbol);
#endif #endif
...@@ -266,7 +266,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -266,7 +266,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
fr = filt16a_r1; fr = filt16a_r1;
// generate pilot // generate pilot
nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[p][0],2000,symbol, nb_rb_coreset); nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[p][0],2000,nb_rb_coreset);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
...@@ -279,12 +279,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -279,12 +279,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
1,ue->frame_parms.ofdm_symbol_size); 1,ue->frame_parms.ofdm_symbol_size);
#ifdef DEBUG_CH //#ifdef DEBUG_CH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL); printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p\n", rxF); printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p\n",dl_ch);
#endif //#endif
if ((ue->frame_parms.N_RB_DL&1)==0) { if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
......
This diff is collapsed.
This diff is collapsed.
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
static nfapi_nr_config_request_t config_t; static nfapi_nr_config_request_t config_t;
static nfapi_nr_config_request_t* config =&config_t; static nfapi_nr_config_request_t* config =&config_t;
int cnt=0;
/* forward declarations */ /* forward declarations */
void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRAME_PARMS *frame_parms); void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRAME_PARMS *frame_parms);
...@@ -54,7 +55,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA ...@@ -54,7 +55,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
{ {
printf("nr pbch detec RB_DL %d\n", ue->frame_parms.N_RB_DL);
uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy;
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
char phich_resource[6]; char phich_resource[6];
...@@ -174,9 +175,10 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -174,9 +175,10 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
// LOG_I(PHY,"**************************************************************\n"); // LOG_I(PHY,"**************************************************************\n");
// First try FDD normal prefix // First try FDD normal prefix
frame_parms->Ncp=NORMAL; frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD; frame_parms->frame_type=TDD;
set_default_frame_parms_single(config,frame_parms); set_default_frame_parms_single(config,frame_parms);
nr_init_frame_parms_ue(config,frame_parms); nr_init_frame_parms_ue(frame_parms);
printf("nr_initial sync ue RB_DL %d\n", ue->frame_parms.N_RB_DL);
/* /*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
exit(-1); exit(-1);
...@@ -194,7 +196,9 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -194,7 +196,9 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
* -------------------------- * --------------------------
* sync_pos SS/PBCH block * sync_pos SS/PBCH block
*/ */
cnt++;
if (cnt >100){
cnt =0;
/* process pss search on received buffer */ /* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE);
...@@ -211,7 +215,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -211,7 +215,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
else else
ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot; ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot;
printf("sync_pos %d sync_pos_slot %d rx_offset\n",sync_pos,sync_pos_slot, ue->rx_offset); printf("sync_pos %d sync_pos_slot %d rx_offset %d\n",sync_pos,sync_pos_slot, ue->rx_offset);
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
...@@ -235,6 +239,11 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -235,6 +239,11 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
nr_gold_pbch(ue); nr_gold_pbch(ue);
ret = nr_pbch_detection(ue,mode); ret = nr_pbch_detection(ue,mode);
nr_gold_pdcch(ue,0, 2);
nr_slot_fep(ue,0, 0, ue->rx_offset, 1, 1, NR_PDCCH_EST);
nr_slot_fep(ue,1, 0, ue->rx_offset, 1, 1, NR_PDCCH_EST);
LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
ue->Mod_id, ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx, ue->proc.proc_rxtx[0].frame_rx,
...@@ -254,6 +263,10 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % ...@@ -254,6 +263,10 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %
LOG_I(PHY,"FDD Normal prefix: SSS error condition: sync_pos %d, sync_pos_slot %d\n", sync_pos, sync_pos_slot); LOG_I(PHY,"FDD Normal prefix: SSS error condition: sync_pos %d, sync_pos_slot %d\n", sync_pos, sync_pos_slot);
#endif #endif
} }
}
else {
ret = -1;
}
/* Consider this is a false detection if the offset is > 1000 Hz */ /* Consider this is a false detection if the offset is > 1000 Hz */
if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) ) if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) )
......
...@@ -486,11 +486,11 @@ void nr_pbch_quantize(int8_t *pbch_llr8, ...@@ -486,11 +486,11 @@ void nr_pbch_quantize(int8_t *pbch_llr8,
uint16_t i; uint16_t i;
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
/*if (pbch_llr[i]>7) if (pbch_llr[i]>127)
pbch_llr8[i]=7; pbch_llr8[i]=127;
else if (pbch_llr[i]<-8) else if (pbch_llr[i]<-128)
pbch_llr8[i]=-8; pbch_llr8[i]=-128;
else*/ else
pbch_llr8[i] = (char)(pbch_llr[i]); pbch_llr8[i] = (char)(pbch_llr[i]);
} }
...@@ -696,14 +696,27 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -696,14 +696,27 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
//#ifdef DEBUG_PBCH //#ifdef DEBUG_PBCH
for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){ for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){
printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]); //printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]);
printf("[PBCH] decoder_output[%d] = %x\n",i,decoded_output[i]); printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]);
} }
//#endif //#endif
ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance
//ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance()
ue->rx_ind.number_pdus = ue->rx_ind.number_pdus + 1;
ue->rx_ind.rx_indication_body = (fapi_nr_rx_indication_body_t *)malloc(sizeof(fapi_nr_rx_indication_body_t));
ue->rx_ind.rx_indication_body->pdu_type = FAPI_NR_RX_PDU_TYPE_MIB;
ue->rx_ind.rx_indication_body->mib_pdu.pdu = &decoded_output[1];
ue->rx_ind.rx_indication_body->mib_pdu.additional_bits = decoded_output[0];
ue->rx_ind.rx_indication_body->mib_pdu.ssb_index = ssb_index; // confirm with TCL
ue->rx_ind.rx_indication_body->mib_pdu.ssb_length = Lmax; // confirm with TCL
ue->rx_ind.rx_indication_body->mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
ue->if_inst->dl_indication(&ue->dl_indication);
return 0;
}
//ue->dl_indication.rx_ind.rx_request_body.pdu_index = FAPI_NR_RX_PDU_BCCH_BCH_TYPE;
//ue->dl_indication.rx_ind.rx_request_body.pdu_length = 3;
//ue->dl_indication.rx_ind.rx_request_body.pdu = &decoded_output[0];
//ue->if_inst->dl_indication(&ue->dl_indication);
}
...@@ -1352,24 +1352,6 @@ int dump_dci(NR_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci); ...@@ -1352,24 +1352,6 @@ int dump_dci(NR_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci);
int dump_ue_stats(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, char* buffer, int length, runmode_t mode, int input_level_dBm); int dump_ue_stats(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, char* buffer, int length, runmode_t mode, int input_level_dBm);
void generate_pcfich_reg_mapping(NR_DL_FRAME_PARMS *frame_parms);
void pcfich_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
int16_t *d);
uint8_t rx_pcfich(NR_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
NR_UE_PDCCH *lte_ue_pdcch_vars,
MIMO_mode_t mimo_mode);
void generate_phich_reg_mapping(NR_DL_FRAME_PARMS *frame_parms);
void init_transport_channels(uint8_t); void init_transport_channels(uint8_t);
void generate_RIV_tables(void); void generate_RIV_tables(void);
...@@ -1381,7 +1363,7 @@ void generate_RIV_tables(void); ...@@ -1381,7 +1363,7 @@ void generate_RIV_tables(void);
parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.) parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.)
@param phy_vars_ue Pointer to UE variables @param phy_vars_ue Pointer to UE variables
*/ */
int initial_sync(PHY_VARS_NR_UE *phy_vars_ue, runmode_t mode); int nr_initial_sync(PHY_VARS_NR_UE *phy_vars_ue, runmode_t mode);
/*! /*!
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#define __NR_TRANSPORT_UE__H__ #define __NR_TRANSPORT_UE__H__
#include <limits.h> #include <limits.h>
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
//#include "PHY/defs_nr_UE.h" //#include "PHY/defs_nr_UE.h"
//#include "../LTE_TRANSPORT/dci.h" //#include "../LTE_TRANSPORT/dci.h"
//#include "../LTE_TRANSPORT/mdci.h" //#include "../LTE_TRANSPORT/mdci.h"
...@@ -50,11 +51,18 @@ ...@@ -50,11 +51,18 @@
* @{ * @{
*/ */
typedef enum {
NEW_TRANSMISSION_HARQ,
RETRANSMISSION_HARQ
} harq_result_t;
//#if defined(UPGRADE_RAT_NR) //#if defined(UPGRADE_RAT_NR)
#if 1 #if 1
typedef struct { typedef struct {
/// HARQ process id /// HARQ process id
uint8_t harq_id; uint8_t harq_id;
/// HARQ rx status
harq_result_t rx_status;
/// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX /// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack; uint8_t ack;
/// send status (for PUCCH) /// send status (for PUCCH)
...@@ -81,6 +89,8 @@ typedef struct { ...@@ -81,6 +89,8 @@ typedef struct {
uint8_t first_tx; uint8_t first_tx;
/// Last Ndi received for this process on DCI (used for C-RNTI only) /// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi; uint8_t DCINdi;
/// HARQ tx status
harq_result_t tx_status;
/// Flag indicating that this ULSCH has a new packet (start of new round) /// Flag indicating that this ULSCH has a new packet (start of new round)
// uint8_t Ndi; // uint8_t Ndi;
/// Status Flag indicating for this ULSCH (idle,active,disabled) /// Status Flag indicating for this ULSCH (idle,active,disabled)
...@@ -145,7 +155,6 @@ typedef struct { ...@@ -145,7 +155,6 @@ typedef struct {
// int calibration_flag; // int calibration_flag;
/// Number of soft channel bits /// Number of soft channel bits
uint32_t G; uint32_t G;
// decode phich // decode phich
uint8_t decode_phich; uint8_t decode_phich;
} NR_UL_UE_HARQ_t; } NR_UL_UE_HARQ_t;
...@@ -159,7 +168,7 @@ typedef struct { ...@@ -159,7 +168,7 @@ typedef struct {
#if 1 #if 1
// Pointers to HARQ processes for the ULSCH // Pointers to HARQ processes for the ULSCH
NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES]; NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
int harq_process_id[NR_MAX_SLOTS_PAR_FRAME]; int harq_process_id[NR_MAX_SLOTS_PER_FRAME];
// UL number of harq processes // UL number of harq processes
uint8_t number_harq_processes_for_pusch; uint8_t number_harq_processes_for_pusch;
#endif #endif
...@@ -211,6 +220,8 @@ typedef struct { ...@@ -211,6 +220,8 @@ typedef struct {
uint8_t cooperation_flag; uint8_t cooperation_flag;
/// RNTI attributed to this ULSCH /// RNTI attributed to this ULSCH
uint16_t rnti; uint16_t rnti;
/// RNTI type
uint8_t rnti_type;
/// f_PUSCH parameter for PUSCH power control /// f_PUSCH parameter for PUSCH power control
int16_t f_pusch; int16_t f_pusch;
/// Po_PUSCH - target output power for PUSCH /// Po_PUSCH - target output power for PUSCH
...@@ -282,6 +293,12 @@ typedef struct { ...@@ -282,6 +293,12 @@ typedef struct {
uint32_t G; uint32_t G;
/// Current Number of RBs /// Current Number of RBs
uint16_t nb_rb; uint16_t nb_rb;
/// Starting RB number
uint16_t start_rb;
/// Number of Symbols
uint16_t nb_symbols;
/// Starting Symbol number
uint16_t start_symbol;
/// Current subband PMI allocation /// Current subband PMI allocation
uint16_t pmi_alloc; uint16_t pmi_alloc;
/// Current RB allocation (even slots) /// Current RB allocation (even slots)
...@@ -305,6 +322,8 @@ typedef struct { ...@@ -305,6 +322,8 @@ typedef struct {
typedef struct { typedef struct {
/// RNTI /// RNTI
uint16_t rnti; uint16_t rnti;
/// RNTI type
uint8_t rnti_type;
/// Active flag for DLSCH demodulation /// Active flag for DLSCH demodulation
uint8_t active; uint8_t active;
/// Transmission mode /// Transmission mode
...@@ -379,12 +398,14 @@ typedef struct { ...@@ -379,12 +398,14 @@ typedef struct {
boolean_t ra_flag; boolean_t ra_flag;
/// rnti /// rnti
rnti_t rnti; rnti_t rnti;
/// rnti type
//crc_scrambled_t rnti_type;
/// Format /// Format
NR_DCI_format_t format; NR_DCI_format_t format;
/// search space /// search space
dci_space_t search_space; dci_space_t search_space;
/// DCI pdu /// DCI pdu
uint8_t dci_pdu[8]; uint32_t dci_pdu[4];
//#if defined(UPGRADE_RAT_NR) //#if defined(UPGRADE_RAT_NR)
#if 1 #if 1
/// harq information /// harq information
......
...@@ -369,7 +369,7 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) ...@@ -369,7 +369,7 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
assert(0); assert(0);
} }
size = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms_ue->samples_per_subframe; size = NR_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms_ue->samples_per_subframe;
q = malloc16(size); q = malloc16(size);
if (q != NULL) { if (q != NULL) {
pss_corr_ue[i] = q; pss_corr_ue[i] = q;
...@@ -578,7 +578,7 @@ void restore_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_ch ...@@ -578,7 +578,7 @@ void restore_frame_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue, int rate_ch
void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **rxdata) void decimation_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change, int **rxdata)
{ {
NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
int samples_for_frame = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti; int samples_for_frame = NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti;
#if TEST_SYNCHRO_TIMING_PSS #if TEST_SYNCHRO_TIMING_PSS
...@@ -631,7 +631,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change) ...@@ -631,7 +631,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change)
#ifdef DBG_PSS_NR #ifdef DBG_PSS_NR
int samples_for_frame = frame_parms->samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME; int samples_for_frame = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
write_output("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], samples_for_frame, 1, 1); write_output("rxdata0_rand.m","rxd0_rand", &PHY_vars_UE->common_vars.rxdata[0][0], samples_for_frame, 1, 1);
...@@ -772,7 +772,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain ...@@ -772,7 +772,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
int result; int result;
int synchro_out; int synchro_out;
unsigned int tmp[NUMBER_PSS_SEQUENCE]; unsigned int tmp[NUMBER_PSS_SEQUENCE];
unsigned int length = (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe*frame_parms->samples_per_tti); /* 1 frame for now, it should be 2 TODO_NR */ unsigned int length = (NR_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->ttis_per_subframe*frame_parms->samples_per_tti); /* 1 frame for now, it should be 2 TODO_NR */
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) { for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
tmp[i] = 0; tmp[i] = 0;
......
This diff is collapsed.
...@@ -160,27 +160,6 @@ ...@@ -160,27 +160,6 @@
#include "NR_IF_Module.h" #include "NR_IF_Module.h"
//#if defined(UPGRADE_RAT_NR)
#if 1
/* see 38.321 Table 7.1-2 RNTI usage */
typedef enum { /* Type for Radio Network Temporary Identifier */
C_RNTI_NR = 0, /* Cell RNTI */
Temporary_C_RNTI_NR, /* Temporary C-RNTI */
CS_RNTI_NR, /* Configured Scheduling RNTI */
P_RNTI_NR, /* Paging RNTI */
SI_RNTI_NR, /* System information RNTI */
RA_RNTI_NR, /* Random Access RNTI */
TPC_CS_RNTI_NR, /* configured scheduling uplink power control */
TPC_PUCCH_RNTI_NR, /* PUCCH power control */
TPC_PUSCH_RNTI_NR, /* PUSCH power control */
TPC_SRS_RNTI_NR, /* SRS trigger and power control */
INT_RNTI_NR, /* Indication pre-emption in DL */
SFI_RNTI_NR, /* Slot Format Indication on the given cell */
SP_CSI_RNTI_NR /* Semipersistent CSI reporting on PUSCH */
} nr_rnti_type_t;
#endif
/// Context data structure for RX/TX portion of subframe processing /// Context data structure for RX/TX portion of subframe processing
typedef struct { typedef struct {
/// index of the current UE RX/TX proc /// index of the current UE RX/TX proc
...@@ -615,9 +594,9 @@ typedef struct { ...@@ -615,9 +594,9 @@ typedef struct {
#define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0) #define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
#ifdef NR_PDCCH_DEFS_NR_UE #ifdef NR_PDCCH_DEFS_NR_UE
#define MAX_NR_DCI_DECODED_SLOT 10 #define MAX_NR_DCI_DECODED_SLOT 10 // This value is not specified
#define NBR_NR_FORMATS 8 #define NBR_NR_FORMATS 8 // The number of formats is 8 (0_0, 0_1, 1_0, 1_1, 2_0, 2_1, 2_2, 2_3)
#define NBR_NR_DCI_FIELDS 56 #define NBR_NR_DCI_FIELDS 56 // The number of different dci fields defined in TS 38.212 subclause 7.3.1
#define IDENTIFIER_DCI_FORMATS 0 #define IDENTIFIER_DCI_FORMATS 0
#define CARRIER_IND 1 #define CARRIER_IND 1
...@@ -655,7 +634,6 @@ typedef struct { ...@@ -655,7 +634,6 @@ typedef struct {
#define TPC_PUCCH 33 #define TPC_PUCCH 33
#define PUCCH_RESOURCE_IND 34 #define PUCCH_RESOURCE_IND 34
#define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35 #define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35
//#define SHORT_MESSAGE_IND 33
#define SRS_RESOURCE_IND 36 #define SRS_RESOURCE_IND 36
#define PRECOD_NBR_LAYERS 37 #define PRECOD_NBR_LAYERS 37
#define ANTENNA_PORTS 38 #define ANTENNA_PORTS 38
...@@ -701,24 +679,21 @@ typedef enum { ...@@ -701,24 +679,21 @@ typedef enum {
#define _TPC_PUSCH_RNTI_ 10 #define _TPC_PUSCH_RNTI_ 10
#define _TPC_PUCCH_RNTI_ 11 #define _TPC_PUCCH_RNTI_ 11
#define _TPC_SRS_RNTI_ 12 #define _TPC_SRS_RNTI_ 12
typedef enum { typedef enum { /* see 38.321 Table 7.1-2 RNTI usage */
_c_rnti = _C_RNTI_, _c_rnti = _C_RNTI_, /* Cell RNTI */
_cs_rnti = _CS_RNTI_, _cs_rnti = _CS_RNTI_, /* Configured Scheduling RNTI */
_new_rnti = _NEW_RNTI_, _new_rnti = _NEW_RNTI_, /* ? */
_tc_rnti = _TC_RNTI_, _tc_rnti = _TC_RNTI_, /* Temporary C-RNTI */
_p_rnti = _P_RNTI_, _p_rnti = _P_RNTI_, /* Paging RNTI */
_si_rnti = _SI_RNTI_, _si_rnti = _SI_RNTI_, /* System information RNTI */
_ra_rnti = _RA_RNTI_, _ra_rnti = _RA_RNTI_, /* Random Access RNTI */
_sp_csi_rnti = _SP_CSI_RNTI_, _sp_csi_rnti = _SP_CSI_RNTI_, /* Semipersistent CSI reporting on PUSCH */
_sfi_rnti = _SFI_RNTI_, _sfi_rnti = _SFI_RNTI_, /* Slot Format Indication on the given cell */
_int_rnti = _INT_RNTI_, _int_rnti = _INT_RNTI_, /* Indication pre-emption in DL */
_tpc_pusch_rnti = _TPC_PUSCH_RNTI_, _tpc_pusch_rnti = _TPC_PUSCH_RNTI_, /* PUSCH power control */
_tpc_pucch_rnti = _TPC_PUCCH_RNTI_, _tpc_pucch_rnti = _TPC_PUCCH_RNTI_, /* PUCCH power control */
_tpc_srs_rnti = _TPC_SRS_RNTI_} crc_scrambled_t; _tpc_srs_rnti = _TPC_SRS_RNTI_} crc_scrambled_t;
typedef enum {bundle_n2=2,bundle_n3=3,bundle_n6=6} NR_UE_CORESET_REG_bundlesize_t; typedef enum {bundle_n2=2,bundle_n3=3,bundle_n6=6} NR_UE_CORESET_REG_bundlesize_t;
typedef enum {interleave_n2=2,interleave_n3=3,interleave_n6=6} NR_UE_CORESET_interleaversize_t; typedef enum {interleave_n2=2,interleave_n3=3,interleave_n6=6} NR_UE_CORESET_interleaversize_t;
...@@ -774,11 +749,11 @@ typedef struct { ...@@ -774,11 +749,11 @@ typedef struct {
int tciStatesPDCCH; int tciStatesPDCCH;
int tciPresentInDCI; int tciPresentInDCI;
uint16_t pdcchDMRSScramblingID; uint16_t pdcchDMRSScramblingID;
uint16_t rb_offset;
} NR_UE_PDCCH_CORESET; } NR_UE_PDCCH_CORESET;
// Slots for PDCCH Monitoring configured as periodicity and offset // Slots for PDCCH Monitoring configured as periodicity and offset
typedef enum {nr_sl1=1,nr_sl2=2,nr_sl4=4,nr_sl5=5,nr_sl8=8,nr_sl10=10,nr_sl16=16,nr_sl20=20} NR_UE_SLOT_PERIOD_OFFSET_t; typedef enum {nr_sl1=1,nr_sl2=2,nr_sl4=4,nr_sl5=5,nr_sl8=8,nr_sl10=10,nr_sl16=16,nr_sl20=20,nr_sl40=40,nr_sl80=80,nr_sl160=160,nr_sl320=320,nr_sl640=640,nr_sl1280=1280,nr_sl2560=2560} NR_UE_SLOT_PERIOD_OFFSET_t;
typedef enum {nc0=0,nc1=1,nc2=2,nc3=3,nc4=4,nc5=5,nc6=6,nc8=8} NR_UE_SEARCHSPACE_nbrCAND_t; typedef enum {nc0=0,nc1=1,nc2=2,nc3=3,nc4=4,nc5=5,nc6=6,nc8=8} NR_UE_SEARCHSPACE_nbrCAND_t;
typedef enum {nsfi1=1,nsfi2=2} NR_UE_SEARCHSPACE_nbrCAND_SFI_t; typedef enum {nsfi1=1,nsfi2=2} NR_UE_SEARCHSPACE_nbrCAND_SFI_t;
typedef enum {n2_3_1=1,n2_3_2=2} NR_UE_SEARCHSPACE_nbrCAND_2_3_t; typedef enum {n2_3_1=1,n2_3_2=2} NR_UE_SEARCHSPACE_nbrCAND_2_3_t;
...@@ -848,9 +823,12 @@ typedef struct { ...@@ -848,9 +823,12 @@ typedef struct {
// INTEGER (0..maxNrofSearchSpaces-1) (0..40-1) // INTEGER (0..maxNrofSearchSpaces-1) (0..40-1)
int searchSpaceId; int searchSpaceId;
int controlResourceSetId; int controlResourceSetId;
// FIXME! Verify type to be used for this parameter (sl1, sl2, sl4, sl5, sl8, sl10, sl16, sl20). Maybe enum.
NR_UE_SLOT_PERIOD_OFFSET_t monitoringSlotPeriodicityAndOffset; NR_UE_SLOT_PERIOD_OFFSET_t monitoringSlotPeriodicityAndOffset;
int monitoringSlotPeriodicityAndOffset_offset; uint16_t monitoringSlotPeriodicityAndOffset_offset;
// duration is number of consecutive slots that a SearchSpace lasts in every occasion, i.e., upon every period as given in the periodicityAndOffset
// if the field is absent, the UE applies the value 1 slot
// the maximum valid duration is peridicity-1 (periodicity as given in the monitoringSlotPeriodicityAndOffset)
uint16_t duration;
// bit string size 14. Bitmap to indicate symbols within slot where PDCCH has to be monitored // bit string size 14. Bitmap to indicate symbols within slot where PDCCH has to be monitored
// the MSB (left) bit represents first OFDM in slot // the MSB (left) bit represents first OFDM in slot
uint16_t monitoringSymbolWithinSlot; uint16_t monitoringSymbolWithinSlot;
...@@ -916,11 +894,14 @@ typedef struct { ...@@ -916,11 +894,14 @@ typedef struct {
uint8_t dciFormat; uint8_t dciFormat;
uint8_t agregationLevel; uint8_t agregationLevel;
#ifdef NR_PDCCH_DEFS_NR_UE #ifdef NR_PDCCH_DEFS_NR_UE
int nb_searchSpaces;
// CORESET structure, where maximum number of CORESETs to be handled is 3 (according to 38.331 V15.1.0) // CORESET structure, where maximum number of CORESETs to be handled is 3 (according to 38.331 V15.1.0)
NR_UE_PDCCH_CORESET coreset[NR_NBR_CORESET_ACT_BWP]; NR_UE_PDCCH_CORESET coreset[NR_NBR_CORESET_ACT_BWP];
// SEARCHSPACE structure, where maximum number of SEARCHSPACEs to be handled is 10 (according to 38.331 V15.1.0) // SEARCHSPACE structure, where maximum number of SEARCHSPACEs to be handled is 10 (according to 38.331 V15.1.0)
// Each SearchSpace is associated with one ControlResourceSet // Each SearchSpace is associated with one ControlResourceSet
NR_UE_PDCCH_SEARCHSPACE searchSpace[NR_NBR_SEARCHSPACE_ACT_BWP]; NR_UE_PDCCH_SEARCHSPACE searchSpace[NR_NBR_SEARCHSPACE_ACT_BWP];
uint32_t nb_search_space;
#endif #endif
} NR_UE_PDCCH; } NR_UE_PDCCH;
...@@ -1015,9 +996,9 @@ typedef struct { ...@@ -1015,9 +996,9 @@ typedef struct {
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime) /// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_t rx_gain_byp[4]; uint32_t rx_gain_byp[4];
/// \brief Current transmit power /// \brief Current transmit power
int16_t tx_power_dBm[MAX_NR_OF_SLOTS]; int16_t tx_power_dBm[NR_MAX_SLOTS_PER_FRAME];
/// \brief Total number of REs in current transmission /// \brief Total number of REs in current transmission
int tx_total_RE[MAX_NR_OF_SLOTS]; int tx_total_RE[NR_MAX_SLOTS_PER_FRAME];
/// \brief Maximum transmit power /// \brief Maximum transmit power
int8_t tx_power_max_dBm; int8_t tx_power_max_dBm;
/// \brief Number of eNB seen by UE /// \brief Number of eNB seen by UE
...@@ -1036,6 +1017,8 @@ typedef struct { ...@@ -1036,6 +1017,8 @@ typedef struct {
nr_ue_if_module_t *if_inst; nr_ue_if_module_t *if_inst;
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
nr_uplink_indication_t ul_indication; nr_uplink_indication_t ul_indication;
fapi_nr_rx_indication_t rx_ind;
fapi_nr_dci_indication_t dci_ind;
// point to the current rxTx thread index // point to the current rxTx thread index
uint8_t current_thread_id[10]; uint8_t current_thread_id[10];
...@@ -1086,7 +1069,7 @@ typedef struct { ...@@ -1086,7 +1069,7 @@ typedef struct {
uint32_t nr_gold_pdsch[2][20][2][21]; uint32_t nr_gold_pdsch[2][20][2][21];
/// PDCCH DMRS /// PDCCH DMRS
uint32_t nr_gold_pdcch[7][20][3][10]; uint32_t nr_gold_pdcch[7][20][3][52];
uint32_t X_u[64][839]; uint32_t X_u[64][839];
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef __PHY_DEFS_NR_COMMON__H__ #ifndef __PHY_DEFS_NR_COMMON__H__
#define __PHY_DEFS_NR_COMMON__H__ #define __PHY_DEFS_NR_COMMON__H__
#include "PHY/impl_defs_top.h"
#include "defs_common.h" #include "defs_common.h"
#include "nfapi_nr_interface.h" #include "nfapi_nr_interface.h"
#include "impl_defs_nr.h" #include "impl_defs_nr.h"
...@@ -176,7 +177,7 @@ typedef struct NR_DL_FRAME_PARMS { ...@@ -176,7 +177,7 @@ typedef struct NR_DL_FRAME_PARMS {
TDD_UL_DL_SlotConfig_t *p_TDD_UL_DL_ConfigDedicated; TDD_UL_DL_SlotConfig_t *p_TDD_UL_DL_ConfigDedicated;
/// TDD configuration /// TDD configuration
uint16_t tdd_uplink_nr[MAX_NR_OF_SLOTS]; /* this is a bitmap of symbol of each slot given for 2 frames */ uint16_t tdd_uplink_nr[2*NR_MAX_SLOTS_PER_FRAME]; /* this is a bitmap of symbol of each slot given for 2 frames */
//SSB related params //SSB related params
/// Start in Subcarrier index of the SSB block /// Start in Subcarrier index of the SSB block
......
...@@ -114,12 +114,13 @@ SystemInformationBlockType1_nr_t; ...@@ -114,12 +114,13 @@ SystemInformationBlockType1_nr_t;
* *
************************************************************************/ ************************************************************************/
#define MAX_NR_OF_SLOTS (320) /* maximum number of slots */
#define NR_TDD_DOWNLINK_SLOT (0x0000) #define NR_TDD_DOWNLINK_SLOT (0x0000)
#define NR_TDD_UPLINK_SLOT (0x3FFF) /* uplink bitmap for each symbol, there are 14 symbols per slots */ #define NR_TDD_UPLINK_SLOT (0x3FFF) /* uplink bitmap for each symbol, there are 14 symbols per slots */
#define NR_TDD_SET_ALL_SYMBOLS (0x3FFF) #define NR_TDD_SET_ALL_SYMBOLS (0x3FFF)
#define NR_DOWNLINK_SLOT (0x01)
#define NR_UPLINK_SLOT (0x02)
#define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */ #define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */
typedef enum { typedef enum {
...@@ -541,7 +542,7 @@ typedef struct { ...@@ -541,7 +542,7 @@ typedef struct {
const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]; /* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]; /* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */
/* structure with all possible field for pucch format from 0 to 4 */ /* structure with all possible fields for pucch format from 0 to 4 */
typedef struct { typedef struct {
pucch_format_nr_t format; /* format 0 1 2 3 4 */ pucch_format_nr_t format; /* format 0 1 2 3 4 */
uint8_t initialCyclicShift; /* x x */ uint8_t initialCyclicShift; /* x x */
......
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
#define NB_NUMEROLOGIES_NR (5) #define NB_NUMEROLOGIES_NR (5)
#define TDD_CONFIG_NB_FRAMES (2) #define TDD_CONFIG_NB_FRAMES (2)
#define NR_MAX_SLOTS_PAR_FRAME (160) /* number of slots per frame */ #define NR_MAX_SLOTS_PER_FRAME (160) /* number of slots per frame */
#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (4) /* FFS_NR_TODO it defines ue capability which is the number of slots */ #define NR_UE_CAPABILITY_SLOT_RX_TO_TX (4) /* FFS_NR_TODO it defines ue capability which is the number of slots */
/* - between reception of pdsch and tarnsmission of its acknowlegment */ /* - between reception of pdsch and tarnsmission of its acknowlegment */
/* - between reception of un uplink grant and its related transmission */ /* - between reception of un uplink grant and its related transmission */
......
...@@ -123,7 +123,7 @@ void phy_procedures_UE_TX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB ...@@ -123,7 +123,7 @@ void phy_procedures_UE_TX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
@param phy_vars_rn pointer to RN variables @param phy_vars_rn pointer to RN variables
*/ */
int phy_procedures_UE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type); int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type); int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
#ifdef UE_SLOT_PARALLELISATION #ifdef UE_SLOT_PARALLELISATION
......
...@@ -41,17 +41,86 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g; ...@@ -41,17 +41,86 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
/// module id
module_id_t module_id = scheduled_response->module_id;
/// component carrier id
uint8_t cc_id = scheduled_response->CC_id;
uint32_t i;
if(scheduled_response != NULL){ if(scheduled_response != NULL){
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[module_id][cc_id];
NR_UE_PDCCH *pdcch_vars2 = ue->pdcch_vars[0][0];
if(scheduled_response->dl_config != NULL){ if(scheduled_response->dl_config != NULL){
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
for(i=0; i<dl_config->number_pdus; ++i){
if(dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI){
pdcch_vars2->nb_search_space = pdcch_vars2->nb_search_space + 1;
fapi_nr_dl_config_dci_dl_pdu_rel15_t *dci_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
pdcch_vars2->searchSpace[i].monitoringSymbolWithinSlot = dci_config->monitoring_symbols_within_slot;
pdcch_vars2->searchSpace[i].nrofCandidates_aggrlevel1 = dci_config->number_of_candidates[0];
pdcch_vars2->searchSpace[i].nrofCandidates_aggrlevel2 = dci_config->number_of_candidates[1];
pdcch_vars2->searchSpace[i].nrofCandidates_aggrlevel4 = dci_config->number_of_candidates[2];
pdcch_vars2->searchSpace[i].nrofCandidates_aggrlevel8 = dci_config->number_of_candidates[3];
pdcch_vars2->searchSpace[i].nrofCandidates_aggrlevel16 = dci_config->number_of_candidates[4];
pdcch_vars2->coreset[i].duration = dci_config->coreset.duration;
pdcch_vars2->coreset[i].frequencyDomainResources = dci_config->coreset.frequency_domain_resource;
pdcch_vars2->coreset[i].rb_offset = dci_config->coreset.rb_offset;
if(dci_config->coreset.cce_reg_mapping_type == CCE_REG_MAPPING_TYPE_INTERLEAVED){
pdcch_vars2->coreset[i].cce_reg_mappingType.shiftIndex = dci_config->coreset.cce_reg_interleaved_shift_index;
pdcch_vars2->coreset[i].cce_reg_mappingType.reg_bundlesize = dci_config->coreset.cce_reg_interleaved_reg_bundle_size;
pdcch_vars2->coreset[i].cce_reg_mappingType.interleaversize = dci_config->coreset.cce_reg_interleaved_interleaver_size;
}else{ //CCE_REG_MAPPING_TYPE_NON_INTERLEAVED
pdcch_vars2->coreset[i].cce_reg_mappingType.shiftIndex = 0;
pdcch_vars2->coreset[i].cce_reg_mappingType.reg_bundlesize = 0;
pdcch_vars2->coreset[i].cce_reg_mappingType.interleaversize = 0;
}
pdcch_vars2->coreset[i].precoderGranularity = dci_config->coreset.precoder_granularity;
//pdcch_vars2->coreset[i].tciStatesPDCCH;
//pdcch_vars2->coreset[i].tciPresentInDCI;
pdcch_vars2->coreset[i].pdcchDMRSScramblingID = dci_config->coreset.pdcch_dmrs_scrambling_id;
}else{ //FAPI_NR_DL_CONFIG_TYPE_DLSCH
// dlsch config pdu
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
NR_UE_DLSCH_t **dlsch = ue->dlsch[ue->current_thread_id[0]][0]; //nr_tti_rx
NR_UE_DLSCH_t *dlsch0 = dlsch[0];
NR_DL_UE_HARQ_t *dlsch0_harq = dlsch[0]->harq_processes[dlsch_pdu->harq_pid];
dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
dlsch0_harq->start_rb = dlsch_pdu->start_rb;
dlsch0_harq->nb_rb = dlsch_pdu->number_rbs;
dlsch0_harq->nb_symbols = dlsch_pdu->number_symbols;
dlsch0_harq->nb_symbols = dlsch_pdu->number_symbols;
dlsch0_harq->start_symbol = dlsch_pdu->start_symbol;
dlsch0->current_harq_pid = dlsch_pdu->harq_pid;
dlsch0->active = 1;
dlsch0_harq->mcs = dlsch_pdu->mcs;
dlsch0_harq->DCINdi = dlsch_pdu->ndi;
}
}
}else{
pdcch_vars2->nb_search_space = 0;
} }
if(scheduled_response->ul_config != NULL){ if(scheduled_response->ul_config != NULL){
}else{
} }
if(scheduled_response->tx_request != NULL){ if(scheduled_response->tx_request != NULL){
}else{
} }
} }
......
...@@ -89,9 +89,53 @@ ...@@ -89,9 +89,53 @@
************************************************************************/ ************************************************************************/
#include "PHY/defs_nr_UE.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "SCHED_NR_UE/harq_nr.h" #include "SCHED_NR_UE/harq_nr.h"
/********************* define **************************************/
#define DL_DCI (1)
#define UL_DCI (0)
/*******************************************************************
*
* NAME : get_dci_info_for_harq
*
* PARAMETERS : pointer to ue context
* id of current gNB
* number of uplink processes
* maximum number of uplink retransmissions
* RETURN : none
*
* DESCRIPTION : update HARQ entity with information from DCI
* TS 38.212 7.3.1.2 DCI formats for scheduling PDSCH
*
*********************************************************************/
void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_info_extracted,
NR_UE_DLSCH_t **dlsch, NR_UE_ULSCH_t *ulsch, uint8_t nr_tti_rx, uint8_t tx_offset)
{
if (nr_dci_info_extracted->identifier_dci_formats == DL_DCI) {
dlsch[0]->current_harq_pid = nr_dci_info_extracted->harq_process_number;
NR_DL_UE_HARQ_t *dl_harq = dlsch[0]->harq_processes[dlsch[0]->current_harq_pid];
dl_harq->harq_ack.vDAI_DL = nr_dci_info_extracted->dai+1;
dl_harq->harq_ack.pucch_resource_indicator = nr_dci_info_extracted->pucch_resource_ind;
dl_harq->harq_ack.slot_for_feedback_ack = (nr_tti_rx + nr_dci_info_extracted->pdsch_to_harq_feedback_time_ind)%ue->frame_parms.ttis_per_subframe;
dl_harq->harq_ack.harq_id = nr_dci_info_extracted->harq_process_number;
dl_harq->harq_ack.rx_status = downlink_harq_process(dl_harq, dlsch[0]->current_harq_pid, nr_dci_info_extracted->ndi, dlsch[0]->rnti_type);
}
else if (nr_dci_info_extracted->identifier_dci_formats == UL_DCI) {
/* store harq id for which pusch should be transmitted at rx_slot + tx_offset */
set_tx_harq_id(ulsch, nr_dci_info_extracted->harq_process_number, (nr_tti_rx + tx_offset)%ue->frame_parms.ttis_per_subframe);
ulsch->harq_processes[nr_dci_info_extracted->harq_process_number]->tx_status = uplink_harq_process(ulsch, nr_dci_info_extracted->harq_process_number, nr_dci_info_extracted->ndi, ulsch->rnti_type);
}
}
/******************************************************************* /*******************************************************************
* *
* NAME : config_uplink_harq_process * NAME : config_uplink_harq_process
...@@ -139,6 +183,10 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h ...@@ -139,6 +183,10 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h
ulsch->harq_processes[harq_pid]->first_tx = 1; ulsch->harq_processes[harq_pid]->first_tx = 1;
ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->round = 0;
} }
for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) {
ue->ulsch[gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES;
}
} }
/******************************************************************* /*******************************************************************
...@@ -184,9 +232,9 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id) ...@@ -184,9 +232,9 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id)
* *
*********************************************************************/ *********************************************************************/
void set_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int harq_pid, int slot_tx) void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx)
{ {
ue->ulsch[gNB_id]->harq_process_id[slot_tx] = harq_pid; ulsch->harq_process_id[slot_tx] = harq_pid;
} }
/******************************************************************* /*******************************************************************
...@@ -199,30 +247,14 @@ void set_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int harq_pid, int slot_tx) ...@@ -199,30 +247,14 @@ void set_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int harq_pid, int slot_tx)
* *
* RETURN : harq process identifier * RETURN : harq process identifier
* *
* DESCRIPTION : return tx harq process identifier for given transmission slot * DESCRIPTION : return tx harq process identifier for given slot transmission
* *
*********************************************************************/ *********************************************************************/
int get_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int slot_tx) int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx)
{ {
return (ue->ulsch[gNB_id]->harq_process_id[slot_tx]);
}
/******************************************************************* return (ulsch->harq_process_id[slot_tx]);
*
* NAME : get_dci_slot_rx_to_tx
*
* PARAMETERS : dci index
*
* RETURN : number of slots
*
* DESCRIPTION : extract from DCI number of slots between current reception and its related transmission
*
*********************************************************************/
int get_dci_slot_rx_to_tx(int dci_index)
{
return (4);
} }
/******************************************************************* /*******************************************************************
...@@ -244,13 +276,17 @@ int get_dci_slot_rx_to_tx(int dci_index) ...@@ -244,13 +276,17 @@ int get_dci_slot_rx_to_tx(int dci_index)
* *
*********************************************************************/ *********************************************************************/
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, nr_rnti_type_t rnti_type) harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, uint8_t rnti_type)
{ {
harq_result_t result_harq = RETRANSMISSION_HARQ; harq_result_t result_harq = RETRANSMISSION_HARQ;
if ((rnti_type != C_RNTI_NR) && (rnti_type != Temporary_C_RNTI_NR)) { if (rnti_type == _CS_RNTI_) {
LOG_E(PHY, "Fatal error in HARQ entity due to unsupported RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); LOG_E(PHY, "Fatal error in HARQ entity due to not supported CS_RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
assert(0); return(NEW_TRANSMISSION_HARQ);
}
else if ((rnti_type != _C_RNTI_) && (rnti_type != _TC_RNTI_)) {
/* harq mechanism is not relevant for other rnti */
return(NEW_TRANSMISSION_HARQ);
} }
else if (harq_pid > ulsch->number_harq_processes_for_pusch) { else if (harq_pid > ulsch->number_harq_processes_for_pusch) {
LOG_E(PHY, "Fatal error in HARQ entity due to unknown process identity %d at line %d in function %s of file %s \n", harq_pid, __LINE__ , __func__, __FILE__); LOG_E(PHY, "Fatal error in HARQ entity due to unknown process identity %d at line %d in function %s of file %s \n", harq_pid, __LINE__ , __func__, __FILE__);
...@@ -258,7 +294,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, n ...@@ -258,7 +294,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, n
} }
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */ /* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == C_RNTI_NR)) { /* no transmission yet on this process so consider its harq buffer as empty */ if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
ulsch->harq_processes[harq_pid]->first_tx = 0; ulsch->harq_processes[harq_pid]->first_tx = 0;
ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */
ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->round = 0;
...@@ -270,7 +306,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, n ...@@ -270,7 +306,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, n
} }
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */ /* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */ /* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
else if ((ulsch->harq_processes[harq_pid]->DCINdi != ndi) && (rnti_type != Temporary_C_RNTI_NR)) { /* is ndi toogled so this is a new grant ? */ else if ((ulsch->harq_processes[harq_pid]->DCINdi != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */
ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */ ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */
ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->round = 0;
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
...@@ -313,7 +349,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) ...@@ -313,7 +349,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
dl_harq->harq_ack.send_harq_status = 0; dl_harq->harq_ack.send_harq_status = 0;
dl_harq->harq_ack.vDAI_UL = UL_DAI_NO_SET; dl_harq->harq_ack.vDAI_UL = UL_DAI_NO_SET;
dl_harq->harq_ack.vDAI_DL = DL_DAI_NO_SET; dl_harq->harq_ack.vDAI_DL = DL_DAI_NO_SET;
dl_harq->harq_ack.slot_for_feedback_ack = NR_MAX_SLOTS_PAR_FRAME; dl_harq->harq_ack.slot_for_feedback_ack = NR_MAX_SLOTS_PER_FRAME;
dl_harq->harq_ack.pucch_resource_indicator = MAX_PUCCH_RESOURCE_INDICATOR; dl_harq->harq_ack.pucch_resource_indicator = MAX_PUCCH_RESOURCE_INDICATOR;
dl_harq->harq_ack.n_CCE = 0; dl_harq->harq_ack.n_CCE = 0;
dl_harq->harq_ack.N_CCE = 0;; dl_harq->harq_ack.N_CCE = 0;;
...@@ -418,13 +454,18 @@ void release_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, in ...@@ -418,13 +454,18 @@ void release_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, in
* *
*********************************************************************/ *********************************************************************/
harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, nr_rnti_type_t rnti_type) harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, uint8_t rnti_type)
{ {
harq_result_t result_harq = RETRANSMISSION_HARQ; harq_result_t result_harq = RETRANSMISSION_HARQ;
if ((rnti_type != C_RNTI_NR) && (rnti_type != Temporary_C_RNTI_NR)) { if (rnti_type == _CS_RNTI_)
LOG_E(PHY, "Fatal error in HARQ entity due to unknown RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); {
assert(0); LOG_E(PHY, "Fatal error in HARQ entity due to not supported CS_RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
return(NEW_TRANSMISSION_HARQ);
}
else if ((rnti_type != _C_RNTI_) && (rnti_type != _TC_RNTI_)) {
/* harq mechanism is not relevant for other rnti */
return(NEW_TRANSMISSION_HARQ);
} }
if (dl_harq->first_tx == 1) { if (dl_harq->first_tx == 1) {
...@@ -436,7 +477,8 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ...@@ -436,7 +477,8 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid); NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid);
} else if (dl_harq->DCINdi != ndi) { }
else if (dl_harq->DCINdi != ndi) {
dl_harq->round = 0; dl_harq->round = 0;
dl_harq->status = ACTIVE; dl_harq->status = ACTIVE;
dl_harq->DCINdi = ndi; dl_harq->DCINdi = ndi;
...@@ -444,7 +486,9 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ...@@ -444,7 +486,9 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid); NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid);
} else { }
else {
dl_harq->round++; dl_harq->round++;
result_harq = RETRANSMISSION_HARQ; result_harq = RETRANSMISSION_HARQ;
......
...@@ -61,16 +61,25 @@ ...@@ -61,16 +61,25 @@
/************* TYPE ***********************************************/ /************* TYPE ***********************************************/
typedef enum {
NEW_TRANSMISSION_HARQ,
RETRANSMISSION_HARQ
} harq_result_t;
/************** VARIABLES *****************************************/ /************** VARIABLES *****************************************/
/*************** FUNCTIONS ****************************************/ /*************** FUNCTIONS ****************************************/
/** \brief This function updates HARQ context according to dci
@param PHY_VARS_NR_UE ue context
@param nr_dci_info_extracted extracted information from dci
@param dlsch downlink context
@param ulsch uplink context
@param nr_tti_rx rx slot
@param tx_offset slot offset for tx
@returns none */
void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_info_extracted,
NR_UE_DLSCH_t **dlsch, NR_UE_ULSCH_t *ulsch, uint8_t nr_tti_rx, uint8_t tx_offset);
/** \brief This function configures uplink HARQ context /** \brief This function configures uplink HARQ context
@param PHY_VARS_NR_UE ue context @param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier @param gNB_id gNodeB identifier
...@@ -87,32 +96,26 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h ...@@ -87,32 +96,26 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id); void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id);
/** \brief This function stores slot for transmission in HARQ context /** \brief This function stores slot for transmission in HARQ context
@param ulsch_harq uplink harq context @param ulsch uplink context
@param harq process identifier harq_pid @param harq process identifier harq_pid
@param slot_tx slot for transmission related to current downlink PDCCH @param slot_tx slot for transmission related to current downlink PDCCH
@returns 0 none */ @returns 0 none */
void set_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int harq_pid, int slot_tx); void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
/** \brief This function initialises context of an uplink HARQ process /** \brief This function initialises context of an uplink HARQ process
@param ulsch_harq uplink harq context @param ulsch uplink context
@param harq process identifier harq_pid @param harq process identifier harq_pid
@returns 0 none */ @returns harq number for tx slot */
int get_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int slot_tx);
/** \brief This function returns number of slots between current reception and related transmission
@param dci value
@returns slots number between reception and related transmission */
int get_dci_slot_rx_to_tx(int dci_index); int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
/** \brief This function update uplink harq context and return transmission type (new transmission or retransmission) /** \brief This function update uplink harq context and return transmission type (new transmission or retransmission)
@param ulsch uplink harq context @param ulsch uplink harq context
@param harq process identifier harq_pid @param harq process identifier harq_pid
@returns retransmission or new transmission */ @returns retransmission or new transmission */
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, nr_rnti_type_t rnti_type); harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, uint8_t rnti_type);
/** \brief This function initialises downlink HARQ status /** \brief This function initialises downlink HARQ status
@param pointer to downlink harq status @param pointer to downlink harq status
...@@ -145,7 +148,7 @@ void release_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, in ...@@ -145,7 +148,7 @@ void release_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, in
@param rnti_type type of rnti @param rnti_type type of rnti
@returns retransmission or new transmission */ @returns retransmission or new transmission */
harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, nr_rnti_type_t rnti_type); harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, uint8_t rnti_type);
#undef EXTERN #undef EXTERN
#undef INIT_VARIABLES_HARQ_NR_H #undef INIT_VARIABLES_HARQ_NR_H
......
...@@ -250,26 +250,26 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) ...@@ -250,26 +250,26 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms)
* *
*********************************************************************/ *********************************************************************/
nr_slot_t slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti) int slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti)
{ {
/* for FFD all slot can be considered as an uplink */ /* for FFD all slot can be considered as an uplink */
if (frame_parms->frame_type == FDD) { if (frame_parms->frame_type == FDD) {
return (NR_TDD_UPLINK_SLOT); return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT );
} }
if (nr_frame%2 == 0) { if (nr_frame%2 == 0) {
if (frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_UPLINK_SLOT) { if (frame_parms->tdd_uplink_nr[nr_tti] == NR_TDD_UPLINK_SLOT) {
return (NR_TDD_UPLINK_SLOT); return (NR_UPLINK_SLOT);
} }
else { else {
return (NR_TDD_DOWNLINK_SLOT); return (NR_DOWNLINK_SLOT);
} }
} }
else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_UPLINK_SLOT)) { else if ((frame_parms->tdd_uplink_nr[(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti] == NR_TDD_UPLINK_SLOT)) {
return (NR_TDD_UPLINK_SLOT); return (NR_UPLINK_SLOT);
} }
else { else {
return (NR_TDD_DOWNLINK_SLOT); return (NR_DOWNLINK_SLOT);
} }
} }
...@@ -296,7 +296,7 @@ void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms) ...@@ -296,7 +296,7 @@ void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms)
free(p_tdd_UL_DL_Configuration); free(p_tdd_UL_DL_Configuration);
} }
for (int number_of_slot = 0; number_of_slot < MAX_NR_OF_SLOTS; number_of_slot++) { for (int number_of_slot = 0; number_of_slot < NR_MAX_SLOTS_PER_FRAME; number_of_slot++) {
frame_parms->tdd_uplink_nr[number_of_slot] = NR_TDD_DOWNLINK_SLOT; frame_parms->tdd_uplink_nr[number_of_slot] = NR_TDD_DOWNLINK_SLOT;
} }
} }
......
...@@ -76,7 +76,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); ...@@ -76,7 +76,7 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms);
* @param nr_tti : slot number * @param nr_tti : slot number
@returns nr_slot_t : downlink or uplink */ @returns nr_slot_t : downlink or uplink */
nr_slot_t slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti); int slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_tti);
/** \brief This function frees tdd configuration for nr /** \brief This function frees tdd configuration for nr
* @param frame_parms NR DL Frame parameters * @param frame_parms NR DL Frame parameters
......
This diff is collapsed.
...@@ -154,7 +154,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -154,7 +154,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
/* sr_payload = 1 means that this is a positive SR, sr_payload = 0 means that it is a negative SR */ /* sr_payload = 1 means that this is a positive SR, sr_payload = 0 means that it is a negative SR */
sr_payload = ue_get_SR(Mod_id, sr_payload = nr_ue_get_SR(Mod_id,
CC_id, CC_id,
frame_tx, frame_tx,
gNB_id, gNB_id,
...@@ -250,6 +250,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -250,6 +250,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
nb_symbols_total = initial_pucch_resource[initial_pucch_id].nrofSymbols; nb_symbols_total = initial_pucch_resource[initial_pucch_id].nrofSymbols;
int N_CS = initial_pucch_resource[initial_pucch_id].nb_CS_indexes; int N_CS = initial_pucch_resource[initial_pucch_id].nb_CS_indexes;
/* see TS 38213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */
int RB_BWP_offset; int RB_BWP_offset;
if (initial_pucch_id == 15) { if (initial_pucch_id == 15) {
RB_BWP_offset = ue->systemInformationBlockType1_nr.N_BWP_SIZE/4; RB_BWP_offset = ue->systemInformationBlockType1_nr.N_BWP_SIZE/4;
...@@ -385,7 +386,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -385,7 +386,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
} }
/* TS 38.212 6.3.1.2 Code block segmentation and CRC attachment */ /* TS 38.212 6.3.1.2 Code block segmentation and CRC attachment */
/* crc attachment can be done depending of paylaod size */ /* crc attachment can be done depending of payload size */
if (N_UCI < 11) { if (N_UCI < 11) {
O_CRC = 0; /* no additional crc bits */ O_CRC = 0; /* no additional crc bits */
} }
...@@ -468,8 +469,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -468,8 +469,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
NR_TST_PHY_PRINTF("PUCCH ( AbsSubframe : %d.%d ) ( total payload size %d data 0x%02x ) ( ack length %d data 0x%02x ) ( sr length %d value %d ) ( csi length %d data : 0x%02x ) \n", NR_TST_PHY_PRINTF("PUCCH ( AbsSubframe : %d.%d ) ( total payload size %d data 0x%02x ) ( ack length %d data 0x%02x ) ( sr length %d value %d ) ( csi length %d data : 0x%02x ) \n",
frame_tx%1024, nr_tti_tx, N_UCI, pucch_payload, O_ACK, pucch_ack_payload, O_SR, sr_payload, csi_status, csi_payload); frame_tx%1024, nr_tti_tx, N_UCI, pucch_payload, O_ACK, pucch_ack_payload, O_SR, sr_payload, csi_status, csi_payload);
NR_TST_PHY_PRINTF("PUCCH ( format : %d ) ( modulation : %s ) ( nb prb : %d ) ( nb symbols : %d ) ( max code rate*100 : %d ) ( starting_symbol_index : %d ) \n", NR_TST_PHY_PRINTF("PUCCH ( format : %d ) ( modulation : %s ) ( nb prb : %d ) ( nb symbols total: %d ) ( nb symbols : %d ) ( max code rate*100 : %d ) ( starting_symbol_index : %d ) \n",
format, (Q_m == BITS_PER_SYMBOL_QPSK ? " QPSK " : " BPSK "), nb_of_prbs, nb_symbols, max_code_rate, starting_symbol_index); format, (Q_m == BITS_PER_SYMBOL_QPSK ? " QPSK " : " BPSK "), nb_of_prbs, nb_symbols_total, nb_symbols, max_code_rate, starting_symbol_index);
NR_TST_PHY_PRINTF("PUCCH ( starting_prb : %d ) ( second_hop : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n", NR_TST_PHY_PRINTF("PUCCH ( starting_prb : %d ) ( second_hop : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n",
starting_prb, second_hop, m_0, m_CS, time_domain_occ, occ_length, occ_Index); starting_prb, second_hop, m_0, m_CS, time_domain_occ, occ_length, occ_Index);
...@@ -482,6 +483,88 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -482,6 +483,88 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
nb_of_prbs, N_sc_ctrl_RB, nb_symbols, N_UCI, O_SR, O_CSI, O_ACK, nb_of_prbs, N_sc_ctrl_RB, nb_symbols, N_UCI, O_SR, O_CSI, O_ACK,
O_CRC, n_HARQ_ACK); O_CRC, n_HARQ_ACK);
/* set tx power */
ue->tx_power_dBm[nr_tti_tx] = pucch_tx_power;
ue->tx_total_RE[nr_tti_tx] = nb_of_prbs*N_SC_RB;
int tx_amp;
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
tx_amp = get_tx_amp(pucch_tx_power,
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
nb_of_prbs);
#else
tx_amp = AMP;
#endif
switch(format) {
case pucch_format0_nr:
{
nr_generate_pucch0(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
tx_amp,
nr_tti_tx,
(uint8_t)m_CS,
nb_symbols_total,
starting_symbol_index,
starting_prb);
break;
}
case pucch_format1_nr:
{
nr_generate_pucch1(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
nb_symbols_total,
starting_symbol_index,
starting_prb,
second_hop,
(uint8_t)time_domain_occ,
(uint8_t)N_UCI);
break;
}
case pucch_format2_nr:
{
nr_generate_pucch2(ue,ue->common_vars.txdataF,
&ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
(uint8_t)N_UCI);
break;
}
case pucch_format3_nr:
case pucch_format4_nr:
{
nr_generate_pucch3_4(ue,ue->common_vars.txdataF,
&ue->frame_parms,
format,
&ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload,
tx_amp,
nr_tti_tx,
nb_symbols_total,
starting_symbol_index,
nb_of_prbs,
starting_prb,
second_hop,
(uint8_t)N_UCI,
(uint8_t)occ_length,
(uint8_t)occ_Index);
break;
}
}
return (TRUE); return (TRUE);
} }
...@@ -538,7 +621,6 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t ...@@ -538,7 +621,6 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
number_of_code_word = 1; number_of_code_word = 1;
} }
if (ue->n_connected_eNB > 1) { if (ue->n_connected_eNB > 1) {
LOG_E(PHY,"PUCCH ACK feedback is not implemented for mutiple gNB cells : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); LOG_E(PHY,"PUCCH ACK feedback is not implemented for mutiple gNB cells : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
return (0); return (0);
...@@ -945,7 +1027,7 @@ boolean_t check_pucch_format(PHY_VARS_NR_UE *ue, uint8_t gNB_id, pucch_format_nr ...@@ -945,7 +1027,7 @@ boolean_t check_pucch_format(PHY_VARS_NR_UE *ue, uint8_t gNB_id, pucch_format_nr
} }
} }
NR_TST_PHY_PRINTF("PUCCH format %d nb symbols %d uci size %d selected format %d \n", format_pucch, nb_symbols_for_tx, uci_size, selected_pucch_format); NR_TST_PHY_PRINTF("PUCCH format %d nb symbols total %d uci size %d selected format %d \n", format_pucch, nb_symbols_for_tx, uci_size, selected_pucch_format);
if (format_pucch != selected_pucch_format) { if (format_pucch != selected_pucch_format) {
if (format_pucch != selected_pucch_format_second) { if (format_pucch != selected_pucch_format_second) {
......
...@@ -55,42 +55,42 @@ set(INC_UNIT_TESTS ...@@ -55,42 +55,42 @@ set(INC_UNIT_TESTS
add_executable(pss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(pss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(pss_test target_link_libraries(pss_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(sss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(sss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(sss_test target_link_libraries(sss_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(frame_config_test target_link_libraries(frame_config_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(harq_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(harq_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(harq_test target_link_libraries(harq_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(srs_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(srs_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(srs_test target_link_libraries(srs_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(pbch_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(pbch_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(pbch_test target_link_libraries(pbch_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
add_executable(pucch_uci_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS}) add_executable(pucch_uci_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
target_link_libraries(pucch_uci_test target_link_libraries(pucch_uci_test
-Wl,--start-group UTIL SCHED_UE_LIB SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
pthread m ${ATLAS_LIBRARIES} pthread m ${ATLAS_LIBRARIES}
) )
...@@ -28,9 +28,10 @@ ...@@ -28,9 +28,10 @@
# - checking output files with reference files. # - checking output files with reference files.
# ./run_test to build/run and check all tests # ./run_test to build/run and check all tests
# -b no build # -b no build
# -r no run # -e no execution
# -c no check # -c no check
# an alone specific test can be executed ./run_test test_name # -m no run of meld
# an alone specific test can be executed ./run_tests test_name
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# CONFIGURATION # CONFIGURATION
# files and directories # files and directories
...@@ -48,8 +49,9 @@ BROWSER="firefox" ...@@ -48,8 +49,9 @@ BROWSER="firefox"
BUILD_TEST="yes" BUILD_TEST="yes"
CHECK_TEST="yes" CHECK_TEST="yes"
RUN_TEST="yes" EXECUTE_TEST="yes"
SINGLE_TEST="no" SINGLE_TEST="no"
RUN_MELD="yes"
# for removing files # for removing files
REMOVE="rm -f" REMOVE="rm -f"
COMPARE="cmp" COMPARE="cmp"
...@@ -76,23 +78,28 @@ do ...@@ -76,23 +78,28 @@ do
echo "No build of unit test" echo "No build of unit test"
BUILD_TEST="no" BUILD_TEST="no"
;; ;;
-r) -e)
echo "No run of unit test" echo "No execution of unit test"
RUN_TEST="no" EXECUTE_TEST="no"
;; ;;
-c) -c)
echo "No check of unit test" echo "No check of unit test"
CHECK_TEST="no" CHECK_TEST="no"
;; ;;
-m)
echo "No run of meld tool"
RUN_MELD="no"
;;
-h) -h)
echo "Option of run_test script" echo "Option of run_test script"
echo "-b : No Build of unit tests" echo "-b : No Build of unit tests"
echo "-c : No check for unit test" echo "-c : No check for unit test"
echo "-r : No run of unit tests" echo "-r : No run of unit tests"
echo "-m : No run of meld tool"
exit exit
BUILD_TEST="no" BUILD_TEST="no"
CHECK_TEST="no" CHECK_TEST="no"
RUN_TEST="no" EXECUTE_TEST="no"
;; ;;
*) *)
for file in $tst_files for file in $tst_files
...@@ -109,7 +116,7 @@ do ...@@ -109,7 +116,7 @@ do
echo "Unknown parameter $1" echo "Unknown parameter $1"
BUILD_TEST="no" BUILD_TEST="no"
CHECK_TEST="no" CHECK_TEST="no"
RUN_TEST="no" EXECUTE_TEST="no"
exit exit
fi fi
;; ;;
...@@ -121,15 +128,12 @@ done ...@@ -121,15 +128,12 @@ done
#-------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------
# RUN AND CHECK RESULTS # RUN AND CHECK RESULTS
# compare reference log file to results file
# diff -s -d -a -q ./testlogs/*.txt ./reflog/*.txt
# compare $RESULTS_FILE to $REFERENCE_DIR/$RESULTS_FILE
numberDisplayFilesDifferencies=0 numberDisplayFilesDifferencies=0
let MAX_NUMBER_DISPLAY_FILES_DIFFERENCES=8 let MAX_NUMBER_DISPLAY_FILES_DIFFERENCES=8
num_diff=0 num_diff=0
if [ $RUN_TEST == "yes" ] if [ $EXECUTE_TEST == "yes" ]
then then
mkdir $RESULT_DIR mkdir $RESULT_DIR
fi fi
...@@ -174,7 +178,7 @@ for file in $tst_files ...@@ -174,7 +178,7 @@ for file in $tst_files
make $file make $file
fi fi
if [ $RUN_TEST == "yes" ] if [ $EXECUTE_TEST == "yes" ]
then then
echo "rm $RESULT_DIR/$RESULT_TEST_FILE" echo "rm $RESULT_DIR/$RESULT_TEST_FILE"
rm $RESULT_DIR/$RESULT_TEST_FILE rm $RESULT_DIR/$RESULT_TEST_FILE
...@@ -195,20 +199,25 @@ for file in $tst_files ...@@ -195,20 +199,25 @@ for file in $tst_files
if [ $? == 0 ] if [ $? == 0 ]
then then
echo "Same file for $file" echo "Test $file is PASS"
echo "Same logging file for $file"
else else
echo "Difference for scenario $file" echo "Test $file is FAIL"
echo "Difference of logging file for scenario $file"
let "num_diff=$num_diff + 1" let "num_diff=$num_diff + 1"
if [ $RUN_MELD == "yes" ]
then
meld $RESULT_DIR/$RESULT_TEST_FILE $REFERENCE_DIR/$RESULT_TEST_FILE & meld $RESULT_DIR/$RESULT_TEST_FILE $REFERENCE_DIR/$RESULT_TEST_FILE &
let "numberDisplayFilesDifferencies=$numberDisplayFilesDifferencies + 1" let "numberDisplayFilesDifferencies=$numberDisplayFilesDifferencies + 1"
echo "Meld number "$numberDisplayFilesDifferencies echo "Meld number "$numberDisplayFilesDifferencies
if [ $numberDisplayFilesDifferencies = $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES ] if [ $numberDisplayFilesDifferencies = $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES ]
then then
echo "###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ######" echo "###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ######"
echo "=> ERROR Test aborted because there are already $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES detected files which are different" echo "=> ERROR Test aborted because there are already $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES detected logging files which are different"
break break
fi fi
fi fi
fi
else else
echo "No reference file for test $file" echo "No reference file for test $file"
fi fi
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
File: /home/jacques/workspace/oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/README.txt File: /home/jacques/workspace/oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/README.txt
This directory contains testbenchs for 5G NR physical layers. This directory contains testbenchs for 5G NR physical layers.
...@@ -33,37 +32,30 @@ Install tools: ...@@ -33,37 +32,30 @@ Install tools:
Build NR UE: Build NR UE:
- under openairinterface5g/cmake_targets/build --nrUE - under openairinterface5g/cmake_targets/build --nrUE
Files Specific test files
===== ====================
pss_test.c: test for detection of primary synchronisation signal. pss_test.c: test for detection of primary synchronisation signal.
sss_test.c: test for detection of secundary synchronisation signal. sss_test.c: test for detection of secundary synchronisation signal.
pbch_test.c: test for decoding of packet braodcast channel. pbch_test.c: test for decoding of packet braodcast channel.
srs_test.c: test of sounding reference signal. srs_test.c: test of sounding reference signal.
frame_config_test.c : test of frame configurations (FDD/TDD). frame_config_test.c : test of frame configurations (FDD/TDD).
harq_test.c : test of HARQ downlink and uplink. harq_test.c : test of HARQ downlink and uplink.
pucch_uci_test : test of packed Uplink Control Channel Uplink Control Information pucch_uci_test : test of packed Uplink Control Channel Uplink Control Information
pss_util_test.c: common functions for running synchronisation tests. pss_util_test.c: common functions for running synchronisation tests.
pss_util_test.h: common headers for synchronisation tests. pss_util_test.h: common headers for synchronisation tests.
input_buffer_test.h: it allows providing samples for pss test. input_buffer_test.h: it allows providing samples for pss test.
How to build & run tests How to build & run tests
======================== ========================
Before building, oai environment should be set by entering under openairinterface5g "source oaienv". Before building, oai environment should be set by entering under directory openairinterface5g "source oaienv".
A script allows to build, to run and to check all tests: A script "run_tests.sh" allows to build, to run and to check all tests.
To run a complete non regression of unit tests, go under directory NR_UE_PHY/unit_tests/build and execute:
./run_tests.sh
>run_tests This script "run_tests.sh" list all available unit tests.
build is based on cmake tool. build is based on cmake tool.
...@@ -73,7 +65,10 @@ CMakeList.txt lists different build. ...@@ -73,7 +65,10 @@ CMakeList.txt lists different build.
How to build: in directory "oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/", below commands should be entered: How to build: in directory "oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/", below commands should be entered:
First command to do:
cmake CMakeList.txt -> it generates makefiles to build all projects. cmake CMakeList.txt -> it generates makefiles to build all projects.
Then build of test:
make pss_test -> build pss_test: detection of NR (Primary Synchronisation Channel - synchronisation of UE). make pss_test -> build pss_test: detection of NR (Primary Synchronisation Channel - synchronisation of UE).
make sss_test -> build sss_test: detection of NR SSS (Secundary Synchronisation Channel - second step for UE synchronisation). make sss_test -> build sss_test: detection of NR SSS (Secundary Synchronisation Channel - second step for UE synchronisation).
make pbch_test -> build pbch_test: decoding of NR PBCH (Packet Broadcast Channel -> UE read MIB Master Information Block which gives network parameters). make pbch_test -> build pbch_test: decoding of NR PBCH (Packet Broadcast Channel -> UE read MIB Master Information Block which gives network parameters).
...@@ -83,6 +78,7 @@ make harq_test -> build harq_test: Hybrid Repeat Request Acknowledgment ...@@ -83,6 +78,7 @@ make harq_test -> build harq_test: Hybrid Repeat Request Acknowledgment
make pucch_uci_test -> build pucch_uci_test : Packet Uplink Control Channel / Uplink Control information : create UCI payload and select PUCCH formats and its parameters. make pucch_uci_test -> build pucch_uci_test : Packet Uplink Control Channel / Uplink Control information : create UCI payload and select PUCCH formats and its parameters.
make clean -> clean all projects. make clean -> clean all projects.
And execution of tests:
./pss_test -> run NR PSS tests. ./pss_test -> run NR PSS tests.
./sss_test -> run NR SSS tests. ./sss_test -> run NR SSS tests.
./pbch_test -> run NR PBCH tests. ./pbch_test -> run NR PBCH tests.
...@@ -94,8 +90,28 @@ make clean -> clean all projects. ...@@ -94,8 +90,28 @@ make clean -> clean all projects.
There is a script in build/run_test.sh which allows: There is a script in build/run_test.sh which allows:
- building/running/checking all tests - building/running/checking all tests
Checking consists in a comparaison of generated logging file at execution with a reference logging file which is stored under git for each test. What is test result?
====================
Test verdict consists in a comparaison of generated logging file at execution with a reference logging file which is stored under git for each test.
By default, tool "meld" is open each time there is a difference between reference file and logging file. By default, tool "meld" is open each time there is a difference between reference file and logging file.
It is possible to disable execution of meld with option -m.
Build/execute only one test:
===========================
The script "run_tests.sh" has different options:
"-b : No Build of unit tests"
"-c : No check for unit test"
"-e : No execution of unit tests"
"-m : No run of meld tool"
./run_tests.sh -> run all unit tests (build, execute and compare for each test)
./run_tests.sh -m -> run all unit tests but meld is not used (verdict is based on system command "cmp").
./run_tests.sh -b -c -r -m -> list all available unit tests
./run_tests.sh pss_test -> run only one test (here it is pss_test).
./run_tests.sh -c -e -m pss_test -> build only one test
./run_tests.sh -m pss_test -> run only one test but without execution of meld
Which processing can be tuned? Which processing can be tuned?
============================= =============================
...@@ -121,7 +137,6 @@ Status ...@@ -121,7 +137,6 @@ Status
====== ======
NR synchronisation tests run successfully with default parameters. NR synchronisation tests run successfully with default parameters.
Warning: Tests of PSS NR with decimation (based on FIR or CIC filter) does not run successfully at the moment. Warning: Tests of PSS NR with decimation (based on FIR or CIC filter) does not run successfully at the moment.
......
...@@ -46,6 +46,11 @@ uint32_t (*p_nr_ue_get_SR)(module_id_t module_idP,int CC_id,frame_t frameP,uint8 ...@@ -46,6 +46,11 @@ uint32_t (*p_nr_ue_get_SR)(module_id_t module_idP,int CC_id,frame_t frameP,uint8
/*****************functions****************************************/ /*****************functions****************************************/
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
{
return(0);
}
PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
frame_t frameP, uint8_t new_Msg3, frame_t frameP, uint8_t new_Msg3,
sub_frame_t subframe){ return(NULL);} sub_frame_t subframe){ return(NULL);}
...@@ -61,7 +66,7 @@ void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id, ...@@ -61,7 +66,7 @@ void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id,
void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
frame_t frameP, uint8_t eNB_id){} frame_t frameP, uint8_t eNB_id){}
uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint32_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){ uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){
uint32_t value = 0; uint32_t value = 0;
...@@ -193,3 +198,8 @@ void exit_fun(const char* s) ...@@ -193,3 +198,8 @@ void exit_fun(const char* s)
undefined_function(__FUNCTION__); undefined_function(__FUNCTION__);
} }
uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){
uint32_t value = 0;
return(value);
}
...@@ -54,26 +54,24 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) { ...@@ -54,26 +54,24 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->ttis_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots, printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->ttis_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots,
frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity); frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity);
int k = (TDD_CONFIG_NB_FRAMES * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) - 1; //19; int k = (TDD_CONFIG_NB_FRAMES * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) - 1; //19;
int tti = 0; int tti = 0;
for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME; j++) { for (int j = 0; j < TDD_CONFIG_NB_FRAMES * frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; j++) {
int frame = 0; int frame = 0;
if (j != 0) { if (j != 0) {
frame = (frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)/j; frame = (frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/j;
tti = (j)%(frame_parms->ttis_per_subframe * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); tti = (j)%(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME);
} }
else { else {
frame = 0; frame = 0;
tti = 0; tti = 0;
} }
if (slot_select_nr(frame_parms, frame, tti) == NR_TDD_DOWNLINK_SLOT) { if (slot_select_nr(frame_parms, frame, tti) & NR_DOWNLINK_SLOT) {
//if (frame_parms->tdd_uplink_nr[j] == NR_TDD_DOWNLINK_SLOT) {
printf(" [%3d] D", j); printf(" [%3d] D", j);
} }
else { else {
if (slot_select_nr(frame_parms, frame, tti) == NR_TDD_UPLINK_SLOT) { if (slot_select_nr(frame_parms, frame, tti) & NR_UPLINK_SLOT) {
//if (frame_parms->tdd_uplink_nr[j] == NR_TDD_UPLINK_SLOT) {
printf(" [%3d] U", j); printf(" [%3d] U", j);
} }
else { else {
...@@ -83,7 +81,7 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) { ...@@ -83,7 +81,7 @@ void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) {
} }
if (j == k) { if (j == k) {
printf("\n"); printf("\n");
k += (TDD_CONFIG_NB_FRAMES * LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); // 20 k += (TDD_CONFIG_NB_FRAMES * NR_NUMBER_OF_SUBFRAMES_PER_FRAME); // 20
} }
} }
printf("\n"); printf("\n");
...@@ -120,7 +118,7 @@ void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int ttis_per_subframe) ...@@ -120,7 +118,7 @@ void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int ttis_per_subframe)
int test_frame_configuration(PHY_VARS_NR_UE *PHY_vars_UE) int test_frame_configuration(PHY_VARS_NR_UE *PHY_vars_UE)
{ {
LTE_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms);
int v_return = 0; int v_return = 0;
#define NO_DOWNLINK_SYMBOL (0) #define NO_DOWNLINK_SYMBOL (0)
......
...@@ -56,7 +56,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue) ...@@ -56,7 +56,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue)
int gNB_id = 0; int gNB_id = 0;
int harq_pid = 0; int harq_pid = 0;
int ndi = 1; int ndi = 1;
nr_rnti_type_t rnti_type = C_RNTI_NR; uint8_t rnti_type = _C_RNTI_;
int number_steps = 5; int number_steps = 5;
printf("\nHARQ Uplink \n"); printf("\nHARQ Uplink \n");
...@@ -113,7 +113,7 @@ int test_harq_downlink(PHY_VARS_NR_UE *phy_vars_ue) ...@@ -113,7 +113,7 @@ int test_harq_downlink(PHY_VARS_NR_UE *phy_vars_ue)
int gNB_id = 0; int gNB_id = 0;
int harq_pid = 0; int harq_pid = 0;
int ndi = 1; int ndi = 1;
nr_rnti_type_t rnti_type = C_RNTI_NR; uint8_t rnti_type = _C_RNTI_;
int number_steps = 5; int number_steps = 5;
int thread_number = 0; int thread_number = 0;
int TB_identifier = 0; int TB_identifier = 0;
......
...@@ -256,7 +256,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission ...@@ -256,7 +256,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
frame_parms->threequarter_fs = 0; frame_parms->threequarter_fs = 0;
frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR; frame_parms->numerology_index = NUMEROLOGY_INDEX_MAX_NR;
nr_init_frame_parms_ue(config,frame_parms); nr_init_frame_parms_ue(frame_parms);
PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + N_ID_2_NUMBER; /* set to unvalid value */ PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + N_ID_2_NUMBER; /* set to unvalid value */
......
...@@ -49,5 +49,65 @@ typedef enum { ...@@ -49,5 +49,65 @@ typedef enum {
PHY_HO_PRACH PHY_HO_PRACH
} NR_UE_L2_STATE_t; } NR_UE_L2_STATE_t;
typedef struct {
uint8_t LCID:6; // octet 1 [5:0]
uint8_t F:1; // octet 1 [6]
uint8_t R:1; // octet 1 [7]
uint8_t L:8; // octet 2 [7:0]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT;
typedef struct {
uint8_t LCID:6; // octet 1 [5:0]
uint8_t F:1; // octet 1 [6]
uint8_t R:1; // octet 1 [7]
uint8_t L1:8; // octet 2 [7:0]
uint8_t L2:8; // octet 3 [7:0]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
typedef struct {
uint8_t LCID:5; // octet 1 [5:0]
uint8_t R:2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
// 38.321 ch6.2.1, 38.331
#define DL_SCH_LCID_CCCH 0x00
#define DL_SCH_LCID_SRB1 0x01
#define DL_SCH_LCID_SRB2 0x02
#define DL_SCH_LCID_SRB3 0x03
#define DL_SCH_LCID_RECOMMENDED_BITRATE 0x2F
#define DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT 0x30
#define DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT 0x31
#define DL_SCH_LCID_SP_SRS_ACTIVATION 0x32
#define DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT 0x33
#define DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH 0x34
#define DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH 0x35
#define DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL 0x36
#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT 0X37
#define DL_SCH_LCID_DUPLICATION_ACT 0X38
#define DL_SCH_LCID_SCell_ACT_4_OCT 0X39
#define DL_SCH_LCID_SCell_ACT_1_OCT 0X3A
#define DL_SCH_LCID_L_DRX 0x3B
#define DL_SCH_LCID_DRX 0x3C
#define DL_SCH_LCID_TA_COMMAND 0x3D
#define DL_SCH_LCID_CON_RES_ID 0x3E
#define DL_SCH_LCID_PADDING 0x3F
#define UL_SCH_LCID_CCCH 0x00
#define UL_SCH_LCID_SRB1 0x01
#define UL_SCH_LCID_SRB2 0x02
#define UL_SCH_LCID_SRB3 0x03
#define UL_SCH_LCID_CCCH_MSG3 0x21
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
#define UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT 0x38
#define UL_SCH_LCID_SINGLE_ENTRY_PHR 0x39
#define UL_SCH_LCID_C_RNTI 0x3A
#define UL_SCH_LCID_S_TRUNCATED_BSR 0x3B
#define UL_SCH_LCID_L_TRUNCATED_BSR 0x3C
#define UL_SCH_LCID_S_BSR 0x3D
#define UL_SCH_LCID_L_BSR 0x3E
#define UL_SCH_LCID_PADDING 0x3F
#endif /*__LAYER2_MAC_DEFS_H__ */ #endif /*__LAYER2_MAC_DEFS_H__ */
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* \warning * \warning
*/ */
// Type0-PDCCH search space
extern const int32_t table_38213_13_1_c2[16]; extern const int32_t table_38213_13_1_c2[16];
extern const int32_t table_38213_13_1_c3[16]; extern const int32_t table_38213_13_1_c3[16];
extern const int32_t table_38213_13_1_c4[16]; extern const int32_t table_38213_13_1_c4[16];
...@@ -80,4 +80,10 @@ extern const float table_38213_13_12_c1[16]; ...@@ -80,4 +80,10 @@ extern const float table_38213_13_12_c1[16];
extern const int32_t table_38213_13_12_c2[16]; extern const int32_t table_38213_13_12_c2[16];
extern const float table_38213_13_12_c3[16]; extern const float table_38213_13_12_c3[16];
extern const int32_t table_38213_10_1_1_c2[3]; extern const int32_t table_38213_10_1_1_c2[5];
\ No newline at end of file
// DCI extraction
// 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];
\ No newline at end of file
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
\param extra_bits extra bits for frame calculation \param extra_bits extra bits for frame calculation
\param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1 \param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_length length of pdu*/ \param pdu_length length of pdu
\param cell_id cell id */
int8_t nr_ue_decode_mib( int8_t nr_ue_decode_mib(
module_id_t module_id, module_id_t module_id,
int cc_id, int cc_id,
...@@ -51,7 +52,8 @@ int8_t nr_ue_decode_mib( ...@@ -51,7 +52,8 @@ int8_t nr_ue_decode_mib(
uint8_t extra_bits, uint8_t extra_bits,
uint32_t ssb_length, uint32_t ssb_length,
uint32_t ssb_index, uint32_t ssb_index,
void *pduP ); void *pduP,
uint16_t cell_id );
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
...@@ -110,5 +112,20 @@ NR_UE_L2_STATE_t nr_ue_scheduler( ...@@ -110,5 +112,20 @@ NR_UE_L2_STATE_t nr_ue_scheduler(
uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe); uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe);
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
uint32_t get_ssb_frame(uint32_t test);
uint32_t get_ssb_slot(uint32_t ssb_index);
uint32_t mr_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);
void nr_ue_process_mac_pdu(
module_id_t module_idP,
uint8_t CC_id,
uint8_t *pduP,
uint16_t mac_pdu_len,
uint8_t eNB_index);
#endif #endif
/** @}*/ /** @}*/
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment