Commit daca2788 authored by Agustin's avatar Agustin

prach implementation 5G NR (format 0, format 1)

parent 0a0a90fc
...@@ -39,11 +39,30 @@ ...@@ -39,11 +39,30 @@
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
//#define PRACH_DEBUG 1 //#define PRACH_DEBUG 1
#define NR_PRACH_DEBUG 1
// The following tables defined for 4G
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419}; uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
// Note: in 4G implementation, restricted set type B is not supported
uint16_t NCS_4[7] = {2,4,6,8,10,12,15}; uint16_t NCS_4[7] = {2,4,6,8,10,12,15};
/*************************************
* The following tables defined for NR
**************************************/
// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
uint16_t NCS_unrestricted_delta_f_RA_125[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted_TypeA_delta_f_RA_125[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case set Type A
uint16_t NCS_restricted_TypeB_delta_f_RA_125[13] = {15,18,22,26,32,38,46,55,68,82,100,118,137}; // high-speed case set Type B
// Table 6.3.3.1-6 (38.211) NCS for preamble formats with delta_f_RA = 5 KHz
uint16_t NCS_unrestricted_delta_f_RA_5[16] = {0,13,26,33,38,41,49,55,64,76,93,119,139,209,279,419};
uint16_t NCS_restricted_TypeA_delta_f_RA_5[16] = {36,57,72,81,89,94,103,112,121,132,137,152,173,195,216,237}; // high-speed case set Type A
uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,85,97,109,122,137}; // high-speed case set Type B
// Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3}
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
int16_t ru[2*839]; // quantized roots of unity int16_t ru[2*839]; // quantized roots of unity
uint32_t ZC_inv[839]; // multiplicative inverse for roots u uint32_t ZC_inv[839]; // multiplicative inverse for roots u
uint16_t du[838]; uint16_t du[838];
...@@ -407,6 +426,17 @@ uint8_t get_fid_prach_tdd(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index) ...@@ -407,6 +426,17 @@ uint8_t get_fid_prach_tdd(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index)
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type)
{ {
/*********************************************************************
* Only prach format 0 and 1 are fully implemented on NR
* NR format 0 == 4G format 0
* NR format 1 == 4G format 3
**********************************************************************/
// Table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum
return(prach_ConfigIndex>>4);
/*
* Table 5.7.1-2 and Table 5.7.1-3 for Frame structure type 1 and Frame structure type 2 respectively
* not defined in NR
if (frame_type == FDD) // FDD if (frame_type == FDD) // FDD
return(prach_ConfigIndex>>4); return(prach_ConfigIndex>>4);
...@@ -426,6 +456,7 @@ uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) ...@@ -426,6 +456,7 @@ uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type)
else else
return (4); return (4);
} }
*/
} }
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf) uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf)
...@@ -482,8 +513,76 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su ...@@ -482,8 +513,76 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su
uint8_t t0_ra; uint8_t t0_ra;
uint8_t t1_ra; uint8_t t1_ra;
uint8_t t2_ra; uint8_t t2_ra;
// Implementing table 6.3.3.2-2 from 38.211 only until Prach Config Index <= 28
if ((((frame&1) == 1) && (subframe < 9)) ||
(((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
((prach_ConfigIndex&0x1f)==18) || // 18,50
((prach_ConfigIndex&0xf)==15) || // 15,47
(prach_ConfigIndex>28) ) // for prach_ConfigIndex > 28 the prach is not implemented (formats 0 and 1 only implemented)
return(0);
switch (prach_ConfigIndex&0x1f) {
case 0:
case 3:
return(subframe==1);
break;
case 1:
case 4:
return(subframe==4);
break;
case 2:
case 5:
return(subframe==7);
break;
case 6:
return((subframe==1) || (subframe==6));
break;
case 7:
return((subframe==2) || (subframe==7));
break;
case 8:
return((subframe==3) || (subframe==8));
break;
case 9:
return((subframe==1) || (subframe==4) || (subframe==7));
break;
case 10:
return((subframe==2) || (subframe==5) || (subframe==8));
break;
case 11:
return((subframe==3) || (subframe==6) || (subframe==9));
break;
case 12:
if (prach_ConfigIndex == 12) {
return((subframe&1)==0);
} else {
return((subframe)==9);
}
break;
case 13:
return((subframe&1)==1);
break;
case 14:
return(1==1);
break;
case 15:
return(subframe==9);
break;
}
/*
if (frame_parms->frame_type == FDD) { //FDD if (frame_parms->frame_type == FDD) { //FDD
//implement Table 5.7.1-2 from 36.211 (Rel-10, p.41) //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
if ((((frame&1) == 1) && (subframe < 9)) || if ((((frame&1) == 1) && (subframe < 9)) ||
...@@ -583,7 +682,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su ...@@ -583,7 +682,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su
} else } else
return(1==2); return(1==2);
} }
*/
// shouldn't get here! // shouldn't get here!
return(2==1); return(2==1);
} }
...@@ -614,6 +713,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -614,6 +713,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
uint16_t d_start,numshift; uint16_t d_start,numshift;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
#ifdef NR_PRACH_DEBUG
printf("### prach_ConfigIndex=%d, prach_fmt=%d\n",prach_ConfigIndex,prach_fmt);
#endif
//uint8_t Nsp=2; //uint8_t Nsp=2;
//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;
...@@ -655,6 +757,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -655,6 +757,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
// First compute physical root sequence // First compute physical root sequence
/************************************************************************
* 4G and NR NCS tables are slightly different and depend on prach format
* Table 6.3.3.1-5: for preamble formats with delta_f_RA = 1.25 Khz (formats 0,1,2)
* Table 6.3.3.1-6: for preamble formats with delta_f_RA = 5 Khz (formats 3)
* NOTE: Restricted set type B is not implemented
*************************************************************************/
if (restricted_set == 0) { if (restricted_set == 0) {
if (Ncs_config > 15) { if (Ncs_config > 15) {
LOG_E( PHY, "[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config ); LOG_E( PHY, "[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config );
...@@ -662,17 +771,38 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -662,17 +771,38 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
return 0; // not reached return 0; // not reached
} }
NCS = NCS_unrestricted[Ncs_config]; //NCS = NCS_unrestricted[Ncs_config];
if (prach_fmt<3) {
#ifdef NR_PRACH_DEBUG
printf("### using table NCS_unrestricted_delta_f_RA_125\n");
#endif
NCS = NCS_unrestricted_delta_f_RA_125[Ncs_config];
} else { } else {
NCS = NCS_unrestricted_delta_f_RA_5[Ncs_config];
}
} else {
//NCS = NCS_restricted[Ncs_config];
if (prach_fmt<3) {
if (Ncs_config > 14) { if (Ncs_config > 14) {
LOG_E( PHY, "[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config ); LOG_E( PHY, "[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config );
mac_xface->macphy_exit("PRACH: Illegal Ncs_config for restricted format"); mac_xface->macphy_exit("PRACH: Illegal Ncs_config for restricted format");
return 0; // not reached return 0; // not reached
} }
#ifdef NR_PRACH_DEBUG
NCS = NCS_restricted[Ncs_config]; printf("### using table NCS_restricted_TypeA_delta_f_RA_125\n");
#endif
NCS = NCS_restricted_TypeA_delta_f_RA_125[Ncs_config];
} else {
if (Ncs_config > 15) {
LOG_E( PHY, "[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config );
mac_xface->macphy_exit("PRACH: Illegal Ncs_config for restricted format");
return 0; // not reached
}
NCS = NCS_restricted_TypeA_delta_f_RA_5[Ncs_config];
}
} }
n_ra_prb = get_prach_prb_offset(&(ue->frame_parms), tdd_mapindex, Nf); n_ra_prb = get_prach_prb_offset(&(ue->frame_parms), tdd_mapindex, Nf);
prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
...@@ -833,7 +963,19 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -833,7 +963,19 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memset((void*)prachF,0,4*18432); memset((void*)prachF,0,4*18432);
break; break;
} }
/********************************************************
*
* In function init_parch_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) { for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
if (offset2 >= N_ZC) if (offset2 >= N_ZC)
...@@ -847,7 +989,31 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -847,7 +989,31 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
if (k==(12*2*ue->frame_parms.ofdm_symbol_size)) if (k==(12*2*ue->frame_parms.ofdm_symbol_size))
k=0; k=0;
} }
/****************************************************************************************************************
* Note that only formats 0 and 1 are fully implemented (format 0 keeps unchanged / format 1 5G NR == format 3 4G)
****************************************************************************************************************/
switch (prach_fmt) {
case 0:
Ncp = 3168;
break;
case 1:
Ncp = 21024;
break;
case 2:
Ncp = 4688;
break;
case 3:
Ncp = 3168;
break;
default:
Ncp = 3168;
break;
}
/* We remove this switch concerning the 4G prach formats
switch (prach_fmt) { switch (prach_fmt) {
case 0: case 0:
Ncp = 3168; Ncp = 3168;
...@@ -870,7 +1036,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -870,7 +1036,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
Ncp = 3168; Ncp = 3168;
break; break;
} }
*/
switch (ue->frame_parms.N_RB_UL) { switch (ue->frame_parms.N_RB_UL) {
case 6: case 6:
Ncp>>=4; Ncp>>=4;
...@@ -911,7 +1077,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -911,7 +1077,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+3072, Ncp<<2 ); memmove( prach, prach+3072, Ncp<<2 );
prach_len = 1536+Ncp; prach_len = 1536+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+3072, prach2, 6144 ); memmove( prach2+3072, prach2, 6144 );
prach_len = 2*1536+Ncp; prach_len = 2*1536+Ncp;
} }
...@@ -930,7 +1097,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -930,7 +1097,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+6144, Ncp<<2 ); memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp; prach_len = 3072+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+6144, prach2, 12288 ); memmove( prach2+6144, prach2, 12288 );
prach_len = 2*3072+Ncp; prach_len = 2*3072+Ncp;
} }
...@@ -951,7 +1119,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -951,7 +1119,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+12288, Ncp<<2 ); memmove( prach, prach+12288, Ncp<<2 );
prach_len = 6144+Ncp; prach_len = 6144+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+12288, prach2, 24576 ); memmove( prach2+12288, prach2, 24576 );
prach_len = 2*6144+Ncp; prach_len = 2*6144+Ncp;
} }
...@@ -969,7 +1138,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -969,7 +1138,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+24576, Ncp<<2 ); memmove( prach, prach+24576, Ncp<<2 );
prach_len = 12288+Ncp; prach_len = 12288+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+24576, prach2, 49152 ); memmove( prach2+24576, prach2, 49152 );
prach_len = 2*12288+Ncp; prach_len = 2*12288+Ncp;
} }
...@@ -988,7 +1158,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -988,7 +1158,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+36864, Ncp<<2 ); memmove( prach, prach+36864, Ncp<<2 );
prach_len = 18432+Ncp; prach_len = 18432+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+36834, prach2, 73728 ); memmove( prach2+36834, prach2, 73728 );
prach_len = 2*18432+Ncp; prach_len = 2*18432+Ncp;
} }
...@@ -1007,13 +1178,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -1007,13 +1178,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+49152, Ncp<<2 ); memmove( prach, prach+49152, Ncp<<2 );
prach_len = 24576+Ncp; prach_len = 24576+Ncp;
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+49152, prach2, 98304 ); memmove( prach2+49152, prach2, 98304 );
prach_len = 2* 24576+Ncp; prach_len = 2* 24576+Ncp;
} }
} }
} } else {
else {
if (prach_fmt == 4) { if (prach_fmt == 4) {
idft3072(prachF,prach2); idft3072(prachF,prach2);
//TODO: account for repeated format in dft output //TODO: account for repeated format in dft output
...@@ -1024,7 +1195,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -1024,7 +1195,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
memmove( prach, prach+36864, Ncp<<2 ); memmove( prach, prach+36864, Ncp<<2 );
prach_len = 18432+Ncp; prach_len = 18432+Ncp;
printf("Generated prach for 100 PRB, 3/4 sampling\n"); printf("Generated prach for 100 PRB, 3/4 sampling\n");
if (prach_fmt>1) { //if (prach_fmt>1) {
if (prach_fmt==1) {
memmove( prach2+36834, prach2, 73728 ); memmove( prach2+36834, prach2, 73728 );
prach_len = 2*18432+Ncp; prach_len = 2*18432+Ncp;
} }
...@@ -1802,6 +1974,42 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, ...@@ -1802,6 +1974,42 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common,
X_u[i][k] = ((uint32_t*)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC]; X_u[i][k] = ((uint32_t*)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC];
// printf("X_u[%d][%d] (%d)(%d)(%d) : %d,%d\n",i,k,u*inv_u*k*(1+(inv_u*k)),u*inv_u*k*(1+(inv_u*k))/2,(u*inv_u*k*(1+(inv_u*k))/2)%N_ZC,((int16_t*)&X_u[i][k])[0],((int16_t*)&X_u[i][k])[1]); // printf("X_u[%d][%d] (%d)(%d)(%d) : %d,%d\n",i,k,u*inv_u*k*(1+(inv_u*k)),u*inv_u*k*(1+(inv_u*k))/2,(u*inv_u*k*(1+(inv_u*k))/2)%N_ZC,((int16_t*)&X_u[i][k])[0],((int16_t*)&X_u[i][k])[1]);
} }
/****************************************************************************************
* The following commented code shows that X_u[i][k] is the DFT xu[n]
* according to ZC property DFT xu[n] = xu[inv_n*k]*X_u[0]
*
printf("### Calculate ZC teorique:\n");
int16_t Rexu[839];
int16_t Imxu[839];
int16_t Re_Xu[839];
int16_t Im_Xu[839];
double X_0_im = 0;
double X_0_re = 0;
for (i=0; i<839; i++) {
Rexu[i] = (int16_t)(floor(32767.0*cos(M_PI*u*i*(i+1)/839)));
Imxu[i] = (int16_t)(floor((-32767.0)*sin(M_PI*u*i*(i+1)/839)));
}
for (i=0; i<839; i++){
X_0_re = X_0_re + Rexu[i]/839;
X_0_im = X_0_im + Imxu[i]/839;
X_0_re = 1;
X_0_im = 0;
}
for (i=0; i<839; i++) {
Re_Xu[i] = (Rexu[(i*inv_u)%839]*X_0_re)-(-Imxu[(i*inv_u)%839]*X_0_im);
Im_Xu[i] = (Rexu[(i*inv_u)%839]*X_0_im)+(-Imxu[(i*inv_u)%839]*X_0_re);
//printf("###### for i=%d -> shift=%d, Rexu=%d Imxu=%d\n",i,(i+shifft)%839,Rexu[i],Imxu[i]);
}
printf("### i \t### ru(re) \t### ru(im) \t### X_u(re) \t### X_u(im) \t### Rexu \t### Imxu \t### Re_Xu \t### Im_Xu \t### X0=%f,%f\n",X_0_re,X_0_im);
for (i=1; i<31; i++){
printf("### %d \t### %d \t### %d \t### %d \t### %d \t### %d \t### %d \t### %d \t### %d\n",i,ru[i<<1],ru[1+(i<<1)],
((int16_t*)&X_u[0][i])[0],((int16_t*)&X_u[0][i])[1],Rexu[i],Imxu[i],Re_Xu[i],Im_Xu[i]);
}
*****************************************************************************************/
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT);
......
...@@ -44,7 +44,7 @@ enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0, ...@@ -44,7 +44,7 @@ enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0,
#define OPENAIR_THREAD_STACK_SIZE PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6 #define OPENAIR_THREAD_STACK_SIZE PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6
//#define DLC_THREAD_STACK_SIZE 4096 //DLC stack size //#define DLC_THREAD_STACK_SIZE 4096 //DLC stack size
//#define UE_SLOT_PARALLELISATION //#define UE_SLOT_PARALLELISATION
#define UE_DLSCH_PARALLELISATION //#define UE_DLSCH_PARALLELISATION
enum openair_SCHED_STATUS { enum openair_SCHED_STATUS {
openair_SCHED_STOPPED=1, openair_SCHED_STOPPED=1,
......
...@@ -96,7 +96,7 @@ int main(int argc, char **argv) ...@@ -96,7 +96,7 @@ int main(int argc, char **argv)
int delay = 0; int delay = 0;
double delay_avg=0; double delay_avg=0;
double ue_speed = 0; double ue_speed = 0;
int NCS_config = 1,rootSequenceIndex=0; int NCS_config = 1,rootSequenceIndex=0,prach_ConfigIndex=0;
int threequarter_fs = 0; int threequarter_fs = 0;
cpuf = get_cpu_freq_GHz(); cpuf = get_cpu_freq_GHz();
...@@ -107,7 +107,7 @@ int main(int argc, char **argv) ...@@ -107,7 +107,7 @@ int main(int argc, char **argv)
while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:P:R:E")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
printf("Running AWGN simulation\n"); printf("Running AWGN simulation\n");
...@@ -232,6 +232,14 @@ int main(int argc, char **argv) ...@@ -232,6 +232,14 @@ int main(int argc, char **argv)
break; break;
case 'P':
prach_ConfigIndex = atoi(optarg);
if ((prach_ConfigIndex < 0) || (prach_ConfigIndex > 28))
printf("Illegal prach_ConfigIndex %d, (should be 0-28)\n",prach_ConfigIndex);
break;
case 'x': case 'x':
transmission_mode=atoi(optarg); transmission_mode=atoi(optarg);
...@@ -297,6 +305,7 @@ int main(int argc, char **argv) ...@@ -297,6 +305,7 @@ int main(int argc, char **argv)
printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n"); printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'"); printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
printf("-L rootSequenceIndex (0-837)\n"); printf("-L rootSequenceIndex (0-837)\n");
printf("-P prach_ConfigIndex (0-28)\n");
printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n"); printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
printf("-H Run with High-Speed Flag enabled \n"); printf("-H Run with High-Speed Flag enabled \n");
printf("-R Number of PRB (6,15,25,50,75,100)\n"); printf("-R Number of PRB (6,15,25,50,75,100)\n");
...@@ -385,14 +394,14 @@ int main(int argc, char **argv) ...@@ -385,14 +394,14 @@ int main(int argc, char **argv)
} }
UE->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex; UE->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=prach_ConfigIndex;
UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config; UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag; UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
eNB->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex; eNB->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=prach_ConfigIndex;
eNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config; eNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
eNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag; eNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
...@@ -407,8 +416,9 @@ int main(int argc, char **argv) ...@@ -407,8 +416,9 @@ int main(int argc, char **argv)
/* N_ZC not used later, no need to set */ /* N_ZC not used later, no need to set */
//N_ZC = (prach_fmt <4)?839:139; //N_ZC = (prach_fmt <4)?839:139;
printf("################################################\n### entering to function compute_prach_seq eNB\n");
compute_prach_seq(&eNB->frame_parms.prach_config_common,eNB->frame_parms.frame_type,eNB->X_u); compute_prach_seq(&eNB->frame_parms.prach_config_common,eNB->frame_parms.frame_type,eNB->X_u);
printf("### entering to function compute_prach_seq UE\n");
compute_prach_seq(&UE->frame_parms.prach_config_common,UE->frame_parms.frame_type,UE->X_u); compute_prach_seq(&UE->frame_parms.prach_config_common,UE->frame_parms.frame_type,UE->X_u);
UE->prach_vars[0]->amp = AMP; UE->prach_vars[0]->amp = AMP;
...@@ -419,15 +429,17 @@ int main(int argc, char **argv) ...@@ -419,15 +429,17 @@ int main(int argc, char **argv)
preamble_tx = (uint16_t)(taus()&0x3f); preamble_tx = (uint16_t)(taus()&0x3f);
if (n_frames == 1) if (n_frames == 1)
printf("raPreamble %d\n",preamble_tx); printf("### rootSequenceIndex=%d, prach_ConfigIndex=%d, NCS_config=%d, hs_flag=%d, preamble_tx=%d\n",rootSequenceIndex,prach_ConfigIndex,NCS_config,hs_flag,preamble_tx);
//printf("raPreamble %d\n",preamble_tx);
UE->prach_resources[0]->ra_PreambleIndex = preamble_tx; UE->prach_resources[0]->ra_PreambleIndex = preamble_tx;
UE->prach_resources[0]->ra_TDD_map_index = 0; UE->prach_resources[0]->ra_TDD_map_index = 0;
printf("### entering to function generate_prach UE\n");
tx_lev = generate_prach(UE, tx_lev = generate_prach(UE,
0, //eNB_id, 0, //eNB_id,
subframe, subframe,
0); //Nf 0); //Nf
printf("### finished function generate_prach UE\n################################################\n");
/* tx_lev_dB not used later, no need to set */ /* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev); //tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
......
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