Commit 63a2e611 authored by Ahmed Hussein's avatar Ahmed Hussein Committed by Thomas Schlichter

Minor fixes in "ulsim.c" and removing some warnings

parent 5d0c0be1
......@@ -262,8 +262,8 @@ int nr_slot_fep_ul(PHY_VARS_gNB *gNB,
else
rxdata_offset = slot_offset + nb_prefix_samples0 + (symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples)) - SOFFSET;
dft((int16_t *)&gNB->common_vars.rxdata[0][rxdata_offset],
(int16_t *)&gNB->common_vars.rxdataF[0][symbol * frame_parms->ofdm_symbol_size], 1);
dft((int16_t *)&gNB->common_vars.rxdata[aa][rxdata_offset],
(int16_t *)&gNB->common_vars.rxdataF[aa][symbol * frame_parms->ofdm_symbol_size], 1);
}
return(0);
......
......@@ -205,7 +205,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint32_t *pz;
uint8_t mod_order;
uint16_t Kr,r,r_offset;
//uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint8_t BG;
uint32_t E;
uint8_t Ilbrm;
......@@ -255,7 +254,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,harq_process->Nl);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
printf("ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, harq_process->Nl);
......@@ -316,6 +315,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Kr_bytes = Kr>>3;
#endif
printf("ulsch coding A %d G %d mod_order %d C %d\n", A,G, mod_order, harq_process->C);
///////////
/////////////////////////////////////////////////////////////////////////////////////
......@@ -327,7 +327,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
//start_meas(te_stats);
for (r=0; r<harq_process->C; r++) {
//d_tmp[r] = &harq_process->d[r][0];
//channel_input[r] = &harq_process->d[r][0];
#ifdef DEBUG_DLSCH_CODING
printf("Encoder: B %d F %d \n",harq_process->B, harq_process->F);
......@@ -354,7 +353,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
}
printf("\n");*/
//ldpc_encoder_optim_8seg(harq_process->c,d_tmp,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
ldpc_encoder_optim_8seg(harq_process->c,harq_process->d,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
//stop_meas(te_stats);
......
......@@ -216,7 +216,6 @@ int main(int argc, char **argv) {
int frame = 0;
int frame_length_complex_samples;
NR_DL_FRAME_PARMS *frame_parms;
int ret;
int loglvl = OAILOG_WARNING;
uint64_t SSB_positions=0x01;
uint16_t nb_symb_sch = 12;
......@@ -227,7 +226,7 @@ int main(int argc, char **argv) {
int ap;
int tx_offset;
double txlev;
int start_rb = 90;
int start_rb = 30;
cpuf = get_cpu_freq_GHz();
......@@ -501,7 +500,6 @@ int main(int argc, char **argv) {
ulsim_params.n_rnti = n_rnti;
unsigned char harq_pid = 0;
uint8_t is_crnti = 0;
unsigned int TBS = 8424;
unsigned int available_bits;
uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4;
......@@ -518,9 +516,6 @@ int main(int argc, char **argv) {
NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0];
printf("available bits %d TBS %d mod_order %d\n", available_bits, TBS, mod_order);
// --------- setting rel15_ul parameters ----------
rel15_ul->rnti = n_rnti;
rel15_ul->ulsch_pdu_rel15.start_rb = start_rb;
......@@ -577,6 +572,8 @@ int main(int argc, char **argv) {
txlev = txlev/(double)AMP; // output of signal_energy is fixed point representation
printf("\n");
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
n_errors = 0;
......@@ -610,20 +607,26 @@ int main(int argc, char **argv) {
//---------------------- count errors ----------------------
//----------------------------------------------------------
for (i = 0; i < TBS; i++) {
for (i = 0; i < available_bits; i++) {
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0)))
{
if(errors_scrambling == 0)
printf("First bit in error = %d\n",i);
printf("First bit in error in unscrambling = %d\n",i);
errors_scrambling++;
}
}
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] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) {
if(errors_bit == 0)
printf("First bit in error in decoding = %d\n",i);
errors_bit++;
}
......@@ -641,17 +644,21 @@ int main(int argc, char **argv) {
if (n_trials == 1)
printf("errors_bit %d (trial %d)\n", errors_bit, trial);
}
printf("\n");
} // [hna] for (trial = 0; trial < n_trials; trial++)
printf("*****************************************\n");
printf("SNR %f, (false positive %f)\n", SNR,
(float) n_false_positive / (float) n_trials);
printf("*****************************************\n");
printf("\n");
if (errors_bit == 0) {
printf("PUSCH test OK\n");
printf("\n");
break;
}
printf("\n");
} // [hna] for (SNR = snr0; SNR < snr1; SNR += snr_step)
......@@ -665,7 +672,7 @@ int main(int argc, char **argv) {
free_gNB_ulsch(gNB->ulsch[0][i]);
printf("gNB ulsch[%d][%d]\n",UE_id, 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment