Commit d8e6ea37 authored by Matthieu Kanj's avatar Matthieu Kanj

bug fix

parent 080d0fdf
...@@ -622,9 +622,9 @@ typedef struct { ...@@ -622,9 +622,9 @@ typedef struct {
//length of the table e //length of the table e
uint16_t length_e; // new parameter uint16_t length_e; // new parameter
/// Tail-biting convolutional coding outputs /// Tail-biting convolutional coding outputs
uint8_t d[96+(3*(24+152))]; // new parameter uint8_t d[96+(3*(24+680))]; // new parameter
/// Sub-block interleaver outputs /// Sub-block interleaver outputs
uint8_t w[3*3*(152+24)]; // new parameter uint8_t w[3*3*(680+24)]; // new parameter
/// Status Flag indicating for this DLSCH (idle,active,disabled) /// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status; //SCH_status_t status;
/// Transport block size /// Transport block size
......
...@@ -93,21 +93,42 @@ int dlsch_encoding_NB_IoT(unsigned char *a, ...@@ -93,21 +93,42 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h //unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h
unsigned int A; unsigned int A;
uint8_t RCC; uint8_t RCC;
uint8_t npbch_a[21]; //uint8_t npbch_a[21];
bzero(npbch_a,21); //bzero(npbch_a,21);
uint8_t npbch_a[85];
uint8_t npbch_a_crc[88];
bzero(npbch_a,85);
bzero(npbch_a_crc,88);
//A = dlsch->harq_process_sib1.TBS; // 680 //A = dlsch->harq_process_sib1.TBS; // 680
A = 19*8; // 680 //A = 19*8; // 680
A = 680;
dlsch->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236 dlsch->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
int32_t numbits = A+24; int32_t numbits = A+24;
crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC) for (int i=0; i<19; i++)
{
npbch_a[i] = a[i];
}
//crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC)
crc = crc24a_NB_IoT(npbch_a,A)>>8;
for (int j=0; j<85; j++)
{
npbch_a_crc[j] = npbch_a[j];
}
// CRC attachment to payload // CRC attachment to payload
a[A>>3] = ((uint8_t*)&crc)[2]; /*a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1]; a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0]; a[2+(A>>3)] = ((uint8_t*)&crc)[0];*/
npbch_a_crc[85] = ((uint8_t*)&crc)[2];
npbch_a_crc[86] = ((uint8_t*)&crc)[1];
npbch_a_crc[87] = ((uint8_t*)&crc)[0];
dlsch->B = numbits; // The length of table b in bits dlsch->B = numbits; // The length of table b in bits
...@@ -127,7 +148,8 @@ int dlsch_encoding_NB_IoT(unsigned char *a, ...@@ -127,7 +148,8 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
//ccode_encode_npdsch_NB_IoT(numbits, dlsch->b, dlsch->d+96, crc); // step 1 Tail-biting convolutional coding //ccode_encode_npdsch_NB_IoT(numbits, dlsch->b, dlsch->d+96, crc); // step 1 Tail-biting convolutional coding
// to uncomment if option 2 // to uncomment if option 2
ccode_encode_npdsch_NB_IoT(numbits,npbch_a, dlsch->d+96, crc); //ccode_encode_npdsch_NB_IoT(numbits,npbch_a, dlsch->d+96, crc);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->d+96,crc);
// sib1_w = 19*8*3*3=1368 // sib1_w = 19*8*3*3=1368
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving
// length e = 1888 // length e = 1888
......
...@@ -251,7 +251,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch, ...@@ -251,7 +251,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
bzero(eNB_npbch->npbch_e,npbch_E); // filling with "0" the table pbch_e[1600] bzero(eNB_npbch->npbch_e,npbch_E); // filling with "0" the table pbch_e[1600]
memset(eNB_npbch->npbch_d,LTE_NULL_NB_IoT,96); // filling with "2" the first 96 elements of table pbch_d[216] memset(eNB_npbch->npbch_d,LTE_NULL_NB_IoT,96); // filling with "2" the first 96 elements of table pbch_d[216]
for (i=0; i<5; i++) // set input bits stream /*for (i=0; i<5; i++) // set input bits stream
{ {
if (i != 4) if (i != 4)
{ {
...@@ -259,16 +259,16 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch, ...@@ -259,16 +259,16 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
} else { } else {
npbch_a[5-i-1]= npbch_pdu[i] & 0x03; npbch_a[5-i-1]= npbch_pdu[i] & 0x03;
} }
} }*/
/*
for (i=0; i<5; i++) // set input bits stream for (i=0; i<5; i++) // set input bits stream
{ {
npbch_a[i] = npbch_pdu[i]; // in LTE 24 bits with 3 bytes, but in NB_IoT 34 bits will require 4 bytes+2 bits !! to verify npbch_a[i] = npbch_pdu[i]; // in LTE 24 bits with 3 bytes, but in NB_IoT 34 bits will require 4 bytes+2 bits !! to verify
} }
*/
if (frame_parms->mode1_flag == 1) // setting CRC mask depending on the number of used eNB antennas if (frame_parms->mode1_flag == 1) // setting CRC mask depending on the number of used eNB antennas
amask = 0x0000; amask = 0x0000;
else { else {
......
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