Commit 2300b9fc authored by Matthieu Kanj's avatar Matthieu Kanj

bug correction for pilots

parent a94b0562
......@@ -1382,6 +1382,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
if (eNB->node_function != NGFI_RRU_IF4p5) {
lte_gold(fp,eNB->lte_gold_table,fp->Nid_cell);
// NB-IoT testing
lte_gold_NB_IoT(fp,eNB->lte_gold_table_NB_IoT,fp->Nid_cell);
//////////////////////////////////////////////////////////
generate_pcfich_reg_mapping(fp);
generate_phich_reg_mapping(fp);
......@@ -1708,7 +1712,7 @@ int phy_init_lte_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
if (eNB->node_function != NGFI_RRU_IF4p5_NB_IoT) {
lte_gold_NB_IoT(fp,eNB->lte_gold_table_NB_IoT,fp->Nid_cell);
// lte_gold_NB_IoT(fp,eNB->lte_gold_table_NB_IoT,fp->Nid_cell); ****** uncomment when this function is used - 16/02/2018
// generate_pcfich_reg_mapping(fp);
// generate_phich_reg_mapping(fp);
......
......@@ -27,7 +27,7 @@
@param lte_gold_table pointer to table where sequences are stored
@param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
void lte_gold_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t lte_gold_table_NB_IoT[20][2][14],
uint16_t Nid_cell);
......
......@@ -77,7 +77,7 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
DevAssert( l < 2 );
for (m=0; m<2; m++) {
output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][0]) & 3]; //TODO should be defined one for NB-IoT
output[k] = qpsk[(phy_vars_eNB->lte_gold_table_NB_IoT[Ns][l][0]) & 3]; //TODO should be defined one for NB-IoT
k+=6;
}
......
......@@ -15,7 +15,7 @@
//#include "defs.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell) // Nid_cell = Nid_cell_NB_IoT
void lte_gold_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell) // Nid_cell = Nid_cell_NB_IoT
{
unsigned char ns,l,Ncp=1;
unsigned int n,x1,x2;
......
......@@ -147,6 +147,9 @@ typedef enum {
typedef struct {
/// NB-IoT
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t si_rnti; ///(=0xfff4)
SCH_status_NB_IoT_t status;
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
......@@ -194,9 +197,60 @@ typedef struct {
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
} NB_IoT_DL_eNB_SIB1_t;
typedef struct {
/// NB-IoT
SCH_status_NB_IoT_t status;
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
uint8_t dci_subframe_repetitions;
/// 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];
/// data after scrambling
uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IoT];
//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
/// Sub-block interleaver outputs
uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IoT+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;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
//this index will be used mainly for SI message buffer
uint8_t pdu_buffer_index;
} NB_IoT_DL_eNB_HARQ_t;
/*
typedef struct { // LTE_eNB_DLSCH_t
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
uint32_t *txdataF[8];
......@@ -217,7 +271,9 @@ typedef struct { // LTE_eNB_DLSCH_t
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
NB_IoT_DL_eNB_HARQ_t harq_process;
NB_IoT_DL_eNB_HARQ_t harq_process2;
NB_IoT_DL_eNB_SIB1_t harq_process;
/// circular list of free harq PIDs (the oldest come first)
/// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
int harq_pid_freelist[10];
......@@ -243,6 +299,7 @@ typedef struct { // LTE_eNB_DLSCH_t
int16_t sqrt_rho_b;
} NB_IoT_eNB_DLSCH_t;
*/
typedef struct {
......@@ -547,9 +604,11 @@ typedef struct {
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
///in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required///
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
NB_IoT_DL_eNB_SIB1_t harq_process_sib1;
/// Number of soft channel bits
uint32_t G;
/// Maximum number of HARQ rounds
......@@ -571,7 +630,7 @@ typedef struct {
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
/*SIB1-NB related parameters*/
///SIB1-NB related parameters//
///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
uint8_t sib1_rep_start;
///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
......
......@@ -85,7 +85,7 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits,
int dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_NDLSCH_t *dlsch,
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G) // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
{
......@@ -94,12 +94,12 @@ int dlsch_encoding_NB_IoT(unsigned char *a,
unsigned int A;
uint8_t RCC;
A = dlsch->harq_process.TBS; // 680
dlsch->harq_process.length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
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
int32_t numbits = A+24;
if (dlsch->harq_process.round == 0) { // This is a new packet
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,16 +107,16 @@ 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.B = numbits; // The length of table b in bits
dlsch->harq_process_sib1.B = numbits; // The length of table b in bits
memcpy(dlsch->harq_process.b,a,numbits/8);
memset(dlsch->harq_process.d,LTE_NULL_NB_IoT,96);
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.b, dlsch->harq_process.d+96, crc); // step 1 Tail-biting convolutional coding
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.d+96,dlsch->harq_process.w); // step 2 interleaving
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_process_sib1.d+96,dlsch->harq_process_sib1.w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_process.length_e,dlsch->harq_process.w,dlsch->harq_process.e); // step 3 Rate Matching
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
}
return(0);
......
......@@ -119,7 +119,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_DLSCH_t *dlsch0,
NB_IoT_eNB_NDLSCH_t *dlsch0,
int G, // number of bits per subframe
unsigned npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned short NB_IoT_RB_ID)
......@@ -164,7 +164,7 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
txdataF,
&jj,
symbol_offset,
&dlsch0->harq_process.s_e[G*npdsch_data_subframe],
&dlsch0->harq_process_sib1.s_e[G*npdsch_data_subframe],
pilots,
amp,
id_offset,
......
......@@ -25,27 +25,31 @@
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void dlsch_scrambling_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_DLSCH_t *dlsch,
int G, // total number of bits to transmit
void dlsch_sib1_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NDLSCH_t *dlsch,
int tot_bits, // total number of bits to transmit
uint8_t Nf, // Nf is the frame number (0..9)
uint8_t Ns) // slot number (0..19)
{
int i,j,k=0;
uint32_t x1,x2, s=0;
uint8_t *e = dlsch->harq_process.e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
uint8_t *e = dlsch->harq_process_sib1.e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
x2 = (dlsch->rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 10.2.3.1
x2 = (dlsch->harq_process_sib1.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
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
for (i=0; i<(1+(G>>5)); i++) {
for (i=0; i<(1+(tot_bits>>5)); i++) {
for (j=0; j<32; j++,k++) {
dlsch->harq_process.s_e[k] = (e[k]&1) ^ ((s>>j)&1);
dlsch->harq_process_sib1.s_e[k] = (e[k]&1) ^ ((s>>j)&1);
}
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
......
......@@ -229,13 +229,13 @@ int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_DLSCH_t *dlsch0,
NB_IoT_eNB_NDLSCH_t *dlsch0,
int G, // number of bits per subframe
unsigned npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned short NB_IoT_RB_ID);
int32_t dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_NDLSCH_t *dlsch,
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G); // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
......
......@@ -326,6 +326,10 @@ typedef struct PHY_VARS_eNB_s {
/// cell-specific reference symbols
uint32_t lte_gold_table[20][2][14];
/// cell-specific reference symbols
uint32_t lte_gold_table_NB_IoT[20][2][14];
/// UE-specific reference symbols (p=5), TM 7
uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][38];
......@@ -507,6 +511,7 @@ typedef struct PHY_VARS_eNB_s {
NB_IoT_eNB_NPBCH_t npbch;
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX];
NB_IoT_eNB_NDLSCH_t ndlsch_SIB1;
//////////////////// END /////////////////////////////////
......
......@@ -530,7 +530,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
void (*do_prach)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int frame,int subframe);
void (*fep)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
int (*td)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int UE_id,int harq_pid,int llr8_flag);
int (*te)(struct PHY_VARS_eNB_NB_IoT_s *,uint8_t *,uint8_t,NB_IoT_eNB_DLSCH_t *,int,uint8_t,time_stats_t_NB_IoT *,time_stats_t_NB_IoT *,time_stats_t_NB_IoT *);
int (*te)(struct PHY_VARS_eNB_NB_IoT_s *,uint8_t *,uint8_t,NB_IoT_eNB_NDLSCH_t *,int,uint8_t,time_stats_t_NB_IoT *,time_stats_t_NB_IoT *,time_stats_t_NB_IoT *);
void (*proc_uespec_rx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,const relaying_type_t_NB_IoT r_type);
void (*proc_tx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,relaying_type_t_NB_IoT r_type,PHY_VARS_RN_NB_IoT *rn);
void (*tx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
......
......@@ -219,6 +219,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms_NB_IoT;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
NB_IoT_eNB_NPBCH_t *broadcast_str = &eNB->npbch;
NB_IoT_eNB_NDLSCH_t *sib1 = &eNB->ndlsch_SIB1;
int **txdataF = eNB->common_vars.txdataF[0];
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
......@@ -226,7 +227,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
int RB_IoT_ID=2 ; // XXX should be initialized (RB reserved for NB-IoT, PRB index)
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();
//NSSS only happened in the even frame
if(frame%2==0)
{
......@@ -279,6 +280,42 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
RB_IoT_ID);
}
// SIB1
/*
if(subframe == 4)
{
*/
/*
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)
}
if(Number_of_sib1_subframe > 1)
*/
}
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_NB_IoT_t *UL_INFO)
......
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