Fixing ulschsim and applying minor change to ulsim
- Problem was related to UE_id and G
This commit is contained in:
committed by
Thomas Schlichter
parent
b1c6538783
commit
4677c0abd7
@@ -730,6 +730,8 @@ typedef struct {
|
||||
uint8_t frame_offset;
|
||||
uint16_t number_symbols;
|
||||
uint16_t start_symbol;
|
||||
uint8_t nb_re_dmrs;
|
||||
uint8_t length_dmrs;
|
||||
nr_pusch_freq_hopping_t pusch_freq_hopping;
|
||||
uint8_t mcs;
|
||||
uint8_t Qm;
|
||||
|
||||
@@ -284,7 +284,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret,offset;
|
||||
uint32_t nb_rb;
|
||||
int32_t no_iteration_ldpc, length_dec;
|
||||
uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0;
|
||||
uint8_t crc_type;
|
||||
@@ -306,9 +305,17 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
uint8_t kc;
|
||||
uint8_t Ilbrm = 0;
|
||||
uint32_t Tbslbrm = 950984;
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
uint16_t length_dmrs = 1;
|
||||
double Coderate = 0.0;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
uint16_t nb_rb = nfapi_ulsch_pdu_rel15->number_rbs;
|
||||
uint16_t number_symbols = nfapi_ulsch_pdu_rel15->number_symbols;
|
||||
uint8_t Qm = nfapi_ulsch_pdu_rel15->Qm;
|
||||
uint8_t mcs = nfapi_ulsch_pdu_rel15->mcs;
|
||||
uint8_t n_layers = nfapi_ulsch_pdu_rel15->n_layers;
|
||||
uint8_t nb_re_dmrs = nfapi_ulsch_pdu_rel15->nb_re_dmrs;
|
||||
uint8_t length_dmrs = nfapi_ulsch_pdu_rel15->length_dmrs;
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
uint32_t i,j;
|
||||
|
||||
@@ -331,19 +338,18 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
return(ulsch->max_ldpc_iterations);
|
||||
}
|
||||
|
||||
nb_rb = nfapi_ulsch_pdu_rel15->number_rbs;
|
||||
|
||||
// harq_process->trials[nfapi_ulsch_pdu_rel15->round]++;
|
||||
|
||||
harq_process->TBS = nr_compute_tbs(nfapi_ulsch_pdu_rel15->mcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->n_layers);
|
||||
|
||||
harq_process->TBS = nr_compute_tbs(mcs, nb_rb, number_symbols, nb_re_dmrs, length_dmrs, n_layers);
|
||||
|
||||
A = harq_process->TBS;
|
||||
ret = ulsch->max_ldpc_iterations;
|
||||
|
||||
G = nr_get_G(nb_rb, number_symbols, nb_re_dmrs, length_dmrs, Qm, n_layers);
|
||||
|
||||
// harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm,nfapi_ulsch_pdu_rel15->n_layers);
|
||||
G = harq_process->G;
|
||||
// G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers);
|
||||
|
||||
LOG_I(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, nfapi_ulsch_pdu_rel15->mcs, nfapi_ulsch_pdu_rel15->n_layers, nb_symb_sch,nb_rb);
|
||||
LOG_I(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb);
|
||||
|
||||
if (harq_process->round == 0) {
|
||||
|
||||
@@ -441,7 +447,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, nfapi_ulsch_pdu_rel15->n_layers);
|
||||
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
|
||||
E = nr_get_E(G, harq_process->C, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers, r);
|
||||
|
||||
#if gNB_TIMING_TRACE
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
// [hna] This enables SC-FDMA transmission in Uplink. If disabled, then OFDMA is used in UPLINK.
|
||||
#ifndef NR_SC_FDMA
|
||||
#define NR_SC_FDMA
|
||||
// #define NR_SC_FDMA
|
||||
#endif
|
||||
|
||||
#define MAX_NUM_SUBCARRIER_SPACING 5
|
||||
|
||||
@@ -207,15 +207,20 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int UE_id, uint8_t harq_pid) {
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->ulsch_pdu;
|
||||
nfapi_nr_ul_config_ulsch_pdu_rel15_t *nfapi_ulsch_pdu_rel15 = &rel15_ul->ulsch_pdu_rel15;
|
||||
|
||||
uint8_t ret;
|
||||
int Nid_cell = 0; // shouldn't be a local variable
|
||||
uint32_t G;
|
||||
int Nid_cell = 0; // [hna] shouldn't be a local variable (should be signaled)
|
||||
|
||||
G = nr_get_G(nfapi_ulsch_pdu_rel15->number_rbs, nfapi_ulsch_pdu_rel15->number_symbols, nfapi_ulsch_pdu_rel15->nb_re_dmrs, nfapi_ulsch_pdu_rel15->length_dmrs, nfapi_ulsch_pdu_rel15->Qm, nfapi_ulsch_pdu_rel15->n_layers);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- ULSCH unscrambling -------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
nr_ulsch_unscrambling(gNB->pusch_vars[UE_id]->llr, gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->G, 0, Nid_cell, rel15_ul->rnti);
|
||||
nr_ulsch_unscrambling(gNB->pusch_vars[UE_id]->llr, G, 0, Nid_cell, rel15_ul->rnti);
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
@@ -223,7 +228,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int UE_id,
|
||||
//----------------------------------------------------------
|
||||
|
||||
ret = nr_ulsch_decoding(gNB, UE_id, gNB->pusch_vars[UE_id]->llr, frame_parms, proc->frame_rx,
|
||||
rel15_ul->ulsch_pdu_rel15.number_symbols, proc->slot_rx, harq_pid, 0);
|
||||
nfapi_ulsch_pdu_rel15->number_symbols, proc->slot_rx, harq_pid, 0);
|
||||
|
||||
// if (ret > ulsch_gNB->max_ldpc_iterations)
|
||||
// n_errors++;
|
||||
|
||||
@@ -143,7 +143,6 @@ int main(int argc, char **argv) {
|
||||
unsigned char qbits = 8;
|
||||
int ret;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
float target_error_rate = 0.01;
|
||||
uint64_t SSB_positions=0x01;
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
@@ -396,19 +395,19 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
unsigned char harq_pid = 0;
|
||||
uint8_t is_crnti = 0, llr8_flag = 0;
|
||||
uint8_t is_crnti = 0;
|
||||
unsigned int TBS = 8424;
|
||||
unsigned int available_bits;
|
||||
uint8_t nb_re_dmrs = 6;
|
||||
uint16_t length_dmrs = 1;
|
||||
uint8_t length_dmrs = 1;
|
||||
uint8_t N_PRB_oh;
|
||||
uint16_t N_RE_prime;
|
||||
unsigned char mod_order;
|
||||
uint8_t Nl = 1;
|
||||
uint8_t rvidx = 0;
|
||||
uint8_t UE_id = 1;
|
||||
uint8_t UE_id = 0;
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id+1][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];
|
||||
@@ -416,6 +415,7 @@ int main(int argc, char **argv) {
|
||||
mod_order = nr_get_Qm(Imcs, 1);
|
||||
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);
|
||||
printf("\n");
|
||||
printf("available bits %d TBS %d mod_order %d\n", available_bits, TBS, mod_order);
|
||||
|
||||
/////////// setting rel15_ul parameters ///////////
|
||||
@@ -425,6 +425,8 @@ int main(int argc, char **argv) {
|
||||
rel15_ul->mcs = Imcs;
|
||||
rel15_ul->rv = rvidx;
|
||||
rel15_ul->n_layers = Nl;
|
||||
rel15_ul->nb_re_dmrs = nb_re_dmrs;
|
||||
rel15_ul->length_dmrs = length_dmrs;
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
|
||||
@@ -485,6 +487,8 @@ int main(int argc, char **argv) {
|
||||
if (input_fd == NULL) {
|
||||
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -518,7 +522,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
SNR_lin = pow(10, SNR / 10.0);
|
||||
sigma = 1.0 / sqrt(2 * SNR_lin);
|
||||
#if 1
|
||||
#if 0
|
||||
channel_output_fixed[i] = (short) quantize(sigma / 4.0 / 4.0,
|
||||
modulated_input[i] + sigma * gaussdouble(0.0, 1.0),
|
||||
qbits);
|
||||
@@ -539,7 +543,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
printf("errors bits uncoded %u\n", errors_bit_uncoded);
|
||||
|
||||
printf("\n");
|
||||
#ifdef DEBUG_CODER
|
||||
printf("\n");
|
||||
exit(-1);
|
||||
@@ -568,6 +572,7 @@ int main(int argc, char **argv) {
|
||||
if (n_trials == 1)
|
||||
printf("errors_bit %d (trial %d)\n", errors_bit, trial);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("*****************************************\n");
|
||||
@@ -575,11 +580,14 @@ int main(int argc, char **argv) {
|
||||
(float) n_errors / (float) n_trials,
|
||||
(float) n_false_positive / (float) n_trials);
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
|
||||
if ((float) n_errors / (float) n_trials < target_error_rate) {
|
||||
if (errors_bit == 0) {
|
||||
printf("PUSCH test OK\n");
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
@@ -592,9 +600,9 @@ 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][i]);
|
||||
free_gNB_ulsch(gNB->ulsch[UE_id+1][i]);
|
||||
|
||||
for (sf = 0; sf < 2; sf++) {
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ int main(int argc, char **argv) {
|
||||
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;
|
||||
uint16_t length_dmrs = 1;
|
||||
uint8_t length_dmrs = 1;
|
||||
unsigned char mod_order;
|
||||
|
||||
mod_order = nr_get_Qm(Imcs, 1);
|
||||
@@ -455,7 +455,6 @@ int main(int argc, char **argv) {
|
||||
TBS = nr_compute_tbs(Imcs, nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, ul_dci_pdu->precod_nbr_layers);
|
||||
|
||||
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id+1][0];
|
||||
ulsch_gNB->harq_processes[harq_pid]->G = available_bits; // [hna] temp until length_dmrs and nb_re_dmrs are signaled
|
||||
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];
|
||||
@@ -466,6 +465,8 @@ int main(int argc, char **argv) {
|
||||
rel15_ul->ulsch_pdu_rel15.number_rbs = nb_rb;
|
||||
rel15_ul->ulsch_pdu_rel15.start_symbol = start_symbol;
|
||||
rel15_ul->ulsch_pdu_rel15.number_symbols = nb_symb_sch;
|
||||
rel15_ul->ulsch_pdu_rel15.nb_re_dmrs = nb_re_dmrs;
|
||||
rel15_ul->ulsch_pdu_rel15.length_dmrs = length_dmrs;
|
||||
rel15_ul->ulsch_pdu_rel15.Qm = mod_order;
|
||||
rel15_ul->ulsch_pdu_rel15.mcs = Imcs;
|
||||
rel15_ul->ulsch_pdu_rel15.rv = 0;
|
||||
@@ -535,8 +536,10 @@ int main(int argc, char **argv) {
|
||||
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)
|
||||
if(errors_scrambling == 0) {
|
||||
printf("\n");
|
||||
printf("First bit in error in unscrambling = %d\n",i);
|
||||
}
|
||||
errors_scrambling++;
|
||||
}
|
||||
|
||||
@@ -559,13 +562,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (errors_scrambling > 0) {
|
||||
if (n_trials == 1)
|
||||
printf("errors_scrambling %d (trial %d)\n", errors_scrambling, trial);
|
||||
printf("errors_scrambling = %d (trial %d)\n", errors_scrambling, trial);
|
||||
}
|
||||
|
||||
if (errors_bit > 0) {
|
||||
n_false_positive++;
|
||||
if (n_trials == 1)
|
||||
printf("errors_bit %d (trial %d)\n", errors_bit, trial);
|
||||
printf("errors_bit = %d (trial %d)\n", errors_bit, trial);
|
||||
}
|
||||
printf("\n");
|
||||
} // [hna] for (trial = 0; trial < n_trials; trial++)
|
||||
|
||||
Reference in New Issue
Block a user