Commit 48c24e5f authored by Raymond Knopp's avatar Raymond Knopp

testing successful with 122.88 Ms/s, format A2, NCS 13

parent ef27c8ce
...@@ -207,7 +207,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -207,7 +207,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t)); prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t));
prach_vars->rxsigF[0] = (int16_t **)malloc16_clear(64*sizeof(int16_t *));
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
//FIXME //FIXME
......
...@@ -93,7 +93,6 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -93,7 +93,6 @@ int nr_phy_init_RU(RU_t *ru) {
// AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]), // AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
// "nb_antennas_rx too large"); // "nb_antennas_rx too large");
ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*)); ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (j=0;j<4;j++) ru->prach_rxsigF_br[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (i=0; i<ru->nb_rx; i++) { for (i=0; i<ru->nb_rx; i++) {
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) ); ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
...@@ -172,9 +171,6 @@ void nr_phy_free_RU(RU_t *ru) ...@@ -172,9 +171,6 @@ void nr_phy_free_RU(RU_t *ru)
for (i = 0; i < ru->nb_rx; i++) { for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[i]); free_and_zero(ru->prach_rxsigF[i]);
} }
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j]);
free_and_zero(ru->prach_rxsigF);
/* ru->prach_rxsigF_br is not allocated -> don't free */
for (i = 0; i < RC.nb_nr_L1_inst; i++) { for (i = 0; i < RC.nb_nr_L1_inst; i++) {
for (p = 0; p < 15; p++) { for (p = 0; p < 15; p++) {
......
...@@ -61,42 +61,18 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -61,42 +61,18 @@ void rx_nr_prach_ru(RU_t *ru,
uint8_t prach_fmt = get_nr_prach_fmt(prach_ConfigIndex,fp->frame_type,fp->freq_range); uint8_t prach_fmt = get_nr_prach_fmt(prach_ConfigIndex,fp->frame_type,fp->freq_range);
rxsigF = ru->prach_rxsigF; rxsigF = ru->prach_rxsigF;
if (LOG_DEBUGFLAG(PRACH)){
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, msg1_frequencystart %d, prach_ConfigIndex %d\n",
subframe,fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart,prach_ConfigIndex);
}
for (int aa=0; aa<ru->nb_rx; aa++) { AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n");
if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node for (int aa=0; aa<ru->nb_rx; aa++)
// DJP - indexing below in subframe zero takes us off the beginning of the array??? prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_slot<<1)-ru->N_TA_offset];
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
if (LOG_DUMPFLAG(PRACH)){
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
int8_t dbEn0 = dB_fixed(en0);
int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
char buffer[80];
if (dbEn0>32 && prach[0]!= NULL) {
static int counter=0;
sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
LOG_M(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
}
if (dB_fixed(en0)>32) {
sprintf(buffer, "rach_dBm:%d",rach_dBm);
if (prach[0]!= NULL) LOG_M("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
LOG_I(PHY,"RU %d, frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d %s rxdata:%p index:%d\n",
ru->idx,frame,subframe,fp->samples_per_tti,
prach[aa],dbEn0,ru->N_TA_offset,buffer,ru->common.rxdata[aa],
(subframe*fp->samples_per_tti)-ru->N_TA_offset);
}
}
}
}
int mu = fp->numerology_index; int mu = fp->numerology_index;
int Ncp; int Ncp;
int16_t *prach2; int16_t *prach2;
switch (prach_fmt) { switch (prach_fmt) {
case 0: case 0:
Ncp = 3168; Ncp = 3168;
...@@ -176,7 +152,14 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -176,7 +152,14 @@ void rx_nr_prach_ru(RU_t *ru,
int n_ra_prb = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart; int n_ra_prb = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart;
int k = (12*n_ra_prb) - 6*fp->N_RB_UL; int k = (12*n_ra_prb) - 6*fp->N_RB_UL;
int N_ZC = (prach_fmt<4)?839:139;
if (k<0) k+=(fp->ofdm_symbol_size);
k*=K;
k+=kbar;
int reps=1;
int dftlen=0;
for (int aa=0; aa<ru->nb_rx; aa++) { for (int aa=0; aa<ru->nb_rx; aa++) {
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa); AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
...@@ -188,124 +171,188 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -188,124 +171,188 @@ void rx_nr_prach_ru(RU_t *ru,
else if (fp->N_RB_UL < 137) { else if (fp->N_RB_UL < 137) {
if (fp->threequarter_fs==0) { if (fp->threequarter_fs==0) {
//40 MHz @ 61.44 Ms/s //40 MHz @ 61.44 Ms/s
//50 MHz @ 61.44 Ms/s //50 MHz @ 61.44 Ms/s
prach2 = prach[aa] + (Ncp<<2); prach2 = prach[aa] + (Ncp<<2);
if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2)
dft49152(prach2,rxsigF[aa],1); dft49152(prach2,rxsigF[aa],1);
if (prach_fmt == 1 || prach_fmt == 2) if (prach_fmt == 1 || prach_fmt == 2) {
dft49152(prach2+98304,rxsigF[aa]+98304,1); dft49152(prach2+98304,rxsigF[aa]+98304,1);
reps++;
}
if (prach_fmt == 2) { if (prach_fmt == 2) {
dft49152(prach2+(98304*2),rxsigF[aa]+(98304*2),1); dft49152(prach2+(98304*2),rxsigF[aa]+(98304*2),1);
dft49152(prach2+(98304*3),rxsigF[aa]+(98304*3),1); dft49152(prach2+(98304*3),rxsigF[aa]+(98304*3),1);
reps+=2;
} }
if (prach_fmt == 3) if (prach_fmt == 3) {
for (int i=0;i<4;i++) dft12288(prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1); for (int i=0;i<4;i++) dft12288(prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1);
reps=4;
}
if (prach_fmt >3) { if (prach_fmt >3) {
dft2048(prach2,rxsigF[aa],1); dft2048(prach2,rxsigF[aa],1);
if (prach_fmt != 0xc0) dft2048(prach2+4096,rxsigF[aa]+4096,1); if (prach_fmt != 0xc0) {
dft2048(prach2+4096,rxsigF[aa]+4096,1);
reps++;
}
} }
if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) { if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {
dft2048(prach2+4096*2,rxsigF[aa]+4096*2,1); dft2048(prach2+4096*2,rxsigF[aa]+4096*2,1);
dft2048(prach2+4096*3,rxsigF[aa]+4096*3,1); dft2048(prach2+4096*3,rxsigF[aa]+4096*3,1);
reps+=2;
} }
if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) { if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {
dft2048(prach2+4096*4,rxsigF[aa]+4096*4,1); dft2048(prach2+4096*4,rxsigF[aa]+4096*4,1);
dft2048(prach2+4096*5,rxsigF[aa]+4096*5,1); dft2048(prach2+4096*5,rxsigF[aa]+4096*5,1);
reps+=2;
} }
if (prach_fmt == 0xc2) if (prach_fmt == 0xc2) {
for (int i=6;i<11;i++) dft2048(prach2+(3072*i),rxsigF[aa]+(3072*i),1); for (int i=6;i<11;i++) dft2048(prach2+(3072*i),rxsigF[aa]+(3072*i),1);
reps+=6;
}
} else { } else {
// 40 MHz @ 46.08 Ms/s // 40 MHz @ 46.08 Ms/s
prach2 = prach[aa] + (3*Ncp); prach2 = prach[aa] + (3*Ncp);
AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n"); AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n");
if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) {
dft36864(prach2,rxsigF[aa],1); dft36864(prach2,rxsigF[aa],1);
if (prach_fmt == 1 || prach_fmt == 2) reps++;
}
if (prach_fmt == 1 || prach_fmt == 2) {
dft36864(prach2+73728,rxsigF[aa]+73728,1); dft36864(prach2+73728,rxsigF[aa]+73728,1);
if (prach_fmt == 3) reps++;
}
if (prach_fmt == 2) {
dft36864(prach2+(98304*2),rxsigF[aa]+(98304*2),1);
dft36864(prach2+(98304*3),rxsigF[aa]+(98304*3),1);
reps+=2;
}
if (prach_fmt == 3) {
for (int i=0;i<4;i++) dft9216(prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1); for (int i=0;i<4;i++) dft9216(prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1);
reps=4;
}
if (prach_fmt >3) { if (prach_fmt >3) {
dft1536(prach2,rxsigF[aa],1); dft1536(prach2,rxsigF[aa],1);
if (prach_fmt != 0xc0) dft1536(prach2+3072,rxsigF[aa]+3072,1); if (prach_fmt != 0xc0) {
dft1536(prach2+3072,rxsigF[aa]+3072,1);
reps++;
}
} }
if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) { if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {
dft1536(prach2+3072*2,rxsigF[aa]+3072*2,1); dft1536(prach2+3072*2,rxsigF[aa]+3072*2,1);
dft1536(prach2+3072*3,rxsigF[aa]+3072*3,1); dft1536(prach2+3072*3,rxsigF[aa]+3072*3,1);
reps+=2;
} }
if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) { if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {
dft1536(prach2+3072*4,rxsigF[aa]+3072*4,1); dft1536(prach2+3072*4,rxsigF[aa]+3072*4,1);
dft1536(prach2+3072*5,rxsigF[aa]+3072*5,1); dft1536(prach2+3072*5,rxsigF[aa]+3072*5,1);
reps+=2;
} }
if (prach_fmt == 0xc2) if (prach_fmt == 0xc2) {
for (int i=6;i<11;i++) dft1536(prach2+(3072*i),rxsigF[aa]+(3072*i),1); for (int i=6;i<11;i++) dft1536(prach2+(3072*i),rxsigF[aa]+(3072*i),1);
reps+=6;
}
} }
} }
else if (fp->N_RB_UL <= 273) { else if (fp->N_RB_UL <= 273) {
if (fp->threequarter_fs==0) { if (fp->threequarter_fs==0) {
prach2 = prach[aa] + (Ncp<<3);
dftlen=98304;
//80,90,100 MHz @ 61.44 Ms/s //80,90,100 MHz @ 61.44 Ms/s
if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2)
dft98304(prach2,rxsigF[aa],1); dft98304(prach2,rxsigF[aa],1);
if (prach_fmt == 1 || prach_fmt == 2) if (prach_fmt == 1 || prach_fmt == 2) {
dft98304(prach2+196608,rxsigF[aa]+196608,1); dft98304(prach2+196608,rxsigF[aa]+196608,1);
if (prach_fmt == 3) reps++;
dft98304(prach2+(2*196608),rxsigF[aa]+(2*196608),1); }
if (prach_fmt == 1 || prach_fmt == 2) {
dft98304(prach2+196608,rxsigF[aa]+196608,1);
dft98304(prach2+(196608*2),rxsigF[aa]+(196608*2),1);
reps+=2;
}
if (prach_fmt == 3) {
dft24576(prach2+(2*49152),rxsigF[aa]+(2*49152),1);
reps=4;
dftlen=24576;
}
if (prach_fmt >3) { if (prach_fmt >3) {
dftlen=4096;
dft4096(prach2,rxsigF[aa],1); dft4096(prach2,rxsigF[aa],1);
if (prach_fmt != 0xc0) dft4096(prach2+8192,rxsigF[aa]+8192,1); if (prach_fmt != 0xc0) {
dft4096(prach2+8192,rxsigF[aa]+8192,1);
reps++;
}
} }
if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) { if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {
dft4096(prach2+8192*2,rxsigF[aa]+8192*2,1); dft4096(prach2+8192*2,rxsigF[aa]+8192*2,1);
dft4096(prach2+8192*3,rxsigF[aa]+8192*3,1); dft4096(prach2+8192*3,rxsigF[aa]+8192*3,1);
reps+=2;
} }
if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) { if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {
dft4096(prach2+8192*4,rxsigF[aa]+8192*4,1); dft4096(prach2+8192*4,rxsigF[aa]+8192*4,1);
dft4096(prach2+8192*5,rxsigF[aa]+8192*5,1); dft4096(prach2+8192*5,rxsigF[aa]+8192*5,1);
reps+=2;
} }
if (prach_fmt == 0xc2) if (prach_fmt == 0xc2) {
for (int i=6;i<11;i++) dft4096(prach2+(8192*i),rxsigF[aa]+(8192*i),1); for (int i=6;i<11;i++) dft4096(prach2+(8192*i),rxsigF[aa]+(8192*i),1);
reps+=6;
}
} else { } else {
AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n"); AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n");
prach2 = prach[aa] + (6*Ncp);
// 80 MHz @ 46.08 Ms/s // 80 MHz @ 46.08 Ms/s
if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) dftlen=73728;
if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) {
dft73728(prach2,rxsigF[aa],1); dft73728(prach2,rxsigF[aa],1);
if (prach_fmt == 1 || prach_fmt == 2) reps++;
}
if (prach_fmt == 1 || prach_fmt == 2) {
dft73728(prach2+(2*73728),rxsigF[aa]+(2*73728),1); dft73728(prach2+(2*73728),rxsigF[aa]+(2*73728),1);
if (prach_fmt == 3) reps++;
}
if (prach_fmt == 3) {
dft73728(prach2+(4*73728),rxsigF[aa]+(4*73728),1); dft73728(prach2+(4*73728),rxsigF[aa]+(4*73728),1);
reps=4;
dftlen=18432;
}
if (prach_fmt >3) { if (prach_fmt >3) {
dftlen=3072;
dft3072(prach2,rxsigF[aa],1); dft3072(prach2,rxsigF[aa],1);
if (prach_fmt != 0xc0) dft3072(prach2+6144,rxsigF[aa]+6144,1); if (prach_fmt != 0xc0) {
dft3072(prach2+6144,rxsigF[aa]+6144,1);
reps++;
}
} }
if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) { if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {
dft3072(prach2+6144*2,rxsigF[aa]+6144*2,1); dft3072(prach2+6144*2,rxsigF[aa]+6144*2,1);
dft3072(prach2+6144*3,rxsigF[aa]+6144*3,1); dft3072(prach2+6144*3,rxsigF[aa]+6144*3,1);
reps+=2;
} }
if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) { if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {
dft3072(prach2+6144*4,rxsigF[aa]+6144*4,1); dft3072(prach2+6144*4,rxsigF[aa]+6144*4,1);
dft3072(prach2+6144*5,rxsigF[aa]+6144*5,1); dft3072(prach2+6144*5,rxsigF[aa]+6144*5,1);
reps+=2;
} }
if (prach_fmt == 0xc2) if (prach_fmt == 0xc2) {
for (int i=6;i<11;i++) dft3072(prach2+(6144*i),rxsigF[aa]+(6144*i),1); for (int i=6;i<11;i++) dft3072(prach2+(6144*i),rxsigF[aa]+(6144*i),1);
reps+=6;
}
} }
} }
if (k<0) k+=(fp->ofdm_symbol_size); //Coherent combining of PRACH repetitions (assumes channel does not change, to be revisted for "long" PRACH)
int16_t rxsigF_tmp[N_ZC<<1];
k*=K; // if (k+N_ZC > dftlen) { // PRACH signal is split around DC
k+=kbar; int16_t *rxsigF2=rxsigF[aa];
k*=2; int k2=k<<1;
int dftsize_x2 = fp->ofdm_symbol_size*24;
//LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k); for (int j=0;j<N_ZC<<1;j++,k2++) {
if (k2==(dftlen<<1)) k2=0;
if ((k+(839*2)) > dftsize_x2) { // PRACH signal is split around DC rxsigF_tmp[j] = rxsigF2[k2];
memmove((void*)&rxsigF[aa][dftsize_x2-k],(void*)&rxsigF[aa][0],(k+(839*2)-dftsize_x2)*2); for (int i=1;i<reps;i++) rxsigF_tmp[j] += rxsigF2[k2+(i*N_ZC<<1)];
memmove((void*)&rxsigF[aa][0],(void*)(&rxsigF[aa][k]),(dftsize_x2-k)*2);
} }
else // PRACH signal is not split around DC memcpy((void*)rxsigF2,(void *)rxsigF_tmp,N_ZC<<2);
memmove((void*)&rxsigF[aa][0],(void*)(&rxsigF[aa][k]),839*4);
} }
} }
...@@ -343,7 +390,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -343,7 +390,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint16_t numshift=0; uint16_t numshift=0;
uint16_t *prach_root_sequence_map; uint16_t *prach_root_sequence_map;
uint8_t not_found; uint8_t not_found;
int k=0;
uint16_t u; uint16_t u;
int16_t *Xu=0; int16_t *Xu=0;
uint16_t offset; uint16_t offset;
...@@ -353,7 +399,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -353,7 +399,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint8_t aa; uint8_t aa;
int32_t lev; int32_t lev;
int16_t levdB; int16_t levdB;
int fft_size,log2_ifft_size; int log2_ifft_size=10;
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32))); int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
int32_t *prach_ifft=(int32_t*)NULL; int32_t *prach_ifft=(int32_t*)NULL;
...@@ -379,7 +425,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -379,7 +425,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
prach_ifft = gNB->prach_vars.prach_ifft; prach_ifft = gNB->prach_vars.prach_ifft;
prachF = gNB->prach_vars.prachF; prachF = gNB->prach_vars.prachF;
if (LOG_DEBUGFLAG(PRACH)){ if (LOG_DEBUGFLAG(PRACH)){
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart,prach_ConfigIndex,rootSequenceIndex); if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart,prach_ConfigIndex,rootSequenceIndex);
} }
...@@ -417,40 +463,17 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -417,40 +463,17 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
// Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839 // Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839
NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139); NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139);
if (NCS2==0) if (NCS2==0) NCS2 = N_ZC;
NCS2 = N_ZC;
preamble_offset_old = 99; preamble_offset_old = 99;
uint8_t update_TA = 4;
uint8_t update_TA2 = 1;
switch (gNB->frame_parms.N_RB_DL) {
case 6:
update_TA = 16;
break;
case 25:
update_TA = 4;
break;
case 50:
update_TA = 2;
break;
case 75:
update_TA = 3;
update_TA2 = 2;
case 100:
update_TA = 1;
break;
}
*max_preamble_energy=0; *max_preamble_energy=0;
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) { for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
if (LOG_DEBUGFLAG(PRACH)){ if (LOG_DEBUGFLAG(PRACH)){
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],(N_ZC==839) ? 840: 140));
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d \n",frame,subframe,preamble_index); if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d \n",frame,subframe,preamble_index);
} }
if (restricted_set == 0) { if (restricted_set == 0) {
...@@ -537,11 +560,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -537,11 +560,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
// Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex // Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex
if (LOG_DEBUGFLAG(PRACH)) { if (LOG_DEBUGFLAG(PRACH)) {
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d: offset %d, preamble shift %d , en %d)\n", if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d, NCS %d, NCS_config %d, N_ZC/NCS %d: offset %d, preamble shift %d , en %d)\n",
frame,subframe,preamble_index,preamble_offset,preamble_shift,en); frame,subframe,preamble_index,NCS,Ncs_config,N_ZC/NCS,preamble_offset,preamble_shift,en);
} }
log2_ifft_size = 10;
fft_size = 6144;
if (new_dft == 1) { if (new_dft == 1) {
new_dft = 0; new_dft = 0;
...@@ -552,20 +573,16 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -552,20 +573,16 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
memset(prachF, 0, sizeof(int16_t)*2*1024 ); memset(prachF, 0, sizeof(int16_t)*2*1024 );
if (LOG_DUMPFLAG(PRACH)) { if (LOG_DUMPFLAG(PRACH)) {
LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1); LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1);
LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1); LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
} }
for (aa=0;aa<nb_rx; aa++) { for (aa=0;aa<nb_rx; aa++) {
// Do componentwise product with Xu* on each antenna // Do componentwise product with Xu* on each antenna
k=0;
for (offset=0; offset<(N_ZC<<1); offset+=2) { for (offset=0; offset<(N_ZC<<1); offset+=2) {
prachF[offset] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][k] + (int32_t)Xu[offset+1]*rxsigF[aa][k+1])>>15); prachF[offset] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset] + (int32_t)Xu[offset+1]*rxsigF[aa][offset+1])>>15);
prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][k+1] - (int32_t)Xu[offset+1]*rxsigF[aa][k])>>15); prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15);
k+=2;
if (k==(12*2*fp->ofdm_symbol_size))
k=0;
} }
// Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
...@@ -591,10 +608,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -591,10 +608,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
} // new dft } // new dft
// check energy in nth time shift, for // check energy in nth time shift, for
if (LOG_DEBUGFLAG(PRACH)){
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain , en %d)\n",frame,subframe,en);
}
preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC)); preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
...@@ -604,7 +618,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -604,7 +618,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
if (levdB>*max_preamble_energy) { if (levdB>*max_preamble_energy) {
*max_preamble_energy = levdB; *max_preamble_energy = levdB;
*max_preamble_delay = ((i*fft_size)>>log2_ifft_size)*update_TA/update_TA2; *max_preamble_delay = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate
*max_preamble = preamble_index; *max_preamble = preamble_index;
} }
} }
...@@ -613,7 +627,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -613,7 +627,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
if (LOG_DUMPFLAG(PRACH)) { if (LOG_DUMPFLAG(PRACH)) {
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
if (en>60) { if (en>60) {
k = (12*n_ra_prb) - 6*fp->N_RB_UL; int k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0) k+=fp->ofdm_symbol_size; if (k<0) k+=fp->ofdm_symbol_size;
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#define NR_PRACH_DEBUG 1
extern uint16_t NCS_unrestricted_delta_f_RA_125[16]; extern uint16_t NCS_unrestricted_delta_f_RA_125[16];
extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15]; extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15];
...@@ -76,7 +75,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -76,7 +75,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
uint8_t prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; uint8_t prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; uint8_t Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
uint8_t restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag; uint8_t restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag;
//uint8_t n_ra_prboffset = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart;
uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex;
//uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; //uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index;
int16_t *prachF = ue->prach_vars[eNB_id]->prachF; int16_t *prachF = ue->prach_vars[eNB_id]->prachF;
...@@ -85,7 +83,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -85,7 +83,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
int16_t *prach2; int16_t *prach2;
int16_t amp = ue->prach_vars[eNB_id]->amp; int16_t amp = ue->prach_vars[eNB_id]->amp;
int16_t Ncp; int16_t Ncp;
uint8_t n_ra_prb;
uint16_t NCS=0; uint16_t NCS=0;
uint16_t *prach_root_sequence_map; uint16_t *prach_root_sequence_map;
uint16_t preamble_offset,preamble_shift; uint16_t preamble_offset,preamble_shift;
...@@ -97,7 +94,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -97,7 +94,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
//uint8_t f_ra,t1_ra; //uint8_t f_ra,t1_ra;
uint16_t N_ZC = (prach_fmt<4)?839:139; uint16_t N_ZC = (prach_fmt<4)?839:139;
uint8_t not_found; uint8_t not_found;
int k;
int16_t *Xu; int16_t *Xu;
uint16_t u; uint16_t u;
int32_t Xu_re,Xu_im; int32_t Xu_re,Xu_im;
...@@ -107,7 +103,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -107,7 +103,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
uint16_t first_nonzero_root_idx=0; uint16_t first_nonzero_root_idx=0;
#if defined(OAI_USRP) #if defined(OAI_USRP)
prach_start = (ue->rx_offset+subframe*(fp->samples_per_tti<<1)-ue->hw_timing_advance-ue->N_TA_offset); prach_start = (ue->rx_offset+subframe*(fp->samples_per_slot<<1)-ue->hw_timing_advance-ue->N_TA_offset);
#ifdef NR_PRACH_DEBUG #ifdef NR_PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start, prach_start,
...@@ -117,14 +113,14 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -117,14 +113,14 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
#endif #endif
if (prach_start<0) if (prach_start<0)
prach_start+=((fp->samples_per_tti<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); prach_start+=((fp->samples_per_slot<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
if (prach_start>=((fp->samples_per_tti<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) if (prach_start>=((fp->samples_per_slot<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
prach_start-=((fp->samples_per_tti<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); prach_start-=((fp->samples_per_slot<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
#else //normal case (simulation) #else //normal case (simulation)
prach_start = subframe*(fp->samples_per_tti<<1)-ue->N_TA_offset; prach_start = subframe*(fp->samples_per_slot<<1)-ue->N_TA_offset;
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start, prach_start,
ue->rx_offset, ue->rx_offset,
ue->hw_timing_advance, ue->hw_timing_advance,
...@@ -162,47 +158,8 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -162,47 +158,8 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
NCS = NCS_unrestricted_delta_f_RA_15[Ncs_config]; NCS = NCS_unrestricted_delta_f_RA_15[Ncs_config];
} }
n_ra_prb = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart;
// n_ra_prb = get_nr_prach_prb_offset(&(ue->frame_parms),
// fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
// fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart,
// tdd_mapindex,
// Nf,
// prach_fmt);
prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map_0_3 : prach_root_sequence_map_abc; prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map_0_3 : prach_root_sequence_map_abc;
/*
// this code is not part of get_prach_prb_offset
if (frame_type == TDD) { // TDD
if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
LOG_E( PHY, "[PHY][UE %"PRIu8"] Illegal prach_ConfigIndex %"PRIu8" for ", ue->Mod_id, prach_ConfigIndex );
}
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
if (prach_fmt < 4) {
if ((f_ra&1) == 0) {
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
} else {
n_ra_prb = fp->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
}
} else {
if ((tdd_config >2) && (tdd_config<6))
Nsp = 2;
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
n_ra_prb = 6*f_ra;
} else {
n_ra_prb = fp->N_RB_UL - 6*(f_ra+1);
}
}
}
*/
// This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index // This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS))); preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
...@@ -274,31 +231,70 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -274,31 +231,70 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
#ifdef NR_PRACH_DEBUG #ifdef NR_PRACH_DEBUG
if (NCS>0) if (NCS>0)
LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, PRACH Format %x, prach_ConfigIndex %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n", LOG_D(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, PRACH Format %x, prach_ConfigIndex %d, NCS %d (NCS_config %d, N_ZC/NCS %d): Preamble_offset %d, Preamble_shift %d\n",
rootSequenceIndex,preamble_index,prach_fmt,prach_ConfigIndex,NCS,Ncs_config,N_ZC/NCS,n_ra_prb, rootSequenceIndex,preamble_index,prach_fmt,prach_ConfigIndex,NCS,Ncs_config,N_ZC/NCS,
preamble_offset,preamble_shift); preamble_offset,preamble_shift);
#endif #endif
// nsymb = (frame_parms->Ncp==0) ? 14:12; // nsymb = (frame_parms->Ncp==0) ? 14:12;
// subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb; // subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
int kbar = 1;
int K = 24;
if (prach_fmt == 3) {
K=4;
kbar=10;
}
else if (prach_fmt > 3) {
// Note: Assumes that PRACH SCS is same as PUSCH SCS
K=1;
kbar=2;
}
int n_ra_prb = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart;
int k = (12*n_ra_prb) - 6*fp->N_RB_UL;
k = (12*n_ra_prb) - 6*fp->N_RB_UL; k = (12*n_ra_prb) - 6*fp->N_RB_UL;
if (k<0) if (k<0) k+=fp->ofdm_symbol_size;
k+=fp->ofdm_symbol_size;
k*=12; k*=K;
k+=13; k+=kbar;
LOG_D(PHY,"placing prach in position %d\n",k);
k*=2;
Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx]; Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx];
/* /********************************************************
k+=(12*fp->first_carrier_offset); *
if (k>(12*fp->ofdm_symbol_size)) * In function init_prach_tables:
k-=(12*fp->ofdm_symbol_size); * to compute quantized roots of unity ru(n) = 32767 * exp j*[ (2 * PI * n) / N_ZC ]
*/ *
k*=2; * In compute_prach_seq:
* to calculate Xu = DFT xu = xu (inv_u*k) * Xu[0] (This is a Zadoff-Chou sequence property: DFT ZC sequence is another ZC sequence)
*
* In generate_prach:
* to do the cyclic-shifted DFT by multiplying Xu[k] * ru[k*preamble_shift] as:
* If X[k] = DFT x(n) -> X_shifted[k] = DFT x(n+preamble_shift) = X[k] * exp -j*[ (2*PI*k*preamble_shift) / N_ZC ]
*
*********************************************************/
AssertFatal(prach_fmt>3,"prach_fmt<=3: Fix this for other formats\n");
int dftlen=2048;
if (fp->N_RB_UL >= 137) dftlen=4096;
if (fp->threequarter_fs==1) dftlen=(3*dftlen)/4;
for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
if (offset2 >= N_ZC)
offset2 -= N_ZC;
Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
prachF[k++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15;
prachF[k++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15;
if (k==dftlen) k=0;
}
switch (fp->N_RB_UL) { switch (fp->N_RB_UL) {
case 6: case 6:
...@@ -333,34 +329,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -333,34 +329,6 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
break; break;
} }
/********************************************************
*
* In function init_prach_tables:
* to compute quantized roots of unity ru(n) = 32767 * exp j*[ (2 * PI * n) / N_ZC ]
*
* In compute_prach_seq:
* to calculate Xu = DFT xu = xu (inv_u*k) * Xu[0] (This is a Zadoff-Chou sequence property: DFT ZC sequence is another ZC sequence)
*
* In generate_prach:
* to do the cyclic-shifted DFT by multiplying Xu[k] * ru[k*preamble_shift] as:
* If X[k] = DFT x(n) -> X_shifted[k] = DFT x(n+preamble_shift) = X[k] * exp -j*[ (2*PI*k*preamble_shift) / N_ZC ]
*
*********************************************************/
for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
if (offset2 >= N_ZC)
offset2 -= N_ZC;
Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
prachF[k++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15;
prachF[k++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15;
if (k==(12*2*fp->ofdm_symbol_size))
k=0;
}
int mu = 1; // numerology is hardcoded. FIXME!!! int mu = 1; // numerology is hardcoded. FIXME!!!
switch (prach_fmt) { switch (prach_fmt) {
case 0: case 0:
...@@ -425,49 +393,77 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -425,49 +393,77 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
AssertFatal(1==0,"N_RB_UL %d not supported for NR PRACH yet\n",fp->N_RB_UL); AssertFatal(1==0,"N_RB_UL %d not supported for NR PRACH yet\n",fp->N_RB_UL);
else if (fp->N_RB_UL < 137) { // 46.08 or 61.44 Ms/s else if (fp->N_RB_UL < 137) { // 46.08 or 61.44 Ms/s
if (fp->threequarter_fs==0) { //61.44 Ms/s if (fp->threequarter_fs==0) { //61.44 Ms/s
Ncp<<=1;
// This is after cyclic prefix (Ncp<<1 samples for 30.72 Ms/s, Ncp<<2 samples for 61.44 Ms/s // This is after cyclic prefix (Ncp<<1 samples for 30.72 Ms/s, Ncp<<2 samples for 61.44 Ms/s
prach2 = prach+(Ncp<<1); prach2 = prach+(Ncp<<1);
if (prach_fmt == 0) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s if (prach_fmt == 0) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s
dft49152(prachF,prach2,1); idft49152(prachF,prach2,1);
// here we have |empty | Prach49152| // here we have |empty | Prach49152|
memmove(prach,prach+(49152<<1),(Ncp<<3)); memmove(prach,prach+(49152<<1),(Ncp<<3));
// here we have |Prefix | Prach49152| // here we have |Prefix | Prach49152|
prach_len = 49152+Ncp;
dftlen=49152;
} }
else if (prach_fmt == 1) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s else if (prach_fmt == 1) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s
dft49152(prachF,prach2,1); idft49152(prachF,prach2,1);
memmove(prach2+(49152<<1),prach2,(49152<<2)); memmove(prach2+(49152<<1),prach2,(49152<<2));
// here we have |empty | Prach49152 | Prach49152| // here we have |empty | Prach49152 | Prach49152|
memmove(prach,prach+(49152<<2),(Ncp<<3)); memmove(prach,prach+(49152<<2),(Ncp<<3));
// here we have |Prefix | Prach49152 | Prach49152| // here we have |Prefix | Prach49152 | Prach49152|
prach_len = (49152*2)+Ncp;
dftlen=49152;
} }
else if (prach_fmt == 2) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s else if (prach_fmt == 2) { //24576 samples @ 30.72 Ms/s, 49152 samples @ 61.44 Ms/s
dft49152(prachF,prach2,1); idft49152(prachF,prach2,1);
memmove(prach2+(49152<<1),prach2,(49152<<2)); memmove(prach2+(49152<<1),prach2,(49152<<2));
// here we have |empty | Prach49152 | Prach49152| empty49152 | empty49152 // here we have |empty | Prach49152 | Prach49152| empty49152 | empty49152
memmove(prach2+(49152<<2),prach2,(49152<<3)); memmove(prach2+(49152<<2),prach2,(49152<<3));
// here we have |empty | Prach49152 | Prach49152| Prach49152 | Prach49152 // here we have |empty | Prach49152 | Prach49152| Prach49152 | Prach49152
memmove(prach,prach+(49152<<3),(Ncp<<3)); memmove(prach,prach+(49152<<3),(Ncp<<3));
// here we have |Prefix | Prach49152 | Prach49152| Prach49152 | Prach49152 // here we have |Prefix | Prach49152 | Prach49152| Prach49152 | Prach49152
prach_len = (49152*4)+Ncp;
dftlen=49152;
} }
else if (prach_fmt == 3) { // //6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s else if (prach_fmt == 3) { // //6144 samples @ 30.72 Ms/s, 12288 samples @ 61.44 Ms/s
dft12288(prachF,prach2,1); idft12288(prachF,prach2,1);
memmove(prach2+(12288<<1),prach2,(12288<<2)); memmove(prach2+(12288<<1),prach2,(12288<<2));
// here we have |empty | Prach12288 | Prach12288| empty12288 | empty12288 // here we have |empty | Prach12288 | Prach12288| empty12288 | empty12288
memmove(prach2+(12288<<2),prach2,(12288<<3)); memmove(prach2+(12288<<2),prach2,(12288<<3));
// here we have |empty | Prach12288 | Prach12288| Prach12288 | Prach12288 // here we have |empty | Prach12288 | Prach12288| Prach12288 | Prach12288
memmove(prach,prach+(12288<<3),(Ncp<<3)); memmove(prach,prach+(12288<<3),(Ncp<<3));
// here we have |Prefix | Prach12288 | Prach12288| Prach12288 | Prach12288 // here we have |Prefix | Prach12288 | Prach12288| Prach12288 | Prach12288
prach_len = (12288*4)+Ncp;
dftlen=12288;
} }
else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) { else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) {
dft2048(prachF,prach2,1); prach2 = prach+(Ncp<<1);
idft2048(prachF,prach2,1);
dftlen=2048;
// here we have |empty | Prach2048 | // here we have |empty | Prach2048 |
if (prach_fmt != 0xc0) if (prach_fmt != 0xc0) {
memmove(prach2+(2048<<1),prach2,(2048<<2)); memmove(prach2+(2048<<1),prach2,(2048<<2));
prach_len = (2048*2)+Ncp;
}
else prach_len = (2048*1)+Ncp;
memmove(prach,prach+(2048<<1),(Ncp<<2)); memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 | Prach2048 (if ! 0xc0) | // here we have |Prefix | Prach2048 | Prach2048 (if ! 0xc0) |
} }
else if (prach_fmt == 0xa2 || prach_fmt == 0xb2) { // 6x2048
idft2048(prachF,prach2,1);
dftlen=2048;
// here we have |empty | Prach2048 |
memmove(prach2+(2048<<1),prach2,(2048<<2));
// here we have |empty | Prach2048 | Prach2048| empty2048 | empty2048 |
memmove(prach2+(2048<<2),prach2,(2048<<3));
// here we have |empty | Prach2048 | Prach2048| Prach2048 | Prach2048 |
memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 |
prach_len = (2048*4)+Ncp;
}
else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x2048 else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x2048
dft2048(prachF,prach2,1); prach2 = prach+(Ncp<<1);
idft2048(prachF,prach2,1);
dftlen=2048;
// here we have |empty | Prach2048 | // here we have |empty | Prach2048 |
memmove(prach2+(2048<<1),prach2,(2048<<2)); memmove(prach2+(2048<<1),prach2,(2048<<2));
// here we have |empty | Prach2048 | Prach2048| empty2048 | empty2048 | empty2048 | empty2048 // here we have |empty | Prach2048 | Prach2048| empty2048 | empty2048 | empty2048 | empty2048
...@@ -476,10 +472,12 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -476,10 +472,12 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
memmove(prach2+((2048<<1)*3),prach2,(2048<<3)); memmove(prach2+((2048<<1)*3),prach2,(2048<<3));
// here we have |empty | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048 // here we have |empty | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048
memmove(prach,prach+(2048<<1),(Ncp<<2)); memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 | // here we have |Prefix | Prach2048 |
prach_len = (2048*6)+Ncp;
} }
else if (prach_fmt == 0xb4) { // 12x2048 else if (prach_fmt == 0xb4) { // 12x2048
dft2048(prachF,prach2,1); idft2048(prachF,prach2,1);
dftlen=2048;
// here we have |empty | Prach2048 | // here we have |empty | Prach2048 |
memmove(prach2+(2048<<1),prach2,(2048<<2)); memmove(prach2+(2048<<1),prach2,(2048<<2));
// here we have |empty | Prach2048 | Prach2048| empty2048 | empty2048 | empty2048 | empty2048 // here we have |empty | Prach2048 | Prach2048| empty2048 | empty2048 | empty2048 | empty2048
...@@ -491,52 +489,77 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -491,52 +489,77 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048| // here we have |empty | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048|
memmove(prach,prach+(2048<<1),(Ncp<<2)); memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048| // here we have |Prefix | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048 | Prach2048| Prach2048 | Prach2048 | Prach2048 | Prach2048|
prach_len = (2048*12)+Ncp;
} }
} }
else { // 46.08 Ms/s else { // 46.08 Ms/s
Ncp = (Ncp*3)/4; Ncp = (Ncp*3)/2;
prach2 = prach+(Ncp<<1);
if (prach_fmt == 0) { if (prach_fmt == 0) {
dft36864(prachF,prach2,1); idft36864(prachF,prach2,1);
dftlen=36864;
// here we have |empty | Prach73728| // here we have |empty | Prach73728|
memmove(prach,prach+(36864<<1),(Ncp<<2)); memmove(prach,prach+(36864<<1),(Ncp<<2));
// here we have |Prefix | Prach73728| // here we have |Prefix | Prach73728|
prach_len = (36864*1)+Ncp;
} }
else if (prach_fmt == 1) { else if (prach_fmt == 1) {
dft36864(prachF,prach2,1); idft36864(prachF,prach2,1);
dftlen=36864;
memmove(prach2+(36864<<1),prach2,(36864<<2)); memmove(prach2+(36864<<1),prach2,(36864<<2));
// here we have |empty | Prach73728 | Prach73728| // here we have |empty | Prach73728 | Prach73728|
memmove(prach,prach+(36864<<2),(Ncp<<3)); memmove(prach,prach+(36864<<2),(Ncp<<2));
// here we have |Prefix | Prach73728 | Prach73728| // here we have |Prefix | Prach73728 | Prach73728|
prach_len = (36864*2)+Ncp;
} }
if (prach_fmt == 2) { if (prach_fmt == 2) {
dft36864(prachF,prach2,1); idft36864(prachF,prach2,1);
dftlen=36864;
memmove(prach2+(36864<<1),prach2,(36864<<2)); memmove(prach2+(36864<<1),prach2,(36864<<2));
// here we have |empty | Prach73728 | Prach73728| empty73728 | empty73728 // here we have |empty | Prach73728 | Prach73728| empty73728 | empty73728
memmove(prach2+(36864<<2),prach2,(36864<<3)); memmove(prach2+(36864<<2),prach2,(36864<<3));
// here we have |empty | Prach73728 | Prach73728| Prach73728 | Prach73728 // here we have |empty | Prach73728 | Prach73728| Prach73728 | Prach73728
memmove(prach,prach+(36864<<3),(Ncp<<3)); memmove(prach,prach+(36864<<3),(Ncp<<2));
// here we have |Prefix | Prach73728 | Prach73728| Prach73728 | Prach73728 // here we have |Prefix | Prach73728 | Prach73728| Prach73728 | Prach73728
prach_len = (36864*4)+Ncp;
} }
else if (prach_fmt == 3) { else if (prach_fmt == 3) {
dft9216(prachF,prach2,1); idft9216(prachF,prach2,1);
dftlen=36864;
memmove(prach2+(9216<<1),prach2,(9216<<2)); memmove(prach2+(9216<<1),prach2,(9216<<2));
// here we have |empty | Prach9216 | Prach9216| empty9216 | empty9216 // here we have |empty | Prach9216 | Prach9216| empty9216 | empty9216
memmove(prach2+(9216<<2),prach2,(9216<<3)); memmove(prach2+(9216<<2),prach2,(9216<<3));
// here we have |empty | Prach9216 | Prach9216| Prach9216 | Prach9216 // here we have |empty | Prach9216 | Prach9216| Prach9216 | Prach9216
memmove(prach,prach+(9216<<3),(Ncp<<3)); memmove(prach,prach+(9216<<3),(Ncp<<2));
// here we have |Prefix | Prach9216 | Prach9216| Prach9216 | Prach9216 // here we have |Prefix | Prach9216 | Prach9216| Prach9216 | Prach9216
prach_len = (9216*4)+Ncp;
} }
else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) { else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) {
dft1536(prachF,prach2,1); idft1536(prachF,prach2,1);
dftlen=1536;
// here we have |empty | Prach1536 | // here we have |empty | Prach1536 |
if (prach_fmt != 0xc0) if (prach_fmt != 0xc0)
memmove(prach2+(1536<<1),prach2,(1536<<2)); memmove(prach2+(1536<<1),prach2,(1536<<2));
memmove(prach,prach+(1536<<1),(Ncp<<2)); memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 | Prach1536 (if ! 0xc0) | // here we have |Prefix | Prach1536 | Prach1536 (if ! 0xc0) |
prach_len = (1536*2)+Ncp;
}
else if (prach_fmt == 0xa2 || prach_fmt == 0xb2) { // 6x1536
idft1536(prachF,prach2,1);
dftlen=1536;
// here we have |empty | Prach1536 |
memmove(prach2+(1536<<1),prach2,(1536<<2));
// here we have |empty | Prach1536 | Prach1536| empty1536 | empty1536 |
memmove(prach2+(1536<<2),prach2,(1536<<3));
// here we have |empty | Prach1536 | Prach1536| Prach1536 | Prach1536 |
memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 |
prach_len = (1536*4)+Ncp;
} }
else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x1536 else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x1536
dft1536(prachF,prach2,1); idft1536(prachF,prach2,1);
dftlen=1536;
// here we have |empty | Prach1536 | // here we have |empty | Prach1536 |
memmove(prach2+(1536<<1),prach2,(1536<<2)); memmove(prach2+(1536<<1),prach2,(1536<<2));
// here we have |empty | Prach1536 | Prach1536| empty1536 | empty1536 | empty1536 | empty1536 // here we have |empty | Prach1536 | Prach1536| empty1536 | empty1536 | empty1536 | empty1536
...@@ -546,9 +569,11 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -546,9 +569,11 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536 // here we have |empty | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536
memmove(prach,prach+(1536<<1),(Ncp<<2)); memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 | // here we have |Prefix | Prach1536 |
prach_len = (1536*6)+Ncp;
} }
else if (prach_fmt == 0xb4) { // 12x1536 else if (prach_fmt == 0xb4) { // 12x1536
dft1536(prachF,prach2,1); idft1536(prachF,prach2,1);
dftlen=1536;
// here we have |empty | Prach1536 | // here we have |empty | Prach1536 |
memmove(prach2+(1536<<1),prach2,(1536<<2)); memmove(prach2+(1536<<1),prach2,(1536<<2));
// here we have |empty | Prach1536 | Prach1536| empty1536 | empty1536 | empty1536 | empty1536 // here we have |empty | Prach1536 | Prach1536| empty1536 | empty1536 | empty1536 | empty1536
...@@ -560,52 +585,81 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -560,52 +585,81 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536| // here we have |empty | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536|
memmove(prach,prach+(1536<<1),(Ncp<<2)); memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536| // here we have |Prefix | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536 | Prach1536| Prach1536 | Prach1536 | Prach1536 | Prach1536|
prach_len = (1536*12)+Ncp;
} }
} }
} }
else if (fp->N_RB_UL <= 273) {// 92.16 or 122.88 Ms/s else if (fp->N_RB_UL <= 273) {// 92.16 or 122.88 Ms/s
if (fp->threequarter_fs==0) { //122.88 Ms/s if (fp->threequarter_fs==0) { //122.88 Ms/s
Ncp<<=2;
prach2 = prach+(Ncp<<1);
if (prach_fmt == 0) { //24576 samples @ 30.72 Ms/s, 98304 samples @ 122.88 Ms/s if (prach_fmt == 0) { //24576 samples @ 30.72 Ms/s, 98304 samples @ 122.88 Ms/s
dft98304(prachF,prach2,1); idft98304(prachF,prach2,1);
dftlen=98304;
// here we have |empty | Prach98304| // here we have |empty | Prach98304|
memmove(prach,prach+(98304<<1),(Ncp<<4)); memmove(prach,prach+(98304<<1),(Ncp<<2));
// here we have |Prefix | Prach98304| // here we have |Prefix | Prach98304|
prach_len = (98304*1)+Ncp;
} }
else if (prach_fmt == 1) { else if (prach_fmt == 1) {
dft98304(prachF,prach2,1); idft98304(prachF,prach2,1);
dftlen=98304;
memmove(prach2+(98304<<1),prach2,(98304<<2)); memmove(prach2+(98304<<1),prach2,(98304<<2));
// here we have |empty | Prach98304 | Prach98304| // here we have |empty | Prach98304 | Prach98304|
memmove(prach,prach+(98304<<2),(Ncp<<4)); memmove(prach,prach+(98304<<2),(Ncp<<2));
// here we have |Prefix | Prach98304 | Prach98304| // here we have |Prefix | Prach98304 | Prach98304|
prach_len = (98304*2)+Ncp;
} }
else if (prach_fmt == 2) { else if (prach_fmt == 2) {
dft98304(prachF,prach2,1); idft98304(prachF,prach2,1);
dftlen=98304;
memmove(prach2+(98304<<1),prach2,(98304<<2)); memmove(prach2+(98304<<1),prach2,(98304<<2));
// here we have |empty | Prach98304 | Prach98304| empty98304 | empty98304 // here we have |empty | Prach98304 | Prach98304| empty98304 | empty98304
memmove(prach2+(98304<<2),prach2,(98304<<3)); memmove(prach2+(98304<<2),prach2,(98304<<3));
// here we have |empty | Prach98304 | Prach98304| Prach98304 | Prach98304 // here we have |empty | Prach98304 | Prach98304| Prach98304 | Prach98304
memmove(prach,prach+(98304<<3),(Ncp<<4)); memmove(prach,prach+(98304<<3),(Ncp<<2));
// here we have |Prefix | Prach98304 | Prach98304| Prach98304 | Prach98304 // here we have |Prefix | Prach98304 | Prach98304| Prach98304 | Prach98304
prach_len = (98304*4)+Ncp;
} }
else if (prach_fmt == 3) { // 4x6144, Ncp 3168 else if (prach_fmt == 3) { // 4x6144, Ncp 3168
dft24576(prachF,prach2,1); idft24576(prachF,prach2,1);
dftlen=24576;
memmove(prach2+(24576<<1),prach2,(24576<<2)); memmove(prach2+(24576<<1),prach2,(24576<<2));
// here we have |empty | Prach24576 | Prach24576| empty24576 | empty24576 // here we have |empty | Prach24576 | Prach24576| empty24576 | empty24576
memmove(prach2+(24576<<2),prach2,(24576<<3)); memmove(prach2+(24576<<2),prach2,(24576<<3));
// here we have |empty | Prach24576 | Prach24576| Prach24576 | Prach24576 // here we have |empty | Prach24576 | Prach24576| Prach24576 | Prach24576
memmove(prach,prach+(24576<<3),(Ncp<<4)); memmove(prach,prach+(24576<<3),(Ncp<<2));
// here we have |Prefix | Prach24576 | Prach24576| Prach24576 | Prach24576 // here we have |Prefix | Prach24576 | Prach24576| Prach24576 | Prach24576
prach_len = (24576*4)+(Ncp<<1);
} }
else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) { else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) {
dft4096(prachF,prach2,1); idft4096(prachF,prach2,1);
dftlen=4096;
// here we have |empty | Prach4096 | // here we have |empty | Prach4096 |
if (prach_fmt != 0xc0) if (prach_fmt != 0xc0) {
memmove(prach2+(4096<<1),prach2,(4096<<2)); memmove(prach2+(4096<<1),prach2,(4096<<2));
prach_len = (4096*2)+Ncp;
}
else prach_len = (4096*1)+Ncp;
memmove(prach,prach+(4096<<1),(Ncp<<2)); memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 | Prach4096 (if ! 0xc0) | // here we have |Prefix | Prach4096 | Prach4096 (if ! 0xc0) |
}
else if (prach_fmt == 0xa2 || prach_fmt == 0xb2) { // 4x4096
idft4096(prachF,prach2,1);
dftlen=4096;
// here we have |empty | Prach4096 |
memmove(prach2+(4096<<1),prach2,(4096<<2));
// here we have |empty | Prach4096 | Prach4096| empty4096 | empty4096 |
memmove(prach2+(4096<<2),prach2,(4096<<3));
// here we have |empty | Prach4096 | Prach4096| Prach4096 | Prach4096 |
memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 |
prach_len = (4096*4)+Ncp;
} }
else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x4096 else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x4096
dft4096(prachF,prach2,1); idft4096(prachF,prach2,1);
dftlen=4096;
// here we have |empty | Prach4096 | // here we have |empty | Prach4096 |
memmove(prach2+(4096<<1),prach2,(4096<<2)); memmove(prach2+(4096<<1),prach2,(4096<<2));
// here we have |empty | Prach4096 | Prach4096| empty4096 | empty4096 | empty4096 | empty4096 // here we have |empty | Prach4096 | Prach4096| empty4096 | empty4096 | empty4096 | empty4096
...@@ -615,9 +669,11 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -615,9 +669,11 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096 // here we have |empty | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096
memmove(prach,prach+(4096<<1),(Ncp<<2)); memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 | // here we have |Prefix | Prach4096 |
prach_len = (4096*6)+Ncp;
} }
else if (prach_fmt == 0xb4) { // 12x4096 else if (prach_fmt == 0xb4) { // 12x4096
dft4096(prachF,prach2,1); idft4096(prachF,prach2,1);
dftlen=4096;
// here we have |empty | Prach4096 | // here we have |empty | Prach4096 |
memmove(prach2+(4096<<1),prach2,(4096<<2)); memmove(prach2+(4096<<1),prach2,(4096<<2));
// here we have |empty | Prach4096 | Prach4096| empty4096 | empty4096 | empty4096 | empty4096 // here we have |empty | Prach4096 | Prach4096| empty4096 | empty4096 | empty4096 | empty4096
...@@ -629,51 +685,66 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -629,51 +685,66 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096| // here we have |empty | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096|
memmove(prach,prach+(4096<<1),(Ncp<<2)); memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096| // here we have |Prefix | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096 | Prach4096| Prach4096 | Prach4096 | Prach4096 | Prach4096|
prach_len = (4096*12)+Ncp;
} }
} }
else { // 92.16 Ms/s else { // 92.16 Ms/s
Ncp = (Ncp*3)/4; Ncp = (Ncp*3);
prach2 = prach+(Ncp<<1);
if (prach_fmt == 0) { if (prach_fmt == 0) {
dft73728(prachF,prach2,1); idft73728(prachF,prach2,1);
dftlen=73728;
// here we have |empty | Prach73728| // here we have |empty | Prach73728|
memmove(prach,prach+(73728<<1),(Ncp<<4)); memmove(prach,prach+(73728<<1),(Ncp<<4));
// here we have |Prefix | Prach73728| // here we have |Prefix | Prach73728|
prach_len = (73728*1)+Ncp;
} }
else if (prach_fmt == 1) { else if (prach_fmt == 1) {
dft73728(prachF,prach2,1); idft73728(prachF,prach2,1);
dftlen=73728;
memmove(prach2+(73728<<1),prach2,(73728<<2)); memmove(prach2+(73728<<1),prach2,(73728<<2));
// here we have |empty | Prach73728 | Prach73728| // here we have |empty | Prach73728 | Prach73728|
memmove(prach,prach+(73728<<2),(Ncp<<4)); memmove(prach,prach+(73728<<2),(Ncp<<4));
// here we have |Prefix | Prach73728 | Prach73728| // here we have |Prefix | Prach73728 | Prach73728|
prach_len = (73728*2)+Ncp;
} }
if (prach_fmt == 2) { if (prach_fmt == 2) {
dft73728(prachF,prach2,1); idft73728(prachF,prach2,1);
dftlen=73728;
memmove(prach2+(73728<<1),prach2,(73728<<2)); memmove(prach2+(73728<<1),prach2,(73728<<2));
// here we have |empty | Prach73728 | Prach73728| empty73728 | empty73728 // here we have |empty | Prach73728 | Prach73728| empty73728 | empty73728
memmove(prach2+(73728<<2),prach2,(73728<<3)); memmove(prach2+(73728<<2),prach2,(73728<<3));
// here we have |empty | Prach73728 | Prach73728| Prach73728 | Prach73728 // here we have |empty | Prach73728 | Prach73728| Prach73728 | Prach73728
memmove(prach,prach+(73728<<3),(Ncp<<4)); memmove(prach,prach+(73728<<3),(Ncp<<4));
// here we have |Prefix | Prach73728 | Prach73728| Prach73728 | Prach73728 // here we have |Prefix | Prach73728 | Prach73728| Prach73728 | Prach73728
prach_len = (73728*4)+Ncp;
} }
else if (prach_fmt == 3) { else if (prach_fmt == 3) {
dft18432(prachF,prach2,1); idft18432(prachF,prach2,1);
dftlen=18432;
memmove(prach2+(18432<<1),prach2,(18432<<2)); memmove(prach2+(18432<<1),prach2,(18432<<2));
// here we have |empty | Prach18432 | Prach18432| empty18432 | empty18432 // here we have |empty | Prach18432 | Prach18432| empty18432 | empty18432
memmove(prach2+(18432<<2),prach2,(18432<<3)); memmove(prach2+(18432<<2),prach2,(18432<<3));
// here we have |empty | Prach18432 | Prach18432| Prach18432 | Prach18432 // here we have |empty | Prach18432 | Prach18432| Prach18432 | Prach18432
memmove(prach,prach+(18432<<3),(Ncp<<4)); memmove(prach,prach+(18432<<3),(Ncp<<4));
// here we have |Prefix | Prach18432 | Prach18432| Prach18432 | Prach18432 // here we have |Prefix | Prach18432 | Prach18432| Prach18432 | Prach18432
prach_len = (18432*4)+Ncp;
} }
else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) { else if (prach_fmt == 0xa1 || prach_fmt == 0xb1 || prach_fmt == 0xc0) {
dft3072(prachF,prach2,1); idft3072(prachF,prach2,1);
dftlen=3072;
// here we have |empty | Prach3072 | // here we have |empty | Prach3072 |
if (prach_fmt != 0xc0) if (prach_fmt != 0xc0) {
memmove(prach2+(3072<<1),prach2,(3072<<2)); memmove(prach2+(3072<<1),prach2,(3072<<2));
prach_len = (3072*2)+Ncp;
}
else prach_len = (3072*1)+Ncp;
memmove(prach,prach+(3072<<1),(Ncp<<2)); memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 | Prach3072 (if ! 0xc0) | // here we have |Prefix | Prach3072 | Prach3072 (if ! 0xc0) |
} }
else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x3072 else if (prach_fmt == 0xa3 || prach_fmt == 0xb3) { // 6x3072
dft3072(prachF,prach2,1); idft3072(prachF,prach2,1);
dftlen=3072;
// here we have |empty | Prach3072 | // here we have |empty | Prach3072 |
memmove(prach2+(3072<<1),prach2,(3072<<2)); memmove(prach2+(3072<<1),prach2,(3072<<2));
// here we have |empty | Prach3072 | Prach3072| empty3072 | empty3072 | empty3072 | empty3072 // here we have |empty | Prach3072 | Prach3072| empty3072 | empty3072 | empty3072 | empty3072
...@@ -683,9 +754,23 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -683,9 +754,23 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072 // here we have |empty | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072
memmove(prach,prach+(3072<<1),(Ncp<<2)); memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 | // here we have |Prefix | Prach3072 |
prach_len = (3072*6)+Ncp;
}
else if (prach_fmt == 0xa2 || prach_fmt == 0xb2) { // 4x3072
idft3072(prachF,prach2,1);
dftlen=3072;
// here we have |empty | Prach3072 |
memmove(prach2+(3072<<1),prach2,(3072<<2));
// here we have |empty | Prach3072 | Prach3072| empty3072 | empty3072 |
memmove(prach2+(3072<<2),prach2,(3072<<3));
// here we have |empty | Prach3072 | Prach3072| Prach3072 | Prach3072 |
memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 |
prach_len = (3072*4)+Ncp;
} }
else if (prach_fmt == 0xb4) { // 12x3072 else if (prach_fmt == 0xb4) { // 12x3072
dft3072(prachF,prach2,1); idft3072(prachF,prach2,1);
dftlen=3072;
// here we have |empty | Prach3072 | // here we have |empty | Prach3072 |
memmove(prach2+(3072<<1),prach2,(3072<<2)); memmove(prach2+(3072<<1),prach2,(3072<<2));
// here we have |empty | Prach3072 | Prach3072| empty3072 | empty3072 | empty3072 | empty3072 // here we have |empty | Prach3072 | Prach3072| empty3072 | empty3072 | empty3072 | empty3072
...@@ -697,16 +782,20 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -697,16 +782,20 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
// here we have |empty | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072| // here we have |empty | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072|
memmove(prach,prach+(3072<<1),(Ncp<<2)); memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072| // here we have |Prefix | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072 | Prach3072| Prach3072 | Prach3072 | Prach3072 | Prach3072|
prach_len = (3072*12)+Ncp;
} }
} }
} }
#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) #if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
int j; int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*(fp->samples_per_tti<<1); int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*(fp->samples_per_slot<<1);
LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
for (i=prach_start,j=0; i<min((fp->samples_per_tti<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { for (i=prach_start,j=0; i<min((fp->samples_per_slot<<1)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]; ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
} }
...@@ -715,6 +804,9 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -715,6 +804,9 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]; ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
} }
#else
LOG_D( PHY, "prach_start=%d\n", prach_start);
for (i=0; i<prach_len; i++) { for (i=0; i<prach_len; i++) {
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i]; ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i];
...@@ -727,7 +819,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -727,7 +819,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
#if defined(PRACH_WRITE_OUTPUT_DEBUG) #if defined(PRACH_WRITE_OUTPUT_DEBUG)
LOG_M("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1); LOG_M("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
LOG_M("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1); LOG_M("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
LOG_M("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),4*fp->samples_per_tti,1,1); LOG_M("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][prach_start]),4*fp->samples_per_slot,1,1);
exit(-1); exit(-1);
#endif #endif
......
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