Merge branch 'develop-nr' into ru-parallel-beamforming-merge
Conflicts: openair1/PHY/MODULATION/nr_modulation.h openair1/PHY/NR_TRANSPORT/nr_dlsch.c openair1/SCHED_NR/phy_procedures_nr_gNB.c
This commit is contained in:
@@ -110,6 +110,7 @@ int main(int argc, char **argv)
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
uint8_t mcs_table = 0;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
@@ -430,6 +431,7 @@ int main(int argc, char **argv)
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
uint16_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
uint16_t rate;
|
||||
uint8_t Nl = 1;
|
||||
uint8_t rvidx = 0;
|
||||
dlsch->rnti = 1;
|
||||
@@ -437,9 +439,10 @@ int main(int argc, char **argv)
|
||||
dlsch->harq_processes[0]->rvidx = rvidx;*/
|
||||
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
|
||||
// dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->mcs,dlsch->harq_processes[0]->Nl);
|
||||
mod_order = nr_get_Qm(Imcs, 1);
|
||||
mod_order = nr_get_Qm_dl(Imcs, mcs_table);
|
||||
rate = nr_get_code_rate_dl(Imcs, mcs_table);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
|
||||
TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
|
||||
printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
//dlsch->harq_ids[subframe]= 0;
|
||||
rel15->n_prb = nb_rb;
|
||||
@@ -448,6 +451,7 @@ int main(int argc, char **argv)
|
||||
rel15->nb_layers = Nl;
|
||||
rel15->nb_re_dmrs = nb_re_dmrs;
|
||||
rel15->transport_block_size = TBS;
|
||||
rel15->coding_rate = rate;
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
|
||||
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
|
||||
@@ -462,10 +466,12 @@ int main(int argc, char **argv)
|
||||
NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0][0];
|
||||
NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid];
|
||||
harq_process->mcs = Imcs;
|
||||
harq_process->mcs_table = mcs_table;
|
||||
harq_process->Nl = Nl;
|
||||
harq_process->nb_rb = nb_rb;
|
||||
harq_process->Qm = mod_order;
|
||||
harq_process->rvidx = rvidx;
|
||||
harq_process->R = rate;
|
||||
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
|
||||
unsigned char *test_input;
|
||||
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
|
||||
|
||||
@@ -75,31 +75,29 @@ void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
|
||||
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);}
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP, const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index, const frame_t frameP,
|
||||
const sub_frame_t subframeP, const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,const uint32_t sourceL2Id
|
||||
,const uint32_t destinationL2Id
|
||||
#endif
|
||||
){mac_rlc_status_resp_t mac_rlc_status_resp; return mac_rlc_status_resp;}
|
||||
tbs_size_t mac_rlc_data_req(
|
||||
const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
char *buffer_pP
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,const uint32_t sourceL2Id
|
||||
,const uint32_t destinationL2Id
|
||||
#endif
|
||||
)
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id)
|
||||
{mac_rlc_status_resp_t mac_rlc_status_resp; return mac_rlc_status_resp;}
|
||||
tbs_size_t mac_rlc_data_req( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
char *buffer_pP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id )
|
||||
{return 0;}
|
||||
int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char num_sdus,
|
||||
@@ -167,6 +165,12 @@ int main(int argc, char **argv)
|
||||
//double pbch_sinr;
|
||||
//int pbch_tx_ant;
|
||||
int N_RB_DL=106,mu=1;
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config;
|
||||
dlsch_config.start_prb = 0;
|
||||
dlsch_config.n_prb = 50;
|
||||
dlsch_config.start_symbol = 2;
|
||||
dlsch_config.nb_symbols = 9;
|
||||
dlsch_config.mcs_idx = 9;
|
||||
|
||||
uint16_t ssb_periodicity = 10;
|
||||
|
||||
@@ -188,6 +192,7 @@ int main(int argc, char **argv)
|
||||
int run_initial_sync=0;
|
||||
int do_pdcch_flag=1;
|
||||
|
||||
uint16_t cset_offset = 0;
|
||||
int loglvl=OAILOG_WARNING;
|
||||
|
||||
float target_error_rate = 0.01;
|
||||
@@ -200,7 +205,7 @@ int main(int argc, char **argv)
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:o:a:b:c:j:e:")) != -1) {
|
||||
switch (c) {
|
||||
/*case 'f':
|
||||
write_output_file=1;
|
||||
@@ -365,6 +370,30 @@ int main(int argc, char **argv)
|
||||
loglvl = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
cset_offset = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
dlsch_config.start_prb = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
dlsch_config.n_prb = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
dlsch_config.start_symbol = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
dlsch_config.nb_symbols = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
dlsch_config.mcs_idx = atoi(optarg);
|
||||
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 -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",
|
||||
@@ -390,6 +419,12 @@ int main(int argc, char **argv)
|
||||
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
//printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-o CORESET offset\n");
|
||||
printf("-a Start PRB for PDSCH\n");
|
||||
printf("-b Number of PRB for PDSCH\n");
|
||||
printf("-c Start symbol for PDSCH (fixed for now)\n");
|
||||
printf("-j Number of symbols for PDSCH (fixed for now)\n");
|
||||
printf("-e MSC index\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
@@ -482,7 +517,7 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(int));
|
||||
bzero(txdata[i],frame_length_complex_samples*sizeof(int));
|
||||
|
||||
}
|
||||
|
||||
@@ -546,18 +581,20 @@ int main(int argc, char **argv)
|
||||
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
|
||||
uint16_t rb_offset_count = cset_offset/6;
|
||||
set_cset_offset(rb_offset_count);
|
||||
// generate signal
|
||||
if (input_fd==NULL) {
|
||||
gNB->pbch_configured = 1;
|
||||
for (int i=0;i<4;i++) gNB->pbch_pdu[i]=i+1;
|
||||
|
||||
nr_schedule_uss_dlsch_phytest(0,frame,slot);
|
||||
nr_schedule_uss_dlsch_phytest(0,frame,slot,&dlsch_config);
|
||||
Sched_INFO.module_id = 0;
|
||||
Sched_INFO.CC_id = 0;
|
||||
Sched_INFO.frame = frame;
|
||||
Sched_INFO.slot = slot;
|
||||
Sched_INFO.DL_req = &gNB_mac->DL_req[0];
|
||||
Sched_INFO.UL_req = NULL;
|
||||
Sched_INFO.UL_tti_req = &gNB_mac->UL_tti_req[0];
|
||||
Sched_INFO.HI_DCI0_req = NULL;
|
||||
Sched_INFO.TX_req = &gNB_mac->TX_req[0];
|
||||
nr_schedule_response(&Sched_INFO);
|
||||
@@ -646,13 +683,15 @@ int main(int argc, char **argv)
|
||||
|
||||
uint64_t mask = 0x0;
|
||||
uint16_t num_rbs=24;
|
||||
uint16_t rb_offset=0;
|
||||
uint16_t rb_offset=gNB->pdcch_vars.dci_alloc[0].pdcch_params.rb_offset;
|
||||
uint16_t cell_id=0;
|
||||
uint16_t num_symbols=2;
|
||||
for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs
|
||||
mask = mask >> 1;
|
||||
mask = mask | 0x100000000000;
|
||||
}
|
||||
uint16_t UE_rb_offset_count = rb_offset/6;
|
||||
mask = mask >> UE_rb_offset_count;
|
||||
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.frequency_domain_resource = mask;
|
||||
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.rb_offset = rb_offset; // additional parameter other than coreset
|
||||
|
||||
@@ -663,8 +702,6 @@ int main(int argc, char **argv)
|
||||
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.cce_reg_interleaved_shift_index = cell_id;
|
||||
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
|
||||
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.pdcch_dmrs_scrambling_id = cell_id;
|
||||
uint8_t gnb_start_symbol = Sched_INFO.DL_req->dl_config_request_body.dl_config_pdu_list[1].dlsch_pdu.dlsch_pdu_rel15.start_symbol;
|
||||
dl_config->dl_config_list[0].dlsch_config_pdu.dlsch_config_rel15.start_symbol = gnb_start_symbol;
|
||||
|
||||
uint32_t number_of_search_space_per_slot=1;
|
||||
uint32_t first_symbol_index=0;
|
||||
@@ -842,25 +879,17 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f, (false positive %f)\n", SNR,
|
||||
(float) n_false_positive / (float) n_trials);
|
||||
(float) n_errors / (float) n_trials);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
|
||||
if (errors_bit == 0) {
|
||||
printf("PDSCH test OK\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d\n", SNR, n_errors, n_trials);
|
||||
printf("\n");
|
||||
|
||||
if ((float)n_errors/(float)n_trials <= target_error_rate) {
|
||||
printf("PDCCH test OK\n");
|
||||
printf("PDSCH test OK\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (n_trials == 1)
|
||||
break;
|
||||
|
||||
} // NSR
|
||||
|
||||
|
||||
@@ -375,20 +375,21 @@ int main(int argc, char **argv)
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
uint8_t length_dmrs = 1;
|
||||
uint8_t N_PRB_oh;
|
||||
uint16_t N_RE_prime;
|
||||
uint16_t N_RE_prime,code_rate;
|
||||
unsigned char mod_order;
|
||||
uint8_t Nl = 1;
|
||||
uint8_t rvidx = 0;
|
||||
uint8_t UE_id = 0;
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id+1][0];
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
|
||||
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0];
|
||||
|
||||
mod_order = nr_get_Qm(Imcs, 1);
|
||||
mod_order = nr_get_Qm_ul(Imcs, 0);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, 0);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, Nl);
|
||||
TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, Nl);
|
||||
|
||||
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
|
||||
@@ -401,6 +402,7 @@ int main(int argc, char **argv)
|
||||
rel15_ul->n_layers = Nl;
|
||||
rel15_ul->nb_re_dmrs = nb_re_dmrs;
|
||||
rel15_ul->length_dmrs = length_dmrs;
|
||||
rel15_ul->R = code_rate;
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
@@ -563,31 +565,6 @@ int main(int argc, char **argv)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
printf("----------------------\n");
|
||||
printf("freeing codeword %d\n", i);
|
||||
printf("----------------------\n");
|
||||
|
||||
printf("gNB ulsch[0][%d]\n", i); // [hna] ulsch[0] is for RA
|
||||
|
||||
free_gNB_ulsch(gNB->ulsch[0][i]);
|
||||
|
||||
printf("gNB ulsch[%d][%d]\n",UE_id+1, i);
|
||||
|
||||
free_gNB_ulsch(gNB->ulsch[UE_id+1][i]);
|
||||
|
||||
for (sf = 0; sf < 2; sf++) {
|
||||
|
||||
printf("UE ulsch[%d][0][%d]\n", sf, i);
|
||||
|
||||
if (UE->ulsch[sf][0][i])
|
||||
free_nr_ue_ulsch(UE->ulsch[sf][0][i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (output_fd)
|
||||
fclose(output_fd);
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
//#define DEBUG_ULSIM
|
||||
|
||||
@@ -69,19 +70,50 @@ uint16_t NB_UE_INST = 1;
|
||||
// dummy functions
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
|
||||
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
|
||||
void mac_rlc_data_ind (
|
||||
const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP)
|
||||
{}
|
||||
void mac_rlc_data_ind ( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP){}
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id)
|
||||
{mac_rlc_status_resp_t mac_rlc_status_resp; return mac_rlc_status_resp;}
|
||||
tbs_size_t mac_rlc_data_req( const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
const tb_size_t tb_sizeP,
|
||||
char *buffer_pP,
|
||||
const uint32_t sourceL2Id,
|
||||
const uint32_t destinationL2Id )
|
||||
{return 0;}
|
||||
int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
unsigned char *sdu_lcids,
|
||||
unsigned char drx_cmd,
|
||||
unsigned short timing_advance_cmd,
|
||||
unsigned char *ue_cont_res_id,
|
||||
unsigned char short_padding,
|
||||
unsigned short post_padding){return 0;}
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
int rlc_module_init (void) {return(0);}
|
||||
void pdcp_layer_init (void) {}
|
||||
@@ -114,7 +146,7 @@ int main(int argc, char **argv)
|
||||
uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
|
||||
//unsigned char frame_type = 0;
|
||||
int number_of_frames = 1;
|
||||
int frame_length_complex_samples;
|
||||
int frame_length_complex_samples, frame_length_complex_samples_no_prefix ;
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
uint64_t SSB_positions=0x01;
|
||||
@@ -144,7 +176,7 @@ int main(int argc, char **argv)
|
||||
//logInit();
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:P:R:S:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:P:R:S:L:")) != -1) {
|
||||
switch (c) {
|
||||
|
||||
/*case 'd':
|
||||
@@ -303,6 +335,10 @@ int main(int argc, char **argv)
|
||||
printf("Setting SNR1 to %f\n", snr1);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
loglvl = atoi(optarg);
|
||||
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 -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]);
|
||||
@@ -373,7 +409,7 @@ int main(int argc, char **argv)
|
||||
//init_eNB_afterRU();
|
||||
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe;
|
||||
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
@@ -410,14 +446,18 @@ int main(int argc, char **argv)
|
||||
uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4;
|
||||
uint8_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
uint16_t code_rate;
|
||||
|
||||
mod_order = nr_get_Qm(Imcs, 1);
|
||||
mod_order = nr_get_Qm_ul(Imcs, 0);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, 0);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, precod_nbr_layers);
|
||||
TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers);
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
|
||||
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
|
||||
nfapi_nr_ul_tti_request_t *UL_tti_req = &gNB->UL_tti_req;
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id+1][0];
|
||||
nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
|
||||
|
||||
NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0];
|
||||
|
||||
unsigned char *estimated_output_bit;
|
||||
@@ -446,7 +486,8 @@ int main(int argc, char **argv)
|
||||
UE_proc.nr_tti_tx = slot;
|
||||
UE_proc.frame_tx = frame;
|
||||
|
||||
// --------- setting rel15_ul parameters for gNB --------
|
||||
// --------- setting parameters for gNB --------
|
||||
/*
|
||||
rel15_ul->rnti = n_rnti;
|
||||
rel15_ul->ulsch_pdu_rel15.start_rb = start_rb;
|
||||
rel15_ul->ulsch_pdu_rel15.number_rbs = nb_rb;
|
||||
@@ -459,9 +500,52 @@ int main(int argc, char **argv)
|
||||
rel15_ul->ulsch_pdu_rel15.rv = 0;
|
||||
rel15_ul->ulsch_pdu_rel15.ndi = 0;
|
||||
rel15_ul->ulsch_pdu_rel15.n_layers = precod_nbr_layers;
|
||||
rel15_ul->ulsch_pdu_rel15.R = code_rate;
|
||||
///////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
//fapi_nr_tx_request_t tx_request;
|
||||
UL_tti_req->sfn = frame;
|
||||
UL_tti_req->slot = slot;
|
||||
UL_tti_req->n_pdus = 1;
|
||||
UL_tti_req->pdus_list[0].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
|
||||
UL_tti_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
|
||||
memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t));
|
||||
|
||||
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_pdu->rnti = n_rnti;
|
||||
pusch_pdu->mcs_index = Imcs;
|
||||
pusch_pdu->mcs_table = 0;
|
||||
pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
|
||||
pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table) ;
|
||||
pusch_pdu->transform_precoding = 0;
|
||||
pusch_pdu->data_scrambling_id = 0;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
pusch_pdu->ul_dmrs_symb_pos = 1;
|
||||
pusch_pdu->dmrs_config_type = 0;
|
||||
pusch_pdu->ul_dmrs_scrambling_id = 0;
|
||||
pusch_pdu->scid = 0;
|
||||
pusch_pdu->resource_alloc = 1;
|
||||
pusch_pdu->rb_start = start_rb;
|
||||
pusch_pdu->rb_size = nb_rb;
|
||||
pusch_pdu->vrb_to_prb_mapping = 0;
|
||||
pusch_pdu->frequency_hopping = 0;
|
||||
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
|
||||
pusch_pdu->start_symbol_index = start_symbol;
|
||||
pusch_pdu->nr_of_symbols = nb_symb_sch;
|
||||
pusch_pdu->pusch_data.rv_index = 0;
|
||||
pusch_pdu->pusch_data.harq_process_id = 0;
|
||||
pusch_pdu->pusch_data.new_data_indicator = 0;
|
||||
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
|
||||
pusch_pdu->target_code_rate,
|
||||
pusch_pdu->rb_size,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
nb_re_dmrs*length_dmrs,
|
||||
0,
|
||||
pusch_pdu->nrOfLayers = 1);
|
||||
pusch_pdu->pusch_data.num_cb = 0;
|
||||
|
||||
|
||||
// --------- setting parameters for UE --------
|
||||
|
||||
scheduled_response.module_id = 0;
|
||||
scheduled_response.CC_id = 0;
|
||||
@@ -495,6 +579,8 @@ int main(int argc, char **argv)
|
||||
|
||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, 0);
|
||||
|
||||
//LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_length_complex_samples,1,1);
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = slot*frame_parms->samples_per_slot;
|
||||
@@ -532,7 +618,9 @@ int main(int argc, char **argv)
|
||||
//----------------------------------------------------------
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
phy_procedures_gNB_uespec_RX(gNB, frame, slot, rel15_ul->ulsch_pdu_rel15.start_symbol, rel15_ul->ulsch_pdu_rel15.start_symbol + rel15_ul->ulsch_pdu_rel15.number_symbols);
|
||||
//LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
|
||||
phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------
|
||||
@@ -557,7 +645,7 @@ int main(int argc, char **argv)
|
||||
for (i = 0; i < TBS; i++) {
|
||||
|
||||
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||
test_input_bit[i] = (ulsch_ue[0]->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7);
|
||||
test_input_bit[i] = (ulsch_ue[0]->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||
|
||||
if (estimated_output_bit[i] != test_input_bit[i]) {
|
||||
if(errors_decoding == 0)
|
||||
@@ -581,7 +669,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
} // frame loop
|
||||
|
||||
if(is_frame_in_error == 0)
|
||||
if(is_frame_in_error == 0 || number_of_frames==1)
|
||||
break;
|
||||
} // SNR loop
|
||||
|
||||
@@ -594,31 +682,6 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("\n");
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
printf("----------------------\n");
|
||||
printf("freeing codeword %d\n", i);
|
||||
printf("----------------------\n");
|
||||
|
||||
printf("gNB ulsch[0][%d]\n", i); // [hna] ulsch[0] is for RA
|
||||
|
||||
free_gNB_ulsch(gNB->ulsch[0][i]);
|
||||
|
||||
printf("gNB ulsch[%d][%d]\n",UE_id+1, i);
|
||||
|
||||
free_gNB_ulsch(gNB->ulsch[UE_id+1][i]); // "+1" because first element in ulsch is for RA
|
||||
|
||||
for (sf = 0; sf < 2; sf++) {
|
||||
|
||||
printf("UE ulsch[%d][0][%d]\n", sf, i);
|
||||
|
||||
if (UE->ulsch[sf][0][i])
|
||||
free_nr_ue_ulsch(UE->ulsch[sf][0][i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
free(test_input_bit);
|
||||
free(estimated_output_bit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user