Commit b6ceb2a1 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Merge branch 'nr-tbs-fixes' into pdsch-ch-est

parents 430b27be 5bfbfd9a
...@@ -1089,10 +1089,8 @@ ...@@ -1089,10 +1089,8 @@
(Test8: 217 PRB 100 PDSCH-PRBs), (Test8: 217 PRB 100 PDSCH-PRBs),
(Test9: 217 PRB 80 PDSCH-Offset), (Test9: 217 PRB 80 PDSCH-Offset),
(Test10: 217 PRB 100 PDSCH-PRBs 80 PDSCH-Offset),--> (Test10: 217 PRB 100 PDSCH-PRBs 80 PDSCH-Offset),-->
(Test11: 106 PRB 4 PDSCH-Start-Symbols), (Test6: 106 PRB 0 MCS),
(Test12: 217 PRB 5 PDSCH-Symbols), (Test7: 273 PRB 28 MCS)</desc>
(Test13: 106 PRB 0 MCS),
(Test14: 273 PRB 28 MCS)</desc>
<pre_compile_prog></pre_compile_prog> <pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args> <compile_prog_args> --phy_simulators -c </compile_prog_args>
...@@ -1109,11 +1107,9 @@ ...@@ -1109,11 +1107,9 @@
-n100 -R217 -b100 -n100 -R217 -b100
-n100 -R217 -a80 -n100 -R217 -a80
-n100 -R217 -a80 -b100--> -n100 -R217 -a80 -b100-->
-n100 -R106 -c4
-n100 -R217 -j5
-n100 -R106 -e0 -n100 -R106 -e0
-n100 -R273 -e28</main_exec_args> -n100 -R273 -e28</main_exec_args>
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 <!--nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10-->nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14</tags> <tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 <!--nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10-->nr_dlsim.test6 nr_dlsim.test7</tags>
<search_expr_true>"PDCCH test OK" "PDSCH test OK"</search_expr_true> <search_expr_true>"PDCCH test OK" "PDSCH test OK"</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns> <nruns>3</nruns>
......
...@@ -593,7 +593,7 @@ typedef struct { ...@@ -593,7 +593,7 @@ typedef struct {
uint16_t coding_rate; uint16_t coding_rate;
uint8_t modulation; uint8_t modulation;
uint8_t modulation_order; uint8_t modulation_order;
uint16_t transport_block_size; uint32_t transport_block_size;
uint8_t nb_re_dmrs; uint8_t nb_re_dmrs;
uint8_t time_alloc_list_flag; uint8_t time_alloc_list_flag;
uint8_t time_alloc_list; uint8_t time_alloc_list;
......
...@@ -54,8 +54,6 @@ uint32_t nr_compute_tbs(uint16_t Qm, ...@@ -54,8 +54,6 @@ uint32_t nr_compute_tbs(uint16_t Qm,
// Intermediate number of information bits // Intermediate number of information bits
Ninfo = (nb_re * R * Qm * Nl)>>scale; Ninfo = (nb_re * R * Qm * Nl)>>scale;
//printf("Ninfo %lf nbp_re %d nb_re %d mcs %d Qm %d, R %d\n", Ninfo, nbp_re, nb_re,mcs, Qm, R);
if (Ninfo <=3824) { if (Ninfo <=3824) {
n = max(3, floor(log2(Ninfo)) - 6); n = max(3, floor(log2(Ninfo)) - 6);
Np_info = max(24, (Ninfo>>n)<<n); Np_info = max(24, (Ninfo>>n)<<n);
...@@ -86,6 +84,7 @@ uint32_t nr_compute_tbs(uint16_t Qm, ...@@ -86,6 +84,7 @@ uint32_t nr_compute_tbs(uint16_t Qm,
} }
} }
//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;
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
void nr_modulation(uint32_t *in, void nr_modulation(uint32_t *in,
uint16_t length, uint32_t length,
uint16_t mod_order, uint16_t mod_order,
int16_t *out) int16_t *out)
{ {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
*/ */
void nr_modulation(uint32_t *in, void nr_modulation(uint32_t *in,
uint16_t length, uint32_t length,
uint16_t mod_order, uint16_t mod_order,
int16_t *out); int16_t *out);
......
...@@ -130,7 +130,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, ...@@ -130,7 +130,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
} }
void nr_pdcch_scrambling(uint32_t *in, void nr_pdcch_scrambling(uint32_t *in,
uint16_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
uint32_t *out) { uint32_t *out) {
...@@ -187,9 +187,9 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -187,9 +187,9 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
dci_idx = 0; dci_idx = 0;
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); 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 // 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) (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); 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_length += pdcch_params.rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
......
...@@ -38,7 +38,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars, ...@@ -38,7 +38,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
nfapi_nr_config_request_t config); nfapi_nr_config_request_t config);
void nr_pdcch_scrambling(uint32_t *in, void nr_pdcch_scrambling(uint32_t *in,
uint16_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
uint32_t *out); uint32_t *out);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
//#define DEBUG_DLSCH_MAPPING //#define DEBUG_DLSCH_MAPPING
void nr_pdsch_codeword_scrambling(uint8_t *in, void nr_pdsch_codeword_scrambling(uint8_t *in,
uint16_t size, uint32_t size,
uint8_t q, uint8_t q,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
...@@ -88,7 +88,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, ...@@ -88,7 +88,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
int8_t Wf[2], Wt[2], l0, l_prime[2], delta; int8_t Wf[2], Wt[2], l0, l_prime[2], delta;
uint16_t nb_symbols = rel15->nb_mod_symbols; uint16_t nb_symbols = rel15->nb_mod_symbols;
uint8_t Qm = rel15->modulation_order; 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 /// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
...@@ -126,6 +126,7 @@ printf("\n"); ...@@ -126,6 +126,7 @@ printf("\n");
Nid, Nid,
n_RNTI, n_RNTI,
scrambled_output[q]); scrambled_output[q]);
stop_meas(dlsch_scrambling_stats); stop_meas(dlsch_scrambling_stats);
#ifdef DEBUG_DLSCH #ifdef DEBUG_DLSCH
printf("PDSCH scrambling:\n"); printf("PDSCH scrambling:\n");
......
...@@ -54,7 +54,7 @@ void nr_get_rbg_list(uint32_t bitmap, uint8_t n_rbg, uint8_t* rbg_list); ...@@ -54,7 +54,7 @@ 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_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, void nr_pdsch_codeword_scrambling(uint8_t *in,
uint16_t size, uint32_t size,
uint8_t q, uint8_t q,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
......
...@@ -184,7 +184,8 @@ void nr_get_tbs_dl(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu, ...@@ -184,7 +184,8 @@ void nr_get_tbs_dl(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; 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); 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 R, TBS=0; uint16_t R;
uint32_t TBS=0;
uint8_t table_idx, Qm; uint8_t table_idx, Qm;
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value; /*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
......
...@@ -310,7 +310,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -310,7 +310,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint16_t nb_rb = nfapi_ulsch_pdu_rel15->number_rbs; uint16_t nb_rb = nfapi_ulsch_pdu_rel15->number_rbs;
uint16_t number_symbols = nfapi_ulsch_pdu_rel15->number_symbols; uint16_t number_symbols = nfapi_ulsch_pdu_rel15->number_symbols;
uint8_t Qm = nfapi_ulsch_pdu_rel15->Qm; uint8_t Qm = nfapi_ulsch_pdu_rel15->Qm;
uint8_t R = nfapi_ulsch_pdu_rel15->R; uint16_t R = nfapi_ulsch_pdu_rel15->R;
uint8_t mcs = nfapi_ulsch_pdu_rel15->mcs; uint8_t mcs = nfapi_ulsch_pdu_rel15->mcs;
uint8_t n_layers = nfapi_ulsch_pdu_rel15->n_layers; uint8_t n_layers = nfapi_ulsch_pdu_rel15->n_layers;
uint8_t nb_re_dmrs = nfapi_ulsch_pdu_rel15->nb_re_dmrs; uint8_t nb_re_dmrs = nfapi_ulsch_pdu_rel15->nb_re_dmrs;
...@@ -353,26 +353,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -353,26 +353,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
harq_process->B = A+24; harq_process->B = A+24;
// [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F) if (R<1024)
nr_segmentation(NULL, Coderate = (float) R /(float) 1024;
NULL, else
harq_process->B, Coderate = (float) R /(float) 2048;
&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;
Coderate = (float) A /(float) G;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
p_decParams->BG = 2; p_decParams->BG = 2;
...@@ -404,6 +388,25 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -404,6 +388,25 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
} }
} }
// [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->numMaxIter = ulsch->max_ldpc_iterations;
p_decParams->outMode= 0; p_decParams->outMode= 0;
......
...@@ -1064,7 +1064,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -1064,7 +1064,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
*/ */
void nr_pusch_codeword_scrambling(uint8_t *in, void nr_pusch_codeword_scrambling(uint8_t *in,
uint16_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
uint32_t* out); uint32_t* out);
......
...@@ -207,6 +207,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -207,6 +207,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint32_t Tbslbrm; uint32_t Tbslbrm;
uint8_t nb_re_dmrs; uint8_t nb_re_dmrs;
uint16_t length_dmrs; uint16_t length_dmrs;
uint16_t R;
float Coderate; float Coderate;
/////////// ///////////
...@@ -223,6 +224,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -223,6 +224,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
A = harq_process->TBS; A = harq_process->TBS;
pz = &Z; pz = &Z;
mod_order = nr_get_Qm_ul(harq_process->mcs,0); mod_order = nr_get_Qm_ul(harq_process->mcs,0);
R = nr_get_code_rate_ul(harq_process->mcs, 0);
Kr=0; Kr=0;
r_offset=0; r_offset=0;
BG = 1; BG = 1;
...@@ -284,7 +286,10 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -284,7 +286,10 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
///////////////////////// b---->| block segmentation |---->c ///////////////////////// ///////////////////////// b---->| block segmentation |---->c /////////////////////////
/////////// ///////////
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){ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
BG = 2; BG = 2;
...@@ -303,7 +308,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -303,7 +308,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
BG); BG);
F = harq_process->F; F = harq_process->F;
Kr = harq_process->K; Kr = harq_process->K;
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
uint16_t Kr_bytes; uint16_t Kr_bytes;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
//#define DEBUG_PUSCH_MAPPING //#define DEBUG_PUSCH_MAPPING
void nr_pusch_codeword_scrambling(uint8_t *in, void nr_pusch_codeword_scrambling(uint8_t *in,
uint16_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
uint32_t* out) { uint32_t* out) {
...@@ -90,7 +90,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -90,7 +90,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t thread_id, uint8_t thread_id,
int gNB_id) { int gNB_id) {
unsigned int available_bits; uint32_t available_bits;
uint8_t mod_order, cwd_index, num_of_codewords; 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 scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
uint32_t ***pusch_dmrs; uint32_t ***pusch_dmrs;
......
...@@ -424,8 +424,8 @@ int main(int argc, char **argv) ...@@ -424,8 +424,8 @@ int main(int argc, char **argv)
printf("-o CORESET offset\n"); printf("-o CORESET offset\n");
printf("-a Start PRB for PDSCH\n"); printf("-a Start PRB for PDSCH\n");
printf("-b Number of PRB for PDSCH\n"); printf("-b Number of PRB for PDSCH\n");
printf("-c Start symbol for PDSCH\n"); printf("-c Start symbol for PDSCH (fixed for now)\n");
printf("-j Number of symbols for PDSCH\n"); printf("-j Number of symbols for PDSCH (fixed for now)\n");
printf("-e MSC index\n"); printf("-e MSC index\n");
exit (-1); exit (-1);
break; break;
...@@ -519,7 +519,7 @@ int main(int argc, char **argv) ...@@ -519,7 +519,7 @@ int main(int argc, char **argv)
printf("Allocating %d samples for txdata\n",frame_length_complex_samples); printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
txdata[i] = malloc(frame_length_complex_samples*sizeof(int)); 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));
} }
......
...@@ -402,6 +402,7 @@ int main(int argc, char **argv) ...@@ -402,6 +402,7 @@ int main(int argc, char **argv)
rel15_ul->n_layers = Nl; rel15_ul->n_layers = Nl;
rel15_ul->nb_re_dmrs = nb_re_dmrs; rel15_ul->nb_re_dmrs = nb_re_dmrs;
rel15_ul->length_dmrs = length_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 double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment