Commit ba13e294 authored by Matthieu Kanj's avatar Matthieu Kanj

ACK decoding

parent 10c62314
...@@ -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