/* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */
/* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */
...
@@ -881,7 +875,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
...
@@ -881,7 +875,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
frame_parms->ofdm_symbol_size,
frame_parms->ofdm_symbol_size,
shift);
shift);
pss_corr_ue[pss_index][n]+=abs64(result);
pss_corr_ue[pss_index][n]+=abs64(result);
//((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
//((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
//((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */
//((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */
//((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */
//((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */
...
@@ -892,40 +885,61 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
...
@@ -892,40 +885,61 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
/* calculate the absolute value of sync_corr[n] */
/* calculate the absolute value of sync_corr[n] */
avg[pss_index]+=pss_corr_ue[pss_index][n];
avg[pss_index]+=pss_corr_ue[pss_index][n];
}
if(pss_corr_ue[pss_index][n]>peak_value){
peak_value=pss_corr_ue[pss_index][n];
peak_position=n;
pss_source=pss_index;
avg[pss_index]/=(length/4);
#ifdef DEBUG_PSS_NR
printf("pss_index %d: n %6d peak_value %15llu\n",pss_index,n,(unsignedlonglong)pss_corr_ue[pss_index][n]);
#endif
}
}
}
}
threshold=10*avg[max3(avg[0],avg[1],avg[2])];
if(fo_flag){
peak_value=threshold;
// fractional frequency offser computation according to Cross-correlation Synchronization Algorithm Using PSS
// Shoujun Huang, Yongtao Su, Ying He and Shan Tang, "Joint time and frequency offset estimation in LTE downlink," 7th International Conference on Communications and Networking in China, 2012.
for(n=0;n<length;n+=4){
int64_tresult1,result2;
// Computing cross-correlation at peak on half the symbol size for first half of data
printf("peak %d found at pss_index %d, n %6d, peak_value %15llu\n",n_peaks,pss_source[n_peaks],peak_position[n_peaks],(unsignedlonglong)pss_corr_ue[pss_source[n_peaks]][peak_position[n_peaks]]);
if ((startingPRB < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is lower band
if ((startingPRB < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is lower band
if ((startingPRB >= (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is upper band
if ((startingPRB >= (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // if number RBs in bandwidth is even and current PRB is upper band
if ((startingPRB < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is lower band
if ((startingPRB < (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is lower band
if ((startingPRB > (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is upper band
if ((startingPRB > (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB is upper band
if ((startingPRB == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB contains DC
if ((startingPRB == (frame_parms->N_RB_DL>>1)) && ((frame_parms->N_RB_DL & 1) == 1)) { // if number RBs in bandwidth is odd and current PRB contains DC
printf("format 4 nrofSymbols >9 and E_init=%d,E = %d\n",E_init,E);
printf("format 4 nrofSymbols >9 and E_init=%d,E = %d\n",E_init,E);
#endif
#endif
}
}
}
}
*M_bit=E;
*M_bit=E;
intI_seg;
intI_seg;
#ifdef DEBUG_NR_PUCCH_TX
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t [nr_uci_encoding] start function with fmt=%d, encoding A=%d bits into M_bit=%d (where nrofSymbols=%d,nrofPRB=%d)\n",fmt,A,*M_bit,nrofSymbols,nrofPRB);
printf("\t\t [nr_uci_encoding] start function with fmt=%d, encoding A=%d bits into M_bit=%d (where nrofSymbols=%d,nrofPRB=%d)\n",fmt,A,*M_bit,nrofSymbols,nrofPRB);
#endif
#endif
if(A<=11){
if(A<=11){
// procedure in subclause 6.3.1.2.2 (UCI encoded by channel coding of small block lengths -> subclause 6.3.1.3.2)
// procedure in subclause 6.3.1.2.2 (UCI encoded by channel coding of small block lengths -> subclause 6.3.1.3.2)
// CRC bits are not attached, and coding small block lengths (subclause 5.3.3)
// CRC bits are not attached, and coding small block lengths (subclause 5.3.3)
}elseif(A>=12){
}elseif(A>=12){
// procedure in subclause 6.3.1.2.1 (UCI encoded by Polar code -> subclause 6.3.1.3.1)
// procedure in subclause 6.3.1.2.1 (UCI encoded by Polar code -> subclause 6.3.1.3.1)
if((A>=360&&E>=1088)||(A>=1013)){
if((A>=360&&E>=1088)||(A>=1013)){
I_seg=1;
I_seg=1;
}else{
}else{
I_seg=0;
I_seg=0;
}
}
if(A>=20){
if(A>=20){
// parity bits (subclause 5.2.1) computed by setting L=11 and using generator polynomial gCRC11(D) (subclause 5.1)
// parity bits (subclause 5.2.1) computed by setting L=11 and using generator polynomial gCRC11(D) (subclause 5.1)
L=11;
L=11;
}elseif(A<=19){
}elseif(A<=19){
// parity bits (subclause 5.2.1) computed by setting L=6 and using generator polynomial gCRC6(D) (subclause 5.1)
// parity bits (subclause 5.2.1) computed by setting L=6 and using generator polynomial gCRC6(D) (subclause 5.1)
L=6;
L=6;
}
}
// code block segmentation and CRC attachment is performed according to subclause 5.2.1
// code block segmentation and CRC attachment is performed according to subclause 5.2.1
printf("\t [nr_generate_pucch2] modulation of bit pair btilde(%d,%d), m_symbol=%d, d(%d)=(%d,%d)\n",(btilde[2*i]&1),(btilde[(2*i)+1]&1),m_symbol,i,d_re[i],d_im[i]);
printf("\t [nr_generate_pucch2] modulation of bit pair btilde(%d,%d), m_symbol=%d, d(%d)=(%d,%d)\n",(btilde[2*i]&1),(btilde[(2*i)+1]&1),m_symbol,i,d_re[i],d_im[i]);
#endif
#endif
}
}
/*
/*
* Implementing TS 38.211 Subclause 6.3.2.5.3 Mapping to physical resources
* Implementing TS 38.211 Subclause 6.3.2.5.3 Mapping to physical resources
printf("\t [nr_generate_pucch3_4] modulation QPSK of bit pair btilde(%d,%d), m_symbol=%d, d(%d)=(%d,%d)\n",(btilde[2*i]&1),(btilde[(2*i)+1]&1),m_symbol,i,d_re[i],d_im[i]);
printf("\t [nr_generate_pucch3_4] modulation QPSK of bit pair btilde(%d,%d), m_symbol=%d, d(%d)=(%d,%d)\n",(btilde[2*i]&1),(btilde[(2*i)+1]&1),m_symbol,i,d_re[i],d_im[i]);
#endif
#endif
}
}
}
}
if(is_pi_over_2_bpsk_enabled==1){
if(is_pi_over_2_bpsk_enabled==1){
// using PI/2-BPSK if PUCCH format 3,4 and pi/2-BPSK is configured, according to subclause 6.3.2.6.2
// using PI/2-BPSK if PUCCH format 3,4 and pi/2-BPSK is configured, according to subclause 6.3.2.6.2
// m0 is the cyclic shift index calculated depending on the Orthogonal sequence index n, according to table 6.4.1.3.3.1-1 from TS 38.211 subclause 6.4.1.3.3.1
// m0 is the cyclic shift index calculated depending on the Orthogonal sequence index n, according to table 6.4.1.3.3.1-1 from TS 38.211 subclause 6.4.1.3.3.1
// Next we proceed to mapping to physical resources according to TS 38.211, subclause 6.3.2.6.5 dor PUCCH formats 3 and 4 and subclause 6.4.1.3.3.2 for DM-RS
// Next we proceed to mapping to physical resources according to TS 38.211, subclause 6.3.2.6.5 dor PUCCH formats 3 and 4 and subclause 6.4.1.3.3.2 for DM-RS