Commit 080d0fdf authored by Matthieu Kanj's avatar Matthieu Kanj

bug fixes in dlsch functions

parent a67d6cb6
......@@ -144,7 +144,7 @@ typedef enum {
} SCH_status_NB_IoT_t;
/*
typedef struct {
/// NB-IoT
/// Allocated RNTI (0 means DLSCH_t is not currently used)
......@@ -164,15 +164,15 @@ typedef struct {
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS_NB_IoT];
uint8_t e[1888];
/// data after scrambling
uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IoT];
uint8_t s_e[1888];
//length of the table e
uint16_t length_e; // new parameter
/// Tail-biting convolutional coding outputs
uint8_t d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IoT))]; // new parameter
uint8_t d[96+(3*(24+152))]; // new parameter
/// Sub-block interleaver outputs
uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IoT+24)]; // new parameter
uint8_t w[3*3*(152+24)]; // new parameter
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
......@@ -197,7 +197,8 @@ typedef struct {
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_SIB1_t;
} NB_IoT_DL_eNB_SIB1_t;
*/
typedef struct {
/// NB-IoT
......@@ -608,7 +609,36 @@ typedef struct {
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
NB_IoT_DL_eNB_SIB1_t harq_process_sib1;
// NB_IoT_DL_eNB_SIB1_t harq_process_sib1;
//////////////////////////////////////////////////////////////////////
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t si_rnti; ///(=0xfff4)
SCH_status_NB_IoT_t status;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[1888];
/// data after scrambling
uint8_t s_e[1888];
//length of the table e
uint16_t length_e; // new parameter
/// Tail-biting convolutional coding outputs
uint8_t d[96+(3*(24+152))]; // new parameter
/// Sub-block interleaver outputs
uint8_t w[3*3*(152+24)]; // new parameter
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t *pdu;
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
////////////////////////////////////////////////////////////////////////////
/// Number of soft channel bits
uint32_t G;
/// Maximum number of HARQ rounds
......
......@@ -93,13 +93,15 @@ 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 int A;
uint8_t RCC;
uint8_t npbch_a[21];
A = dlsch->harq_process_sib1.TBS; // 680
dlsch->harq_process_sib1.length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
bzero(npbch_a,21);
//A = dlsch->harq_process_sib1.TBS; // 680
A = 19*8; // 680
dlsch->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
int32_t numbits = A+24;
if (dlsch->harq_process_sib1.round == 0) { // This is a new packet
crc = crc24a_NB_IoT(a,A)>>8; // CRC calculation (24 bits CRC)
// CRC attachment to payload
......@@ -107,18 +109,31 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
dlsch->harq_process_sib1.B = numbits; // The length of table b in bits
memcpy(dlsch->harq_process_sib1.b,a,numbits/8);
memset(dlsch->harq_process_sib1.d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits, dlsch->harq_process_sib1.b, dlsch->harq_process_sib1.d+96, crc); // step 1 Tail-biting convolutional coding
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_process_sib1.d+96,dlsch->harq_process_sib1.w); // step 2 interleaving
dlsch->B = numbits; // The length of table b in bits
/*for (int i=0; i<21; i++) // to uncomment if option 2
{
npbch_a[i] = a[i];
}
*/
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->d,LTE_NULL_NB_IoT,96);
for (int i=0; i<21; i++) // to uncomment if option 2
{
npbch_a[21-i-1] = a[i];
}
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_process_sib1.length_e,dlsch->harq_process_sib1.w,dlsch->harq_process_sib1.e); // step 3 Rate Matching
//ccode_encode_npdsch_NB_IoT(numbits, dlsch->b, dlsch->d+96, crc); // step 1 Tail-biting convolutional coding
// to uncomment if option 2
ccode_encode_npdsch_NB_IoT(numbits,npbch_a, dlsch->d+96, crc);
// sib1_w = 19*8*3*3=1368
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->d+96,dlsch->w); // step 2 interleaving
// length e = 1888
lte_rate_matching_cc_NB_IoT(RCC,dlsch->length_e,dlsch->w,dlsch->e); // step 3 Rate Matching
}
return(0);
}
......
......@@ -158,13 +158,14 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
symbol_offset = frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
symbol_offset = (14*4*frame_parms->ofdm_symbol_size) + frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF,
&jj,
symbol_offset,
&dlsch0->harq_process_sib1.s_e[G*npdsch_data_subframe],
&dlsch0->s_e[G*npdsch_data_subframe],
pilots,
amp,
id_offset,
......@@ -174,4 +175,4 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
return (re_allocated);
}
}
\ No newline at end of file
......@@ -36,9 +36,9 @@ void dlsch_sib1_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
{
int i,j,k=0;
uint32_t x1,x2, s=0;
uint8_t *e = dlsch->harq_process_sib1.e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
uint8_t *e = dlsch->e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
x2 = (dlsch->harq_process_sib1.si_rnti<<15) + (frame_parms->Nid_cell + 1) * ( (Nf % 61) + 1 ) ;
x2 = (dlsch->si_rnti<<15) + (frame_parms->Nid_cell + 1) * ( (Nf % 61) + 1 ) ;
// for NPDSCH not carriying SIBs
//x2 = (dlsch->harq_process_sib1.rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 10.2.3.1
......@@ -49,7 +49,7 @@ void dlsch_sib1_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
for (j=0; j<32; j++,k++) {
dlsch->harq_process_sib1.s_e[k] = (e[k]&1) ^ ((s>>j)&1);
dlsch->s_e[k] = (e[k]&1) ^ ((s>>j)&1);
}
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
......
......@@ -47,9 +47,9 @@ int generate_sss_NB_IoT(int32_t **txdataF,
unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE
unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
{
uint8_t aa,Nid_NB_IoT,Nid2,f,q,s,c,u;
uint8_t aa,Nid2,f,q,s,c,u;
int16_t *d;
uint16_t n_f;
uint16_t n_f,Nid_NB_IoT;
unsigned short a;
uint16_t slot_id; // slot_id = 17 in NB_IoT
unsigned short bandwidth_even_odd;
......
......@@ -112,6 +112,11 @@ void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length);
void dlsch_sib1_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NDLSCH_t *dlsch,
int tot_bits,
uint8_t Nf,
uint8_t Ns);
/*
int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
......
......@@ -34,6 +34,7 @@
#include "PHY/defs_NB_IoT.h"
#include "PHY/LTE_ESTIMATION/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h" //where we get the global Sched_Rsp_t structure filled
//#include "SCHED/defs.h"
#include "SCHED/extern_NB_IoT.h"
......@@ -228,6 +229,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
int With_NSSS=0; // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
uint8_t *npbch_pdu = get_NB_IoT_MIB();
uint8_t *sib1_pdu = get_NB_IoT_SIB1();
//uint8_t *control_region_size = get_NB_IoT_SIB1_eutracontrolregionsize();
int G=0;
//NSSS only happened in the even frame
if(frame%2==0)
......@@ -238,7 +240,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
With_NSSS = 0;
}
if(subframe == 5)
{
......@@ -282,53 +284,37 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
// SIB1
/*
switch ( a ) {
case 0:
G=142;
break;
case 1:
G=130;
case 2:
G=118;
break;
default:
// Code
break;
}
if(subframe > 3)
if(subframe == 4 && (frame%2==0) && (frame%32<16) )
{
if( frame%32 == 0 )
{
dlsch_encoding_NB_IoT(sib1_pdu,
sib1,
8, ///// number_of_subframes_required
236); //////////// G*2
dlsch_sib1_scrambling_NB_IoT(fp, // is called only in subframe 4
sib1,
1888, ////// total_bits
frame,
subframe*2);
}
*/
/*
dlsch_encoding_NB_IoT(sib1_pdu,
sib1,
number_of_subframes_required, ***************
G); ***********
dlsch_sib1_scrambling_NB_IoT(fp,
sib1,
total_bits, **************************
frame,
subframe*2);
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
control_region_size, ********* // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1,
G, ********* // number of bits per subframe
npdsch_data_subframe, ******* // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
RB_IoT_ID)
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1,
236, // number of bits per subframe
((frame%32)/2), ///npdsch_data_subframe, data per subframe // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
RB_IoT_ID);
}
if(Number_of_sib1_subframe > 1)
*/
}
......
......@@ -551,7 +551,7 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
if (band == eutra_bands[band_index].band) {
uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;
AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
/* AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
"Failed to parse eNB configuration file %s, enb %d downlink frequency %u too low (%u) for band %d!",
lib_config_file_name_pP, enb_properties_index, downlink_frequency, eutra_bands[band_index].dl_min, band);
AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
......@@ -563,7 +563,8 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
lib_config_file_name_pP, enb_properties_index, uplink_frequency, eutra_bands[band_index].ul_min, band);
AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
"Failed to parse eNB configuration file %s, enb %d uplink frequency %u too high (%u) for band %d!",
lib_config_file_name_pP, enb_properties_index, uplink_frequency, eutra_bands[band_index].ul_max, band);
lib_config_file_name_pP, enb_properties_index, uplink_frequency, eutra_bands[band_index].ul_max, band);
*/
AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
"Failed to parse eNB configuration file %s, enb %d invalid frame type (%d/%d) for band %d!",
......
......@@ -135,7 +135,7 @@ uint8_t do_MIB_NB_IoT(
mib_NB_IoT->message.spare.bits_unused = 5;
//decide how to set it
mib_NB_IoT->message.schedulingInfoSIB1_r13 =11; //see TS 36.213-->tables 16.4.1.3-3 ecc...
mib_NB_IoT->message.schedulingInfoSIB1_r13 =10; //see TS 36.213-->tables 16.4.1.3-3 ecc... // to make 8 repetitions
mib_NB_IoT->message.systemInfoValueTag_r13= 0;
mib_NB_IoT->message.ab_Enabled_r13 = 0;
......
......@@ -41,6 +41,8 @@ uint8_t *get_NB_IoT_SIB1(void);
uint8_t *get_NB_IoT_MIB(void);
long *get_NB_IoT_SIB1_eutracontrolregionsize(void);
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame);
/*------------------------common_nb_iot.c----------------------------------------*/
......
......@@ -130,6 +130,11 @@ uint8_t *get_NB_IoT_SIB1(void)
return eNB_rrc_inst_NB_IoT->carrier[0].SIB1_NB_IoT;
}
long *get_NB_IoT_SIB1_eutracontrolregionsize(void)
{
return eNB_rrc_inst_NB_IoT->carrier[0].sib1_NB_IoT->eutraControlRegionSize_r13;
}
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame)
{
......
......@@ -40,8 +40,8 @@
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_t node_function,
uint16_t Nid_cell,
eNB_func_t node_function,
uint8_t abstraction_flag)
{
......@@ -51,8 +51,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_vars_eNB->Mod_id=eNB_id;
PHY_vars_eNB->cooperation_flag=0;//cooperation_flag;
memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3);
PHY_vars_eNB->frame_parms.Nid_cell = Nid_cell; ///////((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3);
PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
// for NB-IoT testing
PHY_vars_eNB->ndlsch_SIB1.si_rnti = 0xfff4;
////////////////////////////
phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag);
LOG_I(PHY,"init eNB: Node Function %d\n",node_function);
......
......@@ -24,7 +24,7 @@
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
uint16_t Nid_cell,
eNB_func_t node_function,
uint8_t abstraction_flag);
......
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