diff --git a/openair1/PHY/MODULATION/nr_beamforming.c b/openair1/PHY/MODULATION/nr_beamforming.c index 65084e401c..a10b95d6d2 100644 --- a/openair1/PHY/MODULATION/nr_beamforming.c +++ b/openair1/PHY/MODULATION/nr_beamforming.c @@ -3,6 +3,7 @@ */ #include "nr_modulation.h" +#include "openair1/PHY/TOOLS/tools_defs.h" void nr_beam_precoding(c16_t **txdataF, c16_t **txdataF_BF, diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index e3afd9b93f..8a1349b648 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -3,6 +3,7 @@ */ #include "nr_modulation.h" +#include "openair1/PHY/TOOLS/tools_defs.h" #include "PHY/NR_REFSIG/nr_mod_table.h" #include "executables/softmodem-common.h" #include @@ -688,12 +689,12 @@ c16_t nr_layer_precoder_cm(int n_layers, int symSz, c16_t datatx_F_precoding[n_layers][symSz], int ap, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset) { c16_t precodatatx_F = {0}; for (int al = 0; al < n_layers; al++) { - c16_t prec_weight = pmi_pdu->weights[al][ap]; + c16_t prec_weight = weights[al][ap]; precodatatx_F = c16maddShift(datatx_F_precoding[al][offset], prec_weight, precodatatx_F, 15); } return precodatatx_F; @@ -803,15 +804,15 @@ static inline __attribute__((always_inline)) __m128i cmac_prec128(__m128i y, __m #endif #define load_consts(Type, Instruct, Rank) \ - const Type w_c##Rank = Instruct(c16toI32(c16conj(pmi_pdu->weights[Rank][ant]))); \ - const Type w_s##Rank = Instruct(c16toI32(c16swap(pmi_pdu->weights[Rank][ant]))); \ + const Type w_c##Rank = Instruct(c16toI32(c16conj(weights[Rank][ant]))); \ + const Type w_s##Rank = Instruct(c16toI32(c16swap(weights[Rank][ant]))); \ const Type *in##Rank = (Type *)(txdataF_res_mapped[Rank] + sc_offset + (out-beginning)); void nr_layer_precoder_simd(const int n_layers, const int symSz, const c16_t txdataF_res_mapped[n_layers][symSz], const int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], const int sc_offset, const int re_cnt, c16_t *txdataF_precoded) diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index ef834db509..769bf43da1 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -7,7 +7,6 @@ #include #include "PHY/defs_nr_common.h" -#include "PHY/defs_gNB.h" #define DMRS_MOD_ORDER 2 /*Precoding matices: W[pmi][antenna_port][layer]*/ @@ -127,7 +126,7 @@ c16_t nr_layer_precoder_cm(int n_layers, int symSz, c16_t datatx_F_precoding[n_layers][symSz], int ap, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset); /*! \brief Precoding with SIMDe, txdataF_precoded[] = prec_matrix[] * txdataF_res_mapped[] @@ -140,7 +139,7 @@ void nr_layer_precoder_simd(const int n_layers, const int symSz, const c16_t txdataF_res_mapped[n_layers][symSz], const int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], const int sc_offset, const int re_cnt, c16_t *txdataF_precoded); diff --git a/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp b/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp index d232c442bf..7a66696384 100644 --- a/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp +++ b/openair1/PHY/MODULATION/tests/test_nr_modulation.cpp @@ -15,7 +15,6 @@ extern "C" { #endif #include "openair1/PHY/TOOLS/tools_defs.h" // c16_t -#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h" // nfapi_nr_pm_pdu_t #include "nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h" // fapi_nr_dl_config_dci_dl_pdu_rel15_t //#include "openair1/PHY/MODULATION/nr_modulation.h" // nr_layer_precoder_simd_[cm, simd] @@ -25,7 +24,7 @@ c16_t nr_layer_precoder_cm(int n_layers, int symbol_size, c16_t (*dataF_in)[/*symbol_size*/], // c16_t dataF_in[n_layers][symbol_size] int ant, - nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset); // Forward declare the function but hide the Variable-Length Array (VLA) feature from C not available in C++ @@ -33,7 +32,7 @@ void nr_layer_precoder_simd(int n_layers, int symbol_size, const c16_t (*dataF_in)[/*symbol_size*/], // c16_t dataF_in[n_layers][symbol_size] int ant, - const nfapi_nr_pm_pdu_t *pmi_pdu, + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS], int offset, int re_cnt, c16_t *dataF_out); @@ -65,15 +64,15 @@ TEST(NrLayerPrecoderTest, Basic) c16_t(*dataF_in)[symbol_size] = reinterpret_cast(buffer_in.data()); c16_t(*dataF_out)[symbol_size] = reinterpret_cast(buffer_out.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { - pmi_pdu.weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; + weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; } // Call the C function for (int symbol = 0; symbol < re_cnt; symbol++) - dataF_out[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, symbol); + dataF_out[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, weights, symbol); // You can calculate the expected value manually or test rough correctness for (int symbol = 0; symbol < re_cnt; symbol++) { @@ -110,14 +109,14 @@ TEST(NrLayerPrecoderTest, SIMD) c16_t(*dataF_in)[symbol_size] = reinterpret_cast(buffer_in.data()); c16_t(*dataF_out)[symbol_size] = reinterpret_cast(buffer_out.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { - pmi_pdu.weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; + weights[layer][ant] = (c16_t){-SHRT_MAX, 0}; } // Call the C function - nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, 0, re_cnt, dataF_out[ant]); + nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, weights, 0, re_cnt, dataF_out[ant]); // You can calculate the expected value manually or test rough correctness for (int symbol = 0; symbol < re_cnt; symbol++) { @@ -156,15 +155,14 @@ TEST(NrLayerPrecoderTest, Compare_CM_SIMD) c16_t(*dataF_out_cm)[symbol_size] = reinterpret_cast(buffer_out_cm.data()); c16_t(*dataF_out_simd)[symbol_size] = reinterpret_cast(buffer_out_simd.data()); - // Create and populate the pmi_pdu structure - nfapi_nr_pm_pdu_t pmi_pdu = {0}; - pmi_pdu.pm_idx = 4; + // Create and populate the weights + c16_t weights[NR_MAX_NB_LAYERS][NR_MAX_CSI_PORTS]; for (int layer = 0; layer < n_layers; ++layer) { // Could not use convert_precoder_weight() as complex.h could not be used in googletest // Use the logic in convert_precoder_weight() // precoder [−1,−j] - pmi_pdu.weights[layer][0] = (c16_t){-SHRT_MAX, 0}; - pmi_pdu.weights[layer][1] = (c16_t){0, -SHRT_MAX}; + weights[layer][0] = (c16_t){-SHRT_MAX, 0}; + weights[layer][1] = (c16_t){0, -SHRT_MAX}; } // Get the results for all the antenna @@ -172,10 +170,10 @@ TEST(NrLayerPrecoderTest, Compare_CM_SIMD) // Call the C function for (int symbol = 0; symbol < re_cnt; symbol++) - dataF_out_cm[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, symbol); + dataF_out_cm[ant][symbol] = nr_layer_precoder_cm(n_layers, symbol_size, dataF_in, ant, weights, symbol); // Call the C function - nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, &pmi_pdu, 0, re_cnt, dataF_out_simd[ant]); + nr_layer_precoder_simd(n_layers, symbol_size, dataF_in, ant, weights, 0, re_cnt, dataF_out_simd[ant]); // Compare the result from both C function for (int symbol = 0; symbol < re_cnt; symbol++) { diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index d227148353..8f1bb827be 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -438,7 +438,7 @@ static inline void do_txdataF(c16_t **txdataF, symbol_sz, txdataF_precoding, ant, - pmi_pdu, + pmi_pdu->weights, subCarrier, re_cnt, &txdataF[ant][txdataF_offset_per_symbol]);