Commit 29f6db97 authored by Matthieu Kanj's avatar Matthieu Kanj

NPDCCH generation

parent 901d02ef
......@@ -116,9 +116,9 @@ int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
opr_mode, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
opr_mode, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1_struct,
G, // number of bits per subframe
G, // number of bits per subframe
((frame%16)/2),
4,
RB_IoT_ID);
......@@ -150,7 +150,7 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
{
uint8_t *SIB23_pdu = SIB23->harq_process->pdu;
uint32_t rep = SIB23->resource_assignment;
uint8_t eutro_control_region = 3;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = SIB23->counter_repetition_number;
uint32_t pointer_to_sf = SIB23->pointer_to_subframe; /// to identify wich encoded subframe to transmit
......@@ -176,7 +176,7 @@ int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutro_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
SIB23,
G, // number of bits per subframe
pointer_to_sf,
......@@ -217,7 +217,7 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
{
uint8_t *RAR_pdu = RAR->harq_process->pdu;
uint32_t rep = RAR->repetition_number;
uint8_t eutro_control_region = 3;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = RAR->counter_repetition_number;
uint32_t counter_sf_rep = RAR->counter_current_sf_repetition; /// for identifiying when to trigger new scrambling
......@@ -261,7 +261,7 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutro_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
RAR,
G, // number of bits per subframe
pointer_to_sf,
......@@ -294,7 +294,7 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutro_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
RAR,
G, // number of bits per subframe
pointer_to_sf,
......@@ -320,7 +320,7 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
/*int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI,
int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
......@@ -329,79 +329,78 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
int RB_IoT_ID)
{
int done=0;
uint8_t *DCI_pdu = DCI->pdu;
uint32_t rep = DCI->repetition_number;
uint8_t eutro_control_region = 3;
for(int i=0; i<2; i++)
{
uint8_t ncce_index = 0; /// = DCI->ncce_index[i];
uint8_t agr_level = 2; /// = DCI->aggregation_level[i];
uint32_t counter_rep = DCI->counter_repetition_number;
uint32_t counter_sf_rep = DCI->counter_current_sf_repetition; /// for identifiying when to trigger new scrambling
uint32_t pointer_to_sf = DCI->pointer_to_subframe; /// to identify wich encoded subframe to transmit
if( (DCI->active[i] == 1) && (frame_parms->flag_free_sf == 0))
{
if( DCI->active == 1 )
{
int G = get_G_NB_IoT(frame_parms);
uint8_t Nsf = DCI->number_of_subframes_for_resource_assignment;
if( (counter_rep == rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_encoding_NB_IoT(DCI_pdu,
DCI,
Nsf, ///// number_of_subframes_required
G); //// this vallue is fixed, should take into account in future the case of stand-alone & guard-band
dlsch_scrambling_Gen_NB_IoT(frame_parms,
DCI,
Nsf*G,
frame,
subframe*2,
DCI->rnti);
}
if( (counter_rep != rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_scrambling_Gen_NB_IoT(frame_parms,
DCI,
Nsf*G,
frame,
subframe*2,
DCI->rnti);
}
uint8_t *DCI_pdu = DCI->pdu[i];
uint32_t rep = DCI->dci_repetitions[i]; /// repetition number
uint8_t eutra_control_region = 3;
uint8_t num_bits_of_DCI =DCI->A[i]; //DCI->dci_bits_length; /// value to be passed through nfapi when filling the PHY structures
uint32_t counter_rep = DCI->counter_repetition_number[i]; ////// Buffer for repetitions
DCI->counter_current_sf_repetition++;
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutro_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
DCI,
G, // number of bits per subframe
pointer_to_sf,
subframe,
RB_IoT_ID);
int G = get_G_NB_IoT(frame_parms);
//////////// uint8_t Nsf = DCI->number_of_subframes_for_resource_assignment;
if(DCI->counter_current_sf_repetition == rep)
{
DCI->pointer_to_subframe++;
if (Nsf == DCI->pointer_to_subframe)
{
DCI->active = 0;
done =1;
}
if( counter_rep == rep)
{
}
}
dci_encoding_NB_IoT(DCI_pdu, // Array of two DCI pdus, even if one DCI is to transmit , the number of DCI is indicated in dci_number
DCI, ////uint8_t *e[2], // *e should be e[2][G]
num_bits_of_DCI, //////A = number of bits of the DCI
G,
ncce_index,
agr_level);
npdcch_scrambling_NB_IoT(frame_parms,
DCI, // Input data
G, // Total number of bits to transmit in one subframe(case of DCI = G)
subframe*2, //XXX we pass the subframe // Slot number (0..19)
ncce_index,
agr_level);
}
if( ((counter_rep %4)== 0) && (counter_rep != rep) )
{
npdcch_scrambling_NB_IoT(frame_parms,
DCI, // Input data
G, // Total number of bits to transmit in one subframe(case of DCI = G)
subframe*2, //XXX we pass the subframe // Slot number (0..19)
ncce_index,
agr_level);
}
dci_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutra_control_region, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
DCI,
0, // npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
agr_level,
ncce_index,
subframe,
RB_IoT_ID);
DCI->counter_repetition_number[i]--;
if(DCI->counter_repetition_number[i] == 0)
{
DCI->active[i] = 0;
done =1;
}
}
}
return(done);
}
*/
////////////////////////////////////////////////// backup ///////////////////////////
//////////////////////////////////////////////////// SIB23 ////////////////////////////////////////////////////////////////////////
/* if( (subframe >0) && (subframe !=5) && (With_NSSS == 0) && (frame%2==1) && (frame%64<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) )
......
......@@ -57,7 +57,6 @@ void dci_encoding_NB_IoT(uint8_t *a, // Array of tw
NB_IoT_eNB_NPDCCH_t *dlcch, ////uint8_t *e[2], // *e should be e[2][G]
uint8_t A,
uint16_t G,
uint16_t rnti, // RNTI for UE specific or common search space
uint8_t ncce_index,
uint8_t agr_level) // Aggregation level
{
......@@ -73,7 +72,7 @@ void dci_encoding_NB_IoT(uint8_t *a, // Array of tw
}
memset((void *)dlcch->npdcch_d[ncce_index],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(A,2,a,dlcch->npdcch_d[ncce_index]+96,rnti); // CRC attachement & Tail-biting convolutional coding
ccode_encode_NB_IoT(A,2,a,dlcch->npdcch_d[ncce_index]+96,dlcch->rnti[ncce_index]); // CRC attachement & Tail-biting convolutional coding
RCC = sub_block_interleaving_cc_NB_IoT(D,dlcch->npdcch_d[ncce_index]+96,dlcch->npdcch_w[ncce_index]); // Interleaving
lte_rate_matching_cc_NB_IoT(RCC,(G/occupation_size),dlcch->npdcch_w[ncce_index],dlcch->npdcch_e[ncce_index]); // Rate Matching
......
......@@ -150,18 +150,19 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_IoT_eNB_NPDCCH_t *ndlcch,
NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t aggregation, //////????? maybe add the ncce index ??????????
uint8_t npdcch_start_symbol)
{
NB_IoT_DL_eNB_HARQ_t *ndlsch_harq = ndlsch->harq_process;
// NB_IoT_eNB_NPDCCH_t *ndlcch = ;
void *DLSCH_DCI_NB_IoT = NULL;
eNB->DCI_pdu = (DCI_PDU_NB_IoT*) malloc(sizeof(DCI_PDU_NB_IoT));
//N1 parameters
uint8_t ncce_index = 0;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type = 0;
......@@ -229,20 +230,25 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
/*Now configure the ndlsch structure*/
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
ndlsch->rnti = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlsch->active = 0; //will be activated by the corresponding NDSLCH pdu
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
ndlcch->A[ncce_index] = sizeof(DCIN1_RAR_t); // number of bits in DCI
//ndlcch->subframe_tx[subframe] = 1; // check if it's OK
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 0; //will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0) //this should be set from initialization (init-lte)
ndlcch->scheduling_delay[ncce_index] = Sched_delay;
ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlcch->repetition_number[ncce_index] = RepNum; // repetition number for NPDSCH
ndlcch->dci_repetitions[ncce_index] = DCIRep; ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
ndlcch->modulation[ncce_index] = 2; //QPSK
//// ////////////////////////////////////////////////if(ndlcch->round == 0) //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE_NB_IoT;
ndlsch_harq->mcs = mcs;
//ndlcch->status[ncce_index] = ACTIVE_NB_IoT;
ndlcch->mcs[ncce_index] = mcs;
/*
* TS 36.213 ch 16.4.1.5
......@@ -250,9 +256,9 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
* ISF = ResAssign
*/
ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign];
ndlsch_harq->subframe = subframe;
ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign];
//ndlcch->subframe[ncce_index] = subframe;
ndlcch->counter_repetition_number[ncce_index] = DCIRep; ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data
//ndlsch->error_treshold
//ndlsch->G??
......@@ -298,27 +304,32 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
add_dci_NB_IoT(eNB->DCI_pdu,DLSCH_DCI_NB_IoT,rnti,sizeof(DCIN1_t),aggregation,sizeof_DCIN1_t,DCIFormatN1,npdcch_start_symbol);
/*Now configure the ndlsch structure*/
ndlcch->A[ncce_index] = sizeof(DCIN1_t); // number of bits in DCI
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
ndlsch->rnti = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlsch->active = 0;//will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0){ //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE_NB_IoT;
ndlsch_harq->mcs = mcs;
ndlsch_harq->TBS = TBStable_NB_IoT[mcs][ResAssign]; // this table should be rewritten for nb-iot
}
ndlsch_harq->frame = frame;
ndlsch_harq->subframe = subframe;
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
//ndlcch->subframe_tx[subframe] = 1; // check if it's OK
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 0;//will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping.
ndlcch->scheduling_delay[ncce_index] = Sched_delay;
ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlcch->repetition_number[ncce_index] = RepNum;
ndlcch->dci_repetitions[ncce_index] = DCIRep; // ????????????? mapping with the table in spec, take into account Rmax
ndlcch->modulation[ncce_index] = 2; //QPSK
//if(ndlcch->round == 0){ //this should be set from initialization (init-lte)
//ndlcch->status[ncce_index] = ACTIVE_NB_IoT;
ndlcch->mcs[ncce_index] = mcs;
ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign]; // this table should be rewritten for nb-iot
ndlcch->counter_repetition_number[ncce_index] = DCIRep; ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//}
//ndlcch->frame[ncce_index] = frame;
//ndlcch->subframe[ncce_index] = subframe;
break;
......
......@@ -681,8 +681,12 @@ typedef struct {
////////////////////////////////////////////////////////
/// Active flag for baseband transmitter processing
uint8_t A[2]; // DCI length in bits
uint8_t active[2];
uint8_t modulation[2];
uint32_t length[2];
uint32_t ncce_index[2];
uint32_t aggregation_level[2];
......@@ -690,14 +694,16 @@ typedef struct {
uint32_t dci_format[2];
uint32_t scheduling_delay[2];
uint32_t resource_assignment[2];
// uint32_t repetition_number[2];
// uint32_t repetition_number[2];
uint32_t mcs[2];
uint32_t TBS[2];
uint32_t new_data_indicator[2];
uint32_t harq_ack_resource[2];
uint32_t npdcch_order_indication[2];
uint32_t dci_subframe_repetition_number[2];
////////////////////////////////////////////////////////
//UE specific parameters
uint16_t dci_repetitions[2];
uint16_t npdcch_NumRepetitions[2];
uint16_t repetition_number[2];
......@@ -706,8 +712,8 @@ typedef struct {
//////////////////////////////////////
uint32_t counter_repetition_number[2];
// uint32_t counter_current_sf_repetition[2];
// uint32_t pointer_to_subframe[2];
// uint32_t counter_current_sf_repetition[2];
// uint32_t pointer_to_subframe[2];
//////////////////////////////////////
uint16_t h_sfn_lsb;
......
......@@ -206,7 +206,7 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_IoT_eNB_NPDCCH_t *ndlcch,
NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t npdcch_start_symbol);
......@@ -307,8 +307,7 @@ int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
void dci_encoding_NB_IoT(uint8_t *a,
NB_IoT_eNB_NPDCCH_t *dlcch,
uint8_t A,
uint16_t G,
uint16_t rnti,
uint16_t G,
uint8_t ncce_index,
uint8_t agr_level);
......
......@@ -262,7 +262,9 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
} else {
With_NSSS = 0;
}
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// NPSS && NSSS //////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
if(subframe == 5)
{
......@@ -285,9 +287,9 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
RB_IoT_ID);
nsss_state = 1;
}
uint8_t *sib23_pdu = sib23->harq_process->pdu;
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// MIB //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
if(subframe == 0)
{
......@@ -299,31 +301,35 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
frame%64,
RB_IoT_ID);
}
//////////////////////////////// SIB1 //////////////////////////////
int sib1_state = 0;
if(subframe == 4)
{
sib1_state = generate_SIB1(sib1,
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID,
0);
}
//////////////////////////////// SIB23 ///////////////////////////////
if( (subframe != 0) && (subframe != 5) && (sib1_state != 1) && (nsss_state != 1))
{
generate_SIB23(sib23,
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID);
}
//////////////////////////////////////////////////// END ////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// SIB1 ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
int sib1_state = 0;
if(subframe == 4)
{
sib1_state = generate_SIB1(sib1,
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID,
0);
}
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// SIB23 ////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
if( (subframe != 0) && (subframe != 5) && (sib1_state != 1) && (nsss_state != 1))
{
generate_SIB23(sib23,
txdataF,
AMP,
fp,
frame,
subframe,
RB_IoT_ID);
}
///////////////////////////////// END ///////////////////////////////////////////
generate_pilots_NB_IoT(eNB,
txdataF,
......
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