|
|
@@ -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 _)
|
|
|
|
{
|
|
|
|
{
|
|
|
@@ -82,7 +91,8 @@ void deref_sched_response(int _)
|
|
|
|
|
|
|
|
|
|
|
|
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,19 +103,12 @@ 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 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 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;
|
|
|
@@ -113,9 +116,7 @@ int main(int argc, char **argv)
|
|
|
|
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;
|
|
|
|
//uint8_t nacktoack_flag=0;
|
|
|
|
|
|
|
|
int16_t amp = 0x7FFF;
|
|
|
|
int16_t amp = 0x7FFF;
|
|
|
|
int nr_slot_tx = 0;
|
|
|
|
int nr_slot_tx = 0;
|
|
|
|
int nr_frame_tx = 0;
|
|
|
|
int nr_frame_tx = 0;
|
|
|
@@ -124,8 +125,11 @@ int main(int argc, char **argv)
|
|
|
|
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 startingPRB = 0;
|
|
|
|
|
|
|
|
// PRB number not sure see 9.2.1, 38.213 for more info. Should be actually present in the resource set provided
|
|
|
|
|
|
|
|
uint16_t startingPRB_intraSlotHopping = 0;
|
|
|
|
uint16_t nrofPRB = 2;
|
|
|
|
uint16_t nrofPRB = 2;
|
|
|
|
uint8_t timeDomainOCC = 0;
|
|
|
|
uint8_t timeDomainOCC = 0;
|
|
|
|
SCM_t channel_model = AWGN; // Rayleigh1_anticorr;
|
|
|
|
SCM_t channel_model = AWGN; // Rayleigh1_anticorr;
|
|
|
@@ -136,9 +140,7 @@ int main(int argc, char **argv)
|
|
|
|
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;
|
|
|
@@ -153,6 +155,7 @@ 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' */
|
|
|
@@ -171,8 +174,6 @@ int main(int argc, char **argv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'g':
|
|
|
|
case 'g':
|
|
|
|
switch ((char)*optarg) {
|
|
|
|
switch ((char)*optarg) {
|
|
|
|
case 'A':
|
|
|
|
case 'A':
|
|
|
@@ -243,36 +244,17 @@ int main(int argc, char **argv)
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
|
|
|
|
case 'p':
|
|
|
|
|
|
|
|
extended_prefix_flag=1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
|
|
|
|
frame_type = 1;
|
|
|
|
|
|
|
|
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':
|
|
|
|
case 'd':
|
|
|
|
delay_us = atof(optarg);
|
|
|
|
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) &&
|
|
|
|
|
|
|
|
(transmission_mode!=6)) {
|
|
|
|
|
|
|
|
printf("Unsupported transmission mode %d\n", transmission_mode);
|
|
|
|
printf("Unsupported transmission mode %d\n", transmission_mode);
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -318,6 +300,7 @@ int main(int argc, char **argv)
|
|
|
|
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);
|
|
|
@@ -330,6 +313,8 @@ int main(int argc, char **argv)
|
|
|
|
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);
|
|
|
@@ -343,6 +328,7 @@ int main(int argc, char **argv)
|
|
|
|
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);
|
|
|
@@ -354,7 +340,11 @@ 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(
|
|
|
|
|
|
|
|
"%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("-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");
|
|
|
@@ -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");
|
|
|
@@ -394,7 +386,8 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
@@ -403,11 +396,13 @@ int main(int argc, char **argv)
|
|
|
|
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,
|
|
|
|
|
|
|
|
nr_bit);
|
|
|
|
int do_DTX = 0;
|
|
|
|
int do_DTX = 0;
|
|
|
|
if ((format < 2) && (actual_payload == 4)) do_DTX=1;
|
|
|
|
if ((format < 2) && (actual_payload == 4))
|
|
|
|
|
|
|
|
do_DTX = 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (random_payload) {
|
|
|
|
if (random_payload) {
|
|
|
|
double tmp = uniformrandom();
|
|
|
|
double tmp = uniformrandom();
|
|
|
@@ -443,12 +438,7 @@ int main(int argc, char **argv)
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
@@ -486,7 +476,8 @@ int main(int argc, char **argv)
|
|
|
|
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;
|
|
|
@@ -499,13 +490,12 @@ int main(int argc, char **argv)
|
|
|
|
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;
|
|
|
@@ -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;
|
|
|
@@ -559,8 +564,8 @@ int main(int argc, char **argv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
@@ -612,26 +617,52 @@ int main(int argc, char **argv)
|
|
|
|
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};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (format == 1) {
|
|
|
|
|
|
|
|
for (int s = 0; s < frame_parms->symbols_per_slot; s++) {
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
for (int s = 0; s < frame_parms->symbols_per_slot; s++) {
|
|
|
|
if (s >= startingSymbolIndex && s < (startingSymbolIndex + nrofSymbols))
|
|
|
|
if (s >= startingSymbolIndex && s < (startingSymbolIndex + nrofSymbols))
|
|
|
|
for (int rb = 0; rb < N_RB; rb++) {
|
|
|
|
for (int rb = 0; rb < N_RB; rb++) {
|
|
|
@@ -639,6 +670,7 @@ int main(int argc, char **argv)
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
rb_mask_ul[s][rb2 >> 5] |= (1 << (rb2 & 31));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// noise measurement (all PRBs)
|
|
|
|
// noise measurement (all PRBs)
|
|
|
|
gNB_I0_measurements(gNB, nr_slot_tx, 0, gNB->frame_parms.symbols_per_slot, rb_mask_ul);
|
|
|
|
gNB_I0_measurements(gNB, nr_slot_tx, 0, gNB->frame_parms.symbols_per_slot, rb_mask_ul);
|
|
|
@@ -677,8 +709,8 @@ int main(int argc, char **argv)
|
|
|
|
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) {
|
|
|
@@ -693,23 +725,51 @@ int main(int argc, char **argv)
|
|
|
|
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) {
|
|
|
|
|
|
|
|
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
|
|
|
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu;
|
|
|
|
|
|
|
|
gNB->phy_stats[0].rnti = 0x1234;
|
|
|
|
|
|
|
|
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_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==1) {
|
|
|
|
|
|
|
|
nr_decode_pucch1((c16_t **)rxdataF,PUCCH_GroupHopping,hopping_id,
|
|
|
|
} else if (format == 2) {
|
|
|
|
&(payload_received),frame_parms,amp,nr_slot_tx,
|
|
|
|
|
|
|
|
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_uci_pucch_pdu_format_2_3_4_t uci_pdu = {0};
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu = {0};
|
|
|
|
nfapi_nr_pucch_pdu_t pucch_pdu = {0};
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
|
pucch_pdu.rnti = 0x1234;
|
|
|
@@ -731,11 +791,12 @@ int main(int argc, char **argv)
|
|
|
|
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)
|
|
|
|
|
|
|
|
csi_part1_bytes++;
|
|
|
|
for (int i = 0; i < csi_part1_bytes; i++) {
|
|
|
|
for (int i = 0; i < csi_part1_bytes; i++) {
|
|
|
|
if (uci_pdu.csi_part1.csi_part1_payload[i] != ((uint8_t *)&actual_payload)[i]) {
|
|
|
|
if (uci_pdu.csi_part1.csi_part1_payload[i] != ((uint8_t *)&actual_payload)[i]) {
|
|
|
|
ack_nack_errors++;
|
|
|
|
ack_nack_errors++;
|
|
|
@@ -743,11 +804,11 @@ int main(int argc, char **argv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
@@ -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();
|
|
|
|