making nr_ulsim working again with the FAPI
This commit is contained in:
@@ -484,29 +484,20 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUMBER_OF_NR_UE_MAX; i++) {
|
||||
for (i=0; i<NUMBER_OF_NR_ULSCH_MAX; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
// ULSCH for RA
|
||||
if(i==0) {
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
if (!gNB->ulsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get gNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
// ULSCH for data
|
||||
gNB->ulsch[i+1][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
if (!gNB->ulsch[i+1][j]) {
|
||||
if (!gNB->ulsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get gNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
LOG_I(PHY,"Initializing nFAPI for ULSCH, UE %d\n",i);
|
||||
// [hna] added here for RT implementation
|
||||
uint8_t harq_pid = 0;
|
||||
@@ -525,8 +516,8 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
rel15_ul->ulsch_pdu_rel15.rv = 0;
|
||||
rel15_ul->ulsch_pdu_rel15.n_layers = 1;
|
||||
///////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z);
|
||||
if (!frame%100)
|
||||
printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->Nl);
|
||||
printf("K %d C %d Z %d F %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->F);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -591,13 +591,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
|
||||
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
|
||||
#ifdef PRINT_CRC_CHECK
|
||||
if (prnt_crc_cnt % 10 == 0)
|
||||
//if (prnt_crc_cnt % 10 == 0)
|
||||
LOG_I(PHY, "Segment %d CRC OK\n",r);
|
||||
#endif
|
||||
ret = no_iteration_ldpc;
|
||||
} else {
|
||||
#ifdef PRINT_CRC_CHECK
|
||||
if (prnt_crc_cnt%10 == 0)
|
||||
//if (prnt_crc_cnt%10 == 0)
|
||||
LOG_I(PHY, "CRC NOK\n");
|
||||
#endif
|
||||
ret = ulsch->max_ldpc_iterations + 1;
|
||||
|
||||
@@ -136,8 +136,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
// to be removed later when MAC is ready
|
||||
|
||||
if (harq_process_ul_ue != NULL){
|
||||
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++)
|
||||
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
|
||||
harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
//printf("input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||
}
|
||||
} else {
|
||||
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
|
||||
return;
|
||||
|
||||
@@ -637,16 +637,11 @@ typedef struct PHY_VARS_gNB_s {
|
||||
|
||||
NR_gNB_PDCCH pdcch_vars;
|
||||
NR_gNB_PBCH pbch;
|
||||
// LTE_eNB_PHICH phich_vars[2];
|
||||
|
||||
NR_gNB_COMMON common_vars;
|
||||
/* LTE_eNB_UCI uci_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_SRS srs_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_PRACH prach_vars;*/
|
||||
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX+1][2]; // [Nusers times + number of RA][2 codewords], index 0 in [NUMBER_OF_UE_MAX+1] is for RA
|
||||
// LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords]
|
||||
NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
|
||||
NR_gNB_DLSCH_t *dlsch_PCH;
|
||||
/*
|
||||
|
||||
@@ -372,6 +372,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||
nr_rx_pusch(gNB, UE_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||
}
|
||||
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[UE_id]->rxdataF_comp[0],6900,1,1);
|
||||
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[UE_id]->rxdataF_ext[0],6900,1,1);
|
||||
nr_ulsch_procedures(gNB, frame_rx, slot_rx, UE_id, harq_pid);
|
||||
nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid); // indicate SDU to MAC
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -96,7 +97,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;
|
||||
@@ -126,7 +127,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':
|
||||
@@ -285,6 +286,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]);
|
||||
@@ -355,7 +360,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));
|
||||
@@ -397,8 +402,9 @@ int main(int argc, char **argv)
|
||||
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);
|
||||
|
||||
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_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;
|
||||
|
||||
NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0];
|
||||
|
||||
@@ -428,7 +434,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;
|
||||
@@ -442,8 +449,12 @@ int main(int argc, char **argv)
|
||||
rel15_ul->ulsch_pdu_rel15.ndi = 0;
|
||||
rel15_ul->ulsch_pdu_rel15.n_layers = precod_nbr_layers;
|
||||
///////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
//fapi_nr_tx_request_t tx_request;
|
||||
nr_schedule_uss_ulsch_phytest(UL_tti_req,frame,slot);
|
||||
|
||||
|
||||
// --------- setting parameters for UE --------
|
||||
|
||||
scheduled_response.module_id = 0;
|
||||
scheduled_response.CC_id = 0;
|
||||
@@ -477,6 +488,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;
|
||||
@@ -514,6 +527,8 @@ int main(int argc, char **argv)
|
||||
//----------------------------------------------------------
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
//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);
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -539,7 +554,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)
|
||||
@@ -563,7 +578,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
|
||||
|
||||
@@ -576,31 +591,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