Merge remote-tracking branch 'origin/develop' into NR_remove_ssb_offset_from_configfile
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
#include "NR_RRCReconfiguration.h"
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
|
||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||
@@ -262,26 +263,41 @@ void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSi
|
||||
void update_dmrs_config(NR_CellGroupConfig_t *scg, int8_t* dmrs_arg);
|
||||
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
||||
|
||||
/* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs/nrOfLayers from command line of
|
||||
dlsim, does not search for CCE/PUCCH occasion but simply sets to 0 */
|
||||
/* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs/nrOfLayers from command line of dlsim */
|
||||
int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1, g_nrOfLayers = 1;
|
||||
void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot) {
|
||||
|
||||
NR_UE_info_t *UE_info = RC.nrmac[module_id]->UE_info.list[0];
|
||||
AssertFatal(RC.nrmac[module_id]->UE_info.list[1]==NULL, "can have only a single UE\n");
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl;
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon;
|
||||
|
||||
/* manually set free CCE to 0 */
|
||||
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
sched_ctrl->search_space = get_searchspace(NULL, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss);
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,4);
|
||||
uint8_t nr_of_candidates = 0;
|
||||
if (g_mcsIndex < 4) {
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,8);
|
||||
}
|
||||
if (nr_of_candidates == 0) {
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space,4);
|
||||
}
|
||||
sched_ctrl->coreset = get_coreset(RC.nrmac[module_id], scc, sched_ctrl->active_bwp->bwp_Dedicated, sched_ctrl->search_space, target_ss);
|
||||
sched_ctrl->cce_index = 0;
|
||||
uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE_info->rnti);
|
||||
int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id],
|
||||
/* CC_id = */ 0,
|
||||
sched_ctrl->aggregation_level,
|
||||
nr_of_candidates,
|
||||
&sched_ctrl->sched_pdcch,
|
||||
sched_ctrl->coreset,
|
||||
Y);
|
||||
AssertFatal(CCEIndex>=0, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, 0, UE_info->rnti);
|
||||
sched_ctrl->cce_index = CCEIndex;
|
||||
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
|
||||
@@ -356,10 +372,13 @@ int main(int argc, char **argv)
|
||||
int i,aa;//,l;
|
||||
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
|
||||
uint8_t snr1set=0;
|
||||
double roundStats[500] = {0};
|
||||
double blerStats[500] = {0};
|
||||
double berStats[500] = {0};
|
||||
double snrStats[500] = {0};
|
||||
uint32_t errors_scrambling[4][100] = {{0}};
|
||||
int n_errors[4][100] = {{0}};
|
||||
int round_trials[4][100] = {{0}};
|
||||
double roundStats[100] = {0};
|
||||
double blerStats[4][100] = {{0}};
|
||||
double berStats[4][100] = {{0}};
|
||||
double snrStats[100] = {0};
|
||||
float effRate;
|
||||
//float psnr;
|
||||
float eff_tp_check = 0.7;
|
||||
@@ -377,7 +396,7 @@ int main(int argc, char **argv)
|
||||
//int freq_offset;
|
||||
// int subframe_offset;
|
||||
// char fname[40], vname[40];
|
||||
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
|
||||
int trial, n_trials = 1, n_false_positive = 0;
|
||||
//int n_errors2, n_alamouti;
|
||||
uint8_t n_tx=1,n_rx=1;
|
||||
uint8_t round;
|
||||
@@ -433,7 +452,8 @@ int main(int argc, char **argv)
|
||||
uint16_t rbSize = 106;
|
||||
uint8_t mcsIndex = 9;
|
||||
uint8_t dlsch_threads = 0;
|
||||
int prb_inter = 0;
|
||||
int chest_type[2] = {0};
|
||||
uint8_t max_ldpc_iterations = 5;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
@@ -444,7 +464,7 @@ int main(int argc, char **argv)
|
||||
|
||||
FILE *scg_fd=NULL;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:q:m:w:T:U:X:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:n:s:S:t:x:y:z:M:N:F:GR:dPI:L:Ea:b:d:e:m:w:T:U:q:X:Y")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
scg_fd = fopen(optarg,"r");
|
||||
@@ -501,7 +521,9 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
prb_inter=1;
|
||||
for(i=0; i < atoi(optarg); i++){
|
||||
chest_type[i] = atoi(argv[optind++]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
@@ -588,9 +610,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
run_initial_sync=1;
|
||||
//target_error_rate=0.1;
|
||||
slot = 0;
|
||||
max_ldpc_iterations = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
@@ -654,6 +674,12 @@ int main(int argc, char **argv)
|
||||
gNBthreads[sizeof(gNBthreads)-1]=0;
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
run_initial_sync=1;
|
||||
//target_error_rate=0.1;
|
||||
slot = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -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",
|
||||
@@ -669,7 +695,7 @@ int main(int argc, char **argv)
|
||||
printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n");
|
||||
printf("-y Number of TX antennas used in gNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
|
||||
printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n");
|
||||
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -686,12 +712,14 @@ int main(int argc, char **argv)
|
||||
printf("-e MSC index\n");
|
||||
printf("-q MCS Table index\n");
|
||||
printf("-t Acceptable effective throughput (in percentage)\n");
|
||||
printf("-I Maximum LDPC decoder iterations\n");
|
||||
printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
|
||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
|
||||
printf("-P Print DLSCH performances\n");
|
||||
printf("-w Write txdata to binary file (one frame)\n");
|
||||
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
|
||||
printf("-X gNB thread pool configuration, n => no threads");
|
||||
printf("-X gNB thread pool configuration, n => no threads\n");
|
||||
printf("-Y Run initial sync in UE\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
@@ -705,6 +733,7 @@ int main(int argc, char **argv)
|
||||
|
||||
get_softmodem_params()->phy_test = 1;
|
||||
get_softmodem_params()->do_ra = 0;
|
||||
set_softmodem_optmask(SOFTMODEM_DLSIM_BIT);
|
||||
|
||||
if (snr1set==0)
|
||||
snr1 = snr0+10;
|
||||
@@ -947,11 +976,10 @@ int main(int argc, char **argv)
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->frame_parms.nb_antennas_rx = n_rx;
|
||||
UE->max_ldpc_iterations = max_ldpc_iterations;
|
||||
|
||||
if (run_initial_sync==1) UE->is_synchronized = 0;
|
||||
else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;}
|
||||
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if (init_nr_ue_signal(UE, 1) != 0)
|
||||
{
|
||||
@@ -981,8 +1009,8 @@ int main(int argc, char **argv)
|
||||
UE->if_inst->phy_config_request = nr_ue_phy_config_request;
|
||||
UE->if_inst->dl_indication = nr_ue_dl_indication;
|
||||
UE->if_inst->ul_indication = dummy_nr_ue_ul_indication;
|
||||
UE->prb_interpolation = prb_inter;
|
||||
|
||||
UE->chest_freq = chest_type[0];
|
||||
UE->chest_time = chest_type[1];
|
||||
|
||||
UE_mac->if_module = nr_ue_if_module_init(0);
|
||||
|
||||
@@ -990,7 +1018,6 @@ int main(int argc, char **argv)
|
||||
unsigned char *estimated_output_bit;
|
||||
unsigned char *test_input_bit;
|
||||
unsigned int errors_bit = 0;
|
||||
uint32_t errors_scrambling = 0;
|
||||
|
||||
initTpool("N", &(nrUE_params.Tpool), false);
|
||||
|
||||
@@ -1031,6 +1058,7 @@ int main(int argc, char **argv)
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||
snrRun = 0;
|
||||
int n_errs = 0;
|
||||
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
initTpool(gNBthreads, gNB->threadPool, true);
|
||||
@@ -1064,11 +1092,9 @@ int main(int argc, char **argv)
|
||||
|
||||
clear_pdsch_stats(gNB);
|
||||
|
||||
n_errors = 0;
|
||||
effRate = 0;
|
||||
//n_errors2 = 0;
|
||||
//n_alamouti = 0;
|
||||
errors_scrambling=0;
|
||||
n_false_positive = 0;
|
||||
if (n_trials== 1) num_rounds = 1;
|
||||
|
||||
@@ -1100,16 +1126,12 @@ int main(int argc, char **argv)
|
||||
UE_harq_process->first_rx = 1;
|
||||
|
||||
while ((round<num_rounds) && (UE_harq_process->ack==0)) {
|
||||
round_trials[round][snrRun]++;
|
||||
|
||||
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
|
||||
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].ndi = !(trial&1);
|
||||
|
||||
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].round = round;
|
||||
for (int i=0; i<MAX_NUM_CORESET; i++)
|
||||
gNB_mac->pdcch_cand[i] = 0;
|
||||
|
||||
|
||||
if (css_flag == 0) {
|
||||
nr_schedule_ue_spec(0, frame, slot);
|
||||
} else {
|
||||
@@ -1272,49 +1294,45 @@ int main(int argc, char **argv)
|
||||
&phy_pdcch_config,
|
||||
NULL);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//---------------------- count errors ----------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
if (UE->dlsch[UE_proc.thread_id][0][0]->last_iteration_cnt >=
|
||||
UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1)
|
||||
n_errors[round][snrRun]++;
|
||||
|
||||
NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id];
|
||||
int16_t *UE_llr = pdsch_vars[0]->llr[0];
|
||||
|
||||
TBS = UE_harq_process->TBS;//rel15->TBSize[0];
|
||||
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||
uint16_t nb_rb = rel15->rbSize;
|
||||
uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*UE_harq_process->n_dmrs_cdm_groups : 4*UE_harq_process->n_dmrs_cdm_groups;
|
||||
uint8_t mod_order = rel15->qamModOrder[0];
|
||||
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
||||
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers);
|
||||
if(pdu_bit_map & 0x1) {
|
||||
available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2);
|
||||
printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) );
|
||||
}
|
||||
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||
((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0)))
|
||||
{
|
||||
if(errors_scrambling[round][snrRun] == 0) {
|
||||
LOG_D(PHY,"First bit in error in unscrambling = %d\n",i);
|
||||
}
|
||||
errors_scrambling[round][snrRun]++;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("dlsim round %d ends\n",round);
|
||||
round++;
|
||||
} // round
|
||||
|
||||
//----------------------------------------------------------
|
||||
//---------------------- count errors ----------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
if (UE->dlsch[UE_proc.thread_id][0][0]->last_iteration_cnt >=
|
||||
UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1)
|
||||
n_errors++;
|
||||
|
||||
//NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id];
|
||||
//int16_t *UE_llr = pdsch_vars[0]->llr[0];
|
||||
|
||||
TBS = UE_harq_process->TBS;//rel15->TBSize[0];
|
||||
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||
uint16_t nb_rb = rel15->rbSize;
|
||||
uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*UE_harq_process->n_dmrs_cdm_groups : 4*UE_harq_process->n_dmrs_cdm_groups;
|
||||
uint8_t mod_order = rel15->qamModOrder[0];
|
||||
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
||||
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers);
|
||||
if(pdu_bit_map & 0x1) {
|
||||
available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2);
|
||||
LOG_D(PHY,"[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) );
|
||||
}
|
||||
|
||||
/*
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
|
||||
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||
((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0)))
|
||||
{
|
||||
if(errors_scrambling == 0) {
|
||||
LOG_D(PHY,"\n");
|
||||
LOG_D(PHY,"First bit in error in unscrambling = %d\n",i);
|
||||
}
|
||||
errors_scrambling++;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < TBS; i++) {
|
||||
|
||||
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||
@@ -1322,19 +1340,14 @@ int main(int argc, char **argv)
|
||||
|
||||
if (estimated_output_bit[i] != test_input_bit[i]) {
|
||||
if(errors_bit == 0)
|
||||
LOG_D(PHY,"First bit in error in decoding = %d (errors scrambling %d)\n",i,errors_scrambling);
|
||||
LOG_D(PHY,"First bit in error in decoding = %d\n",i);
|
||||
errors_bit++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (errors_scrambling > 0) {
|
||||
if (n_trials == 1)
|
||||
printf("errors_scrambling = %u/%u (trial %d)\n", errors_scrambling, available_bits,trial);
|
||||
}
|
||||
|
||||
|
||||
if (errors_bit > 0) {
|
||||
n_false_positive++;
|
||||
if (n_trials == 1)
|
||||
@@ -1344,18 +1357,48 @@ int main(int argc, char **argv)
|
||||
if (UE_harq_process->ack==1) effRate += ((float)TBS)/round;
|
||||
} // noise trials
|
||||
|
||||
blerStats[snrRun] = (float) n_errors / (float) n_trials;
|
||||
roundStats[snrRun]/=((float)n_trials);
|
||||
berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials;
|
||||
|
||||
blerStats[0][snrRun] = (double)n_errors[0][snrRun]/round_trials[0][snrRun];
|
||||
blerStats[1][snrRun] = (double)n_errors[1][snrRun]/round_trials[1][snrRun];
|
||||
blerStats[2][snrRun] = (double)n_errors[2][snrRun]/round_trials[2][snrRun];
|
||||
blerStats[3][snrRun] = (double)n_errors[3][snrRun]/round_trials[3][snrRun];
|
||||
|
||||
berStats[0][snrRun] = (double)errors_scrambling[0][snrRun]/available_bits/round_trials[0][snrRun];
|
||||
berStats[1][snrRun] = (double)errors_scrambling[1][snrRun]/available_bits/round_trials[1][snrRun];
|
||||
berStats[2][snrRun] = (double)errors_scrambling[2][snrRun]/available_bits/round_trials[2][snrRun];
|
||||
berStats[3][snrRun] = (double)errors_scrambling[3][snrRun]/available_bits/round_trials[3][snrRun];
|
||||
|
||||
effRate /= n_trials;
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f, (false positive %f)\n", SNR,
|
||||
(float) n_errors / (float) n_trials);
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n",
|
||||
SNR,
|
||||
n_errors[0][snrRun], round_trials[0][snrRun],
|
||||
n_errors[1][snrRun], round_trials[1][snrRun],
|
||||
n_errors[2][snrRun], round_trials[2][snrRun],
|
||||
n_errors[3][snrRun], round_trials[3][snrRun],
|
||||
n_false_positive, n_trials,
|
||||
errors_scrambling[0][snrRun], available_bits*round_trials[0][snrRun],
|
||||
errors_scrambling[1][snrRun], available_bits*round_trials[1][snrRun],
|
||||
errors_scrambling[2][snrRun], available_bits*round_trials[2][snrRun],
|
||||
errors_scrambling[3][snrRun], available_bits*round_trials[3][snrRun]);
|
||||
printf("\n");
|
||||
dump_pdsch_stats(stdout,gNB);
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n",
|
||||
SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||
printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n",
|
||||
SNR,
|
||||
blerStats[0][snrRun],
|
||||
blerStats[1][snrRun],
|
||||
blerStats[2][snrRun],
|
||||
blerStats[3][snrRun],
|
||||
berStats[0][snrRun],
|
||||
berStats[1][snrRun],
|
||||
berStats[2][snrRun],
|
||||
berStats[3][snrRun],
|
||||
roundStats[snrRun],
|
||||
effRate,
|
||||
effRate/TBS*100,
|
||||
TBS);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
|
||||
if (print_perf==1) {
|
||||
@@ -1415,6 +1458,7 @@ int main(int argc, char **argv)
|
||||
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
|
||||
if (UE->frame_parms.nb_antennas_rx>1)
|
||||
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
|
||||
LOG_M("rxF0.m","rxF0", UE->common_vars.common_vars_rx_data_per_thread[UE_proc.thread_id].rxdataF[0], frame_parms->samples_per_slot_wCP, 1, 1);
|
||||
LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1);
|
||||
write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
|
||||
LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0);
|
||||
@@ -1428,6 +1472,7 @@ int main(int argc, char **argv)
|
||||
|
||||
snrStats[snrRun] = SNR;
|
||||
snrRun++;
|
||||
n_errs = n_errors[0][snrRun];
|
||||
} // NSR
|
||||
|
||||
LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7);
|
||||
@@ -1471,8 +1516,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (scg_fd)
|
||||
fclose(scg_fd);
|
||||
return(n_errors);
|
||||
|
||||
|
||||
return n_errs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -567,8 +567,6 @@ int main(int argc, char **argv)
|
||||
if (run_initial_sync==1) UE->is_synchronized = 0;
|
||||
else UE->is_synchronized = 1;
|
||||
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
|
||||
@@ -476,7 +476,6 @@ int main(int argc, char **argv)
|
||||
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->frame_parms.nb_antennas_rx=1;
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
@@ -141,6 +141,7 @@ int main(int argc, char **argv)
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
uint8_t Nl = 1;
|
||||
uint8_t max_ldpc_iterations = 5;
|
||||
|
||||
double DS_TDL = .03;
|
||||
|
||||
@@ -395,6 +396,8 @@ int main(int argc, char **argv)
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->N_RB_UL = N_RB_UL;
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
gNB->max_ldpc_iterations = max_ldpc_iterations;
|
||||
|
||||
crcTableInit();
|
||||
|
||||
memcpy(&gNB->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
@@ -312,16 +312,15 @@ int main(int argc, char **argv)
|
||||
float roundStats[100];
|
||||
double effRate[100];
|
||||
double effTP[100];
|
||||
float eff_tp_check = 0.7;
|
||||
float eff_tp_check = 100;
|
||||
uint8_t snrRun;
|
||||
int prb_inter = 0;
|
||||
int chest_type[2] = {0};
|
||||
|
||||
int enable_ptrs = 0;
|
||||
int modify_dmrs = 0;
|
||||
/* L_PTRS = ptrs_arg[0], K_PTRS = ptrs_arg[1] */
|
||||
int ptrs_arg[2] = {-1,-1};// Invalid values
|
||||
/* mapping type = dmrs_arg[0], Add Pos = dmrs_arg[1], dmrs config type = dmrs_arg[2] */
|
||||
int dmrs_arg[3] = {-1,-1,-1};// Invalid values
|
||||
int dmrs_arg[4] = {-1,-1,-1,-1};// Invalid values
|
||||
uint16_t ptrsSymPos = 0;
|
||||
uint16_t ptrsSymbPerSlot = 0;
|
||||
uint16_t ptrsRePerSymb = 0;
|
||||
@@ -338,6 +337,8 @@ int main(int argc, char **argv)
|
||||
int ibwps=24;
|
||||
int ibwp_rboffset=41;
|
||||
int params_from_file = 0;
|
||||
int threadCnt=0;
|
||||
int max_ldpc_iterations = 5;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) {
|
||||
exit_fun("[NR_ULSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
@@ -348,7 +349,7 @@ int main(int argc, char **argv)
|
||||
/* initialize the sin-cos table */
|
||||
InitSinLUT();
|
||||
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:t:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z:W:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:kl:m:n:p:q:r:s:t:u:w:y:z:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:")) != -1) {
|
||||
printf("handling optarg %c\n",c);
|
||||
switch (c) {
|
||||
|
||||
@@ -441,7 +442,9 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
prb_inter=1;
|
||||
for(i=0; i < atoi(optarg); i++){
|
||||
chest_type[i] = atoi(argv[optind++]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
@@ -468,7 +471,11 @@ int main(int argc, char **argv)
|
||||
case 'p':
|
||||
extended_prefix_flag = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 'q':
|
||||
mcs_table = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
nb_rb = atoi(optarg);
|
||||
break;
|
||||
@@ -478,6 +485,10 @@ int main(int argc, char **argv)
|
||||
printf("Setting SNR0 to %f\n", snr0);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
threadCnt = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
mu = atoi(optarg);
|
||||
break;
|
||||
@@ -487,7 +498,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 't':
|
||||
eff_tp_check = (float)atoi(optarg)/100;
|
||||
eff_tp_check = (float)atoi(optarg);
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -519,7 +530,7 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg, "r");
|
||||
if (input_fd == NULL) {
|
||||
@@ -536,6 +547,10 @@ int main(int argc, char **argv)
|
||||
slot = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
max_ldpc_iterations = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
// SSB_positions = atoi(optarg);
|
||||
break;
|
||||
@@ -591,19 +606,20 @@ int main(int argc, char **argv)
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId -Z Enable SC-FDMA in Uplink \n", argv[0]);
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -i Intefrence0 -j Interference1 -n n_frames -s snr0 -S snr1 -t Delayspread -x transmission_mode -y TXant -z RXant -A interpolation_file -C(alibration offset dB) -N CellId -Z Enable SC-FDMA in Uplink \n", argv[0]);
|
||||
//printf("-d Use TDD\n");
|
||||
printf("-d Introduce delay in terms of number of samples\n");
|
||||
printf("-f Number of frames to simulate\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("-h This message\n");
|
||||
printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
|
||||
printf("-i Change channel estimation technique. Arguments list: Number of arguments=2, Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}. e.g. -i 2 1 0\n");
|
||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
|
||||
printf("-m MCS value\n");
|
||||
printf("-n Number of trials to simulate\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
//printf("-t Delay spread for multipath channel\n");
|
||||
printf("-q MCS table\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-u Set the numerology\n");
|
||||
printf("-w Start PRB for PUSCH\n");
|
||||
//printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
@@ -614,6 +630,7 @@ int main(int argc, char **argv)
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-G Offset of samples to read from file (0 default)\n");
|
||||
printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n");
|
||||
printf("-I Maximum LDPC decoder iterations\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -621,8 +638,8 @@ int main(int argc, char **argv)
|
||||
printf("-t Acceptable effective throughput (in percentage)\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-P Print ULSCH performances\n");
|
||||
printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
|
||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:3}, e.g. -U 2 0 2 \n");
|
||||
printf("-T Enable PTRS, arguments list: Number of arguments=2 L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
|
||||
printf("-U Change DMRS Config, arguments list: Number of arguments=4, DMRS Mapping Type{0=A,1=B}, DMRS AddPos{0:3}, DMRS Config Type{1,2}, Number of CDM groups without data{1,2,3} e.g. -U 4 0 2 0 1 \n");
|
||||
printf("-Q If -F used, read parameters from file\n");
|
||||
printf("-Z If -Z is used, SC-FDMA or transform precoding is enabled in Uplink \n");
|
||||
printf("-W Num of layer for PUSCH\n");
|
||||
@@ -698,7 +715,18 @@ int main(int argc, char **argv)
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
char tp_param[] = "n";
|
||||
initNotifiedFIFO(gNB->respDecode);
|
||||
char tp_param[80];
|
||||
if (threadCnt>0)
|
||||
sprintf(tp_param,"-1");
|
||||
else
|
||||
tp_param[0]='n';
|
||||
int s_offset = 0;
|
||||
for (int icpu=1; icpu<threadCnt; icpu++) {
|
||||
sprintf(tp_param+2+s_offset,",-1");
|
||||
s_offset += 3;
|
||||
}
|
||||
|
||||
initTpool(tp_param, gNB->threadPool, false);
|
||||
initNotifiedFIFO(gNB->respDecode);
|
||||
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
@@ -717,7 +745,8 @@ int main(int argc, char **argv)
|
||||
gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t));
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
gNB->prb_interpolation = prb_inter;
|
||||
gNB->max_ldpc_iterations = max_ldpc_iterations;
|
||||
gNB->pusch_thres = -20;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
@@ -781,6 +810,8 @@ int main(int argc, char **argv)
|
||||
cfg->carrier_config.num_tx_ant.value = 1;
|
||||
cfg->carrier_config.num_rx_ant.value = n_rx;
|
||||
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,0,0x01);
|
||||
gNB->chest_freq = chest_type[0];
|
||||
gNB->chest_time = chest_type[1];
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
|
||||
@@ -796,7 +827,7 @@ int main(int argc, char **argv)
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->frame_parms.nb_antennas_tx = n_tx;
|
||||
UE->frame_parms.nb_antennas_rx = 1;
|
||||
UE->frame_parms.nb_antennas_rx = 0;
|
||||
|
||||
if (init_nr_ue_signal(UE, 1) != 0) {
|
||||
printf("Error at UE NR initialisation\n");
|
||||
@@ -895,6 +926,7 @@ int main(int argc, char **argv)
|
||||
dmrs_config_type = pusch_dmrs_type1;
|
||||
else if(dmrs_arg[2] == 2)
|
||||
dmrs_config_type = pusch_dmrs_type2;
|
||||
num_dmrs_cdm_grps_no_data = dmrs_arg[3];
|
||||
}
|
||||
|
||||
uint8_t length_dmrs = pusch_len1;
|
||||
@@ -983,7 +1015,6 @@ int main(int argc, char **argv)
|
||||
int slot_length = slot_offset - frame_parms->get_samples_slot_timestamp(slot-1,frame_parms,0);
|
||||
|
||||
if (input_fd != NULL) {
|
||||
AssertFatal(frame_parms->nb_antennas_rx == 1, "nb_ant != 1\n");
|
||||
// 800 samples is N_TA_OFFSET for FR1 @ 30.72 Ms/s,
|
||||
AssertFatal(frame_parms->subcarrier_spacing==30000,"only 30 kHz for file input for now (%d)\n",frame_parms->subcarrier_spacing);
|
||||
|
||||
@@ -1011,18 +1042,21 @@ int main(int argc, char **argv)
|
||||
printf("harq_pid %d\n",harq_pid);
|
||||
}
|
||||
fseek(input_fd,file_offset*sizeof(int16_t)*2,SEEK_SET);
|
||||
read_errors+=fread((void*)&gNB->common_vars.rxdata[0][slot_offset-delay],
|
||||
sizeof(int16_t),
|
||||
slot_length<<1,
|
||||
input_fd);
|
||||
if (read_errors==0) {
|
||||
printf("error reading file\n");
|
||||
exit(1);
|
||||
for (int irx=0; irx<frame_parms->nb_antennas_rx; irx++) {
|
||||
fseek(input_fd,irx*(slot_length+15)*sizeof(int16_t)*2,SEEK_SET); // matlab adds samlples to the end to emulate channel delay
|
||||
read_errors+=fread((void*)&gNB->common_vars.rxdata[irx][slot_offset-delay],
|
||||
sizeof(int16_t),
|
||||
slot_length<<1,
|
||||
input_fd);
|
||||
if (read_errors==0) {
|
||||
printf("error reading file\n");
|
||||
exit(1);
|
||||
}
|
||||
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
|
||||
slot_offset,
|
||||
((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[i],
|
||||
((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[1+i]);
|
||||
}
|
||||
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
|
||||
slot_offset,
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
|
||||
|
||||
mod_order = nr_get_Qm_ul(Imcs, mcs_table);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, mcs_table);
|
||||
@@ -1389,11 +1423,11 @@ int main(int argc, char **argv)
|
||||
&gNB->pusch_vars[0]->llr_layers[0][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
|
||||
if (precod_nbr_layers==2) {
|
||||
LOG_M("rxsigF1_ext.m","rxsF1_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF1_ext.m","rxsF1_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("chestF3.m","chF3",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("chestF3_ext.m","chF3_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[3][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
@@ -1553,7 +1587,12 @@ int main(int argc, char **argv)
|
||||
roundStats[snrRun],effRate[snrRun],effTP[snrRun],TBS);
|
||||
|
||||
FILE *fd=fopen("nr_ulsim.log","w");
|
||||
if (fd == NULL) {
|
||||
printf("Problem with filename %s\n", "nr_ulsim.log");
|
||||
exit(-1);
|
||||
}
|
||||
dump_pusch_stats(fd,gNB);
|
||||
fclose(fd);
|
||||
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
@@ -1583,7 +1622,7 @@ int main(int argc, char **argv)
|
||||
if(n_trials==1)
|
||||
break;
|
||||
|
||||
if (effRate[snrRun] > (eff_tp_check*TBS)) {
|
||||
if ((float)effTP[snrRun] >= eff_tp_check) {
|
||||
printf("*************\n");
|
||||
printf("PUSCH test OK\n");
|
||||
printf("*************\n");
|
||||
@@ -1613,17 +1652,19 @@ int main(int argc, char **argv)
|
||||
length_dmrs,
|
||||
num_dmrs_cdm_grps_no_data);
|
||||
|
||||
LOG_M("ulsimStats.m","SNR",snrStats,snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BLER_round0",blerStats[0],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BLER_round1",blerStats[1],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BLER_round2",blerStats[2],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BLER_round3",blerStats[3],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BER_round0",berStats[0],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BER_round1",berStats[1],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BER_round2",berStats[2],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","BER_round3",berStats[3],snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","EffRate",effRate,snrRun,1,7);
|
||||
LOG_MM("ulsimStats.m","EffTP",effTP,snrRun,1,7);
|
||||
char opStatsFile[50];
|
||||
sprintf(opStatsFile, "ulsimStats_z%d.m", n_rx);
|
||||
LOG_M(opStatsFile,"SNR",snrStats,snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BLER_round0",blerStats[0],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BLER_round1",blerStats[1],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BLER_round2",blerStats[2],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BLER_round3",blerStats[3],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BER_round0",berStats[0],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BER_round1",berStats[1],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BER_round2",berStats[2],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"BER_round3",berStats[3],snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"EffRate",effRate,snrRun,1,7);
|
||||
LOG_MM(opStatsFile,"EffTP",effTP,snrRun,1,7);
|
||||
free(test_input_bit);
|
||||
free(estimated_output_bit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user