Commit 74d2a6bb authored by hardy's avatar hardy

Merge remote-tracking branch 'origin/fix_rb_corruption' into integration_2021_wk13_a

parents ddf3f9e8 fe191c7d
...@@ -418,92 +418,79 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -418,92 +418,79 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
// 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.prgSize == 0) {//No precoding if precoding info is not available for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++) {
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 l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
uint16_t k = start_sc; uint16_t k = start_sc;
for (int rb=0; rb<rel15->rbSize; rb++) { for (int rb=0; rb<rel15->rbSize; rb++) {
//get pmi info //get pmi info
if (rel15->precodingAndBeamforming.prgSize > 0) uint8_t pmi;
pmi = rel15->precodingAndBeamforming.PMIdx[(int)rb/rel15->precodingAndBeamforming.prgSize]; if (rel15->precodingAndBeamforming.prgSize > 0)
else pmi = rel15->precodingAndBeamforming.PMIdx[(int)rb/rel15->precodingAndBeamforming.prgSize];
pmi = 0;//no precoding else
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) {
case 1://1 antenna port case 1://1 antenna port
W_prec = nr_W_1l_2p[pmi][ap]; W_prec = nr_W_1l_2p[pmi][ap];
break; break;
case 2://2 antenna ports case 2://2 antenna ports
if (rel15->nrOfLayers == 1)//1 layer if (rel15->nrOfLayers == 1)//1 layer
W_prec = nr_W_1l_2p[pmi][ap]; W_prec = nr_W_1l_2p[pmi][ap];
else//2 layers else//2 layers
W_prec = nr_W_2l_2p[pmi][ap]; W_prec = nr_W_2l_2p[pmi][ap];
break; break;
case 4://4 antenna ports case 4://4 antenna ports
if (rel15->nrOfLayers == 1)//1 layer if (rel15->nrOfLayers == 1)//1 layer
W_prec = nr_W_1l_4p[pmi][ap]; W_prec = nr_W_1l_4p[pmi][ap];
else if (rel15->nrOfLayers == 2)//2 layers else if (rel15->nrOfLayers == 2)//2 layers
W_prec = nr_W_2l_4p[pmi][ap]; W_prec = nr_W_2l_4p[pmi][ap];
else if (rel15->nrOfLayers == 3)//3 layers else if (rel15->nrOfLayers == 3)//3 layers
W_prec = nr_W_3l_4p[pmi][ap]; W_prec = nr_W_3l_4p[pmi][ap];
else//4 layers else//4 layers
W_prec = nr_W_4l_4p[pmi][ap]; W_prec = nr_W_4l_4p[pmi][ap];
break; break;
default: default:
LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n"); LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n");
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); ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0];
((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1];
((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1];
#ifdef DEBUG_DLSCH_MAPPING #ifdef DEBUG_DLSCH_MAPPING
printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n", printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n",
ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)], ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)],
((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]); ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]);
#endif #endif
if (++k >= frame_parms->ofdm_symbol_size) { if (++k >= frame_parms->ofdm_symbol_size) {
k -= frame_parms->ofdm_symbol_size; k -= frame_parms->ofdm_symbol_size;
}
} }
} }
} //RB loop }
} // symbol loop } //RB loop
}// port loop } // symbol 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