txlev_float=(double)txlev/(double)AMP;// output of signal_energy is fixed point representation
for(SNR=snr0;SNR<snr1;SNR+=snr_step){
n_errors=0;
n_false_positive=0;
//AWGN
sigma_dB=10*log10(txlev_float)-SNR;
sigma=pow(10,sigma_dB/10);
for(trial=0;trial<n_trials;trial++){
errors_scrambling=0;
errors_bit=0;
for(i=0;i<frame_length_complex_samples;i++){
for(ap=0;ap<frame_parms->nb_antennas_rx;ap++){
((short*)gNB->common_vars.rxdata[ap])[2*i]=(((int16_t*)UE->common_vars.txdata[ap])[(i<<1)])+(int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP);// convert to fixed point
((short*)gNB->common_vars.rxdata[ap])[2*i]=(((int16_t*)UE->common_vars.txdata[ap])[(i<<1)])+(int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP);// convert to fixed point