Commit ba13e294 authored by Matthieu Kanj's avatar Matthieu Kanj

ACK decoding

parent 10c62314
...@@ -99,12 +99,16 @@ void rotate_channel_single_carrier_NB_IoT(int16_t *estimated_channel,unsigned ch ...@@ -99,12 +99,16 @@ void rotate_channel_single_carrier_NB_IoT(int16_t *estimated_channel,unsigned ch
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel, void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t l, uint8_t l,
uint8_t Qm, uint8_t Qm,
uint8_t counter_msg3) uint8_t counter_msg3,
uint8_t flag)
{ {
int16_t e_phi_re[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621}; int16_t e_phi_re[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im[120] = {0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009}; int16_t e_phi_im[120] = {0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009};
int16_t e_phi_re_m6[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im_m6[120] = {0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010};
int16_t pi_2_re[2] = {32767 , 0}; int16_t pi_2_re[2] = {32767 , 0};
int16_t pi_2_im[2] = {0 , 32768}; int16_t pi_2_im[2] = {0 , 32767};
//int16_t pi_4_re[2] = {32767 , 25735}; //int16_t pi_4_re[2] = {32767 , 25735};
//int16_t pi_4_im[2] = {0 , 25736}; //int16_t pi_4_im[2] = {0 , 25736};
int16_t pi_4_re[2] = {32767 , 23170}; int16_t pi_4_re[2] = {32767 , 23170};
...@@ -117,14 +121,14 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel, ...@@ -117,14 +121,14 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
est_channel_re = estimated_channel[k<<1]; est_channel_re = estimated_channel[k<<1];
est_channel_im = estimated_channel[(k<<1)+1]; est_channel_im = estimated_channel[(k<<1)+1];
if (Qm == 1) if (Qm == 1) // rotation due to pi/2 BPSK
{ {
est_channel_re2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_re + est_channel_re2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_re +
(int32_t)pi_2_im[l%2] * (int32_t)est_channel_im)>>15); (int32_t)pi_2_im[l%2] * (int32_t)est_channel_im)>>15);
est_channel_im2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_im - est_channel_im2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_im -
(int32_t)pi_2_im[l%2] * (int32_t)est_channel_re)>>15); (int32_t)pi_2_im[l%2] * (int32_t)est_channel_re)>>15);
} }
if(Qm == 2) if(Qm == 2) // rotation due to pi/4 QPSK
{ {
est_channel_re2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)est_channel_re + est_channel_re2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)est_channel_re +
(int32_t)pi_4_im[l%2] * (int32_t)est_channel_im)>>15); (int32_t)pi_4_im[l%2] * (int32_t)est_channel_im)>>15);
...@@ -132,13 +136,144 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel, ...@@ -132,13 +136,144 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
(int32_t)pi_4_im[l%2] * (int32_t)est_channel_re)>>15); (int32_t)pi_4_im[l%2] * (int32_t)est_channel_re)>>15);
} }
if(flag==0) // rotation of msg3
{
estimated_channel[k<<1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)est_channel_re2 + estimated_channel[k<<1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)est_channel_re2 +
(int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)est_channel_im2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)est_channel_im2)>>15);
estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)est_channel_im2 - estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)est_channel_im2 -
(int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)est_channel_re2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)est_channel_re2)>>15);
} }
if(flag==1) // rotation of msg5
{
estimated_channel[k<<1] = (int16_t)(((int32_t)e_phi_re_m6[14*(2-counter_msg3) + l] * (int32_t)est_channel_re2 +
(int32_t)e_phi_im_m6[14*(2-counter_msg3) + l] * (int32_t)est_channel_im2)>>15);
estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)e_phi_re_m6[14*(2-counter_msg3) + l] * (int32_t)est_channel_im2 -
(int32_t)e_phi_im_m6[14*(2-counter_msg3) + l] * (int32_t)est_channel_re2)>>15);
}
}
} }
///////////////// for ACK ////////////
int ul_chest_tmp_f2_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot
uint8_t Ns,
uint8_t counter_msg3,
uint8_t flag,
uint8_t subframerx,
uint8_t Qm,
uint32_t I_sc,
LTE_DL_FRAME_PARMS *frame_parms)
{
// NB-IoT: 36.211, Section 5.5.2.2.1, Table 5.5.2.2.1-2
int16_t bar_w_re[9] = {32767, 32767, 32767, 32767, -16384, -16384, 32767, -16384, -16384};
int16_t bar_w_im[9] = { 0, 0, 0, 0, 28377, -28377, 0, -28377, 28377};
int pilot_pos_format2_15k[6] = {2,3,4,9,10,11}; // holds for npusch format 2, and 15 kHz subcarrier bandwidth
uint16_t ul_sc_start; // subcarrier start index into UL RB
//uint8_t Qm = 1; // needed to rotate the estimated channel
uint32_t u; //for group hopping
//uint32_t I_sc = 0;
int symbol_offset;
uint8_t symbol; //symbol within subframe
int *pilot_pos_format2; // holds for npusch format 2, and 15 kHz subcarrier bandwidth
uint16_t aa,k,n;
int16_t *received_data, *estimated_channel, *pilot_sig; // pointers to
int16_t *ul_ch1, *ul_ch2, *ul_ch3, *ul_ch4, *ul_ch5, *ul_ch6;
uint8_t reset=1, index_w, p;
uint32_t x1, x2, s=0;
uint8_t n_s; // slot within frame (0,..,19)
int16_t ul_ch_estimates_re,ul_ch_estimates_im;
int16_t average_channel[24]; // average channel over a RB and 2 slots
int32_t *p_average_channel = (int32_t *)&average_channel;
pilot_pos_format2 = pilot_pos_format2_15k; // In futur version, this could be adapted for 3.75 kHz
u = frame_parms->Nid_cell%16;
ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB
symbol = l + 7*(Ns&1);
if (l == pilot_pos_format2[0] || l == pilot_pos_format2[1] || l == pilot_pos_format2[2])
{
n_s = Ns+(subframerx<<1);
x2 = 0; //(uint32_t) Ncell_ID;
for (p=0;p<n_s+1;p++) // this should be outsourced to avoid computation in each subframe
{
if ((p%4) == 0)
{
s = lte_gold_generic_NB_IoT(&x1,&x2,reset);
reset = 0;
}
}
index_w = (((s>>(8*(n_s%4)))&255))%3; /// See sections 10.1.4.1 and 5.5.2.2.1 in TS 36.211
symbol_offset = frame_parms->N_RB_UL*12*(l+(7*(Ns&1)));
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++)
{
received_data = (int16_t *)&rxdataF_ext[aa][symbol_offset];
estimated_channel = (int16_t *)&ul_ch_estimates[aa][symbol_offset];
pilot_sig = &ul_ref_sigs_f2_rx_NB_IoT[u][24 + 24*((2-counter_msg5)*6+3*Ns+l-2)-(ul_sc_start<<1)]; // pilot values is the same during 3 symbols l = 1, 2, 3
for (k=0;k<12;k++)
{
// Multiplication by the complex conjugate of the pilot
estimated_channel[k<<1] = (int16_t)(((int32_t)received_data[k<<1]*(int32_t)pilot_sig[k<<1] +
(int32_t)received_data[(k<<1)+1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //real part of estimated channel
estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)received_data[(k<<1)+1]*(int32_t)pilot_sig[k<<1] -
(int32_t)received_data[k<<1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //imaginary part of estimated channel
}
/// Apply inverse rotation to the channel
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg5,flag);
ul_ch_estimates_re = estimated_channel[ul_sc_start<<1];
ul_ch_estimates_im = estimated_channel[(ul_sc_start<<1)+1];
estimated_channel[ul_sc_start<<1] =
(int16_t) (((int32_t) (bar_w_re[3*index_w+(l-2)]) * (int32_t) (ul_ch_estimates_re) +
(int32_t) (bar_w_im[3*index_w+(l-2)]) * (int32_t) (ul_ch_estimates_im))>>15);
estimated_channel[(ul_sc_start<<1)+1] =
(int16_t) (((int32_t) (bar_w_re[3*index_w+(l-2)]) * (int32_t) (ul_ch_estimates_im) -
(int32_t) (bar_w_im[3*index_w+(l-2)]) * (int32_t) (ul_ch_estimates_re))>>15);
if (Ns&1 && l==pilot_pos_format2[2]) //we are in the second slot of the sub-frame, so do the averaging of channel estimation
{
ul_ch1 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[0]];
ul_ch2 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[1]];
ul_ch3 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[2]];
ul_ch4 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[3]];
ul_ch5 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[4]];
ul_ch6 = (int16_t *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos_format2[5]];
for (k=0;k<12;k++)
{
average_channel[k<<1] = (int16_t)(((int32_t)ul_ch1[k<<1] + (int32_t)ul_ch2[k<<1] +
(int32_t)ul_ch3[k<<1] + (int32_t)ul_ch4[k<<1] +
(int32_t)ul_ch5[k<<1] + (int32_t)ul_ch6[k<<1])/6);
average_channel[1+(k<<1)] = (int16_t)(((int32_t)ul_ch1[1+(k<<1)] + (int32_t)ul_ch2[1+(k<<1)] +
(int32_t)ul_ch3[1+(k<<1)] + (int32_t)ul_ch4[1+(k<<1)] +
(int32_t)ul_ch5[1+(k<<1)] + (int32_t)ul_ch6[1+(k<<1)])/6);
}
for (n=0; n<frame_parms->symbols_per_tti; n++)
{
for (k=0;k<12;k++)
{
ul_ch_estimates[aa][frame_parms->N_RB_UL*12*n + k] = p_average_channel[k];
}
}
}
}
}
return(0);
}
/////////////////////////////////////
int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
...@@ -188,7 +323,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -188,7 +323,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
(int32_t)received_data[k<<1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //imaginary part of estimated channel (int32_t)received_data[k<<1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //imaginary part of estimated channel
} }
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg3); rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg3,0); // 0 is used to indicate msg3
//printf("\n"); //printf("\n");
/*for (k=11;k<12;k++) /*for (k=11;k<12;k++)
{ {
...@@ -233,6 +368,8 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -233,6 +368,8 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
return(0); return(0);
} }
int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext, int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **ul_ch_estimates, int32_t **ul_ch_estimates,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
uint16_t sequence_length[4] = {100,100,100,100}; //the "32" value corresponds to the max gold sequence length uint16_t sequence_length[4] = {100,100,100,100}; //the "32" value corresponds to the max gold sequence length
// int16_t *ul_ref_sigs[30][33]; // int16_t *ul_ref_sigs[30][33];
int16_t *ul_ref_sigs_f2_rx_NB_IoT[16]; //this table contain the 16 possible pilots for format 2 NPUSCH
int16_t *ul_ref_sigs_rx_NB_IoT[30][4]; //these contain the sequences in repeated format and quantized to QPSK ifdef IFFT_FPGA int16_t *ul_ref_sigs_rx_NB_IoT[30][4]; //these contain the sequences in repeated format and quantized to QPSK ifdef IFFT_FPGA
uint16_t u_max[4] = {16,12,14,30}; // maximum u value, see 36.211, Section 10.1.4 uint16_t u_max[4] = {16,12,14,30}; // maximum u value, see 36.211, Section 10.1.4
...@@ -231,7 +232,7 @@ int16_t w_n[256] = { ...@@ -231,7 +232,7 @@ int16_t w_n[256] = {
void generate_ul_ref_sigs_rx_NB_IoT(void) void generate_ul_ref_sigs_rx_NB_IoT(void)
{ {
unsigned int u,index_Nsc_RU,n; // Vincent: index_Nsc_RU 0,1,2,3 ---> number of sc 1,3,6,12 unsigned int u,index_Nsc_RU,n,m; // Vincent: index_Nsc_RU 0,1,2,3 ---> number of sc 1,3,6,12
uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
int16_t a; int16_t a;
int16_t qpsk[2]; int16_t qpsk[2];
...@@ -253,6 +254,7 @@ void generate_ul_ref_sigs_rx_NB_IoT(void) ...@@ -253,6 +254,7 @@ void generate_ul_ref_sigs_rx_NB_IoT(void)
{ {
case 0: // 36.211, Section 10.1.4.1.1 case 0: // 36.211, Section 10.1.4.1.1
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*sequence_length[index_Nsc_RU]*12+24)); // *12 is mandatory to fit channel estimation functions ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*sequence_length[index_Nsc_RU]*12+24)); // *12 is mandatory to fit channel estimation functions
ul_ref_sigs_f2_rx_NB_IoT[u] = (int16_t*)malloc(sizeof(int16_t)*(2*12*12+24)); // first "*12" is mandatory to fit channel estimation functions; first "*12" is the length of pilot sequence for
// NB-IoT: for same reason, +24 is added in order to fit the possible subcarrier start shift when index_Nsc_RU = 0, 1, 2 --> see ul_sc_start in channel estimation function // NB-IoT: for same reason, +24 is added in order to fit the possible subcarrier start shift when index_Nsc_RU = 0, 1, 2 --> see ul_sc_start in channel estimation function
for (n=0; n<sequence_length[index_Nsc_RU]; n++) { for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
if (n>0 && n%32==0) if (n>0 && n%32==0)
...@@ -269,6 +271,16 @@ void generate_ul_ref_sigs_rx_NB_IoT(void) ...@@ -269,6 +271,16 @@ void generate_ul_ref_sigs_rx_NB_IoT(void)
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
for (n=0; n<4; n++)
{
for (m=0; m<3; m++)
{
ul_ref_sigs_f2_rx_NB_IoT[u][12*((3*n+m)<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_f2_rx_NB_IoT[u][1+12*((3*n+m)<<1)+24] = ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
}
} }
break; break;
} }
......
...@@ -342,7 +342,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -342,7 +342,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
uint16_t I_sc, uint16_t I_sc,
uint16_t Nsc_RU, uint16_t Nsc_RU,
uint16_t Mcs, uint16_t Mcs,
unsigned int A); unsigned int A,
uint8_t option);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext, int32_t **rxdataF_ext,
...@@ -404,7 +405,8 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -404,7 +405,8 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
uint8_t symbol, uint8_t symbol,
uint8_t counter_msg3, uint8_t counter_msg3,
uint32_t I_sc, uint32_t I_sc,
uint8_t Qm); uint8_t Qm,
uint8_t option);
void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB, void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
...@@ -505,10 +507,23 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -505,10 +507,23 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
uint8_t Qm, uint8_t Qm,
LTE_DL_FRAME_PARMS *frame_parms); LTE_DL_FRAME_PARMS *frame_parms);
/// Channel estimation for NPUSCH format 2
int ul_chest_tmp_f2_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot
uint8_t Ns,
uint8_t counter_msg3,
uint8_t flag,
uint8_t subframerx,
uint8_t Qm,
uint32_t I_sc,
LTE_DL_FRAME_PARMS *frame_parms);
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel, void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t l, uint8_t l,
uint8_t Qm, uint8_t Qm,
uint8_t counter_msg3); uint8_t counter_msg3,
uint8_t flag);
int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext, int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
......
...@@ -1355,20 +1355,23 @@ void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1355,20 +1355,23 @@ void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB,
} }
//for (m=0;m<12;m++) //for (m=0;m<12;m++)
//{ // 12 is the number of subcarriers per RB //{ // 12 is the number of subcarriers per RB
//printf(" rxdataF_comp32_%d = %d",m,rxdataF_comp32[m]); //printf(" rxdataF_comp32_%d = %d",m,rxdataF_comp32[m]);
//} //}
void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
uint8_t UE_id, // to be removed ??? since not used uint8_t eNB_id, // to be removed ??? since not used
uint8_t l, //symbol within subframe uint8_t l, //symbol within subframe
uint8_t counter_msg3, /// to be replaced by the number of received part uint8_t counter_msg3, /// to be replaced by the number of received part
uint32_t I_sc, uint32_t I_sc,
uint8_t Qm) uint8_t Qm,
uint8_t option) // 0 for data and 1 for ACK
{ {
//uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer //uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer
...@@ -1381,11 +1384,13 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1381,11 +1384,13 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
int16_t pi_4_im[2] = {0 , 23170}; int16_t pi_4_im[2] = {0 , 23170};
int16_t e_phi_re[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621}; int16_t e_phi_re[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im[120] = {0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009}; int16_t e_phi_im[120] = {0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009};
int16_t e_phi_re_m6[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im_m6[120] = {0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010};
int16_t *rxdataF_comp16; int16_t *rxdataF_comp16;
int16_t rxdataF_comp16_re, rxdataF_comp16_im,rxdataF_comp16_re_2,rxdataF_comp16_im_2; int16_t rxdataF_comp16_re, rxdataF_comp16_im,rxdataF_comp16_re_2,rxdataF_comp16_im_2;
ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB
rxdataF_comp16 = (int16_t *)&rxdataF_comp[0][l*frame_parms->N_RB_DL*12 + ul_sc_start]; rxdataF_comp16 = (int16_t *)&rxdataF_comp[eNB_id][l*frame_parms->N_RB_DL*12 + ul_sc_start];
rxdataF_comp16_re = rxdataF_comp16[0]; rxdataF_comp16_re = rxdataF_comp16[0];
rxdataF_comp16_im = rxdataF_comp16[1]; rxdataF_comp16_im = rxdataF_comp16[1];
rxdataF_comp16_re_2 = rxdataF_comp16_re; rxdataF_comp16_re_2 = rxdataF_comp16_re;
...@@ -1404,14 +1409,22 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1404,14 +1409,22 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
(int32_t)pi_4_im[l%2] * (int32_t)rxdataF_comp16_re)>>15); (int32_t)pi_4_im[l%2] * (int32_t)rxdataF_comp16_re)>>15);
} }
if (option ==0)
{
rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2 + rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2 +
(int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2)>>15);
rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2 - rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2 -
(int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2)>>15);
} else {
/*rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_re_2 + /*rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_re_2 +
(int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_im_2)>>15); (int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_im_2)>>15);
rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_im_2 - rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_im_2 -
(int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_re_2)>>15); */ (int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_re_2)>>15); */
rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re_m6[14*(2-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2 +
(int32_t)e_phi_im_m6[14*(2-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2)>>15);
rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re_m6[14*(2-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2 -
(int32_t)e_phi_im_m6[14*(2-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2)>>15);
}
/*printf("\n"); /*printf("\n");
printf(" re_eq_data = %d im_eq_data = %d ",rxdataF_comp16[0],rxdataF_comp16[1]); printf(" re_eq_data = %d im_eq_data = %d ",rxdataF_comp16[0],rxdataF_comp16[1]);
printf("\n");*/ printf("\n");*/
...@@ -1948,7 +1961,8 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1948,7 +1961,8 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
l, l,
1, 1,
0, 0,
Qm); Qm,
0);
/* rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, /* rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
...@@ -1975,7 +1989,8 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1975,7 +1989,8 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
l, l,
1, 1,
0, 0,
Qm); Qm,
0);
...@@ -2051,7 +2066,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -2051,7 +2066,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
uint16_t I_sc, uint16_t I_sc,
uint16_t Nsc_RU, uint16_t Nsc_RU,
uint16_t Mcs, uint16_t Mcs,
unsigned int A) unsigned int A, // A = TBS
uint8_t option) // data (0) or control (1)
{ {
//LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id]; //LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id]; LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
...@@ -2162,7 +2178,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -2162,7 +2178,8 @@ void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
l, l,
proc->counter_msg3, proc->counter_msg3,
I_sc, I_sc,
Qm); // Qm Qm,
0); // Qm
} }
......
...@@ -118,6 +118,9 @@ typedef struct { ...@@ -118,6 +118,9 @@ typedef struct {
uint8_t flag_msg5; uint8_t flag_msg5;
uint32_t frame_dscr_msg5;
uint32_t subframe_dscr_msg5;
} eNB_rxtx_proc_t; } eNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing /// Context data structure for eNB subframe processing
......
...@@ -503,6 +503,8 @@ void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,rel ...@@ -503,6 +503,8 @@ void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,rel
int16_t buffer_npusch[153600]; int16_t buffer_npusch[153600];
int16_t buffer_npusch_ext[153600]; int16_t buffer_npusch_ext[153600];
int32_t llr_msg5[16];
int32_t y_msg5[16];
void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
...@@ -515,6 +517,9 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -515,6 +517,9 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
//int With_NSSS=0; //int With_NSSS=0;
int framerx = proc->frame_rx; int framerx = proc->frame_rx;
int subframerx = proc->subframe_rx; int subframerx = proc->subframe_rx;
/////////////////////////////////////////////////ACK ///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//int With_NSSS=0; //int With_NSSS=0;
//printf("\n in eNB_fep_full in frame_tx = %d \n",frame); //printf("\n in eNB_fep_full in frame_tx = %d \n",frame);
...@@ -536,11 +541,157 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -536,11 +541,157 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
exit(0); exit(0);
}*/ }*/
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////// Decoding ACK //////////////////////////////// ////////////////////////////////////////// Decoding ACK ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
if(subframe==proc->subframe_msg5 && frame==proc->frame_msg5 && proc->flag_msg5==1 && proc->counter_msg5>0) if(subframe==proc->subframe_msg5 && frame==proc->frame_msg5 && proc->flag_msg5==1 && proc->counter_msg5>0)
{ {
int x=0; LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0];
NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
int l,ii=0; //i;
uint8_t nb_rb=1; //ulsch_NB_IoT[0]->harq_process->nb_rb, //////////////// high level parameter
int16_t *llrp, *llrp2;
uint32_t rnti_tmp= 65522; // true rnti should be used
uint32_t x1_msg5, x2_msg5, s_msg5=0;
uint8_t reset;
uint8_t counter_ack; // ack counter for decision ack/nack
int32_t counter_ack_soft;
printf("\n\n msg5 received in frame %d subframe %d \n\n",framerx,subframerx);
if (proc->counter_msg5 ==2)
{
proc->frame_dscr_msg5 = framerx;
proc->subframe_dscr_msg5 = subframerx;
}
for (l=0; l<fp->symbols_per_tti; l++)
{
ulsch_extract_rbs_single_NB_IoT(common_vars->rxdataF[eNB_id],
pusch_vars->rxdataF_ext[eNB_id],
UL_RB_ID_NB_IoT, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block
Nsc_RU, //1, //ulsch_NB_IoT[0]->harq_process->N_sc_RU, // number of subcarriers in UL //////////////// high level parameter
I_sc, //used??????? // ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field
l%(fp->symbols_per_tti/2), // (0..13)
l/(fp->symbols_per_tti/2), // (0,1)
fp);
/// Channel Estimation (NPUSCH format 2)
ul_chest_tmp_f2_NB_IoT(pusch_vars->rxdataF_ext[0],
pusch_vars->drs_ch_estimates[0],
l%(fp->symbols_per_tti/2), //symbol within slot
l/(fp->symbols_per_tti/2),
proc->counter_msg5,
proc->flag_msg5, // =1
subframerx,
Qm, // =1
I_sc, // = 0
fp);
}
for (l=0; l<fp->symbols_per_tti; l++)
{ /// Channel Equalization
ul_chequal_tmp_NB_IoT(pusch_vars->rxdataF_ext[0],
pusch_vars->rxdataF_comp[0],
pusch_vars->drs_ch_estimates[0],
l%(fp->symbols_per_tti/2), //symbol within slot
l/(fp->symbols_per_tti/2),
fp);
//}
//for (l=0; l<fp->symbols_per_tti; l++)
//{
/// In case of 1 subcarrier: BPSK and QPSK should be rotated by pi/2 and pi/4, respectively
rotate_single_carrier_NB_IoT(eNB,
fp,
pusch_vars->rxdataF_comp[eNB_id],
eNB_id, // eNB_ID ID
l,
proc->counter_msg5,
I_sc, // carrier 0
1, // Qm
1); // for ACK
}
llrp = (int16_t*)&pusch_vars->llr[0+ (2-proc->counter_msg5)*16];
ii = 0;
for (l=0; l<fp->symbols_per_tti; l++)
{
if (l==2 || l==9 ) // skip pilots: 3 per slots
{
l=l+3;
}
ulsch_qpsk_llr_NB_IoT(eNB,
fp,
pusch_vars->rxdataF_comp[eNB_id],
pusch_vars->llr,
l,
UE_id, // UE ID,
I_sc, // carrier number 0 for the ACK
Nsc_RU, // = 1
&llrp[ii*2]); //// !!! Pensez à créer un buffer de longueur 8 subframes
ii++;
}
if (proc->counter_msg5==1)
{
llrp2 = (int16_t*)&pusch_vars->llr[0];
for (l=0;l<16;l++) /// Add real and imaginary parts of BPSK constellation
{
llr_msg5[l] = llrp2[l<<1] + llrp2[(l<<1)+1];
}
/*printf("\n\n");
for (l=0;l<16;l++){
printf(" llr_msg5 = %d ",llr_msg5[l]);
}*/
/// Descrambling
x2_msg5 = (rnti_tmp<<14) + (proc->subframe_dscr_msg5<<9) + ((proc->frame_dscr_msg5%2)<<13) + fp->Nid_cell;
reset = 1;
s_msg5 = lte_gold_generic(&x1_msg5, &x2_msg5, reset);
reset = 0;
counter_ack = 0;
for (l=0;l<16;l++)
{
//printf("\n s = %d \n",(s_msg5>>(l%32))&1);
if (((s_msg5>>(l%32))&1)==1) //xor
{
y_msg5[l] = -llr_msg5[l];
}else
{
y_msg5[l] = llr_msg5[l];
}
counter_ack += (y_msg5[l]>>31)&1;
}
/// Decision ACK/NACK
printf("\n\n\n");
if (counter_ack>8) //hard decision
{
printf(" decoded msg5: ACK ");
}else if (counter_ack<8) //hard decision
{
printf(" decoded msg5: NACK ");
}else //when equality (8 bits 0 vs 8 bits 1), soft decision
{
counter_ack_soft=0;
for (l=0;l<16;l++)
{
counter_ack_soft += y_msg5[l];
}
if (counter_ack_soft>=0)
{
printf(" decoded msg5 (soft): ACK ");
}else
{
printf(" decoded msg5 (soft): NACK ");
}
}
printf("\n\n\n");
}
proc->subframe_msg5++;
proc->counter_msg5--;
///if (proc->counter_msg5==0) exit(0);
} }
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////// RX NPUSH ////////////////////////////////////// /////////////////////////////////////////////////// RX NPUSH //////////////////////////////////////
...@@ -578,7 +729,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -578,7 +729,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
11, // I_sc 11, // I_sc
1, // Nsc_RU 1, // Nsc_RU
2, // Mcs 2, // Mcs
88); // A = TBS 88, // A = TBS
0); // data (0) or control (1)
/* LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0]; /* LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0];
//NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; //NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0]; NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
......
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