diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool
index 02e031a52f..bbea199ca1 100755
--- a/ci-scripts/oai-ci-vm-tool
+++ b/ci-scripts/oai-ci-vm-tool
@@ -185,7 +185,7 @@ function variant__v3__phy_sim {
NB_PATTERN_FILES=12
BUILD_OPTIONS="--phy_simulators"
VM_MEMORY=8192
- RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
+ RUN_OPTIONS="./run_exec_autotests.bash -g \"01510* 015111\" -q -np -b"
}
function variant__v4__cppcheck {
diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt
index b94d99bff7..10c14fd59a 100644
--- a/cmake_targets/autotests/README.txt
+++ b/cmake_targets/autotests/README.txt
@@ -96,11 +96,41 @@ Obj.# Case# Test# Description
(Test 4, 10 MHz, R3-1.FDD (MCS 16), AWGN, 12dB (70%)),
(Test 5, 20 MHz, FDD (MCS 5), AWGN, 6dB (70%)),
(Test 6, 20 MHz, FDD (MCS 16), AWGN, 12 dB (70%))
-01 51 02 pucchsim (TBD)
-01 51 03 prachsim (TBD)
-01 51 04 pdcchsim (TBD)
-01 51 05 pbchsim (TBD)
-01 51 06 mbmssim (TBD)
+01 51 02 ldpc Test cases. (Test1: block length = 3872),
+ (Test2: block length = 4224),
+ (Test3: block length = 4576),
+ (Test4: block length = 4928),
+ (Test5: block length = 5280),
+ (Test6: block length = 5632),
+ (Test7: block length = 6336),
+ (Test8: block length = 7040),
+ (Test9: block length = 7744),
+ (Test10: block length = 8448)
+01 51 03 polartest Test cases. (Test1: PBCH polar test),
+ (Test2: DCI polar test)
+01 51 04 nr_pbchsim Test cases. (Test1: PBCH-only, 106 PRB),
+ (Test2: PBCH and synchronization, 106PBR),
+ (Test3: PBCH-only, 217 PRB),
+ (Test4: PBCH and synchronization, 217 RPB),
+ (Test5: PBCH-only, 273 PRB),
+ (Test6: PBCH and synchronization, 273 PRB)
+01 51 05 nr_dlsim Test cases. (Test1: 106 PRB),
+ (Test2: 217 PRB),
+ (Test3: 273 PRB)
+01 51 06 nr_dlschsim Test cases. (Test1: 106 PRB),
+ (Test2: 217 PRB),
+ (Test3: 273 PRB)
+01 51 07 shortblocktest Test cases. (Test1: 3 bits),
+ (Test2: 6 bits),
+ (Test3: 7 bits),
+ (Test4: 11 bits)
+01 51 08 nr_ulschsim Test cases. (Test1: 106 PRB),
+ (Test2: 217 PRB),
+ (Test3: 273 PRB)
+01 51 09 nr_pucchsim Test cases. (Test1: Format 0 ACK miss 106 PRB),
+ (Test2: Format 1 ACK miss 106 PRB),
+ (Test3: Format 1 ACK miss 273 PRB),
+ (Test4: Format 1 NACKtoACK 106 PRB)
01 51 10 dlsim_tm4 test cases (Test 1: 10 MHz, R2.FDD (MCS 5), EVA5, -1dB),
(Test 5: 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)),
(Test 6: 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)),
@@ -110,8 +140,11 @@ Obj.# Case# Test# Description
(Test 10: 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)),
(Test 10b: 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)),
(Test 11: 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%))
- (TM2 Test 1 10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)),
- (TM2 Test 1b 20 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)),
+ (TM2 Test 1 10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)),
+ (TM2 Test 1b 20 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)),
+01 51 11 nr_ulsim Test cases. (Test1: MCS 9),
+ (Test2: MCS 16),
+ (Test3: MCS 28)
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index d30537424b..9cfaa2b21d 100644
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1081,7 +1081,16 @@
execution
nr_dlsim Test cases. (Test1: 106 PRB),
(Test2: 217 PRB),
- (Test3: 273 PRB)
+ (Test3: 273 PRB),
+ (Test4: 106 PRB 12 CSET-Offset),
+ (Test5: 217 PRB 48 CSET-Offset),
+
+ (Test7: 273 PRB 28 MCS)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1090,9 +1099,18 @@
$OPENAIR_DIR/targets/bin/nr_dlsim.Rel15
-n100 -R106
-n100 -R217
- -n100 -R273
- nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3
- PDCCH test OK
+ -n100 -R273
+ -n100 -R106 -o12
+ -n100 -R217 -o48
+
+ -n100 -R273 -e28
+ nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7
+ "PDCCH test OK" "PDSCH test OK"
segmentation fault|assertion|exiting|fatal
3
@@ -1220,6 +1238,26 @@
3
+
+ execution
+ nr_ulsim Test cases. (Test1: MCS 9),
+ (Test2: MCS 16),
+ (Test3: MCS 28)
+
+ $OPENAIR_DIR/cmake_targets/build_oai
+ --phy_simulators -c
+ $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash
+
+ $OPENAIR_DIR/targets/bin/nr_ulsim.Rel15
+ -f100 -m9 -s10
+ -f100 -m16 -s20
+ -f100 -m28 -s30
+ nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3
+ PUSCH test OK
+ segmentation fault|assertion|exiting|fatal
+ 3
+
+
lte-softmodem
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 74556ad749..f6fd6412b0 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -695,12 +695,12 @@ void *UE_thread(void *arg) {
//LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB);
#ifdef OAI_ADRV9371_ZC706
- uint32_t total_gain_dB_prev = 0;
+ /*uint32_t total_gain_dB_prev = 0;
if (total_gain_dB_prev != UE->rx_total_gain_dB) {
total_gain_dB_prev = UE->rx_total_gain_dB;
- openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB-20;
+ openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB;
UE->rfdevice.trx_set_gains_func(&UE->rfdevice,&openair0_cfg[0]);
- }
+ }*/
#endif
for (int i=0; iframe_parms.nb_antennas_rx; i++)
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
index aad688c9d4..e85caf7690 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
@@ -586,13 +586,14 @@ typedef struct {
uint8_t start_symbol;
uint8_t nb_symbols;
uint8_t mcs_idx;
+ uint8_t mcs_table;
uint8_t ndi;
uint8_t nb_codewords;
uint8_t nb_layers;
uint16_t coding_rate;
uint8_t modulation;
uint8_t modulation_order;
- uint16_t transport_block_size;
+ uint32_t transport_block_size;
uint8_t nb_re_dmrs;
uint8_t time_alloc_list_flag;
uint8_t time_alloc_list;
@@ -694,6 +695,7 @@ typedef struct {
nr_pusch_freq_hopping_t pusch_freq_hopping;
uint8_t mcs;
uint8_t Qm;
+ uint16_t R;
uint8_t ndi;
uint8_t rv;
int8_t accumulated_delta_PUSCH;
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index 9d6a9775f0..ed8dd3b49a 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -130,9 +130,9 @@ int test_ldpc(short No_iteration,
double *modulated_input[MAX_NUM_DLSCH_SEGMENTS];
char *channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS];
unsigned int i,j,trial=0;
- short BG=0,Zc,Kb=0,nrows=0;//,ncols;
+ short BG=0,nrows=0;//,ncols;
int no_punctured_columns,removed_bit;
- int i1;
+ int i1,Zc,Kb=0;
int R_ind = 0;
//Table of possible lifting sizes
//short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
@@ -287,7 +287,7 @@ int test_ldpc(short No_iteration,
// printf("puncture:%d\n",no_punctured_columns);
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
if (ntrials==0)
- ldpc_encoder_orig(test_input[0],channel_input[0], block_length, BG, 1);
+ ldpc_encoder_orig(test_input[0],channel_input[0], Zc, BG, block_length, BG, 1);
for (trial=0; trial < ntrials; trial++)
{
@@ -295,20 +295,20 @@ int test_ldpc(short No_iteration,
//// encoder
start_meas(&time);
for(j=0;j640)
- Kb = 10;
- else if (block_length>560)
- Kb = 9;
- else if (block_length>192)
- Kb = 8;
- else
- Kb = 6;
}
- //find minimum value in all sets of lifting size
- Zc=0;
- for (i1=0; i1 < 51; i1++)
- {
- if (lift_size[i1] >= (double) block_length/Kb)
- {
- Zc = lift_size[i1];
- //printf("%d\n",Zc);
- break;
- }
- }
- AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
#ifdef DEBUG_LDPC
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d\n",BG,Zc,Kb,block_length);
@@ -317,14 +293,12 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
return 0;
}
-int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
+int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{
- short Zc,Kb=0,nrows=0,ncols=0;
+ short nrows=0,ncols=0;
int i,i1,j;
int no_punctured_columns,removed_bit;
- //Table of possible lifting sizes
- short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
char temp;
int simd_size;
@@ -350,8 +324,6 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
//if (block_length>3840)
if (BG==1)
{
- //BG=1;
- Kb = 22;
nrows=46; //parity check bits
ncols=22; //info bits
}
@@ -362,28 +334,8 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
nrows=42; //parity check bits
ncols=10; // info bits
- if (block_length>640)
- Kb = 10;
- else if (block_length>560)
- Kb = 9;
- else if (block_length>192)
- Kb = 8;
- else
- Kb = 6;
}
- //find minimum value in all sets of lifting size
- Zc=0;
- for (i1=0; i1 < 51; i1++)
- {
- if (lift_size[i1] >= (double) block_length/Kb)
- {
- Zc = lift_size[i1];
- //printf("%d\n",Zc);
- break;
- }
- }
-
#ifdef DEBUG_LDPC
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
@@ -517,14 +469,13 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
return 0;
}
-int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
+int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
{
- short Zc,Kb=0,nrows=0,ncols=0;
+ short nrows=0,ncols=0;
int i,i1,j;
int no_punctured_columns,removed_bit;
//Table of possible lifting sizes
- short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
char temp;
int simd_size;
int macro_segment, macro_segment_end;
@@ -556,38 +507,14 @@ int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **cha
//determine number of bits in codeword
if (BG==1)
{
- BG=1;
- Kb = 22;
nrows=46; //parity check bits
ncols=22; //info bits
}
else if (BG==2)
{
- BG=2;
nrows=42; //parity check bits
ncols=10; // info bits
-
- if (block_length>640)
- Kb = 10;
- else if (block_length>560)
- Kb = 9;
- else if (block_length>192)
- Kb = 8;
- else
- Kb = 6;
- }
-
- //find minimum value in all sets of lifting size
- Zc=0;
- for (i1=0; i1 < 51; i1++)
- {
- if (lift_size[i1] >= (double) block_length/Kb)
- {
- Zc = lift_size[i1];
- //printf("%d\n",Zc);
- break;
}
- }
#ifdef DEBUG_LDPC
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
index faac021088..235badc2e0 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
@@ -361,24 +361,19 @@ short *choose_generator_matrix(short BG,short Zc)
return Gen_shift_values;
}
-int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length, short BG,unsigned char gen_code)
+int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int Zc,int Kb,short block_length, short BG,unsigned char gen_code)
{
unsigned char c[22*384]; //padded input, unpacked, max size
unsigned char d[68*384]; //coded output, unpacked, max size
unsigned char channel_temp,temp;
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
- short Zc;
- //initialize for BG == 1
- short Kb = 22;
+
short nrows = 46;//parity check bits
short ncols = 22;//info bits
int i,i1,i2,i3,i4,i5,temp_prime,var;
int no_punctured_columns,removed_bit;
- //Table of possible lifting sizes
- short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
-
int nind=0;
int indlist[1000];
int indlist2[1000];
@@ -387,8 +382,6 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
//if (block_length>3840)
if (BG==1)
{
- //BG=1;
- Kb = 22;
nrows=46; //parity check bits
ncols=22; //info bits
}
@@ -399,32 +392,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
nrows=42; //parity check bits
ncols=10; // info bits
- if (block_length>640)
- Kb = 10;
- else if (block_length>560)
- Kb = 9;
- else if (block_length>192)
- Kb = 8;
- else
- Kb = 6;
}
- //find minimum value in all sets of lifting size
- Zc=0;
- for (i1=0; i1 < 51; i1++)
- {
- if (lift_size[i1] >= (double) block_length/Kb)
- {
- Zc = lift_size[i1];
- //printf("%d\n",Zc);
- break;
- }
- }
- if (Zc==0) {
- printf("ldpc_encoder_orig: could not determine lifting size\n");
- return(-1);
- }
-
Gen_shift_values=choose_generator_matrix(BG,Zc);
if (Gen_shift_values==NULL) {
printf("ldpc_encoder_orig: could not find generator matrix\n");
diff --git a/openair1/PHY/CODING/nr_compute_tbs.c b/openair1/PHY/CODING/nr_compute_tbs.c
index e1c15d4a86..055f697f41 100644
--- a/openair1/PHY/CODING/nr_compute_tbs.c
+++ b/openair1/PHY/CODING/nr_compute_tbs.c
@@ -24,73 +24,128 @@
author: Hongzhi WANG (TCL)
*/
#include "PHY/defs_nr_UE.h"
-//#include "SCHED/extern.h"
-
#define INDEX_MAX_TBS_TABLE (93)
-//Table 5.1.3.1-1
-uint16_t Mcsindextable1[29][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
- {4,658},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
+
//Table 5.1.2.2-2
uint16_t Tbstable_nr[INDEX_MAX_TBS_TABLE] = {24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,208,224,240,256,272,288,304,320,336,352,368,384,408,432,456,480,504,528,552,576,608,640,672,704,736,768,808,848,888,928,984,1032,1064,1128,1160,1192,1224,1256,1288,1320,1352,1416,1480,1544,1608,1672,1736,1800,1864,1928,2024,2088,2152,2216,2280,2408,2472,2536,2600,2664,2728,2792,2856,2976,3104,3240,3368,3496,3624,3752,3824};
-uint32_t nr_compute_tbs(uint8_t mcs,
- uint16_t nb_rb,
- uint16_t nb_symb_sch,
- uint8_t nb_re_dmrs,
- uint16_t length_dmrs,
- uint8_t Nl)
+uint16_t NPRB_LBRM[7] = {32,66,107,135,162,217,273};
+
+uint32_t nr_compute_tbs(uint16_t Qm,
+ uint16_t R,
+ uint16_t nb_rb,
+ uint16_t nb_symb_sch,
+ uint16_t nb_dmrs_prb,
+ uint16_t nb_rb_oh,
+ uint8_t Nl)
{
- uint16_t nbp_re, nb_re, nb_dmrs_prb, nb_rb_oh,Qm,R;
- uint32_t nr_tbs=0;
- double Ninfo,Np_info,n,C;
- nb_rb_oh = 0; //set to 0 if not configured by higher layer
- Qm = Mcsindextable1[mcs][0];
- R = Mcsindextable1[mcs][1];
- nb_dmrs_prb = nb_re_dmrs*length_dmrs;
+ uint16_t nbp_re, nb_re;
+ uint32_t nr_tbs=0;
+ uint32_t Ninfo, Np_info, C;
+ uint8_t n, scale;
- nbp_re = 12 * nb_symb_sch - nb_dmrs_prb - nb_rb_oh;
+ nbp_re = NR_NB_SC_PER_RB * nb_symb_sch - nb_dmrs_prb - nb_rb_oh;
- nb_re = min(156, nbp_re) * nb_rb;
+ nb_re = min(156, nbp_re) * nb_rb;
+
+ scale = (R>1024)?11:10;
// Intermediate number of information bits
- Ninfo = (double)((nb_re * R * Qm * Nl)/1024);
-
- //printf("Ninfo %lf nbp_re %d nb_re %d mcs %d Qm %d, R %d\n", Ninfo, nbp_re, nb_re,mcs, Qm, R);
+ Ninfo = (nb_re * R * Qm * Nl)>>scale;
if (Ninfo <=3824) {
-
n = max(3, floor(log2(Ninfo)) - 6);
- Np_info = max(24, pow(2,n) * floor(Ninfo/pow(2,n)));
-
+ Np_info = max(24, (Ninfo>>n)<= Np_info){
+ if (Tbstable_nr[i] >= Np_info){
nr_tbs = Tbstable_nr[i];
break;
}
}
}
else {
- n = floor(log2(Ninfo-24)) - 5;
- Np_info = max(3840, pow(2,n) * round((Ninfo - 24)/pow(2,n)));
+ n = log2(Ninfo-24)-5;
+ Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1< 8424){
- C = ceil( (Np_info + 24)/8424 );
- nr_tbs = (uint32_t)(8 * C * ceil( (Np_info + 24)/(8*C) ) - 24);
+ C = CEILIDIV((Np_info+24),8424);
+ nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
}
else {
- nr_tbs = (uint32_t)(8 * ceil( (Np_info + 24)/8 ) - 24);
- //printf("n %lf Np_info %f pow %f ceil %f \n",n, Np_info,pow(2,6),ceil( (Np_info + 24)/8 ));
+ nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24;
}
}
}
+ //printf("Ninfo %d nbp_re %d nb_re %d Qm %d, R %d, tbs %d\n", Ninfo, nbp_re, nb_re, Qm, R, nr_tbs);
+ return nr_tbs;
+}
- return nr_tbs;
+
+//tbslbrm calculation according to 5.4.2.1 of 38.212
+uint32_t nr_compute_tbslbrm(uint16_t table,
+ uint16_t nb_rb,
+ uint8_t Nl,
+ uint8_t C)
+{
+
+ uint16_t R, nb_re;
+ uint16_t nb_rb_lbrm=0;
+ uint8_t Qm;
+ int i;
+ uint32_t nr_tbs=0;
+ uint32_t Ninfo, Np_info;
+ uint8_t n;
+
+ for (i=0; i<7; i++) {
+ if (NPRB_LBRM[i] >= nb_rb){
+ nb_rb_lbrm = NPRB_LBRM[i];
+ break;
+ }
+ }
+
+ Qm = ((table == 1)? 8 : 6);
+ R = 948;
+ nb_re = 156 * nb_rb_lbrm;
+
+ // Intermediate number of information bits
+ Ninfo = (nb_re * R * Qm * Nl)>>10;
+
+ if (Ninfo <=3824) {
+ n = max(3, floor(log2(Ninfo)) - 6);
+ Np_info = max(24, (Ninfo>>n)<= Np_info){
+ nr_tbs = Tbstable_nr[i];
+ break;
+ }
+ }
+ }
+ else {
+ n = log2(Ninfo-24)-5;
+ Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1< 8424){
+ nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
+ }
+ else {
+ nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24;
+ }
+
+ }
+
+ }
+ return nr_tbs;
+
}
diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c
index 0954939a58..9d50b4678b 100644
--- a/openair1/PHY/CODING/nr_rate_matching.c
+++ b/openair1/PHY/CODING/nr_rate_matching.c
@@ -206,3 +206,4 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
return 0;
}
+
diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c
index 00616f2189..90586e24d4 100644
--- a/openair1/PHY/CODING/nr_segmentation.c
+++ b/openair1/PHY/CODING/nr_segmentation.c
@@ -30,25 +30,31 @@
//#define DEBUG_SEGMENTATION
int32_t nr_segmentation(unsigned char *input_buffer,
- unsigned char **output_buffers,
- unsigned int B,
- unsigned int *C,
- unsigned int *K,
- unsigned int *Zout, // [hna] Zout is Zc
- unsigned int *F)
+ unsigned char **output_buffers,
+ unsigned int B,
+ unsigned int *C,
+ unsigned int *K,
+ unsigned int *Zout, // [hna] Zout is Zc
+ unsigned int *F,
+ uint8_t BG)
{
- unsigned int L,Bprime,Bprime_by_C,Z,r,Kb,k,s,crc,Kprime;
+ unsigned int L,Bprime,Z,r,Kcb,Kb,k,s,crc,Kprime;
- if (B<=8448) {
+ if (BG==1)
+ Kcb=8448;
+ else
+ Kcb=3840;
+
+ if (B<=Kcb) {
L=0;
*C=1;
Bprime=B;
} else {
L=24;
- *C = B/(8448-L);
+ *C = B/(Kcb-L);
- if ((8448-L)*(*C) < B)
+ if ((Kcb-L)*(*C) < B)
*C=*C+1;
Bprime = B+((*C)*L);
@@ -63,27 +69,31 @@ int32_t nr_segmentation(unsigned char *input_buffer,
}
// Find K+
- Bprime_by_C = Bprime/(*C);
- if (Bprime <=192) {
- Kb = 6;
- } else if (Bprime <=560) {
- Kb = 8;
- } else if (Bprime <=640) {
- Kb = 9;
- } else if (Bprime <=3840) {
- Kb = 10;;
- } else {
- Kb = 22;
+ Kprime = Bprime/(*C);
+
+ if (BG==1)
+ Kb = 22;
+ else {
+ if (B > 640) {
+ Kb = 10;
+ } else if (B > 560) {
+ Kb = 9;
+ } else if (B > 192) {
+ Kb = 8;
+ }
+ else {
+ Kb = 6;
+ }
}
-if ((Bprime_by_C%Kb) > 0)
- Z = (Bprime_by_C/Kb)+1;
+if ((Kprime%Kb) > 0)
+ Z = (Kprime/Kb)+1;
else
- Z = (Bprime_by_C/Kb);
+ Z = (Kprime/Kb);
#ifdef DEBUG_SEGMENTATION
- printf("nr segmetation B %u Bprime %u Bprime_by_C %u z %u \n", B, Bprime, Bprime_by_C, Z);
+ printf("nr segmetation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z);
#endif
if (Z <= 2) {
@@ -128,10 +138,15 @@ else
//msg("nr_segmentation.c: Illegal codeword size !!!\n");
return -1;
}
- *Zout = *K;
- *K = *K*Kb;
- *F = ((*K) - Bprime_by_C);
+ *Zout = *K;
+
+ if(BG==1)
+ *K = *K*22;
+ else
+ *K = *K*10;
+
+ *F = ((*K) - Kprime);
#ifdef DEBUG_SEGMENTATION
printf("final nr seg output Z %u K %u F %u \n", *Zout, *K, *F);
@@ -145,7 +160,6 @@ else
for (r=0; r<*C; r++) {
k = 0;
- Kprime = Bprime_by_C;
while (k<((Kprime - L)>>3)) {
output_buffers[r][k] = input_buffer[s];
@@ -154,6 +168,13 @@ else
s++;
}
+ if (*C > 1) { // add CRC
+ crc = crc24b(output_buffers[r],Kprime-L)>>8;
+ output_buffers[r][(Kprime-L)>>3] = ((uint8_t*)&crc)[2];
+ output_buffers[r][1+((Kprime-L)>>3)] = ((uint8_t*)&crc)[1];
+ output_buffers[r][2+((Kprime-L)>>3)] = ((uint8_t*)&crc)[0];
+ }
+
if (*F>0) {
for (k=Kprime>>3; k<(*K)>>3; k++) {
output_buffers[r][k] = 0;
@@ -161,16 +182,10 @@ else
}
}
- if (*C > 1) { // add CRC
- crc = crc24b(output_buffers[r],Kprime-L)>>8;
- output_buffers[r][(Kprime-L)>>3] = ((uint8_t*)&crc)[2];
- output_buffers[r][1+((Kprime-L)>>3)] = ((uint8_t*)&crc)[1];
- output_buffers[r][2+((Kprime-L)>>3)] = ((uint8_t*)&crc)[0];
- }
}
}
- return 0;
+ return Kb;
}
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index f44acc0e49..c8df496423 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -512,6 +512,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
rel15_ul->ulsch_pdu_rel15.nb_re_dmrs = 6;
rel15_ul->ulsch_pdu_rel15.length_dmrs = 1;
rel15_ul->ulsch_pdu_rel15.Qm = 2;
+ rel15_ul->ulsch_pdu_rel15.R = 679;
rel15_ul->ulsch_pdu_rel15.mcs = 9;
rel15_ul->ulsch_pdu_rel15.rv = 0;
rel15_ul->ulsch_pdu_rel15.n_layers = 1;
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index eb7b62ff99..0c7ce1cdd6 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -877,6 +877,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
pbch_vars[eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
pbch_vars[eNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
+ pbch_vars[eNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
pbch_vars[eNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
prach_vars[eNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
prach_vars[eNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
@@ -888,6 +889,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
int idx = (j<<1)+i;
pbch_vars[eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
pbch_vars[eNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[eNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
}
}
diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c
index 3643264c87..57bca9e2ec 100644
--- a/openair1/PHY/MODULATION/nr_modulation.c
+++ b/openair1/PHY/MODULATION/nr_modulation.c
@@ -24,7 +24,7 @@
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
void nr_modulation(uint32_t *in,
- uint16_t length,
+ uint32_t length,
uint16_t mod_order,
int16_t *out)
{
diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h
index 3b37d8e769..8a6abd5de5 100644
--- a/openair1/PHY/MODULATION/nr_modulation.h
+++ b/openair1/PHY/MODULATION/nr_modulation.h
@@ -37,7 +37,7 @@
*/
void nr_modulation(uint32_t *in,
- uint16_t length,
+ uint32_t length,
uint16_t mod_order,
int16_t *out);
@@ -93,4 +93,4 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
*/
void nr_dft(int32_t *z,int32_t *d, uint32_t Msc_PUSCH);
-#endif
\ No newline at end of file
+#endif
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c
index b48299b691..f6eebb462f 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dci.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c
@@ -130,7 +130,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
}
void nr_pdcch_scrambling(uint32_t *in,
- uint16_t size,
+ uint32_t size,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t *out) {
@@ -162,8 +162,6 @@ uint8_t nr_generate_dci_top(NR_gNB_DCI_ALLOC_t dci_alloc,
NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config) {
int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration
- uint32_t dmrs_seq[NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD];
- uint16_t dmrs_offset=0;
uint16_t cset_start_sc;
uint8_t cset_start_symb, cset_nsymb;
int k,l,k_prime,dci_idx, dmrs_idx;
@@ -187,45 +185,20 @@ uint8_t nr_generate_dci_top(NR_gNB_DCI_ALLOC_t dci_alloc,
dci_idx = 0;
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
// DMRS length is per OFDM symbol
- uint16_t dmrs_length = (pdcch_params.precoder_granularity == NFAPI_NR_CSET_ALL_CONTIGUOUS_RBS)?
+ uint32_t dmrs_length = (pdcch_params.precoder_granularity == NFAPI_NR_CSET_ALL_CONTIGUOUS_RBS)?
(pdcch_params.n_rb*6) : (dci_alloc.L*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE)
- uint16_t encoded_length = dci_alloc.L*108; //2(QPSK)*9(per RB)*6(REG per CCE)
+ uint32_t encoded_length = dci_alloc.L*108; //2(QPSK)*9(per RB)*6(REG per CCE)
LOG_D(PHY, "DMRS length per symbol %d\t DCI encoded length %d\n", dmrs_length, encoded_length);
+ dmrs_length += pdcch_params.rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
/// DMRS QPSK modulation
- /*There is a need to shift from which index the pregenerated DMRS sequence is used
- * see 38211 r15.2.0 section 7.4.1.3.2: assumption is the reference point for k refers to the DMRS sequence*/
- if (pdcch_params.config_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) {
- for (int symb=cset_start_symb; symb>5;
-
- dmrs_offset = (pdcch_params.rb_offset*3)&0x1f;
- LOG_D(PHY, "PDCCH DMRS offset %d\n", dmrs_offset);
- }
-
for (int symb=cset_start_symb; symb>5)] |= ((gold_pdcch_dmrs[symb][(i+dmrs_offset)>>5]>>((i+dmrs_offset)&0x1f))&1)<<(i&0x1f);
-#ifdef DEBUG_PDCCH_DMRS
- //printf("out 0x%08x in 0x%08x \n", dmrs_seq[(i>>5)], gold_pdcch_dmrs[symb][(i+dmrs_offset)>>5]);
-#endif
- }
-
- nr_modulation(dmrs_seq, dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
- } else
- nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
+
+ nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
#ifdef DEBUG_PDCCH_DMRS
for (int i=0; i>1; i++)
- if (dmrs_offset)
- printf("symb %d i %d gold seq 0x%08x mod_dmrs %d %d\n", symb, i, dmrs_seq[i>>5],
- mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1] );
- else
printf("symb %d i %d gold seq 0x%08x mod_dmrs %d %d\n", symb, i,
gold_pdcch_dmrs[symb][i>>5], mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1] );
@@ -276,32 +249,28 @@ uint8_t nr_generate_dci_top(NR_gNB_DCI_ALLOC_t dci_alloc,
cset_start_sc -= frame_parms.ofdm_symbol_size;
/*Reorder REG list for a freq first mapping*/
- uint8_t symb_idx[NR_MAX_CSET_DURATION] = {0,0,0};
uint8_t nb_regs = dci_alloc.L*NR_NB_REG_PER_CCE;
- uint8_t regs_per_symb = nb_regs/cset_nsymb;
for (int cce_idx=0; cce_idxnb_mod_symbols;
uint8_t Qm = rel15->modulation_order;
- uint16_t encoded_length = nb_symbols*Qm;
+ uint32_t encoded_length = nb_symbols*Qm;
/// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
@@ -121,11 +121,12 @@ printf("\n");
pdcch_params.scrambling_id : config->sch_config.physical_cell_id.value;
for (int q=0; qnb_codewords; q++)
nr_pdsch_codeword_scrambling(harq->f,
- encoded_length,
- q,
- Nid,
- n_RNTI,
- scrambled_output[q]);
+ encoded_length,
+ q,
+ Nid,
+ n_RNTI,
+ scrambled_output[q]);
+
stop_meas(dlsch_scrambling_stats);
#ifdef DEBUG_DLSCH
printf("PDSCH scrambling:\n");
@@ -175,7 +176,7 @@ for (int l=0; lnb_layers; l++)
//to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007
/// DMRS QPSK modulation
- uint16_t n_dmrs = (rel15->n_prb*rel15->nb_re_dmrs)<<1;
+ uint16_t n_dmrs = ((rel15->n_prb+rel15->start_prb)*rel15->nb_re_dmrs)<<1;
int16_t mod_dmrs[n_dmrs<<1];
uint8_t dmrs_type = config->pdsch_config.dmrs_type.value;
uint8_t mapping_type = config->pdsch_config.mapping_type.value;
@@ -220,6 +221,10 @@ ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime[0], l0, dmrs_symbol);
#endif
uint8_t k_prime=0;
uint16_t m=0, n=0, dmrs_idx=0, k=0;
+ if (dmrs_type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k)
+ dmrs_idx = rel15->start_prb*6;
+ else
+ dmrs_idx = rel15->start_prb*4;
for (int l=rel15->start_symbol; lstart_symbol+rel15->nb_symbols; l++) {
k = start_sc;
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
index 3419be30fa..d982a17ea7 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
@@ -54,11 +54,11 @@ void nr_get_rbg_list(uint32_t bitmap, uint8_t n_rbg, uint8_t* rbg_list);
void nr_get_PRG_parms(NR_BWP_PARMS* bwp, NR_gNB_DCI_ALLOC_t dci_alloc, uint8_t prb_bundling_type);
void nr_pdsch_codeword_scrambling(uint8_t *in,
- uint16_t size,
- uint8_t q,
- uint32_t Nid,
- uint32_t n_RNTI,
- uint32_t* out);
+ uint32_t size,
+ uint8_t q,
+ uint32_t Nid,
+ uint32_t n_RNTI,
+ uint32_t* out);
void nr_fill_dlsch(PHY_VARS_gNB *gNB,
int frame,
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
index 14371e89e2..d001141f37 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
@@ -283,18 +283,21 @@ int nr_dlsch_encoding(unsigned char *a,
nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15;
uint16_t nb_rb = rel15.n_prb;
uint8_t nb_symb_sch = rel15.nb_symbols;
- uint32_t A, Z, F=0;
- uint32_t *pz = &Z;
+ uint32_t A, Z, Kb, F=0;
+ uint32_t *Zc = &Z;
uint8_t mod_order = rel15.modulation_order;
- uint16_t Kr=0,r,r_offset=0;
+ uint16_t Kr=0,r;
+ uint32_t r_offset=0;
//uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint8_t BG=1;
uint32_t E;
- uint8_t Ilbrm = 0;
+ uint8_t Ilbrm = 1;
uint32_t Tbslbrm = 950984; //max tbs
uint8_t nb_re_dmrs = rel15.nb_re_dmrs;
+ uint16_t R=rel15.coding_rate;
uint16_t length_dmrs = 1;
float Coderate = 0.0;
+ uint8_t Nl = 4;
/*
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
@@ -310,9 +313,6 @@ int nr_dlsch_encoding(unsigned char *a,
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15.nb_layers);
LOG_D(PHY,"dlsch coding A %d G %d mod_order %d\n", A,G, mod_order);
-
-
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, rel15.nb_layers);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
@@ -326,38 +326,58 @@ int nr_dlsch_encoding(unsigned char *a,
printf("%02x.",a[i]);
printf("\n");
*/
- // Add 24-bit crc (polynomial A) to payload
- crc = crc24a(a,A)>>8;
- a[A>>3] = ((uint8_t*)&crc)[2];
- a[1+(A>>3)] = ((uint8_t*)&crc)[1];
- a[2+(A>>3)] = ((uint8_t*)&crc)[0];
- //printf("CRC %x (A %d)\n",crc,A);
- //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
- dlsch->harq_processes[harq_pid]->B = A+24;
- // dlsch->harq_processes[harq_pid]->b = a;
+ if (A > 3824) {
+ // Add 24-bit crc (polynomial A) to payload
+ crc = crc24a(a,A)>>8;
+ a[A>>3] = ((uint8_t*)&crc)[2];
+ a[1+(A>>3)] = ((uint8_t*)&crc)[1];
+ a[2+(A>>3)] = ((uint8_t*)&crc)[0];
+ //printf("CRC %x (A %d)\n",crc,A);
+ //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
+
+ dlsch->harq_processes[harq_pid]->B = A+24;
+ // dlsch->harq_processes[harq_pid]->b = a;
- AssertFatal((A/8)+4 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_DLSCH_PAYLOAD_BYTES);
+ AssertFatal((A/8)+4 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_DLSCH_PAYLOAD_BYTES);
- memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
+ memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); // why is this +4 if the CRC is only 3 bytes?
+ }
+ else {
+ // Add 16-bit crc (polynomial A) to payload
+ crc = crc16(a,A)>>16;
+ a[A>>3] = ((uint8_t*)&crc)[1];
+ a[1+(A>>3)] = ((uint8_t*)&crc)[0];
+ //printf("CRC %x (A %d)\n",crc,A);
+ //printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
+
+ dlsch->harq_processes[harq_pid]->B = A+16;
+ // dlsch->harq_processes[harq_pid]->b = a;
+
+ AssertFatal((A/8)+3 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+3 = %d > %d)\n",A,(A/8)+3,MAX_DLSCH_PAYLOAD_BYTES);
- nr_segmentation(dlsch->harq_processes[harq_pid]->b,
- dlsch->harq_processes[harq_pid]->c,
- dlsch->harq_processes[harq_pid]->B,
- &dlsch->harq_processes[harq_pid]->C,
- &dlsch->harq_processes[harq_pid]->K,
- pz, // [hna] pz is Zc
- &dlsch->harq_processes[harq_pid]->F);
+ memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+3); // using 3 bytes to mimic the case of 24 bit crc
+ }
+ if (R<1000)
+ Coderate = (float) R /(float) 1024;
+ else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools
+ Coderate = (float) R /(float) 2048;
+
+ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
+ BG = 2;
+ else
+ BG = 1;
+
+ Kb = nr_segmentation(dlsch->harq_processes[harq_pid]->b,
+ dlsch->harq_processes[harq_pid]->c,
+ dlsch->harq_processes[harq_pid]->B,
+ &dlsch->harq_processes[harq_pid]->C,
+ &dlsch->harq_processes[harq_pid]->K,
+ Zc,
+ &dlsch->harq_processes[harq_pid]->F,
+ BG);
F = dlsch->harq_processes[harq_pid]->F;
- Coderate = (float) A /(float) G;
-
- if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
- BG = 2;
- }
- else{
- BG = 1;
- }
Kr = dlsch->harq_processes[harq_pid]->K;
#ifdef DEBUG_DLSCH_CODING
@@ -365,7 +385,7 @@ int nr_dlsch_encoding(unsigned char *a,
Kr_bytes = Kr>>3;
#endif
- //printf("segment Z %d k %d Kr %d BG %d\n", *pz,dlsch->harq_processes[harq_pid]->K,Kr,BG);
+ //printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,dlsch->harq_processes[harq_pid]->K,Kr,BG,dlsch->harq_processes[harq_pid]->C);
for (r=0; rharq_processes[harq_pid]->C; r++) {
//d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
@@ -374,32 +394,21 @@ int nr_dlsch_encoding(unsigned char *a,
printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F);
printf("start ldpc encoder segment %d/%d\n",r,dlsch->harq_processes[harq_pid]->C);
printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
- for (int cnt =0 ; cnt < 22*(*pz)/8; cnt ++){
+ for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++){
printf("%d ", dlsch->harq_processes[harq_pid]->c[r][cnt]);
}
printf("\n");
#endif
- //ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],Kr,BG,0);
- //ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],Kr,BG,NULL,NULL,NULL,NULL);
+ //ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],*Zc,Kb,Kr,BG,0);
+ //ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
}
- //for (int i=0;i<68*384;i++)
- // printf("channel_input[%d]=%d\n",i,channel_input[i]);
+ for(int j=0;j<(dlsch->harq_processes[harq_pid]->C/8+1);j++) {
+ ldpc_encoder_optim_8seg_multi(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,dlsch->harq_processes[harq_pid]->C,j,NULL,NULL,NULL,NULL);
+ }
-
- /*printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[0][0], dlsch->harq_processes[harq_pid]->d[0][1], dlsch->harq_processes[harq_pid]->d[r][2],dlsch->harq_processes[harq_pid]->d[0][3], dlsch->harq_processes[harq_pid]->d[0][4]);
- for (int cnt =0 ; cnt < 66*(*pz); cnt ++){
- printf("%d \n", dlsch->harq_processes[harq_pid]->d[0][cnt]);
- }
- printf("\n");*/
-
- //ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
- ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
-
- //printf("end ldpc encoder -- output\n");
-
#ifdef DEBUG_DLSCH_CODING
write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[0][0],(3*8*Kr_bytes)+12,1,4);
@@ -409,13 +418,14 @@ int nr_dlsch_encoding(unsigned char *a,
for (r=0; rharq_processes[harq_pid]->C; r++) {
- if (dlsch->harq_processes[harq_pid]->F>0) {
- for (int k=(Kr-F-2*(*pz)); kharq_processes[harq_pid]->d[r][k] = NR_NULL;
- //if (k<(Kr-F+8))
- //printf("r %d filler bits [%d] = %d \n", r,k, dlsch->harq_processes[harq_pid]->d[r][k]);
- }
- }
+ if (dlsch->harq_processes[harq_pid]->F>0) {
+ for (int k=(Kr-F-2*(*Zc)); kharq_processes[harq_pid]->d[r][k] = NR_NULL;
+ //if (k<(Kr-F+8))
+ //printf("r %d filler bits [%d] = %d \n", r,k, dlsch->harq_processes[harq_pid]->d[r][k]);
+ }
+ }
+
#ifdef DEBUG_DLSCH_CODING
printf("Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d)...\n",
r,
@@ -430,26 +440,31 @@ int nr_dlsch_encoding(unsigned char *a,
E = nr_get_E(G, dlsch->harq_processes[harq_pid]->C, mod_order, rel15.nb_layers, r);
+ // for tbslbrm calculation according to 5.4.2.1 of 38.212
+ if (rel15.nb_layers < Nl)
+ Nl = rel15.nb_layers;
+
+ Tbslbrm = nr_compute_tbslbrm(rel15.mcs_table,nb_rb,Nl,dlsch->harq_processes[harq_pid]->C);
+
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
BG,
- *pz,
+ *Zc,
dlsch->harq_processes[harq_pid]->d[r],
dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C,
rel15.redundancy_version,
E);
-
#ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++)
printf("output ratematching e[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->e[i+r_offset], r_offset);
#endif
nr_interleaving_ldpc(E,
- mod_order,
- dlsch->harq_processes[harq_pid]->e+r_offset,
- dlsch->harq_processes[harq_pid]->f+r_offset);
+ mod_order,
+ dlsch->harq_processes[harq_pid]->e+r_offset,
+ dlsch->harq_processes[harq_pid]->f+r_offset);
#ifdef DEBUG_DLSCH_CODING
diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
index 8d9bf00639..303282929f 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
@@ -85,7 +85,7 @@ uint8_t get_delta(uint8_t ap, uint8_t config) {
return ((config==NFAPI_NR_DMRS_TYPE1)?(pdsch_dmrs_1[ap][2]):(pdsch_dmrs_2[ap][2]));
}
-uint16_t get_dmrs_freq_idx(uint8_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type) {
+uint16_t get_dmrs_freq_idx(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type) {
uint16_t dmrs_idx = (dmrs_type)? (6*n+k_prime+delta):((n<<2)+(k_prime<<1)+delta);
return dmrs_idx;
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
index 02f454b7d0..6f07874ca0 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
@@ -45,6 +45,6 @@ void get_Wf(int8_t *Wf, uint8_t ap, uint8_t config);
uint8_t get_delta(uint8_t ap, uint8_t config);
-uint16_t get_dmrs_freq_idx(uint8_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type);
+uint16_t get_dmrs_freq_idx(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type);
uint8_t get_l0(uint8_t mapping_type, uint8_t dmrs_typeA_position);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
index 07ca17cd6d..10ac17acab 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
@@ -31,32 +31,42 @@
*/
#include "nr_transport_common_proto.h"
+#include "PHY/CODING/coding_defs.h"
-/// Target code rate tables indexed by Imcs
-uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \
- 616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948};
- // Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
-uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \
- 616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948};
-uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \
- 378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772};
-uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
- 336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
- 1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \
- 3104, 3240, 3368, 3496, 3624, 3752, 3824};
+//Table 5.1.3.1-1 of 38.214
+uint16_t Table_51311[29][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
+ {4,658},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
-uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) {
+//Table 5.1.3.1-2 of 38.214
+// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
+uint16_t Table_51312[28][2] = {{2,120},{2,193},{2,308},{2,449},{2,602},{4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{6,466},{6,517},{6,567},{6,616},{6,666},
+ {6,719},{6,772},{6,822},{6,873},{8,1365},{8,711},{8,754},{8,797},{8,841},{8,885},{8,1833},{8,948}};
+
+//Table 5.1.3.1-3 of 38.214
+uint16_t Table_51313[29][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{4,340},
+ {4,378},{4,434},{4,490},{4,553},{4,616},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666}, {6,719}, {6,772}};
+
+//Table 6.1.4.1-1 of 38.214 TODO fix for tp-pi2BPSK
+uint16_t Table_61411[28][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
+ {4,658},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
+
+//Table 6.1.4.1-2 of 38.214 TODO fix for tp-pi2BPSK
+uint16_t Table_61412[28][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},
+ {4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{4,699},{4,772},{6,567},{6,616},{6,666}, {6,772}};
+
+
+uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
+ case 0:
+ return (Table_51311[Imcs][0]);
+ break;
+
case 1:
- return (((Imcs<10)||(Imcs==29))?2:((Imcs<17)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
+ return (Table_51312[Imcs][0]);
break;
case 2:
- return (((Imcs<5)||(Imcs==28))?2:((Imcs<11)||(Imcs==29))?4:((Imcs<20)||(Imcs==30))?6:((Imcs<28)||(Imcs==31))?8:-1);
- break;
-
- case 3:
- return (((Imcs<15)||(Imcs==29))?2:((Imcs<21)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
+ return (Table_51313[Imcs][0]);
break;
default:
@@ -64,18 +74,18 @@ uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) {
}
}
-uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) {
+uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
+ case 0:
+ return (Table_51311[Imcs][1]);
+ break;
+
case 1:
- return (nr_target_code_rate_table1[Imcs]);
+ return (Table_51312[Imcs][1]);
break;
case 2:
- return (nr_target_code_rate_table2[Imcs]);
- break;
-
- case 3:
- return (nr_target_code_rate_table3[Imcs]);
+ return (Table_51313[Imcs][1]);
break;
default:
@@ -83,6 +93,60 @@ uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) {
}
}
+uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
+ switch(table_idx) {
+ case 0:
+ return (Table_51311[Imcs][0]);
+ break;
+
+ case 1:
+ return (Table_51312[Imcs][0]);
+ break;
+
+ case 2:
+ return (Table_51313[Imcs][0]);
+ break;
+
+ case 3:
+ return (Table_61411[Imcs][0]);
+ break;
+
+ case 4:
+ return (Table_61412[Imcs][0]);
+ break;
+
+ default:
+ AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
+ }
+}
+
+uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
+ switch(table_idx) {
+ case 0:
+ return (Table_51311[Imcs][1]);
+ break;
+
+ case 1:
+ return (Table_51312[Imcs][1]);
+ break;
+
+ case 2:
+ return (Table_51313[Imcs][1]);
+ break;
+
+ case 3:
+ return (Table_61411[Imcs][1]);
+ break;
+
+ case 4:
+ return (Table_61412[Imcs][1]);
+ break;
+
+ default:
+ AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
+ }
+}
+
static inline uint8_t is_codeword_disabled(uint8_t format, uint8_t Imcs, uint8_t rv) {
return ((format==NFAPI_NR_DL_DCI_FORMAT_1_1)&&(Imcs==26)&&(rv==1));
}
@@ -103,16 +167,16 @@ static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8
return 1;
}
-void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
- nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
- nfapi_nr_config_request_t config) {
+void nr_get_tbs_dl(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
+ nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
+ nfapi_nr_config_request_t config) {
LOG_D(MAC, "TBS calculation\n");
nfapi_nr_dl_config_pdcch_parameters_rel15_t params_rel15 = dci_pdu.pdcch_params_rel15;
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_rel15 = &dlsch_pdu->dlsch_pdu_rel15;
uint8_t rnti_type = params_rel15.rnti_type;
- uint8_t N_PRB_oh = ((rnti_type==NFAPI_NR_RNTI_SI)||(rnti_type==NFAPI_NR_RNTI_RA)||(rnti_type==NFAPI_NR_RNTI_P))? 0 : \
+ uint16_t N_PRB_oh = ((rnti_type==NFAPI_NR_RNTI_SI)||(rnti_type==NFAPI_NR_RNTI_RA)||(rnti_type==NFAPI_NR_RNTI_P))? 0 : \
(config.pdsch_config.x_overhead.value);
uint8_t N_PRB_DMRS = (config.pdsch_config.dmrs_type.value == NFAPI_NR_DMRS_TYPE1)?6:4; //This only works for antenna port 1000
uint8_t N_sh_symb = dlsch_rel15->nb_symbols;
@@ -120,56 +184,35 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
LOG_D(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
- uint16_t N_RE, Ninfo, Ninfo_prime, C, TBS=0, R;
- uint8_t table_idx, Qm, n, scale;
+ uint16_t R;
+ uint32_t TBS=0;
+ uint8_t table_idx, Qm;
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t ss_type = params_rel15.search_space_type;
uint8_t dci_format = params_rel15.dci_format;
get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/
- table_idx = 1;
- scale = ((table_idx==2)&&((Imcs==20)||(Imcs==26)))?11:10;
-
- N_RE = min(156, N_RE_prime)*dlsch_rel15->n_prb;
- R = nr_get_code_rate(Imcs, table_idx);
- Qm = nr_get_Qm(Imcs, table_idx);
- Ninfo = (N_RE*R*Qm*dlsch_rel15->nb_layers)>>scale;
+ table_idx = 0;
+ R = nr_get_code_rate_dl(Imcs, table_idx);
+ Qm = nr_get_Qm_dl(Imcs, table_idx);
- if (Ninfo <= 3824) {
- n = max(3, (log2(Ninfo)-6));
- Ninfo_prime = max(24, (Ninfo>>n)<= Ninfo_prime) {
- TBS = nr_tbs_table[i];
- break;
- }
- }
- else {
- n = log2(Ninfo-24)-5;
- Ninfo_prime = max(3840, (ROUNDIDIV((Ninfo-24),(1<8424) {
- C = CEILIDIV((Ninfo_prime+24),8424);
- TBS = (C<<3)*CEILIDIV((Ninfo_prime+24),(C<<3)) - 24;
- }
- else
- TBS = ((CEILIDIV((Ninfo_prime+24),8))<<3) - 24;
- }
- }
+ TBS = nr_compute_tbs(Qm,
+ R,
+ dlsch_rel15->n_prb,
+ N_sh_symb,
+ N_PRB_DMRS,
+ N_PRB_oh,
+ dlsch_rel15->nb_layers);
dlsch_rel15->coding_rate = R;
dlsch_rel15->modulation_order = Qm;
dlsch_rel15->transport_block_size = TBS;
dlsch_rel15->nb_re_dmrs = N_PRB_DMRS;
dlsch_rel15->nb_mod_symbols = N_RE_prime*dlsch_rel15->n_prb*dlsch_rel15->nb_codewords;
+ dlsch_rel15->mcs_table = table_idx;
- LOG_D(MAC, "TBS %d : N_RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d scale %d nb_symbols %d\n",
- TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale, dlsch_rel15->nb_mod_symbols);
+ LOG_D(MAC, "TBS %d : N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d R %d Qm %d table %d nb_symbols %d\n",
+ TBS, N_PRB_DMRS, N_sh_symb, N_PRB_oh, R, Qm, table_idx, dlsch_rel15->nb_mod_symbols);
}
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) {
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
index 36f3fb5c2c..6a88203f8c 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
@@ -48,14 +48,17 @@
#define NR_PUSCH_x 2 // UCI placeholder bit TS 38.212 V15.4.0 subclause 5.3.3.1
#define NR_PUSCH_y 3 // UCI placeholder bit
-/** \brief Computes Q based on I_MCS PDSCH and table_idx. Implements Table 5.1.3.1-2 from 38.214. */
-uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx);
+/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
+uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
+uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
-uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx);
+/** \brief Computes Q based on I_MCS PDSCH and table_idx for uplink. Implements MCS Tables from 38.214. */
+uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx);
+uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
-void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
- nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
- nfapi_nr_config_request_t config);
+void nr_get_tbs_dl(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
+ nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
+ nfapi_nr_config_request_t config);
/** \brief Computes available bits G. */
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch, uint8_t nb_re_dmrs, uint16_t length_dmrs, uint8_t Qm, uint8_t Nl);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
index d5c031428e..8d220a76bb 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
@@ -196,3 +196,13 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
int frame,
int slot,
nfapi_nr_pusch_pdu_t *ulsch_pdu);
+
+uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
+
+uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx);
+
+uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
+
+uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
+
+uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
index ce4c18333e..6e991faf37 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
@@ -320,6 +320,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint16_t nb_rb = nfapi_ulsch_pdu_rel15->number_rbs;
uint16_t number_symbols = nfapi_ulsch_pdu_rel15->number_symbols;
uint8_t Qm = nfapi_ulsch_pdu_rel15->Qm;
+ uint16_t R = nfapi_ulsch_pdu_rel15->R;
uint8_t mcs = nfapi_ulsch_pdu_rel15->mcs;
uint8_t n_layers = nfapi_ulsch_pdu_rel15->n_layers;
uint8_t nb_re_dmrs = nfapi_ulsch_pdu_rel15->nb_re_dmrs;
@@ -348,8 +349,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
// harq_process->trials[nfapi_ulsch_pdu_rel15->round]++;
-
- harq_process->TBS = nr_compute_tbs(mcs, nb_rb, number_symbols, nb_re_dmrs, length_dmrs, n_layers);
+ harq_process->TBS = nr_compute_tbs(Qm, R, nb_rb, number_symbols, nb_re_dmrs*length_dmrs, 0, n_layers);
A = harq_process->TBS;
ret = ulsch->max_ldpc_iterations + 1;
@@ -363,29 +363,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// This is a new packet, so compute quantities regarding segmentation
harq_process->B = A+24;
- // [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F)
- nr_segmentation(NULL,
- NULL,
- harq_process->B,
- &harq_process->C,
- &harq_process->K,
- &harq_process->Z, // [hna] Z is Zc
- &harq_process->F);
+ if (R<1024)
+ Coderate = (float) R /(float) 1024;
+ else
+ Coderate = (float) R /(float) 2048;
-#ifdef DEBUG_ULSCH_DECODING
- printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z);
- if (!frame%100)
- printf("K %d C %d Z %d F %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->F);
-#endif
- }
-
- p_decParams->Z = harq_process->Z;
-
- Coderate = (float) A /(float) G;
-
- if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
- p_decParams->BG = 2;
- if (Coderate < 0.3333) {
+ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
+ p_decParams->BG = 2;
+ if (Coderate < 0.3333) {
p_decParams->R = 15;
kc = 52;
}
@@ -413,7 +398,24 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
}
- //printf("coderate %f kc %d \n", Coderate, kc);
+ // [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F)
+ nr_segmentation(NULL,
+ NULL,
+ harq_process->B,
+ &harq_process->C,
+ &harq_process->K,
+ &harq_process->Z, // [hna] Z is Zc
+ &harq_process->F,
+ p_decParams->BG);
+
+#ifdef DEBUG_ULSCH_DECODING
+ printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z);
+ if (!frame%100)
+ printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->Nl);
+#endif
+ }
+ p_decParams->Z = harq_process->Z;
+
p_decParams->numMaxIter = ulsch->max_ldpc_iterations;
p_decParams->outMode= 0;
@@ -449,8 +451,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
K_bytes_F = Kr_bytes-(harq_process->F>>3);
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, nfapi_ulsch_pdu_rel15->n_layers);
-
for (r=0; rC; r++) {
E = nr_get_E(G, harq_process->C, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers, r);
@@ -500,6 +500,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
///////////////////////// harq_process->e =====> harq_process->d /////////////////////////
+ Tbslbrm = nr_compute_tbslbrm(0,nb_rb,nfapi_ulsch_pdu_rel15->n_layers,harq_process->C);
+
if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm,
p_decParams->BG,
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
index 24ca3d1ad6..cc22e5f7d7 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
@@ -60,8 +60,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
temp = 0;
for (aa=0; aanb_antennas_rx; aa++) {
- Re = ((int16_t*)ue->pdcch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_time[aa])[(i<<1)];
- Im = ((int16_t*)ue->pdcch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_time[aa])[1+(i<<1)];
+ Re = ((int16_t*)ue->pbch_vars[eNB_id]->dl_ch_estimates_time[aa])[(i<<1)];
+ Im = ((int16_t*)ue->pbch_vars[eNB_id]->dl_ch_estimates_time[aa])[1+(i<<1)];
temp += (Re*Re/2) + (Im*Im/2);
}
@@ -80,7 +80,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
// do not filter to have proactive timing adjustment
//max_pos_fil = max_pos;
- if(subframe == 1)
+ if(subframe == 0)
{
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
index ab2ac44a9a..e9b93719c1 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
@@ -21,7 +21,7 @@
#include
-
+#include "SCHED_NR_UE/defs.h"
#include "nr_estimation.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "filt16a_32.h"
@@ -199,19 +199,23 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
- uint8_t eNB_offset,
- unsigned char Ns,
- unsigned char symbol,
- int dmrss,
- uint8_t ssb_index,
- uint8_t n_hf)
+ uint8_t eNB_offset,
+ unsigned char Ns,
+ unsigned char symbol,
+ int dmrss,
+ uint8_t ssb_index,
+ uint8_t n_hf)
{
int pilot[200] __attribute__((aligned(16)));
- unsigned char aarx;
+ unsigned char aarx,p;
unsigned short k;
unsigned int pilot_cnt;
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
int ch_offset,symbol_offset;
+ int slot_pbch;
+ fapi_nr_pbch_config_t *pbch_config = &ue->nrUE_config.pbch_config;
+ // initialized to 5ms in nr_init_ue for scenarios where UE is not configured (otherwise acquired by cell configuration from gNB or LTE)
+ uint8_t ssb_periodicity = 10;// ue->ssb_periodicity;
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
@@ -418,6 +422,59 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
}
+ void (*idft)(int16_t *,int16_t *, int);
+
+ switch (ue->frame_parms.ofdm_symbol_size) {
+ case 128:
+ idft = idft128;
+ break;
+
+ case 256:
+ idft = idft256;
+ break;
+
+ case 512:
+ idft = idft512;
+ break;
+
+ case 1024:
+ idft = idft1024;
+ break;
+
+ case 1536:
+ idft = idft1536;
+ break;
+
+ case 2048:
+ idft = idft2048;
+ break;
+
+ case 3072:
+ idft = idft3072;
+ break;
+
+ case 4096:
+ idft = idft4096;
+ break;
+
+ default:
+ printf("unsupported ofdm symbol size \n");
+ assert(0);
+ }
+
+ if( symbol == 3)
+ {
+ // do ifft of channel estimate
+ for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++)
+ for (p=0; pframe_parms.nb_antenna_ports_eNB; p++) {
+ if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx])
+ {
+ LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, ue->current_thread_id[Ns], symbol, ch_offset);
+ idft((int16_t*) &ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx][ch_offset],
+ (int16_t*) ue->pbch_vars[eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1);
+ }
+ }
+ }
//}
@@ -433,7 +490,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short nb_rb_coreset)
{
int pilot[200] __attribute__((aligned(16)));
- unsigned char aarx,p;
+ unsigned char aarx;
unsigned short k;
unsigned int pilot_cnt;
int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
@@ -597,60 +654,6 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
//}
}
-
- void (*idft)(int16_t *,int16_t *, int);
-
- switch (ue->frame_parms.ofdm_symbol_size) {
- case 128:
- idft = idft128;
- break;
-
- case 256:
- idft = idft256;
- break;
-
- case 512:
- idft = idft512;
- break;
-
- case 1024:
- idft = idft1024;
- break;
-
- case 1536:
- idft = idft1536;
- break;
-
- case 2048:
- idft = idft2048;
- break;
-
- case 3072:
- idft = idft3072;
- break;
-
- case 4096:
- idft = idft4096;
- break;
-
- default:
- printf("unsupported ofdm symbol size \n");
- assert(0);
- }
-
- if( (Ns== 1) && (symbol == 0))
- {
- // do ifft of channel estimate
- for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++)
- for (p=0; pframe_parms.nb_antenna_ports_eNB; p++) {
- if (ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx])
- {
- LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns], symbol);
- idft((int16_t*) &ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx][0],
- (int16_t*) ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1);
- }
- }
- }
return(0);
}
@@ -721,11 +724,14 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
// generate pilot
- nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][0], &pilot[0],1000,0,nb_rb_pdsch);
+ uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12;
+ int config_type = 0; // needs to be updated from higher layer
+ nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset);
for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) {
- pil = (int16_t *)&pilot[0];
+ pil = (int16_t *)&pilot[rb_offset*((config_type==0) ? 6:4)];
+ k = k&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)];
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
@@ -755,8 +761,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//for (int i= 0; i<8; i++)
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
@@ -771,8 +777,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//printf("dl_ch addr %p\n",dl_ch);
@@ -790,8 +796,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8;
@@ -811,8 +817,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
8);
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -825,8 +831,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8;
@@ -847,8 +853,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -863,8 +869,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
8);
pil+=2;
- //re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
- re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
+ re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
+ //re_offset = (re_offset >= ue->frame_parms.ofdm_symbol_size) ? (re_offset - ue->frame_parms.ofdm_symbol_size + 2) : (re_offset+2);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8;
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
index 64bd81433d..092fdfd1fc 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
@@ -726,7 +726,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
ch_offset = ue->frame_parms.ofdm_symbol_size*2;
-printf("testing measurements\n");
+//printf("testing measurements\n");
// signal measurements
for (eNB_id=0; eNB_idn_connected_eNB; eNB_id++) {
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index 3f206a679c..c51309e3eb 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -140,9 +140,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
}
f_reg = (f_bundle_j*reg_bundle_size_L)+(reg%reg_bundle_size_L);
- //index_z = 9*reg;
- index_z = 9*(uint16_t)floor(reg/coreset_time_dur) + (9*coreset_nbr_rb)*(reg%coreset_time_dur);
- //index_llr = 9*(((uint16_t)floor(f_reg/reg_bundle_size_L)+(f_reg)%coreset_time_dur))*(coreset_nbr_rb);
+ index_z = 9*reg;
index_llr = 9*((uint16_t)floor(f_reg/coreset_time_dur)+((f_reg%coreset_time_dur)*(coreset_nbr_rb)));
for (int i=0; i<9; i++) {
@@ -395,7 +393,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
if (((c_rb - n_BWP_start) % BIT_TO_NBR_RB_CORESET_FREQ_DOMAIN)==0) {
bitcnt_coreset_freq_dom ++;
- while ((((coreset_freq_dom & 0x1FFFFFFFFFFF) >> (CORESET_FREQ_DOMAIN_BITMAP_SIZE - bitcnt_coreset_freq_dom)) & 0x1)== 0) { // 46 -> 45 is number of bits in coreset_freq_dom
+ while ((((coreset_freq_dom & 0x1FFFFFFFFFFF) >> (CORESET_FREQ_DOMAIN_BITMAP_SIZE - (n_BWP_start/BIT_TO_NBR_RB_CORESET_FREQ_DOMAIN) - bitcnt_coreset_freq_dom)) & 0x1)== 0) { // 46 -> 45 is number of bits in coreset_freq_dom
// next 6 RB are not part of the CORESET within the BWP as bit in coreset_freq_dom is set to 0
bitcnt_coreset_freq_dom ++;
//c_rb_tmp = c_rb_tmp + 6;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
index b7be5d9cd6..ce01ecbab6 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
@@ -239,7 +239,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//__m128i l;
//int16_t inv_d [68*384];
uint8_t kc;
- uint8_t Ilbrm = 0;
+ uint8_t Ilbrm = 1;
uint32_t Tbslbrm; //= 950984;
uint16_t nb_rb; //= 30;
double Coderate; //= 0.0;
@@ -299,12 +299,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->trials[harq_process->round]++;
- harq_process->TBS = nr_compute_tbs(harq_process->mcs,nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs, harq_process->Nl);
+ uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
+
+ harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*length_dmrs, nb_rb_oh, harq_process->Nl);
A = harq_process->TBS;
ret = dlsch->max_ldpc_iterations + 1;
dlsch->last_iteration_cnt = ret;
-
+
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
G = harq_process->G;
@@ -312,29 +314,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_IN);
- if (harq_process->round == 0) {
- // This is a new packet, so compute quantities regarding segmentation
- harq_process->B = A+24;
- nr_segmentation(NULL,
- NULL,
- harq_process->B,
- &harq_process->C,
- &harq_process->K,
- &harq_process->Z, // [hna] Z is Zc
- &harq_process->F);
+ if ((harq_process->R)<1024)
+ Coderate = (float) (harq_process->R) /(float) 1024;
+ else
+ Coderate = (float) (harq_process->R) /(float) 2048;
-#ifdef DEBUG_DLSCH_DECODING
- if (!frame%100)
- printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl);
-#endif
- }
-
- vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT);
-
- p_decParams->Z = harq_process->Z;
- //printf("dlsch decoding nr segmentation Z %d\n", p_decParams->Z);
-
- Coderate = (float) A /(float) G;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{
p_decParams->BG = 2;
@@ -367,6 +351,34 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
}
}
+
+ if (harq_process->round == 0) {
+ // This is a new packet, so compute quantities regarding segmentation
+ if (A > 3824)
+ harq_process->B = A+24;
+ else
+ harq_process->B = A+16;
+
+ nr_segmentation(NULL,
+ NULL,
+ harq_process->B,
+ &harq_process->C,
+ &harq_process->K,
+ &harq_process->Z, // [hna] Z is Zc
+ &harq_process->F,
+ p_decParams->BG);
+
+#ifdef DEBUG_DLSCH_DECODING
+ if (!frame%100)
+ printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl);
+#endif
+ }
+
+ vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT);
+
+ p_decParams->Z = harq_process->Z;
+ //printf("dlsch decoding nr segmentation Z %d\n", p_decParams->Z);
+
//printf("coderate %f kc %d \n", Coderate, kc);
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
@@ -403,8 +415,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
K_bytes_F = Kr_bytes-(harq_process->F>>3);
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
-
for (r=0; rC; r++) {
//printf("start rx segment %d\n",r);
@@ -448,6 +458,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
+ if ((harq_process->Nl)<4)
+ Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl,harq_process->C);
+ else
+ Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4,harq_process->C);
+
if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm,
p_decParams->BG,
@@ -495,8 +510,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// printf("done\n");
if (harq_process->C == 1){
- crc_type = CRC24_A;
- length_dec = harq_process->B;
+ if (A > 3824)
+ crc_type = CRC24_A;
+ else
+ crc_type = CRC16;
+
+ length_dec = harq_process->B;
+
}
else{
crc_type = CRC24_B;
@@ -739,7 +759,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
int32_t no_iteration_ldpc,length_dec;
/*uint8_t C;
uint8_t Qm;
- uint8_t Nl;
uint8_t r_thread;
uint32_t Er, Gp,GpmodC;*/
t_nrLDPC_dec_params decParams;
@@ -748,14 +767,14 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
t_nrLDPC_time_stats* p_procTime =&procTime ;
int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_procBuf* p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[0];
-
+ uint8_t Nl=4;
int16_t z [68*384];
int8_t l [68*384];
//__m128i l;
int16_t inv_d [68*384];
//int16_t *p_invd =&inv_d;
uint8_t kb, kc;
- uint8_t Ilbrm = 0;
+ uint8_t Ilbrm = 1;
uint32_t Tbslbrm = 950984;
uint16_t nb_rb = 30;
double Coderate = 0.0;
@@ -813,7 +832,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
nb_rb = harq_process->nb_rb;
harq_process->trials[harq_process->round]++;
- harq_process->TBS = nr_compute_tbs(harq_process->mcs,nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs, harq_process->Nl);
+ uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
+
+ harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*length_dmrs, nb_rb_oh, harq_process->Nl);
A = harq_process->TBS;
@@ -833,22 +854,11 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
// printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
- if (harq_process->round == 0) {
- // This is a new packet, so compute quantities regarding segmentation
- harq_process->B = A+24;
- nr_segmentation(NULL,
- NULL,
- harq_process->B,
- &harq_process->C,
- &harq_process->K,
- &harq_process->Z,
- &harq_process->F);
+ if ((harq_process->R)<1024)
+ Coderate = (float) (harq_process->R) /(float) 1024;
+ else
+ Coderate = (float) (harq_process->R) /(float) 2048;
- p_decParams->Z = harq_process->Z;
-
- }
-
- Coderate = (float) A /(float) G;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{
p_decParams->BG = 2;
@@ -881,6 +891,26 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
}
}
+ if (harq_process->round == 0) {
+ // This is a new packet, so compute quantities regarding segmentation
+ if (A > 3824)
+ harq_process->B = A+24;
+ else
+ harq_process->B = A+16;
+
+ nr_segmentation(NULL,
+ NULL,
+ harq_process->B,
+ &harq_process->C,
+ &harq_process->K,
+ &harq_process->Z,
+ &harq_process->F,
+ p_decParams->BG);
+
+ p_decParams->Z = harq_process->Z;
+
+ }
+
//printf("coderate %f kc %d \n", Coderate, kc);
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
p_decParams->outMode= 0;
@@ -959,8 +989,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
Kr_bytes = Kr>>3;
K_bytes_F = Kr_bytes-(harq_process->F>>3);
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
-
E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
/*
@@ -1001,6 +1029,12 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->round);
#endif
+ // for tbslbrm calculation according to 5.4.2.1 of 38.212
+ if (harq_process->Nl < Nl)
+ Nl = harq_process->Nl;
+
+ Tbslbrm = nr_compute_tbslbrm(rel15.mcs_table,nb_rb,Nl,dlsch->harq_processes[harq_pid]->C);
+
if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm,
p_decParams->BG,
@@ -1053,7 +1087,11 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
// printf("done\n");
if (harq_process->C == 1){
- crc_type = CRC24_A;
+ if (A > 3824)
+ crc_type = CRC24_A;
+ else
+ crc_type = CRC16;
+
length_dec = harq_process->B;
}
else{
@@ -1304,7 +1342,7 @@ void *nr_dlsch_decoding_process(void *arg)
int16_t inv_d [68*384];
int16_t *p_invd =&inv_d;
uint8_t kb, kc;
- uint8_t Ilbrm = 0;
+ uint8_t Ilbrm = 1;
uint32_t Tbslbrm = 950984;
uint16_t nb_rb = 30; //to update
double Coderate = 0.0;
@@ -1344,8 +1382,8 @@ void *nr_dlsch_decoding_process(void *arg)
int harq_pid = proc->harq_pid;
llr8_flag1 = proc->llr8_flag;
int frame = proc->frame_rx;
- int slot = proc->nr_tti_rx;
- r = proc->num_seg;
+ int slot = proc->nr_tti_rx;
+ r = proc->num_seg;
NR_UE_DLSCH_t *dlsch = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[slot]][eNB_id][0];
NR_DL_UE_HARQ_t *harq_process = dlsch->harq_processes[harq_pid];
@@ -1373,7 +1411,9 @@ void *nr_dlsch_decoding_process(void *arg)
harq_process->trials[harq_process->round]++;
- harq_process->TBS = nr_compute_tbs(harq_process->mcs,nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs, harq_process->Nl);
+ uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
+
+ harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*length_dmrs, nb_rb_oh, harq_process->Nl);
A = harq_process->TBS; //2072 for QPSK 1/3
@@ -1385,23 +1425,11 @@ void *nr_dlsch_decoding_process(void *arg)
LOG_I(PHY,"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
-
- if (harq_process->round == 0) {
- // This is a new packet, so compute quantities regarding segmentation
- harq_process->B = A+24;
+ if ((harq_process->R)<1024)
+ Coderate = (float) (harq_process->R) /(float) 1024;
+ else
+ Coderate = (float) (harq_process->R) /(float) 2048;
- nr_segmentation(NULL,
- NULL,
- harq_process->B,
- &harq_process->C,
- &harq_process->K,
- &harq_process->Z,
- &harq_process->F);
- p_decParams->Z = harq_process->Z;
-
- }
-
- Coderate = (float) A /(float) G;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{
p_decParams->BG = 2;
@@ -1432,7 +1460,29 @@ void *nr_dlsch_decoding_process(void *arg)
p_decParams->R = 89;
kc = 27;
}
- }
+ }
+
+ if (harq_process->round == 0) {
+ // This is a new packet, so compute quantities regarding segmentation
+ if (A > 3824)
+ harq_process->B = A+24;
+ else
+ harq_process->B = A+16;
+
+ nr_segmentation(NULL,
+ NULL,
+ harq_process->B,
+ &harq_process->C,
+ &harq_process->K,
+ &harq_process->Z,
+ &harq_process->F,
+ p_decParams->BG);
+
+ p_decParams->Z = harq_process->Z;
+
+ }
+
+
p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
p_decParams->outMode= 0;
@@ -1492,9 +1542,7 @@ void *nr_dlsch_decoding_process(void *arg)
Kr_bytes = Kr>>3;
K_bytes_F = Kr_bytes-(harq_process->F>>3);
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
-
- E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
+ E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
#if UE_TIMING_TRACE
start_meas(dlsch_deinterleaving_stats);
@@ -1529,6 +1577,11 @@ void *nr_dlsch_decoding_process(void *arg)
harq_process->round);
#endif
+ if (Nl<4)
+ Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,Nl,harq_process->C);
+ else
+ Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4,harq_process->C);
+
if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm,
p_decParams->BG,
@@ -1573,7 +1626,11 @@ void *nr_dlsch_decoding_process(void *arg)
memset(harq_process->c[r],0,Kr_bytes);
if (harq_process->C == 1){
- crc_type = CRC24_A;
+ if (A > 3824)
+ crc_type = CRC24_A;
+ else
+ crc_type = CRC16;
+
length_dec = harq_process->B;
}
else{
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 79b5c8d909..8f810d36d3 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -176,7 +176,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id];
- dlsch[0]->harq_processes[harq_pid]->Qm = nr_get_Qm(dlsch[0]->harq_processes[harq_pid]->mcs, 1);;
+ dlsch[0]->harq_processes[harq_pid]->Qm = nr_get_Qm_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
+ dlsch[0]->harq_processes[harq_pid]->R = nr_get_code_rate_dl(dlsch[0]->harq_processes[harq_pid]->mcs, dlsch[0]->harq_processes[harq_pid]->mcs_table);
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n",
@@ -964,7 +965,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
break;
}
if (dlsch1_harq) {
- switch (nr_get_Qm(dlsch1_harq->mcs, 1)) {
+ switch (nr_get_Qm_dl(dlsch1_harq->mcs,dlsch1_harq->mcs_table)) {
case 2 :
if (rx_type==rx_standard) {
nr_dlsch_qpsk_llr(frame_parms,
@@ -2379,10 +2380,13 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char j=0;
- k = frame_parms->first_carrier_offset + 12*start_rb;
+ AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
+ "nushift %d is illegal\n",frame_parms->nushift);
for (aarx=0; aarxnb_antennas_rx; aarx++) {
+ k = frame_parms->first_carrier_offset + 12*start_rb;
+
if (high_speed_flag == 1)
dl_ch0 = &dl_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))];
else
@@ -2393,65 +2397,43 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)];
rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))];
- //printf("extract single addr %p pilots %d symbol %d, l %d RB_DL %d nushift %d k %d\n", rxF, pilots, symbol, l, frame_parms->N_RB_DL,frame_parms->nushift,k);
-
- //if ((frame_parms->N_RB_DL&1) == 0){ // even number of RBs
-
- for (rb = start_rb; rb < nb_rb_pdsch + start_rb; rb++) {
-
- // For second half of RBs skip DC carrier
- if (k>=frame_parms->ofdm_symbol_size) {
- rxF = &rxdataF[aarx][(symbol*(frame_parms->ofdm_symbol_size))];
- k=k-(frame_parms->ofdm_symbol_size);
+ for (rb = 0; rb < nb_rb_pdsch; rb++) {
+ if (k>frame_parms->ofdm_symbol_size) {
+ k = k-frame_parms->ofdm_symbol_size;
+ rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))];
}
-
- //*pmi_ext = (pmi>>((rb>>2)<<1))&3;
- //memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
-
- /*
- printf("rb %d\n",rb);
- for (i=0;i<12;i++)
- printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]);
- printf("\n");
- */
- if (pilots==0) {
- for (i=0; i<12; i++) {
- rxF_ext[i]=rxF[i];
- dl_ch0_ext[i]=dl_ch0[i];
- /*printf("rb %ld %p: (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
- ((short*)&rxF[i])[0],((short*)&rxF[i])[1]);
- printf("rb %ld %p: dl_ch (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
- ((short*)&dl_ch0[i])[0],((short*)&dl_ch0[i])[1]);
- printf("re count %d\n",rb*12+i);*/
- }
-
- dl_ch0_ext+=12;
- rxF_ext+=12;
- } else {
- j=0;
-
- for (i=0; i<12; i++) {
- if ((i&1)!=frame_parms->nushift){
- rxF_ext[j]=rxF[i];
- //printf("extract rb %d, re %d => rxF (%d,%d) rxF ext (%d,%d) addr %p\n",rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i]),*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]),rxF_ext);
- dl_ch0_ext[j]=dl_ch0[i];
- //printf("rb %ld %p: dl_ch (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
- //((short*)&dl_ch0[i])[0],((short*)&dl_ch0[i])[1]);
- j++;
- }
- }
-
- dl_ch0_ext+=6;
- rxF_ext+=6;
- }
-
- dl_ch0+=12;
- rxF+=12;
- k+=12;
+ if (pilots==0) {
+ memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext));
+ memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));
+ dl_ch0_ext+=12;
+ rxF_ext+=12;
+ } else {
+ j=0;
+
+ for (i = (1-frame_parms->nushift);
+ i<12;
+ i+=2) {
+ rxF_ext[j]=rxF[i];
+ dl_ch0_ext[j]=dl_ch0[i];
+ j++;
+ }
+
+
+ dl_ch0_ext+=6;
+ rxF_ext+=6;
}
+
+ dl_ch0+=12;
+ rxF+=12;
+ k+=12;
+ if (k>=frame_parms->ofdm_symbol_size) {
+ k=k-(frame_parms->ofdm_symbol_size);
+ rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))];
+ }
+ }
}
-
-
+
+
return(nb_rb_pdsch/frame_parms->nb_antennas_rx);
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index 6c14aa8b56..7559115a29 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -1064,7 +1064,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
*/
void nr_pusch_codeword_scrambling(uint8_t *in,
- uint16_t size,
+ uint32_t size,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
index 376c8b90db..39b037a600 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
@@ -265,10 +265,14 @@ typedef struct {
uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS];
/// Index of current HARQ round for this DLSCH
uint8_t round;
+ /// MCS table for this DLSCH
+ uint8_t mcs_table;
/// MCS format for this DLSCH
uint8_t mcs;
/// Qm (modulation order) for this DLSCH
uint8_t Qm;
+ /// target code rate R x 1024
+ uint16_t R;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// MIMO mode for this DLSCH
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
index bc986e2918..cbe0a816ff 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
@@ -202,11 +202,12 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint8_t mod_order;
uint16_t Kr,r,r_offset;
uint8_t BG;
- uint32_t E;
+ uint32_t E,Kb;
uint8_t Ilbrm;
uint32_t Tbslbrm;
uint8_t nb_re_dmrs;
uint16_t length_dmrs;
+ uint16_t R;
float Coderate;
///////////
@@ -222,7 +223,8 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
nb_symb_sch = harq_process->number_of_symbols;
A = harq_process->TBS;
pz = &Z;
- mod_order = nr_get_Qm(harq_process->mcs,1);
+ mod_order = nr_get_Qm_ul(harq_process->mcs,0);
+ R = nr_get_code_rate_ul(harq_process->mcs, 0);
Kr=0;
r_offset=0;
BG = 1;
@@ -250,9 +252,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,harq_process->Nl);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
-
-
- Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
// if (harq_process->Ndi == 1) { // this is a new packet
if (harq_process->round == 0) { // this is a new packet
@@ -287,16 +286,10 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
///////////////////////// b---->| block segmentation |---->c /////////////////////////
///////////
- nr_segmentation(harq_process->b,
- harq_process->c,
- harq_process->B,
- &harq_process->C,
- &harq_process->K,
- pz,
- &harq_process->F);
-
- F = harq_process->F;
- Coderate = (float) A /(float) G;
+ if (R<1024)
+ Coderate = (float) R /(float) 1024;
+ else
+ Coderate = (float) R /(float) 2048;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
BG = 2;
@@ -305,6 +298,16 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
BG = 1;
}
+ Kb=nr_segmentation(harq_process->b,
+ harq_process->c,
+ harq_process->B,
+ &harq_process->C,
+ &harq_process->K,
+ pz,
+ &harq_process->F,
+ BG);
+
+ F = harq_process->F;
Kr = harq_process->K;
#ifdef DEBUG_DLSCH_CODING
uint16_t Kr_bytes;
@@ -349,7 +352,7 @@ opp_enabled=0;
}
printf("\n");*/
- ldpc_encoder_optim_8seg(harq_process->c,harq_process->d,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
+ ldpc_encoder_optim_8seg(harq_process->c,harq_process->d,*pz,Kb,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
@@ -391,6 +394,8 @@ opp_enabled=0;
E = nr_get_E(G, harq_process->C, mod_order, harq_process->Nl, r);
+ Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->Nl,harq_process->C);
+
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
BG,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
index b70f746a8c..12aaebc917 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
@@ -46,7 +46,7 @@
//#define DEBUG_PUSCH_MAPPING
void nr_pusch_codeword_scrambling(uint8_t *in,
- uint16_t size,
+ uint32_t size,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out) {
@@ -90,7 +90,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t thread_id,
int gNB_id) {
- unsigned int available_bits;
+ uint32_t available_bits;
uint8_t mod_order, cwd_index, num_of_codewords;
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
uint32_t ***pusch_dmrs;
@@ -98,7 +98,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int32_t **txdataF;
uint16_t start_sc, start_rb;
int8_t Wf[2], Wt[2], l0, l_prime[2], delta;
- uint16_t n_dmrs;
+ uint16_t n_dmrs,code_rate;
uint8_t dmrs_type, length_dmrs;
uint8_t mapping_type;
int ap, start_symbol, Nid_cell, i;
@@ -130,7 +130,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords;
- harq_process_ul_ue->TBS = nr_compute_tbs( harq_process_ul_ue->mcs, harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols, ulsch_ue->nb_re_dmrs, ulsch_ue->length_dmrs, harq_process_ul_ue->Nl);
+ mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0);
+ code_rate = nr_get_code_rate_ul(harq_process_ul_ue->mcs, 0);
+
+ harq_process_ul_ue->TBS = nr_compute_tbs(mod_order,
+ code_rate,
+ harq_process_ul_ue->nb_rb,
+ harq_process_ul_ue->number_of_symbols,
+ ulsch_ue->nb_re_dmrs*ulsch_ue->length_dmrs,
+ 0,
+ harq_process_ul_ue->Nl);
//-----------------------------------------------------//
// to be removed later when MAC is ready
@@ -158,7 +167,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH scrambling/////////////////////////
///////////
- mod_order = nr_get_Qm(harq_process_ul_ue->mcs, 1);
+ mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0);
available_bits = nr_get_G(harq_process_ul_ue->nb_rb,
harq_process_ul_ue->number_of_symbols,
diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c
index af895ba556..778070b347 100644
--- a/openair1/PHY/TOOLS/nr_phy_scope.c
+++ b/openair1/PHY/TOOLS/nr_phy_scope.c
@@ -589,8 +589,8 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form,
time = calloc(samples_per_frame,sizeof(float));
corr = calloc(samples_per_frame,sizeof(float));
- chest_t = (int16_t**) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_time;
- chest_f = (int16_t**) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates;
+ chest_t = (int16_t**) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time;
+ chest_f = (int16_t**) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates;
pbch_llr = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->llr;
pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0];
@@ -697,8 +697,8 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form,
if (chest_f[(atx<<1)+arx] != NULL) {
for (k=0; kofdm_symbol_size; k++) {
freq[ind] = (float)ind;
- Re = (float)(chest_f[(atx<<1)+arx][(2*k)]);
- Im = (float)(chest_f[(atx<<1)+arx][(2*k)+1]);
+ Re = (float)(chest_f[(atx<<1)+arx][6144+(2*k)]);
+ Im = (float)(chest_f[(atx<<1)+arx][6144+(2*k)+1]);
chest_f_abs[ind] = (short)10*log10(1.0+((double)Re*Re + (double)Im*Im));
ind++;
diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h
index 075650907b..780825b88a 100644
--- a/openair1/PHY/defs_nr_UE.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -810,6 +810,10 @@ typedef struct {
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..287] (hard coded)
int32_t **dl_ch_estimates_ext;
+ /// \brief Hold the channel estimates in time domain (used for tracking).
+ /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+ /// - second index: samples? [0..2*ofdm_symbol_size[
+ int32_t **dl_ch_estimates_time;
int log2_maxh;
uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
uint32_t pbch_a_interleaved;
diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h
index 4635f6fb49..8e42149add 100644
--- a/openair1/SCHED_NR_UE/defs.h
+++ b/openair1/SCHED_NR_UE/defs.h
@@ -370,7 +370,7 @@ void nr_compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsP
void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
-
+int is_pbch_in_slot(fapi_nr_pbch_config_t *pbch_config, int frame, int slot, int periodicity, uint16_t slots_per_frame);
/*@}*/
diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
index 6802b77d8c..ced40c491a 100644
--- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
@@ -123,6 +123,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response)
dlsch0_harq->harq_ack.pucch_resource_indicator = dlsch_config_pdu->pucch_resource_id;
dlsch0_harq->harq_ack.slot_for_feedback_ack = dlsch_config_pdu->pdsch_to_harq_feedback_time_ind;
dlsch0_harq->Nl=1;
+ dlsch0_harq->mcs_table=0;
dlsch0_harq->status = ACTIVE;
LOG_D(MAC,">>>> \tdlsch0->g_pucch=%d\tdlsch0_harq.mcs=%d\n",dlsch0->g_pucch,dlsch0_harq->mcs);
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index ccf534353d..60378d81fc 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -3307,7 +3307,7 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t
harq_processes_dest->B = current_harq_processes->B ;
harq_processes_dest->C = current_harq_processes->C ;
- harq_processes_dest->DCINdi = current_harq_processes->DCINdi ;
+ harq_processes_dest->DCINdi = current_harq_processes->DCINdi ;
harq_processes_dest->F = current_harq_processes->F ;
harq_processes_dest->G = current_harq_processes->G ;
harq_processes_dest->K = current_harq_processes->K ;
@@ -3320,6 +3320,7 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t
harq_processes_dest->dl_power_off = current_harq_processes->dl_power_off ;
harq_processes_dest->first_tx = current_harq_processes->first_tx ;
harq_processes_dest->mcs = current_harq_processes->mcs ;
+ harq_processes_dest->mcs_table = current_harq_processes->mcs_table ;
harq_processes_dest->mimo_mode = current_harq_processes->mimo_mode ;
harq_processes_dest->nb_rb = current_harq_processes->nb_rb ;
harq_processes_dest->pmi_alloc = current_harq_processes->pmi_alloc ;
@@ -4139,6 +4140,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t harq_pid = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->current_harq_pid;
NR_DL_UE_HARQ_t *dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
uint16_t nb_symb_sch = dlsch0_harq->nb_symbols;
+ uint16_t start_symb_sch = dlsch0_harq->start_symbol;
uint8_t nb_symb_pdcch = pdcch_vars->coreset[0].duration;
uint8_t ssb_periodicity = 10;// ue->ssb_periodicity; // initialized to 5ms in nr_init_ue for scenarios where UE is not configured (otherwise acquired by cell configuration from gNB or LTE)
uint8_t dci_cnt = 0;
@@ -4165,6 +4167,43 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
}
uint16_t coreset_nb_rb = 6 * coreset_count;
uint16_t coreset_start_rb = 6 * coreset_start;
+
+ slot_pbch = is_pbch_in_slot(pbch_config, frame_rx, nr_tti_rx, ssb_periodicity, ue->frame_parms.slots_per_frame);
+
+ // looking for pbch only in slot where it is supposed to be
+ if ((ue->decode_MIB == 1) && slot_pbch)
+ {
+ LOG_I(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
+
+ for (int i=1; i<4; i++) {
+
+ nr_slot_fep(ue,
+ (ue->symbol_offset+i)%(ue->frame_parms.symbols_per_slot),
+ nr_tti_rx,
+ 0,
+ 0);
+
+#if UE_TIMING_TRACE
+ start_meas(&ue->dlsch_channel_estimation_stats);
+#endif
+ nr_pbch_channel_estimation(ue,0,nr_tti_rx,(ue->symbol_offset+i)%(ue->frame_parms.symbols_per_slot),i-1,(pbch_config->ssb_index)&7,pbch_config->half_frame_bit);
+#if UE_TIMING_TRACE
+ stop_meas(&ue->dlsch_channel_estimation_stats);
+#endif
+
+ }
+ nr_ue_pbch_procedures(eNB_id,ue,proc,0);
+
+ if (ue->no_timing_correction==0) {
+ LOG_I(PHY,"start adjust sync slot = %d no timing %d\n", nr_tti_rx, ue->no_timing_correction);
+ nr_adjust_synch_ue(&ue->frame_parms,
+ ue,
+ eNB_id,
+ nr_tti_rx,
+ 0,
+ 16384);
+ }
+ }
#ifdef NR_PDCCH_SCHED
nr_gold_pdcch(ue, 0, 2);
@@ -4204,16 +4243,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (dci_cnt > 0) {
LOG_I(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n",ue->Mod_id,frame_rx,nr_tti_rx,dci_cnt);
-
- if (ue->no_timing_correction==0) {
- LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_tti_rx, ue->no_timing_correction);
- nr_adjust_synch_ue(&ue->frame_parms,
- ue,
- eNB_id,
- nr_tti_rx,
- 0,
- 16384);
- }
+
} else {
LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: No DCIs found\n",ue->Mod_id,frame_rx,nr_tti_rx);
}
@@ -4223,11 +4253,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (dci_cnt > 0){
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
//to update from pdsch config
- nr_gold_pdsch(ue,nb_symb_pdcch,0, 1);
+ start_symb_sch = dlsch0_harq->start_symbol;
+ nr_gold_pdsch(ue,start_symb_sch,0, 1);
nb_symb_sch = dlsch0_harq->nb_symbols;
- for (uint16_t m=nb_symb_pdcch;m<=(nb_symb_sch+nb_symb_pdcch-1) ; m++){
+ for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){
nr_slot_fep(ue,
m, //to be updated from higher layer
nr_tti_rx,
@@ -4308,34 +4339,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT);
}
-
- slot_pbch = is_pbch_in_slot(pbch_config, frame_rx, nr_tti_rx, ssb_periodicity, ue->frame_parms.slots_per_frame);
-
- // looking for pbch only in slot where it is supposed to be
- if ((ue->decode_MIB == 1) && slot_pbch)
- {
- LOG_I(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
-
- for (int i=1; i<4; i++) {
-
- nr_slot_fep(ue,
- (ue->symbol_offset+i)%(ue->frame_parms.symbols_per_slot),
- nr_tti_rx,
- 0,
- 0);
-
-#if UE_TIMING_TRACE
- start_meas(&ue->dlsch_channel_estimation_stats);
-#endif
- nr_pbch_channel_estimation(ue,0,nr_tti_rx,(ue->symbol_offset+i)%(ue->frame_parms.symbols_per_slot),i-1,(pbch_config->ssb_index)&7,pbch_config->half_frame_bit);
-#if UE_TIMING_TRACE
- stop_meas(&ue->dlsch_channel_estimation_stats);
-#endif
-
- }
- nr_ue_pbch_procedures(eNB_id,ue,proc,0);
- }
-
+
// do procedures for C-RNTI
if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1) {
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index b07fdad73a..aab762b9e2 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -110,6 +110,7 @@ int main(int argc, char **argv)
uint16_t nb_symb_sch = 12;
uint16_t nb_rb = 50;
uint8_t Imcs = 9;
+ uint8_t mcs_table = 0;
cpuf = get_cpu_freq_GHz();
@@ -430,6 +431,7 @@ int main(int argc, char **argv)
uint8_t nb_re_dmrs = 6;
uint16_t length_dmrs = 1;
unsigned char mod_order;
+ uint16_t rate;
uint8_t Nl = 1;
uint8_t rvidx = 0;
dlsch->rnti = 1;
@@ -437,9 +439,10 @@ int main(int argc, char **argv)
dlsch->harq_processes[0]->rvidx = rvidx;*/
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
// dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->mcs,dlsch->harq_processes[0]->Nl);
- mod_order = nr_get_Qm(Imcs, 1);
+ mod_order = nr_get_Qm_dl(Imcs, mcs_table);
+ rate = nr_get_code_rate_dl(Imcs, mcs_table);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
- TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
+ TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
//dlsch->harq_ids[subframe]= 0;
rel15->n_prb = nb_rb;
@@ -448,6 +451,7 @@ int main(int argc, char **argv)
rel15->nb_layers = Nl;
rel15->nb_re_dmrs = nb_re_dmrs;
rel15->transport_block_size = TBS;
+ rel15->coding_rate = rate;
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
@@ -462,10 +466,12 @@ int main(int argc, char **argv)
NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0][0];
NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid];
harq_process->mcs = Imcs;
+ harq_process->mcs_table = mcs_table;
harq_process->Nl = Nl;
harq_process->nb_rb = nb_rb;
harq_process->Qm = mod_order;
harq_process->rvidx = rvidx;
+ harq_process->R = rate;
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
unsigned char *test_input;
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 8ebb800f72..5f747e25e1 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -165,6 +165,12 @@ int main(int argc, char **argv)
//double pbch_sinr;
//int pbch_tx_ant;
int N_RB_DL=106,mu=1;
+ nfapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config;
+ dlsch_config.start_prb = 0;
+ dlsch_config.n_prb = 50;
+ dlsch_config.start_symbol = 2;
+ dlsch_config.nb_symbols = 9;
+ dlsch_config.mcs_idx = 9;
uint16_t ssb_periodicity = 10;
@@ -186,6 +192,7 @@ int main(int argc, char **argv)
int run_initial_sync=0;
int do_pdcch_flag=1;
+ uint16_t cset_offset = 0;
int loglvl=OAILOG_WARNING;
float target_error_rate = 0.01;
@@ -198,7 +205,7 @@ int main(int argc, char **argv)
randominit(0);
- while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
+ while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:o:a:b:c:j:e:")) != -1) {
switch (c) {
/*case 'f':
write_output_file=1;
@@ -363,6 +370,30 @@ int main(int argc, char **argv)
loglvl = atoi(optarg);
break;
+ case 'o':
+ cset_offset = atoi(optarg);
+ break;
+
+ case 'a':
+ dlsch_config.start_prb = atoi(optarg);
+ break;
+
+ case 'b':
+ dlsch_config.n_prb = atoi(optarg);
+ break;
+
+ case 'c':
+ dlsch_config.start_symbol = atoi(optarg);
+ break;
+
+ case 'j':
+ dlsch_config.nb_symbols = atoi(optarg);
+ break;
+
+ case 'e':
+ dlsch_config.mcs_idx = atoi(optarg);
+ break;
+
default:
case 'h':
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
@@ -388,6 +419,12 @@ int main(int argc, char **argv)
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
//printf("-f Output filename (.txt format) for Pe/SNR results\n");
printf("-F Input filename (.txt format) for RX conformance testing\n");
+ printf("-o CORESET offset\n");
+ printf("-a Start PRB for PDSCH\n");
+ printf("-b Number of PRB for PDSCH\n");
+ printf("-c Start symbol for PDSCH (fixed for now)\n");
+ printf("-j Number of symbols for PDSCH (fixed for now)\n");
+ printf("-e MSC index\n");
exit (-1);
break;
}
@@ -480,7 +517,7 @@ int main(int argc, char **argv)
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
- bzero(r_re[i],frame_length_complex_samples*sizeof(int));
+ bzero(txdata[i],frame_length_complex_samples*sizeof(int));
}
@@ -544,12 +581,14 @@ int main(int argc, char **argv)
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
+ uint16_t rb_offset_count = cset_offset/6;
+ set_cset_offset(rb_offset_count);
// generate signal
if (input_fd==NULL) {
gNB->pbch_configured = 1;
for (int i=0;i<4;i++) gNB->pbch_pdu[i]=i+1;
- nr_schedule_uss_dlsch_phytest(0,frame,slot);
+ nr_schedule_uss_dlsch_phytest(0,frame,slot,&dlsch_config);
Sched_INFO.module_id = 0;
Sched_INFO.CC_id = 0;
Sched_INFO.frame = frame;
@@ -642,13 +681,15 @@ int main(int argc, char **argv)
uint64_t mask = 0x0;
uint16_t num_rbs=24;
- uint16_t rb_offset=0;
+ uint16_t rb_offset=gNB->pdcch_vars.dci_alloc[0].pdcch_params.rb_offset;
uint16_t cell_id=0;
uint16_t num_symbols=2;
for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs
mask = mask >> 1;
mask = mask | 0x100000000000;
}
+ uint16_t UE_rb_offset_count = rb_offset/6;
+ mask = mask >> UE_rb_offset_count;
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.frequency_domain_resource = mask;
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.rb_offset = rb_offset; // additional parameter other than coreset
@@ -659,8 +700,6 @@ int main(int argc, char **argv)
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.cce_reg_interleaved_shift_index = cell_id;
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.pdcch_dmrs_scrambling_id = cell_id;
- uint8_t gnb_start_symbol = Sched_INFO.DL_req->dl_config_request_body.dl_config_pdu_list[1].dlsch_pdu.dlsch_pdu_rel15.start_symbol;
- dl_config->dl_config_list[0].dlsch_config_pdu.dlsch_config_rel15.start_symbol = gnb_start_symbol;
uint32_t number_of_search_space_per_slot=1;
uint32_t first_symbol_index=0;
diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c
index 4deeaffd7b..07105e6e1f 100644
--- a/openair1/SIMULATION/NR_PHY/ulschsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulschsim.c
@@ -375,7 +375,7 @@ int main(int argc, char **argv)
uint8_t nb_re_dmrs = 6;
uint8_t length_dmrs = 1;
uint8_t N_PRB_oh;
- uint16_t N_RE_prime;
+ uint16_t N_RE_prime,code_rate;
unsigned char mod_order;
uint8_t Nl = 1;
uint8_t rvidx = 0;
@@ -386,9 +386,10 @@ int main(int argc, char **argv)
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0];
- mod_order = nr_get_Qm(Imcs, 1);
+ mod_order = nr_get_Qm_ul(Imcs, 0);
+ code_rate = nr_get_code_rate_ul(Imcs, 0);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
- TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
+ TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
@@ -401,6 +402,7 @@ int main(int argc, char **argv)
rel15_ul->n_layers = Nl;
rel15_ul->nb_re_dmrs = nb_re_dmrs;
rel15_ul->length_dmrs = length_dmrs;
+ rel15_ul->R = code_rate;
///////////////////////////////////////////////////
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index e175e9d371..94204ea5e2 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -446,10 +446,12 @@ int main(int argc, char **argv)
uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4;
uint8_t length_dmrs = 1;
unsigned char mod_order;
+ uint16_t code_rate;
- mod_order = nr_get_Qm(Imcs, 1);
+ mod_order = nr_get_Qm_ul(Imcs, 0);
+ code_rate = nr_get_code_rate_ul(Imcs, 0);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
- TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, precod_nbr_layers);
+ TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers);
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
@@ -498,6 +500,7 @@ int main(int argc, char **argv)
rel15_ul->ulsch_pdu_rel15.rv = 0;
rel15_ul->ulsch_pdu_rel15.ndi = 0;
rel15_ul->ulsch_pdu_rel15.n_layers = precod_nbr_layers;
+ rel15_ul->ulsch_pdu_rel15.R = code_rate;
///////////////////////////////////////////////////
*/
@@ -512,8 +515,8 @@ int main(int argc, char **argv)
pusch_pdu->rnti = n_rnti;
pusch_pdu->mcs_index = Imcs;
pusch_pdu->mcs_table = 0;
- pusch_pdu->target_code_rate = nr_get_code_rate(pusch_pdu->mcs_index,pusch_pdu->mcs_table+1);
- pusch_pdu->qam_mod_order = nr_get_Qm(pusch_pdu->mcs_index,pusch_pdu->mcs_table+1) ;
+ pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table+1);
+ pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table+1) ;
pusch_pdu->transform_precoding = 0;
pusch_pdu->data_scrambling_id = 0;
pusch_pdu->nrOfLayers = 1;
@@ -533,6 +536,7 @@ int main(int argc, char **argv)
pusch_pdu->pusch_data.harq_process_id = 0;
pusch_pdu->pusch_data.new_data_indicator = 0;
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
+ pusch_pdu->target_code_rate,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
nb_re_dmrs,
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 1a243b0aa4..6b9e79d510 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -226,7 +226,7 @@ int8_t nr_ue_decode_mib(
uint32_t ssb_length,
uint32_t ssb_index,
void *pduP,
- uint16_t cell_id ){
+ uint16_t cell_id ){
LOG_I(MAC,"[L2][MAC] decode mib\n");
@@ -283,7 +283,7 @@ int8_t nr_ue_decode_mib(
scs_pdcch = scs_30kHz;
}
- channel_bandwidth_t min_channel_bw = bw_40MHz; // deafult for testing
+ channel_bandwidth_t min_channel_bw = bw_10MHz; // deafult for testing
uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13
frequency_range_t frequency_range = FR1;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index 0420b947c2..e43f2633b1 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -307,6 +307,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
rnti_t rnti;
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
+ //nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = NULL;
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
@@ -339,7 +340,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
frame_txP,
slot_txP,
*cfg)){
- nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP);
+ nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, NULL);
}
rnti = UE_RNTI(module_idP, i);
@@ -379,7 +380,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
}
if (slot_txP==1){
- nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP);
+ nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
}
/*
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
index 306431ba56..3b24e00ed5 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
@@ -145,7 +145,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
params_rel15->nb_slots,
params_rel15->sfn_mod2,
params_rel15->first_slot);
- nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
+ nr_get_tbs_dl(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d\n",
dlsch_pdu_rel15->start_prb,
dlsch_pdu_rel15->n_prb,
@@ -178,7 +178,8 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
nfapi_nr_config_request_t *cfg,
nfapi_nr_coreset_t* coreset,
nfapi_nr_search_space_t* search_space,
- int16_t pdu_index){
+ int16_t pdu_index,
+ nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config){
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
@@ -212,6 +213,14 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
dlsch_pdu_rel15->ndi = 1;
dlsch_pdu_rel15->redundancy_version = 0;
+ if (dlsch_config != NULL) {
+ dlsch_pdu_rel15->start_prb = dlsch_config->start_prb;
+ dlsch_pdu_rel15->n_prb = dlsch_config->n_prb;
+ dlsch_pdu_rel15->start_symbol = dlsch_config->start_symbol;
+ dlsch_pdu_rel15->nb_symbols = dlsch_config->nb_symbols;
+ dlsch_pdu_rel15->mcs_idx = dlsch_config->mcs_idx;
+ }
+
nr_configure_dci_from_pdcch_config(params_rel15,
coreset,
search_space,
@@ -221,7 +230,7 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
pdu_rel15->time_domain_assignment = 3; // row index used here instead of SLIV;
pdu_rel15->vrb_to_prb_mapping = 1;
- pdu_rel15->mcs = 9;
+ pdu_rel15->mcs = dlsch_pdu_rel15->mcs_idx;
pdu_rel15->tb_scaling = 1;
pdu_rel15->ra_preamble_index = 25;
@@ -261,7 +270,7 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
params_rel15->rb_offset,
params_rel15->first_symbol,
params_rel15->search_space_type);
- nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
+ nr_get_tbs_dl(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
// Hardcode it for now
TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
@@ -293,7 +302,8 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
frame_t frameP,
- sub_frame_t slotP)
+ sub_frame_t slotP,
+ nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config)
{
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest \n");
uint8_t CC_id;
@@ -350,7 +360,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
// Hardcode it for now
TBS = 6784/8; //TBS in bytes
- //nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
+ //nr_get_tbs_dl(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
//TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
@@ -458,7 +468,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0][offset + sdu_length_total + j] = 0;
}
- TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
+ TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id], dlsch_config);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, , TBS size: %d \n \n", frameP, slotP, TBS_bytes);
@@ -482,7 +492,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
//occur every time that the current function is called (dlsch phytest mode)
else{
- TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
+ TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id], dlsch_config);
// HOT FIX for all zero pdu problem
// ------------------------------------------------------------------------------------------------
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 4d96693831..d746756d65 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -399,8 +399,10 @@ void nr_configure_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel1
// first symbol
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
- for (int i=0; imonitoring_symbols_in_slot>>(31-i))&1) {
+ int sps = get_symbolsperslot(&cfg);
+
+ for (int i=0; imonitoring_symbols_in_slot>>(sps-1-i))&1) {
pdcch_params->first_symbol=i;
break;
}
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
index 3352df7bb9..d56d5d28c1 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
@@ -34,6 +34,8 @@
#include "nr_mac_gNB.h"
#include "PHY/defs_gNB.h"
+void set_cset_offset(uint16_t);
+
void mac_top_init_gNB(void);
void config_common(int Mod_idP,
@@ -79,11 +81,13 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
nfapi_nr_config_request_t *cfg,
nfapi_nr_coreset_t* coreset,
nfapi_nr_search_space_t* search_space,
- int16_t pdu_index);
+ int16_t pdu_index,
+ nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config);
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
frame_t frameP,
- sub_frame_t slotP);
+ sub_frame_t slotP,
+ nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config);
void nr_schedule_uss_ulsch_phytest(nfapi_nr_ul_tti_request_t *UL_tti_req,
frame_t frameP,
diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c
index 0924da0669..88f6c38758 100644
--- a/openair2/LAYER2/NR_MAC_gNB/main.c
+++ b/openair2/LAYER2/NR_MAC_gNB/main.c
@@ -44,6 +44,9 @@
extern RAN_CONTEXT_t RC;
+void set_cset_offset(uint16_t offset_bits) {
+ RC.nrmac[0]->coreset[0][1].frequency_domain_resources >>= offset_bits;
+}
void nr_init_coreset(nfapi_nr_coreset_t *coreset) {
@@ -66,7 +69,7 @@ void nr_init_search_space(nfapi_nr_search_space_t *search_space)
search_space->duration = 5;
search_space->slot_monitoring_periodicity = NFAPI_NR_SS_PERIODICITY_SL10;
search_space->slot_monitoring_offset = 1;
- search_space->monitoring_symbols_in_slot = 0xC0000000; // first 2 ofdm symbols
+ search_space->monitoring_symbols_in_slot = 0x3000; // 14 bits field
search_space->css_formats_0_0_and_1_0 = 1;
search_space->uss_dci_formats = 0; // enum to be defined-- formats 0.0 and 1.0
for (int i=0; i