Commit b5a55c13 authored by Matthieu Kanj's avatar Matthieu Kanj

version for testing NRS signal

parent 656ecb44
......@@ -18,7 +18,7 @@
#define __LTE_REFSIG_DEFS_NB_IOT__H__
#include "PHY/defs_NB_IoT.h"
#include "PHY/defs.h"
/** @ingroup _PHY_REF_SIG
* @{
*/
......@@ -40,7 +40,7 @@ void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
@param p antenna index
@param RB_IoT_ID the ID of the RB dedicated for NB_IoT
*/
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
......
......@@ -21,7 +21,7 @@
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h"
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
......@@ -76,6 +76,72 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
DevAssert( Ns < 20 );
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
k+=6;
}
return(0);
}
/////////////////////////////////////////////////////////////////////////
/*
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
unsigned char l,
unsigned char p,
unsigned short RB_IoT_ID) // the ID of the RB dedicated for NB_IoT
{
unsigned char nu,m;
unsigned short k,a;
unsigned short NB_IoT_start,bandwidth_even_odd;
int32_t qpsk[4];
a = (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a;
((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a;
((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a;
if ((p==0) && (l==0) )
nu = 0;
else if ((p==0) && (l>0))
nu = 3;
else if ((p==1) && (l==0))
nu = 3;
else if ((p==1) && (l>0))
nu = 0;
else {
printf("lte_dl_cell_spec_NB_IoT: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
// testing if the total number of RBs is even or odd
bandwidth_even_odd = phy_vars_eNB->frame_parms.N_RB_DL % 2; // 0 even, 1 odd
//mprime = 0; // mprime = 0,1 for NB_IoT // for LTE , maximum number of resources blocks (110) - the total number of RB in the selected bandwidth (.... 15 , 25 , 50, 100)
k = (nu + phy_vars_eNB->frame_parms.nushift)%6;
if(RB_IoT_ID < (phy_vars_eNB->frame_parms.N_RB_DL/2))
{ //XXX this mod operation is not valid since the second member is not an integer but double (for the moment i put a cast)
NB_IoT_start = phy_vars_eNB->frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} else {
//XXX invalid mod operation (put a cast for the moment)
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
}
k+=NB_IoT_start;
DevAssert( Ns < 20 );
DevAssert( l < 2 );
for (m=0; m<2; m++) {
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;
......@@ -84,3 +150,4 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
return(0);
}
*/
\ No newline at end of file
......@@ -359,7 +359,7 @@ void RX_NPRACH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_buffer){
uint32_t estimated_TA_coarse=0;
int16_t *Rx_sub_sampled_buffer_128,*Rx_sub_sampled_buffer_16;
uint16_t sub_sampling_rate; //NB-IoT: to be defined somewhere
uint32_t FRAME_LENGTH_COMPLEX_SAMPLES=0; // NB-IoT: length of input buffer, to be defined somewhere
uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx=0; // NB-IoT: length of input buffer, to be defined somewhere
uint32_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES; // Length of buffer after sub-sampling
uint32_t *length_ouput; // Length of buffer after sub-sampling
char coarse=1; // flag that indicate the level of TA estimation
......@@ -370,7 +370,7 @@ void RX_NPRACH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_buffer){
sub_sampling_rate = 128;
length_ouput = &FRAME_LENGTH_COMPLEX_SUB_SAMPLES;
Rx_sub_sampled_buffer_128 = sub_sampling_NB_IoT(Rx_buffer,FRAME_LENGTH_COMPLEX_SAMPLES,length_ouput, sub_sampling_rate);
Rx_sub_sampled_buffer_128 = sub_sampling_NB_IoT(Rx_buffer,FRAME_LENGTH_COMPLEX_SAMPLESx,length_ouput, sub_sampling_rate);
// Detection and TA estimation stage /============================================================/
......@@ -387,7 +387,7 @@ void RX_NPRACH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_buffer){
// Sub-sampling stage /============================================================/
sub_sampling_rate = 16;
Rx_sub_sampled_buffer_16 = sub_sampling_NB_IoT(Rx_buffer,FRAME_LENGTH_COMPLEX_SAMPLES,length_ouput, sub_sampling_rate);
Rx_sub_sampled_buffer_16 = sub_sampling_NB_IoT(Rx_buffer,FRAME_LENGTH_COMPLEX_SAMPLESx,length_ouput, sub_sampling_rate);
// Fine TA estimation stage /============================================================/
......
......@@ -12,34 +12,33 @@
* \warning
*/
//#include "PHY/defs.h"
#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT
uint16_t Ntti, // Ntti = 0..9
unsigned short RB_ID, // RB reserved for NB-IoT
unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{
NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT;
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms;
uint16_t subframe = Ntti;
uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
uint8_t first_pilot,second_pilot;
unsigned short RB_IoT_ID = RB_ID;
Nsymb = 14;
first_pilot = 5; // first pilot position
second_pilot = 6; // second pilot position
for (tti=0; tti<Ntti; tti++) { // loop on sub-frames
tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
slot_offset = (Ntti*2)%20;
if(subframe !=5 && ((With_NSSS*subframe)!= 9) ) // condition to avoid NPSS and NSSS signals
{
tti_offset = subframe*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512
slot_offset = (tti*2)%20; // 0, 2, 4, ....... 18
if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) { // condition to avoid NPSS and NSSS signals
//Generate Pilots for slot 0 and 1
......@@ -47,70 +46,171 @@ void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp,
RB_IoT_ID,
slot_offset,
0, //p
0);
0,
0,
RB_IoT_ID);
//antenna 0 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
0);
0,
RB_IoT_ID);
//antenna 0 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
0);
0,
RB_IoT_ID);
//antenna 0 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
0);
0,
RB_IoT_ID);
if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas
// antenna 1 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
0,
1);
1,
RB_IoT_ID);
// antenna 1 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
1);
1,
RB_IoT_ID);
//antenna 1 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
1);
1,
RB_IoT_ID);
// antenna 1 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
1);
1,
RB_IoT_ID);
}
}
}
}
//////////////////////////////////////////////////////
/*
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT
unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{
NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT;
uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
uint8_t first_pilot,second_pilot;
Nsymb = 14;
first_pilot = 5; // first pilot position
second_pilot = 6; // second pilot position
for (tti=0; tti<Ntti; tti++) { // loop on sub-frames
tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512
slot_offset = (tti*2)%20; // 0, 2, 4, ....... 18
if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) { // condition to avoid NPSS and NSSS signals
//Generate Pilots for slot 0 and 1
//antenna 0 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp,
RB_IoT_ID,
slot_offset,
0, //p
0);
//antenna 0 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
0);
//antenna 0 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
0);
//antenna 0 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
0);
if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas
// antenna 1 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
0,
1);
// antenna 1 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
1);
//antenna 1 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
1);
// antenna 1 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
1);
}
}
}
}
*/
\ No newline at end of file
......@@ -33,6 +33,7 @@
#define __LTE_TRANSPORT_PROTO_NB_IOT__H__
#include "PHY/defs_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/defs.h"
//#include <math.h>
//NPSS
......@@ -65,7 +66,7 @@ int nsss_extract_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
//NRS
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
......
......@@ -220,7 +220,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
int **txdataF = eNB->common_vars.txdataF[0];
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
uint16_t Ntti = 10; //ntti = 10
//uint16_t Ntti = 10; //ntti = 10
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
......@@ -260,17 +260,14 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
RB_IoT_ID);
}
/*else
{
generate_pilots_NB_IoT(eNB,
txdataF,
AMP,
Ntti,
subframe,
RB_IoT_ID,
With_NSSS);
}
*/
With_NSSS);
}
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_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