Commit d62b7a1e authored by Thomas Schlichter's avatar Thomas Schlichter

gNB: fix corruption of RBs not used by PDSCH in nr_generate_pdsch()

A memcpy() introduced to optimize for the case of no precoding corrupted RBs which are not allocated to PDSCH in the common txdataF array.
So instead fall back to memcpy() for each PDSCH RB.
parent f0c46b45
...@@ -412,25 +412,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -412,25 +412,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
///Layer Precoding and Antenna port mapping ///Layer Precoding and Antenna port mapping
// tx_layers 1-8 are mapped on antenna ports 1000-1007 // tx_layers 1-8 are mapped on antenna ports 1000-1007
// The precoding info is supported by nfapi such as numPRGs, prg_size, and pm_idx // The precoding info is supported by nfapi such as num_prgs, prg_size, prgs_list and pm_idx
// The same precoding matrix is applied on prg_size RBs, Thus // The same precoding matrix is applied on prg_size RBs, Thus
// pmi = pm_idx[rbidx/prg_size], rbidx =0,...,rbSize-1 // pmi = prgs_list[rbidx/prg_size].pm_idx, rbidx =0,...,rbSize-1
// The Precoding matrix: // The Precoding matrix:
// The Codebook Type I and Type II are not supported yet. // The Codebook Type I and Type II are not supported yet.
// We adopt the precoding matrices of PUSCH for 4 layers. // We adopt the precoding matrices of PUSCH for 4 layers.
if ((frame_parms->nb_antennas_tx == 1 && rel15->nrOfLayers == 1) || rel15->precodingAndBeamforming.prg_size == 0) {//No precoding if precoding info is not available
for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++) {//frame_parms->nb_antennas_tx rel15->nrOfLayers
if(ap<rel15->nrOfLayers)
memcpy((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset],
(void*)&txdataF_precoding[ap][2*(rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset)],
rel15->NrOfSymbols*frame_parms->ofdm_symbol_size*sizeof(int32_t));
else
memset((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset],
0,
rel15->NrOfSymbols*frame_parms->ofdm_symbol_size*sizeof(int32_t));
}
} else {//apply precoding
uint8_t pmi;
for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++) { for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++) {
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
...@@ -438,11 +425,27 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -438,11 +425,27 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
for (int rb=0; rb<rel15->rbSize; rb++) { for (int rb=0; rb<rel15->rbSize; rb++) {
//get pmi info //get pmi info
uint8_t pmi;
if (rel15->precodingAndBeamforming.prg_size > 0) if (rel15->precodingAndBeamforming.prg_size > 0)
pmi = rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx; pmi = rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx;
else else
pmi = 0;//no precoding pmi = 0;//no precoding
if (pmi == 0) {//unitary Precoding
if(ap<rel15->nrOfLayers)
memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k],
(void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + txdataF_offset+ k)],
NR_NB_SC_PER_RB*sizeof(int32_t));
else
memset((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset +k],
0,
NR_NB_SC_PER_RB*sizeof(int32_t));
k += NR_NB_SC_PER_RB;
if (k >= frame_parms->ofdm_symbol_size) {
k -= frame_parms->ofdm_symbol_size;
}
}
else {
//get the precoding matrix weights: //get the precoding matrix weights:
char *W_prec; char *W_prec;
switch (frame_parms->nb_antennas_tx) { switch (frame_parms->nb_antennas_tx) {
...@@ -470,21 +473,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -470,21 +473,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
W_prec = nr_W_1l_2p[pmi][ap]; W_prec = nr_W_1l_2p[pmi][ap];
break; break;
} }
if (pmi == 0) {//unitary Precoding
if(ap<rel15->nrOfLayers)
memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k],
(void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + txdataF_offset+ k)],
NR_NB_SC_PER_RB*sizeof(int32_t));
else
memset((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset +k],
0,
NR_NB_SC_PER_RB*sizeof(int32_t));
k += NR_NB_SC_PER_RB;
if (k >= frame_parms->ofdm_symbol_size) {
k -= frame_parms->ofdm_symbol_size;
}
}
else {
for (int i=0; i<NR_NB_SC_PER_RB; i++) { for (int i=0; i<NR_NB_SC_PER_RB; i++) {
int32_t re_offset = l*frame_parms->ofdm_symbol_size + k; int32_t re_offset = l*frame_parms->ofdm_symbol_size + k;
int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset);
...@@ -503,7 +491,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -503,7 +491,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
} //RB loop } //RB loop
} // symbol loop } // symbol loop
}// port loop }// port loop
}
dlsch->slot_tx[slot]=0; dlsch->slot_tx[slot]=0;
......
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