Commit f4631f21 authored by Parminder Singh's avatar Parminder Singh

Bug-fix in Up-link with respect to PUSCH RE calculation when PTRS is enabled.

Problem STATEMENT:
- When enabling PTRS flag in ulsim, there are multiple scrambling and decoding errors
  are observed even with high SNR values
  SNR 60dB   errors_scrambling 5546/13800
  Channel BLER 1.000000e+00, Channel BER 4.018841e-01

ANALYSIS:
- While extracting PTRS RE's, the PUSCH RE count was not updated accordingly for PTRS symbols.
- This results in 0 value LLR's on same positions which cause offset issue in later processing.

IMPLEMENTATION:
* nr_ulsch_demodulation.c
- In case of PTRS symbol, respective total number of PTRS RE's are subtracted from available
  PUSCH RE's in each PUSCH Symbol processing.

TESTING
* ulsim.c
- PTRS are enabled for testing and are not enabled by default by this commit.
- Available bit count is adjusted if PTRS is enabled.

VERIFICATION
- Total Scrambling errors after gNb processing shall be only 250 bits (in K=2)
  which were replaced with PTRS at UE side while transmission.
  SNR 60.000000 errors_scrambling 250/13800
  Channel BLER 0.000000e+00, Channel BER 1.811594e-02
- After adjusting available bits in ulsim.c for error calculation
  SNR 60.000000: n_errors errors_scrambling 0/13550
  Channel BLER 0.000000e+00, Channel BER 0.000000e+00

EXTRA
- Removed white-spaces from all above mentioned files
- Added Global/vim tags to .gitignore file
parent f7dc17ec
...@@ -12,3 +12,9 @@ targets/bin/ ...@@ -12,3 +12,9 @@ targets/bin/
# vscode # vscode
.vscode .vscode
# Tags for vim/global
GPATH
GRTAGS
GTAGS
tags
...@@ -1018,7 +1018,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1018,7 +1018,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
unsigned char harq_pid) unsigned char harq_pid)
{ {
uint8_t aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol uint8_t aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
uint32_t nb_re_pusch, bwp_start_subcarrier; uint32_t nb_re_pusch, bwp_start_subcarrier;
uint8_t L_ptrs = 0; // PTRS parameter uint8_t L_ptrs = 0; // PTRS parameter
int avgs; int avgs;
...@@ -1027,7 +1027,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1027,7 +1027,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu;
dmrs_symbol_flag = 0; dmrs_symbol_flag = 0;
gNB->pusch_vars[ulsch_id]->ptrs_sc_per_ofdm_symbol = 0; ptrs_symbol_flag = 0;
if(symbol == rel15_ul->start_symbol_index){ if(symbol == rel15_ul->start_symbol_index){
gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset = 0; gNB->pusch_vars[ulsch_id]->rxdataF_ext_offset = 0;
...@@ -1069,7 +1069,10 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1069,7 +1069,10 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { // if there is ptrs pdu
if(is_ptrs_symbol(symbol, gNB->pusch_vars[ulsch_id]->ptrs_symbols)) if(is_ptrs_symbol(symbol, gNB->pusch_vars[ulsch_id]->ptrs_symbols))
{
ptrs_symbol_flag = 1;
gNB->pusch_vars[ulsch_id]->ptrs_symbol_index = symbol; gNB->pusch_vars[ulsch_id]->ptrs_symbol_index = symbol;
}
} }
...@@ -1100,6 +1103,12 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1100,6 +1103,12 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
frame_parms); frame_parms);
stop_meas(&gNB->ulsch_rbs_extraction_stats); stop_meas(&gNB->ulsch_rbs_extraction_stats);
if(ptrs_symbol_flag == 1)
{
/* Subtract total PTRS RE's in the smybol from PUSCH RE's */
nb_re_pusch -= gNB->pusch_vars[ulsch_id]->ptrs_sc_per_ofdm_symbol;
}
nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
frame_parms, frame_parms,
gNB->ulsch[ulsch_id], gNB->ulsch[ulsch_id],
......
...@@ -1047,6 +1047,8 @@ void init_pucch2_luts() { ...@@ -1047,6 +1047,8 @@ void init_pucch2_luts() {
bit = (i&0x80) > 0 ? 0 : 1; bit = (i&0x80) > 0 ? 0 : 1;
*lut_num_i = _mm_insert_epi16(*lut_num_i,bit,7); *lut_num_i = _mm_insert_epi16(*lut_num_i,bit,7);
*lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,7); *lut_den_i = _mm_insert_epi16(*lut_den_i,1-bit,7);
#ifdef DEBUG_NR_PUCCH_RX
printf("i %d, lut_num (%d,%d,%d,%d,%d,%d,%d,%d)\n",i, printf("i %d, lut_num (%d,%d,%d,%d,%d,%d,%d,%d)\n",i,
((int16_t *)lut_num_i)[0], ((int16_t *)lut_num_i)[0],
((int16_t *)lut_num_i)[1], ((int16_t *)lut_num_i)[1],
...@@ -1056,6 +1058,7 @@ void init_pucch2_luts() { ...@@ -1056,6 +1058,7 @@ void init_pucch2_luts() {
((int16_t *)lut_num_i)[5], ((int16_t *)lut_num_i)[5],
((int16_t *)lut_num_i)[6], ((int16_t *)lut_num_i)[6],
((int16_t *)lut_num_i)[7]); ((int16_t *)lut_num_i)[7]);
#endif
} }
} }
......
...@@ -561,6 +561,7 @@ int main(int argc, char **argv) ...@@ -561,6 +561,7 @@ int main(int argc, char **argv)
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct
uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table); uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table);
uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb);
int ptrs_symbols = 0; // to calculate total PTRS RE's in a slot
if(1<<ptrs_time_density >= nb_symb_sch) if(1<<ptrs_time_density >= nb_symb_sch)
pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
...@@ -838,6 +839,15 @@ int main(int argc, char **argv) ...@@ -838,6 +839,15 @@ int main(int argc, char **argv)
//----------------- count and print errors ----------------- //----------------- count and print errors -----------------
//---------------------------------------------------------- //----------------------------------------------------------
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++){
ptrs_symbols += ((gNB->pusch_vars[UE_id]->ptrs_symbols) >> i) & 1;
}
/* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */
available_bits = available_bits - (2 * ptrs_symbols * (nb_rb/((ptrs_freq_density)?4:2)));
printf("After PTRS subtraction available_bits are : %d \n", available_bits);
}
for (i = 0; i < available_bits; i++) { for (i = 0; i < available_bits; i++) {
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
...@@ -865,7 +875,7 @@ int main(int argc, char **argv) ...@@ -865,7 +875,7 @@ int main(int argc, char **argv)
errors_decoding++; errors_decoding++;
} }
} }
if (n_trials == 1) { if (n_trials == 1 && errors_decoding > 0) {
for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++) for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++)
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) { for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************");
......
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