Commit 64b361aa authored by Guy De Souza's avatar Guy De Souza

Minor fixes

parent 6de60def
......@@ -178,15 +178,16 @@ void nr_pdsch_layer_mapping(uint16_t **mod_symbs,
break;
default:
AsserFatal(0, "Invalid number of layers %d\n", n_layers);
AssertFatal(0, "Invalid number of layers %d\n", n_layers);
}
}
uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
NR_gNB_DCI_ALLOC_t dci_alloc,
uint32_t *pdsch_dmrs,
uint32_t **pdsch_dmrs,
int32_t** txdataF,
int16_t amp,
uint8_t subframe,
NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config) {
......@@ -200,6 +201,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
int8_t Wf[2], Wt[2], l0, delta;
/// CRC, coding, interleaving and rate matching
nr_dlsch_encoding(0, subframe, &dlsch, &frame_parms);
/// scrambling
uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? \
......@@ -235,7 +237,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
uint16_t n_dmrs = rel15->n_prb*rel15->nb_re_dmrs;
int16_t mod_dmrs[n_dmrs<<1];
uint8_t dmrs_type = config.pdsch_config.dmrs_type.value;
nr_modulation(pdsch_dmrs, n_dmrs, MOD_QPSK, mod_dmrs);
l0 = get_l0(dmrs_type, config.pdsch_config.dmrs_typeA_position.value);
nr_modulation(pdsch_dmrs[l0], n_dmrs, MOD_QPSK, mod_dmrs);
/// Resource mapping
AssertFatal(rel15->nb_layers<=config.rf_config.tx_antenna_ports.value, "Not enough Tx antennas (%d) for %d layers\n",\
......@@ -251,7 +254,6 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
// DMRS params for this ap
get_Wt(Wt, ap, dmrs_type);
get_Wf(Wf, ap, dmrs_type);
l0 = get_l0(0, config.pdsch_config.dmrs_typeA_position.value);
delta = get_delta(ap, dmrs_type);
uint8_t k_prime=0, n=0, dmrs_idx=0;
uint16_t m = 0;
......
......@@ -79,16 +79,21 @@ void nr_pdsch_layer_mapping(uint16_t **mod_symbs,
uint16_t *n_symbs,
uint16_t **tx_layers);
uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
NR_gNB_DCI_ALLOC_t dci_alloc,
uint32_t **pdsch_dmrs,
int32_t** txdataF,
int16_t amp,
uint8_t subframe,
NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_config_request_t config);
/** \brief Computes available bits G.
@param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl);
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned char *a,
NR_gNB_DLSCH_t *dlsch,
uint16_t frame,
int nr_dlsch_encoding(unsigned char *a,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms);
......@@ -243,20 +243,15 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
}
}
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned char *a,
NR_gNB_DLSCH_t *dlsch,
uint16_t frame,
int nr_dlsch_encoding(unsigned char *a,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms)
{
unsigned int G;
unsigned int crc=1;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
uint8_t harq_pid = dlsch->harq_ids[subframe];
nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15;
uint16_t nb_rb = rel15.n_prb;
......@@ -266,7 +261,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t mod_order = rel15.modulation_order;
uint16_t Kr=0,r,r_offset=0;//Kr_bytes
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
//double rate = 0.33;
uint8_t kb,BG=1;
uint32_t E;
uint8_t Ilbrm = 0;
......@@ -278,7 +272,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
A = rel15.transport_block_size;
//printf("Encoder: A: %d frame.subframe %d.%d \n",A, frame,subframe);
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15.nb_layers);
printf("dlsch coding A %d G %d mod_order %d\n", A,G, mod_order);
......@@ -328,7 +321,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
Kr = dlsch->harq_processes[harq_pid]->K;
//Kr_bytes = Kr>>3;
start_meas(te_stats);
//start_meas(te_stats);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
channel_input[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
......@@ -361,7 +354,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
printf("\n");*/
//ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,1,3,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
stop_meas(te_stats);
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
#ifdef DEBUG_DLSCH_CODING
......@@ -380,7 +373,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
mod_order,nb_rb);
#endif
start_meas(rm_stats);
//start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#endif
......@@ -402,14 +395,14 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
for (int i =0; i<16; i++)
printf("output ratematching e[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->e[i], r_offset);
#endif
stop_meas(rm_stats);
//stop_meas(rm_stats);
start_meas(i_stats);
//start_meas(i_stats);
nr_interleaving_ldpc(E,
mod_order,
dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->f+r_offset);
stop_meas(i_stats);
//stop_meas(i_stats);
r_offset += E;
#ifdef DEBUG_DLSCH_CODING
......
......@@ -120,8 +120,8 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch,
uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t N_sh_symb = dlsch_rel15->nb_symbols;
uint8_t Imcs = dlsch_rel15->mcs_idx;
uint16_t N_prime_RE = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
LOG_I(MAC, "N_prime_RE %d for %d symbols %d DMRS per PRB and %d overhead\n", N_prime_RE, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
LOG_I(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
uint16_t N_RE, Ninfo, Ninfo_prime, C, TBS;
uint8_t table_idx, R, Qm, n, scale;
......@@ -129,7 +129,7 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch,
table_idx = get_table_idx(mcs_table, dci_format, rnti_type, ss_type);
scale = 10 + (((table_idx==2)&&((Imcs==20)||(Imcs==26)))?1:0);
N_RE = min(156, N_RE)*dlsch_rel15->n_prb;
N_RE = min(156, N_RE_prime)*dlsch_rel15->n_prb;
R = nr_get_code_rate(Imcs, table_idx);
Qm = nr_get_Qm(Imcs, table_idx);
Ninfo = (N_RE*R*Qm*dlsch_rel15->nb_layers)>>scale;
......
......@@ -63,6 +63,7 @@ typedef struct {
typedef struct {
uint8_t num_dci;
uint8_t num_pdsch_rnti;
NR_gNB_DCI_ALLOC_t dci_alloc[256];
} NR_gNB_PDCCH;
......
......@@ -157,7 +157,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
int aa;
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
uint8_t num_dci=0;
uint8_t num_dci=0, num_pdsch_rnti;
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
......@@ -181,18 +181,28 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
}
num_dci = gNB->pdcch_vars.num_dci;
num_pdsch_rnti = gNB->pdcch_vars.num_pdsch_rnti;
if (num_dci) {
LOG_I(PHY, "[gNB %d] Frame %d subframe %d \
Calling nr_generate_dci_top (number of DCI %d)\n", gNB->Mod_id, frame, subframe, num_dci);
uint8_t slot_idx = gNB->pdcch_vars.dci_alloc[0].pdcch_params.first_slot;
if (nfapi_mode == 0 || nfapi_mode == 1)
if (nfapi_mode == 0 || nfapi_mode == 1){
nr_generate_dci_top(gNB->pdcch_vars,
gNB->nrPolar_params,
gNB->nr_gold_pdcch_dmrs[slot_idx],
gNB->common_vars.txdataF,
AMP, *fp, *cfg);
if (num_pdsch_rnti) {
LOG_I(PHY, "PDSCH generation started (%d)\n", num_pdsch_rnti);
nr_generate_pdsch(gNB->dlsch,
gNB->pdcch_vars,
gNB->nr_gold_pdsch_dmrs[slot_idx],
gNB->common_vars.txdataF,
AMP, subframe, *fp, *cfg);
}
}
}
}
......@@ -759,7 +759,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
LOG_E(PHY,"Can't get gNB dlsch structures for UE %d \n", i);
exit(-1);
} else {
gNB->dlsch[i][j]->rnti=0;
gNB->dlsch[i][j]->rnti=0x1234;
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,gNB->dlsch[i][j], gNB->dlsch[i][j]->rnti);
}
}
......@@ -767,10 +767,10 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
//LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
//gNB->ulsch[1+i] = new_gNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
if (!gNB->ulsch[1+i]) {
/*if (!gNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get gNB ulsch structures\n");
exit(-1);
}
}*/
// this is the transmission mode for the signalling channels
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
......
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