Commit 9d2ad34b authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/improve-layer-mapping' into integration_2024_w15

parents 829d8c3c be3452a1
......@@ -293,8 +293,7 @@ static size_t dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output, size
output += print_meas_log(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL, output, end - output);
output += print_meas_log(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL, output, end - output);
output += print_meas_log(&gNB->dlsch_scrambling_stats, "DLSCH scrambling", NULL, NULL, output, end-output);
output += print_meas_log(&gNB->dlsch_modulation_stats, "DLSCH modulation", NULL, NULL, output, end-output);
output += print_meas_log(&gNB->dlsch_layer_mapping_stats, "DLSCH layer mapping", NULL, NULL, output,end-output);
output += print_meas_log(&gNB->dlsch_modulation_stats, "DLSCH modulation", NULL, NULL, output, end - output);
output += print_meas_log(&gNB->dlsch_resource_mapping_stats, "DLSCH resource mapping", NULL, NULL, output,end-output);
output += print_meas_log(&gNB->dlsch_precoding_stats, "DLSCH precoding", NULL, NULL, output,end-output);
output += print_meas_log(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL, output, end - output);
......@@ -347,7 +346,6 @@ void *nrL1_stats_thread(void *param) {
reset_meas(&gNB->schedule_response_stats);
reset_meas(&gNB->dlsch_scrambling_stats);
reset_meas(&gNB->dlsch_modulation_stats);
reset_meas(&gNB->dlsch_layer_mapping_stats);
reset_meas(&gNB->dlsch_resource_mapping_stats);
reset_meas(&gNB->dlsch_precoding_stats);
while (!oai_exit) {
......
......@@ -249,14 +249,15 @@ void nr_layer_mapping(int nbCodes,
uint8_t n_layers,
int layerSz,
uint32_t n_symbs,
c16_t tx_layers[n_layers][layerSz])
c16_t tx_layer[layerSz],
int layer)
{
LOG_D(PHY,"Doing layer mapping for %d layers, %d symbols\n",n_layers,n_symbs);
switch (n_layers) {
case 1:
memcpy(tx_layers[0], mod_symbs[0], n_symbs * sizeof(**mod_symbs));
memcpy(tx_layer, mod_symbs[0], n_symbs * sizeof(**mod_symbs));
break;
case 2:
......@@ -264,21 +265,20 @@ void nr_layer_mapping(int nbCodes,
case 4:
for (int i = 0; i < n_symbs / n_layers; i++) {
const c16_t *base = mod_symbs[0] + n_layers * i;
for (int l = 0; l < n_layers; l++)
tx_layers[l][i] = base[l];
tx_layer[i] = base[layer];
}
break;
case 5:
if (layer < 2)
for (int i = 0; i < n_symbs; i += 2) {
const int txIdx = i / 2;
for (int l = 0; l < 2; l++)
tx_layers[l][txIdx] = mod_symbs[0][i + l];
tx_layer[txIdx] = mod_symbs[0][i + layer];
}
else
for (int i = 0; i < n_symbs; i += 3) {
const int txIdx = i / 3;
for (int l = 2; l < 5; l++)
tx_layers[l][txIdx] = mod_symbs[1][i + l];
tx_layer[txIdx] = mod_symbs[1][i + layer];
}
break;
......@@ -286,21 +286,20 @@ void nr_layer_mapping(int nbCodes,
for (int q=0; q<2; q++)
for (int i = 0; i < n_symbs; i += 3) {
const int txIdx = i / 3;
for (int l = 0; l < 3; l++)
tx_layers[l][txIdx] = mod_symbs[q][i + l];
tx_layer[txIdx] = mod_symbs[q][i + layer];
}
break;
case 7:
if (layer < 3)
for (int i = 0; i < n_symbs; i += 3) {
const int txIdx = i / 3;
for (int l = 0; l < 3; l++)
tx_layers[l][txIdx] = mod_symbs[1][i + l];
tx_layer[txIdx] = mod_symbs[1][i + layer];
}
else
for (int i = 0; i < n_symbs; i += 4) {
const int txIdx = i / 4;
for (int l = 3; l < 7; l++)
tx_layers[l][txIdx] = mod_symbs[0][i + l];
tx_layer[txIdx] = mod_symbs[0][i + layer];
}
break;
......@@ -308,8 +307,7 @@ void nr_layer_mapping(int nbCodes,
for (int q=0; q<2; q++)
for (int i = 0; i < n_symbs; i += 4) {
const int txIdx = i / 4;
for (int l = 0; l < 3; l++)
tx_layers[l][txIdx] = mod_symbs[q][i + l];
tx_layer[txIdx] = mod_symbs[q][i + layer];
}
break;
......
......@@ -60,7 +60,8 @@ void nr_layer_mapping(int nbCodes,
uint8_t n_layers,
int layerSz,
uint32_t n_symbs,
c16_t tx_layers[n_layers][layerSz]);
c16_t tx_layers[layerSz],
int l);
/*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3
@param[in] ulsch_ue, double Pointer to NR_UE_ULSCH_t struct
......
......@@ -43,12 +43,7 @@
//#define DEBUG_DLSCH
//#define DEBUG_DLSCH_MAPPING
void nr_pdsch_codeword_scrambling(uint8_t *in,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out)
static void nr_pdsch_codeword_scrambling(uint8_t *in, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI, uint32_t *out)
{
nr_codeword_scrambling(in, size, q, Nid, n_RNTI, out);
}
......@@ -74,8 +69,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
const int layerSz = frame_parms->N_RB_DL * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8;
c16_t tx_layers[rel15->nrOfLayers][layerSz] __attribute__((aligned(64)));
const int layerSz = frame_parms->N_RB_DL * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB;
const int dmrs_Type = rel15->dmrsConfigType;
const int nb_re_dmrs = rel15->numDmrsCdmGrpsNoData * (rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
LOG_D(PHY,"pdsch: BWPStart %d, BWPSize %d, rbStart %d, rbsize %d\n",
......@@ -184,24 +178,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
}
#endif
}
start_meas(&gNB->dlsch_layer_mapping_stats);
/// Layer mapping
nr_layer_mapping(rel15->NrOfCodewords, encoded_length, mod_symbs, rel15->nrOfLayers, layerSz, nb_re, tx_layers);
#ifdef DEBUG_DLSCH
printf("Layer mapping (%d layers):\n", rel15->nrOfLayers);
for (int l=0; l<rel15->nrOfLayers; l++)
for (int i = 0; i < nb_re / rel15->nrOfLayers; i += 8) {
printf("layer %d, Re %d..%d : ", l, i, i + 7);
for (int j=0; j<8; j++) {
printf("l%d %d\t", tx_layers[l][i + j].r, tx_layers[l][i + j].i);
}
printf("\n");
}
#endif
stop_meas(&gNB->dlsch_layer_mapping_stats);
/// Resource mapping
// Non interleaved VRB to PRB mapping
......@@ -223,6 +199,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
start_meas(&gNB->dlsch_resource_mapping_stats);
for (int layer = 0; layer < rel15->nrOfLayers; layer++) {
c16_t tx_layer[layerSz] __attribute__((aligned(64)));
nr_layer_mapping(rel15->NrOfCodewords, encoded_length, mod_symbs, rel15->nrOfLayers, layerSz, nb_re, tx_layer, layer);
int dmrs_port = get_dmrs_port(layer, rel15->dmrsPorts);
// DMRS params for this dmrs port
......@@ -248,7 +227,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
dmrs_symbol);
#endif
uint32_t m=0, dmrs_idx=0;
uint32_t cur_re = 0, dmrs_idx = 0;
AssertFatal(n_dmrs, "n_dmrs can't be 0\n");
c16_t mod_dmrs[n_dmrs] __attribute__((aligned(64)));
......@@ -360,7 +339,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
frame_parms->ofdm_symbol_size,
rel15->numDmrsCdmGrpsNoData,
dmrs_Type)) {
txdataF_precoding[layer][l_symbol][k] = c16mulRealShift(tx_layers[layer][m], amp, 15);
txdataF_precoding[layer][l_symbol][k] = c16mulRealShift(tx_layer[cur_re], amp, 15);
#ifdef DEBUG_DLSCH_MAPPING
printf("m %u\t l %d \t k %d \t txdataF: %d %d\n",
m,
......@@ -369,7 +348,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
txdataF_precoding[layer][l_symbol][k].r,
txdataF_precoding[layer][l_symbol][k].i);
#endif
m++;
cur_re++;
}
/* mute RE */
else {
......@@ -391,15 +370,15 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
if (0/*(frame_parms->N_RB_DL&1)==0*/) {
simde__m128i *txF = (simde__m128i *)&txdataF_precoding[layer][l_symbol][start_sc];
simde__m128i *txl = (simde__m128i *)&tx_layers[layer][m];
simde__m128i *txl = (simde__m128i *)&tx_layer[cur_re];
simde__m128i amp128=simde_mm_set1_epi16(amp);
for (int i=0; i<(upper_limit>>2); i++) {
txF[i] = simde_mm_mulhrs_epi16(amp128,txl[i]);
} //RE loop, first part
m+=upper_limit;
cur_re += upper_limit;
if (remaining_re > 0) {
txF = (simde__m128i *)&txdataF_precoding[layer][l_symbol];
txl = (simde__m128i *)&tx_layers[layer][m];
txl = (simde__m128i *)&tx_layer[cur_re];
for (int i = 0; i < (remaining_re >> 2); i++) {
txF[i] = simde_mm_mulhrs_epi16(amp128, txl[i]);
}
......@@ -408,7 +387,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
else {
simde__m128i *txF = (simde__m128i *)&txdataF_precoding[layer][l_symbol][start_sc];
simde__m128i *txl = (simde__m128i *)&tx_layers[layer][m];
simde__m128i *txl = (simde__m128i *)&tx_layer[cur_re];
simde__m128i amp64 = simde_mm_set1_epi16(amp);
int i;
for (i = 0; i < (upper_limit >> 2); i++) {
......@@ -431,16 +410,16 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
}
if (i * 4 != upper_limit) {
c16_t *txFc = &txdataF_precoding[layer][l_symbol][start_sc];
c16_t *txlc = &tx_layers[layer][m];
c16_t *txlc = &tx_layer[cur_re];
for (i = (upper_limit >> 2) << 2; i < upper_limit; i++) {
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
}
}
m+=upper_limit;
cur_re += upper_limit;
if (remaining_re > 0) {
txF = (simde__m128i *)&txdataF_precoding[layer][l_symbol];
txl = (simde__m128i *)&tx_layers[layer][m];
txl = (simde__m128i *)&tx_layer[cur_re];
int i;
for (i = 0; i < (remaining_re >> 2); i++) {
const simde__m128i txL = simde_mm_loadu_si128(txl + i);
......@@ -463,14 +442,14 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
} // RE loop, second part
if (i * 4 != remaining_re) {
c16_t *txFc = txdataF_precoding[layer][l_symbol];
c16_t *txlc = &tx_layers[layer][m];
c16_t *txlc = &tx_layer[cur_re];
for (i = (remaining_re >> 2) << 2; i < remaining_re; i++) {
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
}
}
} // remaining_re > 0
m+=remaining_re;
cur_re += remaining_re;
} // N_RB_DL even
} // no DMRS/PTRS in symbol
} // symbol loop
......
......@@ -35,13 +35,6 @@
#include "PHY/defs_gNB.h"
void nr_pdsch_codeword_scrambling(uint8_t *in,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI,
uint32_t* out);
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
unsigned char *sdu);
......@@ -50,12 +43,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
int frame,
uint8_t slot,
......@@ -70,7 +57,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
time_stats_t *dlsch_interleaving_stats,
time_stats_t *dlsch_segmentation_stats);
void init_dlsch_tpool(uint8_t nun_dlsch_threads);
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB);
......
......@@ -137,11 +137,6 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
return(dlsch);
}
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) {
AssertFatal(dlsch!=NULL,"dlsch is null\n");
dlsch->active = 0;
}
void ldpc8blocks(void *p)
{
encoder_implemparams_t *impp=(encoder_implemparams_t *) p;
......
......@@ -673,7 +673,6 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t dlsch_modulation_stats;
time_stats_t dlsch_scrambling_stats;
time_stats_t dlsch_resource_mapping_stats;
time_stats_t dlsch_layer_mapping_stats;
time_stats_t dlsch_precoding_stats;
time_stats_t tinput;
time_stats_t tprep;
......
......@@ -12,7 +12,6 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu){
......
......@@ -12,7 +12,6 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu){
......
......@@ -1224,7 +1224,6 @@ int main(int argc, char **argv)
printStatIndent3(&gNB->dlsch_interleaving_stats, "DLSCH Interleaving time");
printStatIndent2(&gNB->dlsch_modulation_stats,"DLSCH modulation time");
printStatIndent2(&gNB->dlsch_scrambling_stats, "DLSCH scrambling time");
printStatIndent2(&gNB->dlsch_layer_mapping_stats, "DLSCH Layer Mapping time");
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
......
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