Commit 2b7e0a05 authored by Sakthivel Velumani's avatar Sakthivel Velumani Committed by francescomani

Change loop order to maximize cache hit

It is better to write to memory that are grouped together to reduce
probability of cache miss. This simple change improved the function's
execution speed by 70%.

Removed the unnecessary memset for the buffer.
parent 9c8bdd6d
......@@ -318,10 +318,10 @@ void nr_layer_mapping(int nbCodes,
}
}
void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, int sz, c16_t tx_layers[][sz])
void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, c16_t tx_layers[][n_symbs])
{
for (int i=0; i<n_symbs/n_layers; i++) {
for (int l=0; l<n_layers; l++) {
for (int l = 0; l < n_layers; l++) {
for (int i = 0; i < n_symbs; i++) {
tx_layers[l][i] = c16mulRealShift(mod_symbs[n_layers * i + l], AMP, 15);
}
}
......
......@@ -69,7 +69,7 @@ void nr_layer_mapping(int nbCodes,
@param[in] n_symbs, number of modulated symbols
@param[out] tx_layers, modulated symbols for each layer
*/
void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, int sz, c16_t tx_layers[][sz]);
void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, c16_t tx_layers[][n_symbs]);
/*!
\brief This function implements the OFDM front end processor on reception (FEP)
\param frame_parms Pointer to frame parameters
......
......@@ -248,11 +248,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH layer mapping/////////////////////////
///////////
const int sz = available_bits / mod_order;
const int sz = available_bits / mod_order / Nl;
c16_t tx_layers[Nl][sz];
memset(tx_layers, 0, sizeof(tx_layers));
nr_ue_layer_mapping(d_mod, Nl, available_bits / mod_order, sz, tx_layers);
nr_ue_layer_mapping(d_mod, Nl, sz, tx_layers);
///////////
////////////////////////////////////////////////////////////////////////
......
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