|
|
@@ -61,13 +61,22 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
|
|
|
|
// needed for some functions
|
|
|
|
// needed for some functions
|
|
|
|
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = {{NULL}};
|
|
|
|
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = {{NULL}};
|
|
|
|
static softmodem_params_t softmodem_params;
|
|
|
|
static softmodem_params_t softmodem_params;
|
|
|
|
softmodem_params_t *get_softmodem_params(void) {
|
|
|
|
softmodem_params_t *get_softmodem_params(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
return &softmodem_params;
|
|
|
|
return &softmodem_params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
|
|
|
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
|
|
|
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); }
|
|
|
|
{
|
|
|
|
nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; }
|
|
|
|
}
|
|
|
|
|
|
|
|
NR_IF_Module_t *NR_IF_Module_init(int Mod_id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nfapi_mode_t nfapi_getmode(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return NFAPI_MODE_UNKNOWN;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void inc_ref_sched_response(int _)
|
|
|
|
void inc_ref_sched_response(int _)
|
|
|
|
{
|
|
|
|
{
|
|
|
@@ -80,9 +89,10 @@ void deref_sched_response(int _)
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nrUE_params_t nrUE_params={0};
|
|
|
|
nrUE_params_t nrUE_params = {0};
|
|
|
|
|
|
|
|
|
|
|
|
nrUE_params_t *get_nrUE_params(void) {
|
|
|
|
nrUE_params_t *get_nrUE_params(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
return &nrUE_params;
|
|
|
|
return &nrUE_params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -93,53 +103,45 @@ int main(int argc, char **argv)
|
|
|
|
__attribute__((unused)) struct sigaction oldaction;
|
|
|
|
__attribute__((unused)) struct sigaction oldaction;
|
|
|
|
sigaction(SIGINT, &sigint_action, &oldaction);
|
|
|
|
sigaction(SIGINT, &sigint_action, &oldaction);
|
|
|
|
|
|
|
|
|
|
|
|
int i;//,l;
|
|
|
|
int i;
|
|
|
|
double SNR, snr0 = -2.0, snr1 = 2.0;
|
|
|
|
double SNR, snr0 = -2.0, snr1 = 2.0;
|
|
|
|
double cfo=0;
|
|
|
|
double cfo = 0;
|
|
|
|
uint8_t snr1set=0;
|
|
|
|
uint8_t snr1set = 0;
|
|
|
|
double **s_re,**s_im,**r_re,**r_im;
|
|
|
|
double **s_re, **s_im, **r_re, **r_im;
|
|
|
|
//int sync_pos, sync_pos_slot;
|
|
|
|
|
|
|
|
//FILE *rx_frame_file;
|
|
|
|
|
|
|
|
FILE *output_fd = NULL;
|
|
|
|
FILE *output_fd = NULL;
|
|
|
|
//uint8_t write_output_file=0;
|
|
|
|
int trial, n_trials = 100, n_errors = 0, ack_nack_errors = 0, sr_errors = 0;
|
|
|
|
//int result;
|
|
|
|
|
|
|
|
//int freq_offset;
|
|
|
|
|
|
|
|
//int subframe_offset;
|
|
|
|
|
|
|
|
//char fname[40], vname[40];
|
|
|
|
|
|
|
|
int trial,n_trials=100,n_errors=0,ack_nack_errors=0,sr_errors=0;
|
|
|
|
|
|
|
|
int ret = 1;
|
|
|
|
int ret = 1;
|
|
|
|
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
|
|
|
uint8_t transmission_mode = 1, n_tx = 1, n_rx = 1;
|
|
|
|
uint16_t Nid_cell=0;
|
|
|
|
uint16_t Nid_cell = 0;
|
|
|
|
uint64_t SSB_positions=0x01;
|
|
|
|
uint64_t SSB_positions = 0x01;
|
|
|
|
channel_desc_t *UE2gNB;
|
|
|
|
channel_desc_t *UE2gNB;
|
|
|
|
int format=0;
|
|
|
|
int format = 0;
|
|
|
|
//uint8_t extended_prefix_flag=0;
|
|
|
|
FILE *input_fd = NULL;
|
|
|
|
FILE *input_fd=NULL;
|
|
|
|
int16_t amp = 0x7FFF;
|
|
|
|
//uint8_t nacktoack_flag=0;
|
|
|
|
int nr_slot_tx = 0;
|
|
|
|
int16_t amp=0x7FFF;
|
|
|
|
int nr_frame_tx = 0;
|
|
|
|
int nr_slot_tx=0;
|
|
|
|
|
|
|
|
int nr_frame_tx=0;
|
|
|
|
|
|
|
|
uint64_t actual_payload = 0, payload_received = 0;
|
|
|
|
uint64_t actual_payload = 0, payload_received = 0;
|
|
|
|
bool random_payload = true;
|
|
|
|
bool random_payload = true;
|
|
|
|
int nr_bit=1; // maximum value possible is 2
|
|
|
|
int nr_bit = 1; // maximum value possible is 2
|
|
|
|
uint8_t m0=0;// higher layer paramater initial cyclic shift
|
|
|
|
uint8_t m0 = 0; // higher layer paramater initial cyclic shift
|
|
|
|
uint8_t nrofSymbols=1; //number of OFDM symbols can be 1-2 for format 1
|
|
|
|
uint8_t nrofSymbols = 1; // number of OFDM symbols can be 1-2 for format 1
|
|
|
|
uint8_t startingSymbolIndex=0; // resource allocated see 9.2.1, 38.213 for more info.should be actually present in the resource set provided
|
|
|
|
// resource allocated see 9.2.1, 38.213 for more info.should be actually present in the resource set provided
|
|
|
|
uint16_t startingPRB=0,startingPRB_intraSlotHopping=0; //PRB number not sure see 9.2.1, 38.213 for more info. Should be actually present in the resource set provided
|
|
|
|
uint8_t startingSymbolIndex = 0;
|
|
|
|
uint16_t nrofPRB=2;
|
|
|
|
uint16_t startingPRB = 0;
|
|
|
|
uint8_t timeDomainOCC=0;
|
|
|
|
// PRB number not sure see 9.2.1, 38.213 for more info. Should be actually present in the resource set provided
|
|
|
|
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
|
|
|
uint16_t startingPRB_intraSlotHopping = 0;
|
|
|
|
|
|
|
|
uint16_t nrofPRB = 2;
|
|
|
|
|
|
|
|
uint8_t timeDomainOCC = 0;
|
|
|
|
|
|
|
|
SCM_t channel_model = AWGN; // Rayleigh1_anticorr;
|
|
|
|
|
|
|
|
|
|
|
|
double DS_TDL = .03;
|
|
|
|
double DS_TDL = .03;
|
|
|
|
|
|
|
|
|
|
|
|
double delay_us = 0;
|
|
|
|
double delay_us = 0;
|
|
|
|
int N_RB_DL=273,mu=1;
|
|
|
|
int N_RB_DL = 273, mu = 1;
|
|
|
|
float target_error_rate=0.001;
|
|
|
|
float target_error_rate = 0.001;
|
|
|
|
int frame_length_complex_samples;
|
|
|
|
int frame_length_complex_samples;
|
|
|
|
//int frame_length_complex_samples_no_prefix;
|
|
|
|
|
|
|
|
NR_DL_FRAME_PARMS *frame_parms;
|
|
|
|
NR_DL_FRAME_PARMS *frame_parms;
|
|
|
|
//unsigned char frame_type = 0;
|
|
|
|
int loglvl = OAILOG_WARNING;
|
|
|
|
int loglvl=OAILOG_WARNING;
|
|
|
|
|
|
|
|
int sr_flag = 0;
|
|
|
|
int sr_flag = 0;
|
|
|
|
int pucch_DTX_thres = 0;
|
|
|
|
int pucch_DTX_thres = 0;
|
|
|
|
cpuf = get_cpu_freq_GHz();
|
|
|
|
cpuf = get_cpu_freq_GHz();
|
|
|
@@ -153,54 +155,53 @@ int main(int argc, char **argv)
|
|
|
|
logInit();
|
|
|
|
logInit();
|
|
|
|
|
|
|
|
|
|
|
|
int c;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
int nrofSymbols_set = 0;
|
|
|
|
while ((c = getopt(argc, argv, "--:O:f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:C")) != -1) {
|
|
|
|
while ((c = getopt(argc, argv, "--:O:f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:C")) != -1) {
|
|
|
|
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
|
|
|
|
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
|
|
|
|
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
|
|
|
|
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
|
|
|
|
if (c == 1 || c == '-' || c == 'O')
|
|
|
|
if (c == 1 || c == '-' || c == 'O')
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
printf("handling optarg %c\n",c);
|
|
|
|
printf("handling optarg %c\n", c);
|
|
|
|
switch (c) {
|
|
|
|
switch (c) {
|
|
|
|
case 'f':
|
|
|
|
case 'f':
|
|
|
|
//write_output_file=1;
|
|
|
|
// write_output_file=1;
|
|
|
|
output_fd = fopen(optarg,"w");
|
|
|
|
output_fd = fopen(optarg, "w");
|
|
|
|
|
|
|
|
|
|
|
|
if (output_fd==NULL) {
|
|
|
|
if (output_fd == NULL) {
|
|
|
|
printf("Error opening %s\n",optarg);
|
|
|
|
printf("Error opening %s\n", optarg);
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'g':
|
|
|
|
case 'g':
|
|
|
|
switch((char)*optarg) {
|
|
|
|
switch ((char)*optarg) {
|
|
|
|
case 'A':
|
|
|
|
case 'A':
|
|
|
|
channel_model=SCM_A;
|
|
|
|
channel_model = SCM_A;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'B':
|
|
|
|
case 'B':
|
|
|
|
channel_model=SCM_B;
|
|
|
|
channel_model = SCM_B;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'C':
|
|
|
|
case 'C':
|
|
|
|
channel_model=SCM_C;
|
|
|
|
channel_model = SCM_C;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'D':
|
|
|
|
case 'D':
|
|
|
|
channel_model=SCM_D;
|
|
|
|
channel_model = SCM_D;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'E':
|
|
|
|
case 'E':
|
|
|
|
channel_model=EPA;
|
|
|
|
channel_model = EPA;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'F':
|
|
|
|
case 'F':
|
|
|
|
channel_model=EVA;
|
|
|
|
channel_model = EVA;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'G':
|
|
|
|
case 'G':
|
|
|
|
channel_model=ETU;
|
|
|
|
channel_model = ETU;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'H':
|
|
|
|
case 'H':
|
|
|
|
channel_model = TDL_C;
|
|
|
|
channel_model = TDL_C;
|
|
|
@@ -213,7 +214,7 @@ int main(int argc, char **argv)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'J':
|
|
|
|
case 'J':
|
|
|
|
channel_model=TDL_D;
|
|
|
|
channel_model = TDL_D;
|
|
|
|
DS_TDL = .03;
|
|
|
|
DS_TDL = .03;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
@@ -229,69 +230,50 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
|
|
|
case 'o':
|
|
|
|
case 'o':
|
|
|
|
cfo = atof(optarg);
|
|
|
|
cfo = atof(optarg);
|
|
|
|
printf("Setting CFO to %f Hz\n",cfo);
|
|
|
|
printf("Setting CFO to %f Hz\n", cfo);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
case 's':
|
|
|
|
snr0 = atof(optarg);
|
|
|
|
snr0 = atof(optarg);
|
|
|
|
printf("Setting SNR0 to %f\n",snr0);
|
|
|
|
printf("Setting SNR0 to %f\n", snr0);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
case 'S':
|
|
|
|
snr1 = atof(optarg);
|
|
|
|
snr1 = atof(optarg);
|
|
|
|
snr1set=1;
|
|
|
|
snr1set = 1;
|
|
|
|
printf("Setting SNR1 to %f\n",snr1);
|
|
|
|
printf("Setting SNR1 to %f\n", snr1);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
case 't':
|
|
|
|
pucch_DTX_thres= atoi(optarg);
|
|
|
|
pucch_DTX_thres = atoi(optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
case 'p':
|
|
|
|
|
|
|
|
extended_prefix_flag=1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
case 'd':
|
|
|
|
frame_type = 1;
|
|
|
|
delay_us = atof(optarg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
|
|
|
|
ricean_factor = pow(10,-.1*atof(optarg));
|
|
|
|
|
|
|
|
if (ricean_factor>1) {
|
|
|
|
|
|
|
|
printf("Ricean factor must be between 0 and 1\n");
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
|
|
|
|
delay_us=atof(optarg);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
case 'x':
|
|
|
|
transmission_mode=atoi(optarg);
|
|
|
|
transmission_mode = atoi(optarg);
|
|
|
|
|
|
|
|
|
|
|
|
if ((transmission_mode!=1) &&
|
|
|
|
if ((transmission_mode != 1) && (transmission_mode != 2) && (transmission_mode != 6)) {
|
|
|
|
(transmission_mode!=2) &&
|
|
|
|
printf("Unsupported transmission mode %d\n", transmission_mode);
|
|
|
|
(transmission_mode!=6)) {
|
|
|
|
|
|
|
|
printf("Unsupported transmission mode %d\n",transmission_mode);
|
|
|
|
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'y':
|
|
|
|
case 'y':
|
|
|
|
n_tx=atoi(optarg);
|
|
|
|
n_tx = atoi(optarg);
|
|
|
|
|
|
|
|
|
|
|
|
if ((n_tx==0) || (n_tx>2)) {
|
|
|
|
if ((n_tx == 0) || (n_tx > 2)) {
|
|
|
|
printf("Unsupported number of tx antennas %d\n",n_tx);
|
|
|
|
printf("Unsupported number of tx antennas %d\n", n_tx);
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'z':
|
|
|
|
case 'z':
|
|
|
|
n_rx=atoi(optarg);
|
|
|
|
n_rx = atoi(optarg);
|
|
|
|
|
|
|
|
|
|
|
|
if ((n_rx==0) || (n_rx>8)) {
|
|
|
|
if ((n_rx == 0) || (n_rx > 8)) {
|
|
|
|
printf("Unsupported number of rx antennas %d\n",n_rx);
|
|
|
|
printf("Unsupported number of rx antennas %d\n", n_rx);
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@@ -305,10 +287,10 @@ int main(int argc, char **argv)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'F':
|
|
|
|
case 'F':
|
|
|
|
input_fd = fopen(optarg,"r");
|
|
|
|
input_fd = fopen(optarg, "r");
|
|
|
|
|
|
|
|
|
|
|
|
if (input_fd==NULL) {
|
|
|
|
if (input_fd == NULL) {
|
|
|
|
printf("Problem with filename %s\n",optarg);
|
|
|
|
printf("Problem with filename %s\n", optarg);
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@@ -317,36 +299,40 @@ int main(int argc, char **argv)
|
|
|
|
loglvl = atoi(optarg);
|
|
|
|
loglvl = atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
case 'i':
|
|
|
|
nrofSymbols=(uint8_t)atoi(optarg);
|
|
|
|
nrofSymbols = (uint8_t)atoi(optarg);
|
|
|
|
|
|
|
|
nrofSymbols_set = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'I':
|
|
|
|
case 'I':
|
|
|
|
startingSymbolIndex=(uint8_t)atoi(optarg);
|
|
|
|
startingSymbolIndex = (uint8_t)atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
case 'r':
|
|
|
|
startingPRB=atoi(optarg);
|
|
|
|
startingPRB = atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
case 'q':
|
|
|
|
nrofPRB=atoi(optarg);
|
|
|
|
nrofPRB = atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
case 'P':
|
|
|
|
format=atoi(optarg);
|
|
|
|
format = atoi(optarg);
|
|
|
|
|
|
|
|
if ((format == 1 || format == 3) && nrofSymbols_set == 0)
|
|
|
|
|
|
|
|
nrofSymbols = 14;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
case 'm':
|
|
|
|
m0=atoi(optarg);
|
|
|
|
m0 = atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
case 'b':
|
|
|
|
nr_bit=atoi(optarg);
|
|
|
|
nr_bit = atoi(optarg);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
case 'c':
|
|
|
|
sr_flag=1;
|
|
|
|
sr_flag = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'B':
|
|
|
|
case 'B':
|
|
|
|
actual_payload=atoi(optarg);
|
|
|
|
actual_payload = atoi(optarg);
|
|
|
|
random_payload = false;
|
|
|
|
random_payload = false;
|
|
|
|
|
|
|
|
printf("Setting payload to %llx\n", (unsigned long long)actual_payload);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'T':
|
|
|
|
case 'T':
|
|
|
|
//nacktoack_flag=(uint8_t)atoi(optarg);
|
|
|
|
// nacktoack_flag=(uint8_t)atoi(optarg);
|
|
|
|
target_error_rate=0.001;
|
|
|
|
target_error_rate = 0.001;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
case 'C':
|
|
|
|
print_perf = 1;
|
|
|
|
print_perf = 1;
|
|
|
@@ -354,8 +340,12 @@ int main(int argc, char **argv)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
case 'h':
|
|
|
|
case 'h':
|
|
|
|
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]);
|
|
|
|
printf(
|
|
|
|
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
|
|
|
"%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t "
|
|
|
|
|
|
|
|
"Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A "
|
|
|
|
|
|
|
|
"interpolation_file -C(alibration offset dB) -N CellId\n",
|
|
|
|
|
|
|
|
argv[0]);
|
|
|
|
|
|
|
|
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
|
|
|
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
|
|
|
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
|
|
|
printf("-b number of HARQ bits (1-2)\n");
|
|
|
|
printf("-b number of HARQ bits (1-2)\n");
|
|
|
|
printf("-B payload to be transmitted on PUCCH\n");
|
|
|
|
printf("-B payload to be transmitted on PUCCH\n");
|
|
|
@@ -363,7 +353,9 @@ int main(int argc, char **argv)
|
|
|
|
printf("-d Use TDD\n");
|
|
|
|
printf("-d Use TDD\n");
|
|
|
|
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
|
|
|
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
|
|
|
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
|
|
|
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
|
|
|
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
|
|
|
printf(
|
|
|
|
|
|
|
|
"-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean "
|
|
|
|
|
|
|
|
"factor)\n");
|
|
|
|
printf("-i Enter number of ofdm symbols for pucch\n");
|
|
|
|
printf("-i Enter number of ofdm symbols for pucch\n");
|
|
|
|
printf("-I Starting symbol index for pucch\n");
|
|
|
|
printf("-I Starting symbol index for pucch\n");
|
|
|
|
printf("-h This message\n");
|
|
|
|
printf("-h This message\n");
|
|
|
@@ -385,43 +377,46 @@ int main(int argc, char **argv)
|
|
|
|
printf("-y Number of TX antennas used in eNB\n");
|
|
|
|
printf("-y Number of TX antennas used in eNB\n");
|
|
|
|
printf("-z Number of RX antennas used in UE\n");
|
|
|
|
printf("-z Number of RX antennas used in UE\n");
|
|
|
|
printf("-C print CPU cost\n");
|
|
|
|
printf("-C print CPU cost\n");
|
|
|
|
exit (-1);
|
|
|
|
exit(-1);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double phase = (1<<mu)*30e-3*delay_us;
|
|
|
|
double phase = (1 << mu) * 30e-3 * delay_us;
|
|
|
|
|
|
|
|
|
|
|
|
set_glog(loglvl);
|
|
|
|
set_glog(loglvl);
|
|
|
|
|
|
|
|
|
|
|
|
if (snr1set==0) snr1 = snr0+10;
|
|
|
|
if (snr1set == 0)
|
|
|
|
|
|
|
|
snr1 = snr0 + 10;
|
|
|
|
|
|
|
|
|
|
|
|
printf("Initializing gNodeB for mu %d, N_RB_DL %d, n_rx %d\n",mu,N_RB_DL,n_rx);
|
|
|
|
printf("Initializing gNodeB for mu %d, N_RB_DL %d, n_rx %d\n", mu, N_RB_DL, n_rx);
|
|
|
|
|
|
|
|
|
|
|
|
if((format!=0) && (format!=1) && (format!=2)){
|
|
|
|
if ((format != 0) && (format != 1) && (format != 2)) {
|
|
|
|
printf("PUCCH format %d not supported\n",format);
|
|
|
|
printf("PUCCH format %d not supported\n", format);
|
|
|
|
exit(0);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AssertFatal(((format < 2)&&(nr_bit<3)&&(actual_payload<5)) ||
|
|
|
|
AssertFatal(((format < 2) && (nr_bit < 3) && (actual_payload < 5)) || ((format == 2) && (nr_bit > 2) && (nr_bit < 65)),
|
|
|
|
((format == 2)&&(nr_bit>2)&&(nr_bit<65)),"illegal combination format %d, nr_bit %d\n",
|
|
|
|
"illegal combination format %d, nr_bit %d\n",
|
|
|
|
format,nr_bit);
|
|
|
|
format,
|
|
|
|
int do_DTX=0;
|
|
|
|
nr_bit);
|
|
|
|
if ((format < 2) && (actual_payload == 4)) do_DTX=1;
|
|
|
|
int do_DTX = 0;
|
|
|
|
|
|
|
|
if ((format < 2) && (actual_payload == 4))
|
|
|
|
|
|
|
|
do_DTX = 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (random_payload) {
|
|
|
|
if (random_payload) {
|
|
|
|
double tmp = uniformrandom();
|
|
|
|
double tmp = uniformrandom();
|
|
|
|
memcpy(&actual_payload, &tmp, sizeof(actual_payload));
|
|
|
|
memcpy(&actual_payload, &tmp, sizeof(actual_payload));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
actual_payload &= nr_bit < 64 ? (1UL << nr_bit) - 1: 0xffffffffffffffff;
|
|
|
|
actual_payload &= nr_bit < 64 ? (1UL << nr_bit) - 1 : 0xffffffffffffffff;
|
|
|
|
|
|
|
|
|
|
|
|
printf("Transmitted payload is %lu, do_DTX = %d\n",actual_payload,do_DTX);
|
|
|
|
printf("Transmitted payload is %lu, do_DTX = %d\n", actual_payload, do_DTX);
|
|
|
|
|
|
|
|
|
|
|
|
RC.gNB = calloc(1, sizeof(PHY_VARS_gNB *));
|
|
|
|
RC.gNB = calloc(1, sizeof(PHY_VARS_gNB *));
|
|
|
|
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
|
|
|
|
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
|
|
|
|
gNB = RC.gNB[0];
|
|
|
|
gNB = RC.gNB[0];
|
|
|
|
gNB->pucch0_thres = pucch_DTX_thres;
|
|
|
|
gNB->pucch0_thres = pucch_DTX_thres;
|
|
|
|
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
|
|
|
frame_parms = &gNB->frame_parms; // to be initialized I suppose (maybe not necessary for PBCH)
|
|
|
|
frame_parms->nb_antennas_tx = n_tx;
|
|
|
|
frame_parms->nb_antennas_tx = n_tx;
|
|
|
|
frame_parms->nb_antennas_rx = n_rx;
|
|
|
|
frame_parms->nb_antennas_rx = n_rx;
|
|
|
|
frame_parms->N_RB_DL = N_RB_DL;
|
|
|
|
frame_parms->N_RB_DL = N_RB_DL;
|
|
|
@@ -431,7 +426,7 @@ int main(int argc, char **argv)
|
|
|
|
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
|
|
|
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
|
|
|
cfg->carrier_config.num_tx_ant.value = n_tx;
|
|
|
|
cfg->carrier_config.num_tx_ant.value = n_tx;
|
|
|
|
cfg->carrier_config.num_rx_ant.value = n_rx;
|
|
|
|
cfg->carrier_config.num_rx_ant.value = n_rx;
|
|
|
|
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
|
|
|
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell, SSB_positions);
|
|
|
|
// TDD configuration
|
|
|
|
// TDD configuration
|
|
|
|
gNB->gNB_config.tdd_table.tdd_period.value = 6;
|
|
|
|
gNB->gNB_config.tdd_table.tdd_period.value = 6;
|
|
|
|
do_tdd_config_sim(gNB, mu);
|
|
|
|
do_tdd_config_sim(gNB, mu);
|
|
|
@@ -442,71 +437,66 @@ int main(int argc, char **argv)
|
|
|
|
for (i = 0; i < n_rx; i++)
|
|
|
|
for (i = 0; i < n_rx; i++)
|
|
|
|
gNB->common_vars.rxdataF[0][i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP * sizeof(c16_t));
|
|
|
|
gNB->common_vars.rxdataF[0][i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP * sizeof(c16_t));
|
|
|
|
|
|
|
|
|
|
|
|
double fs,txbw,rxbw;
|
|
|
|
double fs, txbw, rxbw;
|
|
|
|
get_samplerate_and_bw(mu,
|
|
|
|
get_samplerate_and_bw(mu, N_RB_DL, frame_parms->threequarter_fs, &fs, &txbw, &rxbw);
|
|
|
|
N_RB_DL,
|
|
|
|
|
|
|
|
frame_parms->threequarter_fs,
|
|
|
|
|
|
|
|
&fs,
|
|
|
|
|
|
|
|
&txbw,
|
|
|
|
|
|
|
|
&rxbw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, 0, txbw, DS_TDL, 0.0, CORR_LEVEL_LOW, 0, 0, 0, 0);
|
|
|
|
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, 0, txbw, DS_TDL, 0.0, CORR_LEVEL_LOW, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (UE2gNB==NULL) {
|
|
|
|
if (UE2gNB == NULL) {
|
|
|
|
printf("Problem generating channel model. Exiting.\n");
|
|
|
|
printf("Problem generating channel model. Exiting.\n");
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
|
|
|
frame_length_complex_samples = frame_parms->samples_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
|
|
|
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
|
|
|
// frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
|
|
|
|
|
|
|
|
|
|
|
s_re = malloc(n_tx*sizeof(double*));
|
|
|
|
s_re = malloc(n_tx * sizeof(double *));
|
|
|
|
s_im = malloc(n_tx*sizeof(double*));
|
|
|
|
s_im = malloc(n_tx * sizeof(double *));
|
|
|
|
r_re = malloc(n_rx*sizeof(double*));
|
|
|
|
r_re = malloc(n_rx * sizeof(double *));
|
|
|
|
r_im = malloc(n_rx*sizeof(double*));
|
|
|
|
r_im = malloc(n_rx * sizeof(double *));
|
|
|
|
memcpy((void *)&gNB->frame_parms, (void *)frame_parms, sizeof(*frame_parms));
|
|
|
|
memcpy((void *)&gNB->frame_parms, (void *)frame_parms, sizeof(*frame_parms));
|
|
|
|
for (int aatx=0; aatx<n_tx; aatx++) {
|
|
|
|
for (int aatx = 0; aatx < n_tx; aatx++) {
|
|
|
|
s_re[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
|
|
|
s_re[aatx] = calloc(1, frame_length_complex_samples * sizeof(double));
|
|
|
|
s_im[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
|
|
|
s_im[aatx] = calloc(1, frame_length_complex_samples * sizeof(double));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int aarx=0; aarx<n_rx; aarx++) {
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++) {
|
|
|
|
r_re[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
|
|
|
r_re[aarx] = calloc(1, frame_length_complex_samples * sizeof(double));
|
|
|
|
r_im[aarx] = calloc(1,frame_length_complex_samples*sizeof(double));
|
|
|
|
r_im[aarx] = calloc(1, frame_length_complex_samples * sizeof(double));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t mcs=0;
|
|
|
|
uint8_t mcs = 0;
|
|
|
|
int shift = 0;
|
|
|
|
int shift = 0;
|
|
|
|
if(format==0){
|
|
|
|
if (format == 0) {
|
|
|
|
if (sr_flag)
|
|
|
|
if (sr_flag)
|
|
|
|
shift = 1<<nr_bit;
|
|
|
|
shift = 1 << nr_bit;
|
|
|
|
if (nr_bit ==0)
|
|
|
|
if (nr_bit == 0)
|
|
|
|
mcs=table1_mcs[0];
|
|
|
|
mcs = table1_mcs[0];
|
|
|
|
else if(nr_bit==1)
|
|
|
|
else if (nr_bit == 1)
|
|
|
|
mcs=table1_mcs[actual_payload+shift];
|
|
|
|
mcs = table1_mcs[actual_payload + shift];
|
|
|
|
else if(nr_bit==2)
|
|
|
|
else if (nr_bit == 2)
|
|
|
|
mcs=table2_mcs[actual_payload+shift];
|
|
|
|
mcs = table2_mcs[actual_payload + shift];
|
|
|
|
else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag);
|
|
|
|
else
|
|
|
|
|
|
|
|
AssertFatal(1 == 0, "Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
startingPRB_intraSlotHopping = N_RB_DL-1;
|
|
|
|
startingPRB_intraSlotHopping = N_RB_DL - 1;
|
|
|
|
uint32_t hopping_id = Nid_cell;
|
|
|
|
uint32_t hopping_id = Nid_cell;
|
|
|
|
uint32_t dmrs_scrambling_id = 0;
|
|
|
|
uint32_t dmrs_scrambling_id = 0;
|
|
|
|
uint32_t data_scrambling_id = 0;
|
|
|
|
uint32_t data_scrambling_id = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//configure UE
|
|
|
|
// configure UE
|
|
|
|
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
|
|
|
UE = calloc(1, sizeof(PHY_VARS_NR_UE));
|
|
|
|
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
|
|
|
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
|
|
|
UE->frame_parms.nb_antennas_rx=1;
|
|
|
|
UE->frame_parms.nb_antennas_rx = 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (init_nr_ue_signal(UE, 1) != 0)
|
|
|
|
if (init_nr_ue_signal(UE, 1) != 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Error at UE NR initialisation\n");
|
|
|
|
printf("Error at UE NR initialisation\n");
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fapi_nr_ul_config_pucch_pdu pucch_tx_pdu;
|
|
|
|
fapi_nr_ul_config_pucch_pdu pucch_tx_pdu = {0};
|
|
|
|
if (format==0) {
|
|
|
|
if (format == 0) {
|
|
|
|
pucch_tx_pdu.format_type = 0;
|
|
|
|
pucch_tx_pdu.format_type = 0;
|
|
|
|
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
|
|
|
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
|
|
|
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
|
|
|
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
|
|
@@ -520,7 +510,22 @@ int main(int argc, char **argv)
|
|
|
|
pucch_tx_pdu.initial_cyclic_shift = 0;
|
|
|
|
pucch_tx_pdu.initial_cyclic_shift = 0;
|
|
|
|
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
|
|
|
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (format==2) {
|
|
|
|
else if (format == 1) {
|
|
|
|
|
|
|
|
pucch_tx_pdu.format_type = 0;
|
|
|
|
|
|
|
|
pucch_tx_pdu.n_bit = nr_bit;
|
|
|
|
|
|
|
|
pucch_tx_pdu.payload = actual_payload;
|
|
|
|
|
|
|
|
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
|
|
|
|
|
|
|
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
|
|
|
|
|
|
|
pucch_tx_pdu.bwp_start = 0;
|
|
|
|
|
|
|
|
pucch_tx_pdu.prb_start = startingPRB;
|
|
|
|
|
|
|
|
pucch_tx_pdu.hopping_id = hopping_id;
|
|
|
|
|
|
|
|
pucch_tx_pdu.group_hop_flag = 0;
|
|
|
|
|
|
|
|
pucch_tx_pdu.sequence_hop_flag = 0;
|
|
|
|
|
|
|
|
pucch_tx_pdu.freq_hop_flag = 1;
|
|
|
|
|
|
|
|
pucch_tx_pdu.initial_cyclic_shift = m0;
|
|
|
|
|
|
|
|
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
|
|
|
|
|
|
|
pucch_tx_pdu.time_domain_occ_idx = timeDomainOCC;
|
|
|
|
|
|
|
|
} else if (format == 2) {
|
|
|
|
pucch_tx_pdu.format_type = 2;
|
|
|
|
pucch_tx_pdu.format_type = 2;
|
|
|
|
pucch_tx_pdu.rnti = 0x1234;
|
|
|
|
pucch_tx_pdu.rnti = 0x1234;
|
|
|
|
pucch_tx_pdu.n_bit = nr_bit;
|
|
|
|
pucch_tx_pdu.n_bit = nr_bit;
|
|
|
@@ -539,28 +544,28 @@ int main(int argc, char **argv)
|
|
|
|
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
|
|
|
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1);
|
|
|
|
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag << 1);
|
|
|
|
double tx_level_fp = 100.0;
|
|
|
|
double tx_level_fp = 100.0;
|
|
|
|
c16_t **rxdataF = gNB->common_vars.rxdataF[0];
|
|
|
|
c16_t **rxdataF = gNB->common_vars.rxdataF[0];
|
|
|
|
for(SNR = snr0; SNR <= snr1 && !stop; SNR += 1) {
|
|
|
|
for (SNR = snr0; SNR <= snr1 && !stop; SNR += 1) {
|
|
|
|
ack_nack_errors=0;
|
|
|
|
ack_nack_errors = 0;
|
|
|
|
sr_errors = 0;
|
|
|
|
sr_errors = 0;
|
|
|
|
n_errors = 0;
|
|
|
|
n_errors = 0;
|
|
|
|
c16_t **txdataF = gNB->common_vars.txdataF[0];
|
|
|
|
c16_t **txdataF = gNB->common_vars.txdataF[0];
|
|
|
|
for (trial = 0; trial < n_trials && !stop; trial++) {
|
|
|
|
for (trial = 0; trial < n_trials && !stop; trial++) {
|
|
|
|
for (int aatx=0;aatx<1;aatx++)
|
|
|
|
for (int aatx = 0; aatx < 1; aatx++)
|
|
|
|
bzero(txdataF[aatx],frame_parms->ofdm_symbol_size*sizeof(int));
|
|
|
|
bzero(txdataF[aatx], frame_parms->ofdm_symbol_size * sizeof(int));
|
|
|
|
if(format==0 && do_DTX==0){
|
|
|
|
if (format == 0 && do_DTX == 0) {
|
|
|
|
nr_generate_pucch0(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
nr_generate_pucch0(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
} else if (format == 1 && do_DTX==0){
|
|
|
|
} else if (format == 1 && do_DTX == 0) {
|
|
|
|
nr_generate_pucch1(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
nr_generate_pucch1(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
} else if (do_DTX == 0){
|
|
|
|
} else if (do_DTX == 0) {
|
|
|
|
nr_generate_pucch2(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
nr_generate_pucch2(txdataF, frame_parms, amp, nr_slot_tx, &pucch_tx_pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SNR Computation
|
|
|
|
// SNR Computation
|
|
|
|
// standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e. N_RB_DL resource blocks)
|
|
|
|
// standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e.
|
|
|
|
// txlev = S.
|
|
|
|
// N_RB_DL resource blocks) txlev = S.
|
|
|
|
|
|
|
|
|
|
|
|
// Compute transmitter energy level
|
|
|
|
// Compute transmitter energy level
|
|
|
|
int symbol_offset = startingSymbolIndex * frame_parms->ofdm_symbol_size;
|
|
|
|
int symbol_offset = startingSymbolIndex * frame_parms->ofdm_symbol_size;
|
|
|
@@ -572,14 +577,14 @@ int main(int argc, char **argv)
|
|
|
|
int N_RB = (format == 0 || format == 1) ? 1 : nrofPRB;
|
|
|
|
int N_RB = (format == 0 || format == 1) ? 1 : nrofPRB;
|
|
|
|
double sigma2 = compute_noise_variance(txlev, N_RB_DL * 12, N_RB, 1, SNR, n_trials);
|
|
|
|
double sigma2 = compute_noise_variance(txlev, N_RB_DL * 12, N_RB, 1, SNR, n_trials);
|
|
|
|
|
|
|
|
|
|
|
|
for (int symb=0; symb<gNB->frame_parms.symbols_per_slot;symb++) {
|
|
|
|
for (int symb = 0; symb < gNB->frame_parms.symbols_per_slot; symb++) {
|
|
|
|
if (symb<startingSymbolIndex || symb >= startingSymbolIndex+nrofSymbols) {
|
|
|
|
if (symb < startingSymbolIndex || symb >= startingSymbolIndex + nrofSymbols) {
|
|
|
|
int i0 = symb*gNB->frame_parms.ofdm_symbol_size;
|
|
|
|
int i0 = symb * gNB->frame_parms.ofdm_symbol_size;
|
|
|
|
for (int re=0;re<N_RB_DL*12;re++) {
|
|
|
|
for (int re = 0; re < N_RB_DL * 12; re++) {
|
|
|
|
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
|
|
|
i = i0 + ((gNB->frame_parms.first_carrier_offset + re) % gNB->frame_parms.ofdm_symbol_size);
|
|
|
|
for (int aarx=0;aarx<n_rx;aarx++) {
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++) {
|
|
|
|
double nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
|
|
|
double nr = sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0);
|
|
|
|
double ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
|
|
|
double ni = sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0);
|
|
|
|
rxdataF[aarx][i].r = (int16_t)(tx_level_fp * (nr) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].r = (int16_t)(tx_level_fp * (nr) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].i = (int16_t)(tx_level_fp * (ni) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].i = (int16_t)(tx_level_fp * (ni) / sqrt((double)txlev));
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -587,57 +592,84 @@ int main(int argc, char **argv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
random_channel(UE2gNB,0);
|
|
|
|
random_channel(UE2gNB, 0);
|
|
|
|
freq_channel(UE2gNB,N_RB_DL,2*N_RB_DL+1,15<<mu);
|
|
|
|
freq_channel(UE2gNB, N_RB_DL, 2 * N_RB_DL + 1, 15 << mu);
|
|
|
|
for (int symb=0; symb<nrofSymbols; symb++) {
|
|
|
|
for (int symb = 0; symb < nrofSymbols; symb++) {
|
|
|
|
int i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
|
|
|
int i0 = (startingSymbolIndex + symb) * gNB->frame_parms.ofdm_symbol_size;
|
|
|
|
for (int re=0;re<N_RB_DL*12;re++) {
|
|
|
|
for (int re = 0; re < N_RB_DL * 12; re++) {
|
|
|
|
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
|
|
|
i = i0 + ((gNB->frame_parms.first_carrier_offset + re) % gNB->frame_parms.ofdm_symbol_size);
|
|
|
|
struct complexd phasor;
|
|
|
|
struct complexd phasor;
|
|
|
|
phasor.r = cos(2*M_PI*phase*re);
|
|
|
|
phasor.r = cos(2 * M_PI * phase * re);
|
|
|
|
phasor.i = sin(2*M_PI*phase*re);
|
|
|
|
phasor.i = sin(2 * M_PI * phase * re);
|
|
|
|
for (int aarx=0;aarx<n_rx;aarx++) {
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++) {
|
|
|
|
double txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
|
|
|
double txr = (double)(((int16_t *)txdataF[0])[(i << 1)]);
|
|
|
|
double txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
|
|
|
double txi = (double)(((int16_t *)txdataF[0])[1 + (i << 1)]);
|
|
|
|
double rxr={0},rxi={0};
|
|
|
|
double rxr = {0}, rxi = {0};
|
|
|
|
for (int l = 0; l<UE2gNB->channel_length; l++) {
|
|
|
|
for (int l = 0; l < UE2gNB->channel_length; l++) {
|
|
|
|
rxr = txr*UE2gNB->chF[aarx][l].r - txi*UE2gNB->chF[aarx][l].i;
|
|
|
|
rxr = txr * UE2gNB->chF[aarx][l].r - txi * UE2gNB->chF[aarx][l].i;
|
|
|
|
rxi = txr*UE2gNB->chF[aarx][l].i + txi*UE2gNB->chF[aarx][l].r;
|
|
|
|
rxi = txr * UE2gNB->chF[aarx][l].i + txi * UE2gNB->chF[aarx][l].r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
double rxr_tmp = rxr*phasor.r - rxi*phasor.i;
|
|
|
|
double rxr_tmp = rxr * phasor.r - rxi * phasor.i;
|
|
|
|
rxi = rxr*phasor.i + rxi*phasor.r;
|
|
|
|
rxi = rxr * phasor.i + rxi * phasor.r;
|
|
|
|
rxr = rxr_tmp;
|
|
|
|
rxr = rxr_tmp;
|
|
|
|
double nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
|
|
|
double nr = sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0);
|
|
|
|
double ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
|
|
|
double ni = sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0);
|
|
|
|
rxdataF[aarx][i].r = (int16_t)(tx_level_fp * (rxr + nr) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].r = (int16_t)(tx_level_fp * (rxr + nr) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].i = (int16_t)(tx_level_fp * (rxi + ni) / sqrt((double)txlev));
|
|
|
|
rxdataF[aarx][i].i = (int16_t)(tx_level_fp * (rxi + ni) / sqrt((double)txlev));
|
|
|
|
|
|
|
|
|
|
|
|
if (n_trials==1 && fabs(txr) > 0) printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
|
|
|
|
if (n_trials == 1 && fabs(txr) > 0)
|
|
|
|
symb, re, aarx, txr,txi,
|
|
|
|
printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
|
|
|
|
UE2gNB->chF[aarx][re].r,UE2gNB->chF[aarx][re].i,
|
|
|
|
symb,
|
|
|
|
nr,ni, rxr,rxi,
|
|
|
|
re,
|
|
|
|
rxdataF[aarx][i].r,rxdataF[aarx][i].i);
|
|
|
|
aarx,
|
|
|
|
|
|
|
|
txr,
|
|
|
|
|
|
|
|
txi,
|
|
|
|
|
|
|
|
UE2gNB->chF[aarx][re].r,
|
|
|
|
|
|
|
|
UE2gNB->chF[aarx][re].i,
|
|
|
|
|
|
|
|
nr,
|
|
|
|
|
|
|
|
ni,
|
|
|
|
|
|
|
|
rxr,
|
|
|
|
|
|
|
|
rxi,
|
|
|
|
|
|
|
|
rxdataF[aarx][i].r,
|
|
|
|
|
|
|
|
rxdataF[aarx][i].i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int rxlev=0;
|
|
|
|
int rxlev = 0;
|
|
|
|
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy((int32_t*)&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++)
|
|
|
|
|
|
|
|
rxlev += signal_energy((int32_t *)&rxdataF[aarx][startingSymbolIndex * frame_parms->ofdm_symbol_size],
|
|
|
|
frame_parms->ofdm_symbol_size);
|
|
|
|
frame_parms->ofdm_symbol_size);
|
|
|
|
|
|
|
|
|
|
|
|
int rxlev_pucch=0;
|
|
|
|
int rxlev_pucch = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (int aarx=0;aarx<n_rx;aarx++) rxlev_pucch += signal_energy((int32_t*)&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++)
|
|
|
|
12);
|
|
|
|
rxlev_pucch += signal_energy((int32_t *)&rxdataF[aarx][startingSymbolIndex * frame_parms->ofdm_symbol_size], 12);
|
|
|
|
|
|
|
|
|
|
|
|
// set UL mask for pucch allocation
|
|
|
|
// set UL mask for pucch allocation
|
|
|
|
uint32_t rb_mask_ul[14][9] = {0};
|
|
|
|
uint32_t rb_mask_ul[14][9] = {0};
|
|
|
|
for (int s=0;s<frame_parms->symbols_per_slot;s++){
|
|
|
|
|
|
|
|
if (s>=startingSymbolIndex && s<(startingSymbolIndex+nrofSymbols))
|
|
|
|
if (format == 1) {
|
|
|
|
for (int rb=0; rb<N_RB; rb++) {
|
|
|
|
for (int s = 0; s < frame_parms->symbols_per_slot; s++) {
|
|
|
|
int rb2 = rb+startingPRB;
|
|
|
|
if (s >= startingSymbolIndex && s < (startingSymbolIndex + nrofSymbols / 2))
|
|
|
|
|
|
|
|
for (int rb = 0; rb < N_RB; rb++) {
|
|
|
|
|
|
|
|
int rb2 = rb + startingPRB;
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (s >= (startingSymbolIndex + nrofSymbols / 2) && s < startingSymbolIndex + nrofSymbols)
|
|
|
|
|
|
|
|
for (int rb = 0; rb < N_RB; rb++) {
|
|
|
|
|
|
|
|
int rb2 = rb + startingPRB_intraSlotHopping;
|
|
|
|
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
for (int s = 0; s < frame_parms->symbols_per_slot; s++) {
|
|
|
|
|
|
|
|
if (s >= startingSymbolIndex && s < (startingSymbolIndex + nrofSymbols))
|
|
|
|
|
|
|
|
for (int rb = 0; rb < N_RB; rb++) {
|
|
|
|
|
|
|
|
int rb2 = rb + startingPRB;
|
|
|
|
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// noise measurement (all PRBs)
|
|
|
|
// noise measurement (all PRBs)
|
|
|
@@ -654,14 +686,14 @@ int main(int argc, char **argv)
|
|
|
|
10 * log10((double)txlev * UE->frame_parms.ofdm_symbol_size / 12),
|
|
|
|
10 * log10((double)txlev * UE->frame_parms.ofdm_symbol_size / 12),
|
|
|
|
gNB->measurements.n0_subband_power_tot_dB[startingPRB],
|
|
|
|
gNB->measurements.n0_subband_power_tot_dB[startingPRB],
|
|
|
|
gNB->measurements.n0_subband_power_avg_dB);
|
|
|
|
gNB->measurements.n0_subband_power_avg_dB);
|
|
|
|
if(format==0){
|
|
|
|
if (format == 0) {
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu;
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu;
|
|
|
|
gNB->phy_stats[0].rnti = 0x1234;
|
|
|
|
gNB->phy_stats[0].rnti = 0x1234;
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
pucch_pdu.subcarrier_spacing = 1;
|
|
|
|
pucch_pdu.subcarrier_spacing = 1;
|
|
|
|
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
|
|
|
|
pucch_pdu.group_hop_flag = PUCCH_GroupHopping & 1;
|
|
|
|
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1;
|
|
|
|
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping >> 1) & 1;
|
|
|
|
pucch_pdu.bit_len_harq = nr_bit;
|
|
|
|
pucch_pdu.bit_len_harq = nr_bit;
|
|
|
|
pucch_pdu.bit_len_csi_part1 = 0;
|
|
|
|
pucch_pdu.bit_len_csi_part1 = 0;
|
|
|
|
pucch_pdu.bit_len_csi_part2 = 0;
|
|
|
|
pucch_pdu.bit_len_csi_part2 = 0;
|
|
|
@@ -674,48 +706,76 @@ int main(int argc, char **argv)
|
|
|
|
pucch_pdu.prb_size = 1;
|
|
|
|
pucch_pdu.prb_size = 1;
|
|
|
|
pucch_pdu.bwp_start = 0;
|
|
|
|
pucch_pdu.bwp_start = 0;
|
|
|
|
pucch_pdu.bwp_size = N_RB_DL;
|
|
|
|
pucch_pdu.bwp_size = N_RB_DL;
|
|
|
|
if (nrofSymbols>1) {
|
|
|
|
if (nrofSymbols > 1) {
|
|
|
|
pucch_pdu.freq_hop_flag = 1;
|
|
|
|
pucch_pdu.freq_hop_flag = 1;
|
|
|
|
pucch_pdu.second_hop_prb = N_RB_DL-1;
|
|
|
|
pucch_pdu.second_hop_prb = N_RB_DL - 1;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
else pucch_pdu.freq_hop_flag = 0;
|
|
|
|
pucch_pdu.freq_hop_flag = 0;
|
|
|
|
|
|
|
|
|
|
|
|
nr_decode_pucch0(gNB, rxdataF, nr_frame_tx, nr_slot_tx,&uci_pdu,&pucch_pdu);
|
|
|
|
nr_decode_pucch0(gNB, rxdataF, nr_frame_tx, nr_slot_tx, &uci_pdu, &pucch_pdu);
|
|
|
|
if(sr_flag==1){
|
|
|
|
if (sr_flag == 1) {
|
|
|
|
if (uci_pdu.sr.sr_indication == 0 || uci_pdu.sr.sr_confidence_level == 1)
|
|
|
|
if (uci_pdu.sr.sr_indication == 0 || uci_pdu.sr.sr_confidence_level == 1)
|
|
|
|
sr_errors+=1;
|
|
|
|
sr_errors += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// harq value 0 -> pass
|
|
|
|
// harq value 0 -> pass
|
|
|
|
nfapi_nr_harq_t *harq_list = uci_pdu.harq.harq_list;
|
|
|
|
nfapi_nr_harq_t *harq_list = uci_pdu.harq.harq_list;
|
|
|
|
// confidence value 0 -> good confidence
|
|
|
|
// confidence value 0 -> good confidence
|
|
|
|
const int confidence_lvl = uci_pdu.harq.harq_confidence_level;
|
|
|
|
const int confidence_lvl = uci_pdu.harq.harq_confidence_level;
|
|
|
|
if(nr_bit>0){
|
|
|
|
if (nr_bit > 0) {
|
|
|
|
if (nr_bit==1 && do_DTX == 0)
|
|
|
|
if (nr_bit == 1 && do_DTX == 0)
|
|
|
|
ack_nack_errors+=(actual_payload^(!harq_list[0].harq_value));
|
|
|
|
ack_nack_errors += (actual_payload ^ (!harq_list[0].harq_value));
|
|
|
|
else if (do_DTX == 0)
|
|
|
|
else if (do_DTX == 0)
|
|
|
|
ack_nack_errors+=(((actual_payload&1)^(!harq_list[1].harq_value))+((actual_payload>>1)^(!harq_list[0].harq_value)));
|
|
|
|
ack_nack_errors +=
|
|
|
|
else if ((!confidence_lvl && !harq_list[0].harq_value) ||
|
|
|
|
(((actual_payload & 1) ^ (!harq_list[1].harq_value)) + ((actual_payload >> 1) ^ (!harq_list[0].harq_value)));
|
|
|
|
(!confidence_lvl && nr_bit == 2 && !harq_list[1].harq_value))
|
|
|
|
else if ((!confidence_lvl && !harq_list[0].harq_value) || (!confidence_lvl && nr_bit == 2 && !harq_list[1].harq_value))
|
|
|
|
ack_nack_errors++;
|
|
|
|
ack_nack_errors++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (format == 1) {
|
|
|
|
else if (format==1) {
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
|
|
|
nr_decode_pucch1((c16_t **)rxdataF,PUCCH_GroupHopping,hopping_id,
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu;
|
|
|
|
&(payload_received),frame_parms,amp,nr_slot_tx,
|
|
|
|
gNB->phy_stats[0].rnti = 0x1234;
|
|
|
|
m0,nrofSymbols,startingSymbolIndex,startingPRB,
|
|
|
|
|
|
|
|
startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
|
|
|
|
|
|
|
|
if(nr_bit==1)
|
|
|
|
|
|
|
|
ack_nack_errors+=((actual_payload^payload_received)&1);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ack_nack_errors+=((actual_payload^payload_received)&1) + (((actual_payload^payload_received)&2)>>1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (format==2) {
|
|
|
|
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t uci_pdu={0};
|
|
|
|
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu={0};
|
|
|
|
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
pucch_pdu.subcarrier_spacing = 1;
|
|
|
|
pucch_pdu.subcarrier_spacing = 1;
|
|
|
|
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
|
|
|
|
pucch_pdu.group_hop_flag = PUCCH_GroupHopping & 1;
|
|
|
|
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping>>1)&1;
|
|
|
|
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping >> 1) & 1;
|
|
|
|
|
|
|
|
pucch_pdu.bit_len_harq = nr_bit;
|
|
|
|
|
|
|
|
pucch_pdu.bit_len_csi_part1 = 0;
|
|
|
|
|
|
|
|
pucch_pdu.bit_len_csi_part2 = 0;
|
|
|
|
|
|
|
|
pucch_pdu.sr_flag = sr_flag;
|
|
|
|
|
|
|
|
pucch_pdu.nr_of_symbols = nrofSymbols;
|
|
|
|
|
|
|
|
pucch_pdu.hopping_id = hopping_id;
|
|
|
|
|
|
|
|
pucch_pdu.initial_cyclic_shift = m0;
|
|
|
|
|
|
|
|
pucch_pdu.start_symbol_index = startingSymbolIndex;
|
|
|
|
|
|
|
|
pucch_pdu.prb_start = startingPRB;
|
|
|
|
|
|
|
|
pucch_pdu.prb_size = 1;
|
|
|
|
|
|
|
|
pucch_pdu.bwp_start = 0;
|
|
|
|
|
|
|
|
pucch_pdu.bwp_size = N_RB_DL;
|
|
|
|
|
|
|
|
pucch_pdu.freq_hop_flag = 1;
|
|
|
|
|
|
|
|
pucch_pdu.second_hop_prb = N_RB_DL - 2;
|
|
|
|
|
|
|
|
pucch_pdu.time_domain_occ_idx = timeDomainOCC;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nr_decode_pucch1(gNB, rxdataF, nr_frame_tx, nr_slot_tx, &uci_pdu, &pucch_pdu);
|
|
|
|
|
|
|
|
// harq value 0 -> pass
|
|
|
|
|
|
|
|
nfapi_nr_harq_t *harq_list = uci_pdu.harq.harq_list;
|
|
|
|
|
|
|
|
// confidence value 0 -> good confidence
|
|
|
|
|
|
|
|
const int confidence_lvl = uci_pdu.harq.harq_confidence_level;
|
|
|
|
|
|
|
|
if (nr_bit > 0) {
|
|
|
|
|
|
|
|
if (nr_bit == 1 && do_DTX == 0)
|
|
|
|
|
|
|
|
ack_nack_errors += (actual_payload ^ (!harq_list[0].harq_value));
|
|
|
|
|
|
|
|
else if (do_DTX == 0)
|
|
|
|
|
|
|
|
ack_nack_errors +=
|
|
|
|
|
|
|
|
(((actual_payload & 1) ^ (!harq_list[1].harq_value)) + ((actual_payload >> 1) ^ (!harq_list[0].harq_value)));
|
|
|
|
|
|
|
|
else if ((!confidence_lvl && !harq_list[0].harq_value) || (!confidence_lvl && nr_bit == 2 && !harq_list[1].harq_value))
|
|
|
|
|
|
|
|
ack_nack_errors++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (format == 2) {
|
|
|
|
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t uci_pdu = {0};
|
|
|
|
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu = {0};
|
|
|
|
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
|
|
|
|
pucch_pdu.subcarrier_spacing = 1;
|
|
|
|
|
|
|
|
pucch_pdu.group_hop_flag = PUCCH_GroupHopping & 1;
|
|
|
|
|
|
|
|
pucch_pdu.sequence_hop_flag = (PUCCH_GroupHopping >> 1) & 1;
|
|
|
|
pucch_pdu.bit_len_csi_part1 = nr_bit;
|
|
|
|
pucch_pdu.bit_len_csi_part1 = nr_bit;
|
|
|
|
pucch_pdu.bit_len_harq = 0;
|
|
|
|
pucch_pdu.bit_len_harq = 0;
|
|
|
|
pucch_pdu.bit_len_csi_part2 = 0;
|
|
|
|
pucch_pdu.bit_len_csi_part2 = 0;
|
|
|
@@ -728,29 +788,30 @@ int main(int argc, char **argv)
|
|
|
|
pucch_pdu.prb_start = startingPRB;
|
|
|
|
pucch_pdu.prb_start = startingPRB;
|
|
|
|
pucch_pdu.dmrs_scrambling_id = dmrs_scrambling_id;
|
|
|
|
pucch_pdu.dmrs_scrambling_id = dmrs_scrambling_id;
|
|
|
|
pucch_pdu.data_scrambling_id = data_scrambling_id;
|
|
|
|
pucch_pdu.data_scrambling_id = data_scrambling_id;
|
|
|
|
if (nrofSymbols>1) {
|
|
|
|
if (nrofSymbols > 1) {
|
|
|
|
pucch_pdu.freq_hop_flag = 1;
|
|
|
|
pucch_pdu.freq_hop_flag = 1;
|
|
|
|
pucch_pdu.second_hop_prb = N_RB_DL-1;
|
|
|
|
pucch_pdu.second_hop_prb = N_RB_DL - 1;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
else pucch_pdu.freq_hop_flag = 0;
|
|
|
|
pucch_pdu.freq_hop_flag = 0;
|
|
|
|
nr_decode_pucch2(gNB, rxdataF, nr_frame_tx, nr_slot_tx, &uci_pdu, &pucch_pdu);
|
|
|
|
nr_decode_pucch2(gNB, rxdataF, nr_frame_tx, nr_slot_tx, &uci_pdu, &pucch_pdu);
|
|
|
|
int csi_part1_bytes=pucch_pdu.bit_len_csi_part1>>3;
|
|
|
|
int csi_part1_bytes = pucch_pdu.bit_len_csi_part1 >> 3;
|
|
|
|
if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++;
|
|
|
|
if ((pucch_pdu.bit_len_csi_part1 & 7) > 0)
|
|
|
|
for (int i=0;i<csi_part1_bytes;i++) {
|
|
|
|
csi_part1_bytes++;
|
|
|
|
if (uci_pdu.csi_part1.csi_part1_payload[i] != ((uint8_t*)&actual_payload)[i]) {
|
|
|
|
for (int i = 0; i < csi_part1_bytes; i++) {
|
|
|
|
|
|
|
|
if (uci_pdu.csi_part1.csi_part1_payload[i] != ((uint8_t *)&actual_payload)[i]) {
|
|
|
|
ack_nack_errors++;
|
|
|
|
ack_nack_errors++;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(uci_pdu.csi_part1.csi_part1_payload);
|
|
|
|
free(uci_pdu.csi_part1.csi_part1_payload);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stop_meas(&gNB->phy_proc_rx);
|
|
|
|
stop_meas(&gNB->phy_proc_rx);
|
|
|
|
|
|
|
|
|
|
|
|
n_errors=((actual_payload^payload_received)&1)+(((actual_payload^payload_received)&2)>>1)+(((actual_payload^payload_received)&4)>>2)+n_errors;
|
|
|
|
n_errors = ((actual_payload ^ payload_received) & 1) + (((actual_payload ^ payload_received) & 2) >> 1)
|
|
|
|
|
|
|
|
+ (((actual_payload ^ payload_received) & 4) >> 2) + n_errors;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sr_flag == 1)
|
|
|
|
if (sr_flag == 1)
|
|
|
|
printf("SR: SNR=%f, n_trials=%d, n_bit_errors=%d\n",SNR,n_trials,sr_errors);
|
|
|
|
printf("SR: SNR=%f, n_trials=%d, n_bit_errors=%d\n", SNR, n_trials, sr_errors);
|
|
|
|
if (print_perf) {
|
|
|
|
if (print_perf) {
|
|
|
|
time_stats_t *ts = &gNB->phy_proc_rx;
|
|
|
|
time_stats_t *ts = &gNB->phy_proc_rx;
|
|
|
|
printf("cpu time for pucch format %d: per block %.2f us; nb blocks %d, max time %.2f;\n",
|
|
|
|
printf("cpu time for pucch format %d: per block %.2f us; nb blocks %d, max time %.2f;\n",
|
|
|
@@ -760,9 +821,9 @@ int main(int argc, char **argv)
|
|
|
|
ts->max / cpuf / 1000.0);
|
|
|
|
ts->max / cpuf / 1000.0);
|
|
|
|
reset_meas(ts);
|
|
|
|
reset_meas(ts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nr_bit > 0)
|
|
|
|
if (nr_bit > 0)
|
|
|
|
printf("ACK/NACK: SNR=%f, n_trials=%d, n_bit_errors=%d\n",SNR,n_trials,ack_nack_errors);
|
|
|
|
printf("ACK/NACK: SNR=%f, n_trials=%d, n_bit_errors=%d\n", SNR, n_trials, ack_nack_errors);
|
|
|
|
if((float)(ack_nack_errors+sr_errors)/(float)(n_trials)<=target_error_rate){
|
|
|
|
if ((float)(ack_nack_errors + sr_errors) / (float)(n_trials) <= target_error_rate) {
|
|
|
|
printf("PUCCH test OK\n");
|
|
|
|
printf("PUCCH test OK\n");
|
|
|
|
ret = 0;
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@@ -787,11 +848,11 @@ int main(int argc, char **argv)
|
|
|
|
term_nr_ue_signal(UE);
|
|
|
|
term_nr_ue_signal(UE);
|
|
|
|
free(UE);
|
|
|
|
free(UE);
|
|
|
|
|
|
|
|
|
|
|
|
for (int aatx=0; aatx<n_tx; aatx++) {
|
|
|
|
for (int aatx = 0; aatx < n_tx; aatx++) {
|
|
|
|
free(s_re[aatx]);
|
|
|
|
free(s_re[aatx]);
|
|
|
|
free(s_im[aatx]);
|
|
|
|
free(s_im[aatx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int aarx=0; aarx<n_rx; aarx++) {
|
|
|
|
for (int aarx = 0; aarx < n_rx; aarx++) {
|
|
|
|
free(r_re[aarx]);
|
|
|
|
free(r_re[aarx]);
|
|
|
|
free(r_im[aarx]);
|
|
|
|
free(r_im[aarx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -800,8 +861,10 @@ int main(int argc, char **argv)
|
|
|
|
free(r_re);
|
|
|
|
free(r_re);
|
|
|
|
free(r_im);
|
|
|
|
free(r_im);
|
|
|
|
|
|
|
|
|
|
|
|
if (output_fd) fclose(output_fd);
|
|
|
|
if (output_fd)
|
|
|
|
if (input_fd) fclose(input_fd);
|
|
|
|
fclose(output_fd);
|
|
|
|
|
|
|
|
if (input_fd)
|
|
|
|
|
|
|
|
fclose(input_fd);
|
|
|
|
|
|
|
|
|
|
|
|
loader_reset();
|
|
|
|
loader_reset();
|
|
|
|
logTerm();
|
|
|
|
logTerm();
|
|
|
|