rename reverse_bits to bits and move functions to count bits in there
This commit is contained in:
@@ -16,7 +16,7 @@ add_subdirectory(nr)
|
|||||||
add_subdirectory(LOG)
|
add_subdirectory(LOG)
|
||||||
add_subdirectory(threadPool)
|
add_subdirectory(threadPool)
|
||||||
add_subdirectory(time_manager)
|
add_subdirectory(time_manager)
|
||||||
add_library(utils utils.c system.c time_meas.c time_stat.c tuntap_if.c reverse_bits.c fsn.c)
|
add_library(utils utils.c system.c time_meas.c time_stat.c tuntap_if.c bits.c fsn.c)
|
||||||
target_include_directories(utils PUBLIC .)
|
target_include_directories(utils PUBLIC .)
|
||||||
target_link_libraries(utils PRIVATE ${T_LIB})
|
target_link_libraries(utils PRIVATE ${T_LIB})
|
||||||
add_subdirectory(barrier)
|
add_subdirectory(barrier)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
// we avoid assertions.h as it necessitates othe dependencies (e.g., exit_function)
|
// we avoid assertions.h as it necessitates othe dependencies (e.g., exit_function)
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <simde/x86/gfni.h>
|
#include <simde/x86/gfni.h>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BITS_H_
|
||||||
|
#define BITS_H_
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "assertions.h"
|
||||||
|
|
||||||
|
uint64_t reverse_bits(uint64_t in, int n_bits);
|
||||||
|
void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out);
|
||||||
|
|
||||||
|
static inline int count_bits(uint8_t *arr, int sz)
|
||||||
|
{
|
||||||
|
AssertFatal(sz % sizeof(int) == 0, "to implement if needed\n");
|
||||||
|
int ret = 0;
|
||||||
|
for (uint *ptr = (uint *)arr; (uint8_t *)ptr < arr + sz; ptr++)
|
||||||
|
ret += __builtin_popcount(*ptr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __attribute__((always_inline)) inline int count_bits64(uint64_t v)
|
||||||
|
{
|
||||||
|
return __builtin_popcountll(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t v, int start, int num)
|
||||||
|
{
|
||||||
|
uint64_t mask = ((1LL << num) - 1) << start;
|
||||||
|
return count_bits64(v & mask);
|
||||||
|
}
|
||||||
|
#endif /* BITS_H_ */
|
||||||
@@ -262,28 +262,7 @@ static inline int get_num_dmrs(uint16_t dmrs_mask )
|
|||||||
return(num_dmrs);
|
return(num_dmrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int count_bits(uint8_t *arr, int sz)
|
|
||||||
{
|
|
||||||
AssertFatal(sz % sizeof(int) == 0, "to implement if needed\n");
|
|
||||||
int ret = 0;
|
|
||||||
for (uint *ptr = (uint *)arr; (uint8_t *)ptr < arr + sz; ptr++)
|
|
||||||
ret += __builtin_popcount(*ptr);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __attribute__((always_inline)) inline int count_bits64(uint64_t v)
|
|
||||||
{
|
|
||||||
return __builtin_popcountll(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t v, int start, int num)
|
|
||||||
{
|
|
||||||
uint64_t mask = ((1LL << num) - 1) << start;
|
|
||||||
return count_bits64(v & mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
void warn_higher_threequarter_fs(const int n_rb, const int mu);
|
void warn_higher_threequarter_fs(const int n_rb, const int mu);
|
||||||
|
|
||||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||||
uint32_t to_nrarfcn(uint64_t dl_CarrierFreq);
|
uint32_t to_nrarfcn(uint64_t dl_CarrierFreq);
|
||||||
uint8_t set_ssb_case(int scs, int nr_band);
|
uint8_t set_ssb_case(int scs, int nr_band);
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef REVERSE_BITS_H_
|
|
||||||
#define REVERSE_BITS_H_
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
uint64_t reverse_bits(uint64_t in, int n_bits);
|
|
||||||
void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out);
|
|
||||||
|
|
||||||
#endif /* REVERSE_BITS_H_ */
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "../nrLDPC_coding_interface.h"
|
#include "../nrLDPC_coding_interface.h"
|
||||||
#include "nrLDPC_coding_aal.h"
|
#include "nrLDPC_coding_aal.h"
|
||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include <common/utils/LOG/log.h>
|
#include <common/utils/LOG/log.h>
|
||||||
#include "common/config/config_paramdesc.h"
|
#include "common/config/config_paramdesc.h"
|
||||||
#include "common/config/config_userapi.h"
|
#include "common/config/config_userapi.h"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
|
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
|
||||||
|
#include "bits.h"
|
||||||
|
|
||||||
uint8_t allowed_xlsch_re_in_dmrs_symbol(uint16_t k,
|
uint8_t allowed_xlsch_re_in_dmrs_symbol(uint16_t k,
|
||||||
uint16_t start_sc,
|
uint16_t start_sc,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||||
#include "PHY/sse_intrin.h"
|
#include "PHY/sse_intrin.h"
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
||||||
#include "openair1/PHY/NR_REFSIG/nr_mod_table.h"
|
#include "openair1/PHY/NR_REFSIG/nr_mod_table.h"
|
||||||
#include "openair1/PHY/TOOLS/tools_defs.h"
|
#include "openair1/PHY/TOOLS/tools_defs.h"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||||
#include "SCHED_NR/sched_nr.h"
|
#include "SCHED_NR/sched_nr.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "bits.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
// #define DEBUG_ULSCH_DECODING
|
// #define DEBUG_ULSCH_DECODING
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
#include "SCHED_NR/sched_nr.h"
|
#include "SCHED_NR/sched_nr.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
#include "nr_phy_common.h"
|
#include "nr_phy_common.h"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
|
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
|
||||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||||
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include "instrumentation.h"
|
#include "instrumentation.h"
|
||||||
//#define DEBUG_PBCH
|
//#define DEBUG_PBCH
|
||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||||
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
|
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
#include "openair1/PHY/NR_REFSIG/nr_refsig.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nr_phy_common.h"
|
#include "nr_phy_common.h"
|
||||||
|
#include "bits.h"
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
#ifdef __aarch64__
|
#ifdef __aarch64__
|
||||||
#define USE_128BIT
|
#define USE_128BIT
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
#include "executables/nr-uesoftmodem.h"
|
#include "executables/nr-uesoftmodem.h"
|
||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
#include "bits.h"
|
||||||
|
|
||||||
//#define DEBUG_NR_ULSCHSIM
|
//#define DEBUG_NR_ULSCHSIM
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include "common/openairinterface5g_limits.h"
|
#include "common/openairinterface5g_limits.h"
|
||||||
#include "common/ran_context.h"
|
#include "common/ran_context.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
#include "common/utils/bits.h"
|
||||||
#include "common/utils/T/T.h"
|
#include "common/utils/T/T.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/nr/nr_common.h"
|
||||||
#include "common/utils/threadPool/thread-pool.h"
|
#include "common/utils/threadPool/thread-pool.h"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "nr_mac.h"
|
#include "nr_mac.h"
|
||||||
#include "nr_mac_common.h"
|
#include "nr_mac_common.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/bits.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <executables/softmodem-common.h>
|
#include <executables/softmodem-common.h>
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
/* utils */
|
/* utils */
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include "oai_asn1.h"
|
#include "oai_asn1.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "oai_asn1.h"
|
#include "oai_asn1.h"
|
||||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "bits.h"
|
||||||
#include <executables/softmodem-common.h>
|
#include <executables/softmodem-common.h>
|
||||||
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||||
#include "RRC/NR_UE/L2_interface_ue.h"
|
#include "RRC/NR_UE/L2_interface_ue.h"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
/* Utils */
|
/* Utils */
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
#include "common/utils/bits.h"
|
||||||
#include "UTIL/OPT/opt.h"
|
#include "UTIL/OPT/opt.h"
|
||||||
|
|
||||||
/* rlc */
|
/* rlc */
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
#include "NR_MAC_gNB/nr_mac_gNB.h"
|
||||||
#include "NR_MAC_gNB/mac_proto.h"
|
#include "NR_MAC_gNB/mac_proto.h"
|
||||||
|
#include "common/utils/bits.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/nr/nr_common.h"
|
|
||||||
#include "UTIL/OPT/opt.h"
|
#include "UTIL/OPT/opt.h"
|
||||||
|
|
||||||
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||||
#include "openair3/UTILS/conversions.h"
|
#include "openair3/UTILS/conversions.h"
|
||||||
#include "LAYER2/nr_rlc/nr_rlc_asn1_utils.h"
|
#include "LAYER2/nr_rlc/nr_rlc_asn1_utils.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
|
|
||||||
#include "NR_MeasurementTimingConfiguration.h"
|
#include "NR_MeasurementTimingConfiguration.h"
|
||||||
#include "uper_decoder.h"
|
#include "uper_decoder.h"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "NR_MAC_UE/mac_proto.h"
|
#include "NR_MAC_UE/mac_proto.h"
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "SCHED_NR_UE/fapi_nr_ue_l1.h"
|
#include "SCHED_NR_UE/fapi_nr_ue_l1.h"
|
||||||
#include "reverse_bits.h"
|
#include "bits.h"
|
||||||
#include "openair2/RRC/NR_UE/L2_interface_ue.h"
|
#include "openair2/RRC/NR_UE/L2_interface_ue.h"
|
||||||
|
|
||||||
#define MAX_IF_MODULES 100
|
#define MAX_IF_MODULES 100
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rrc_proto.h"
|
#include "rrc_proto.h"
|
||||||
|
#include "common/utils/bits.h"
|
||||||
|
|
||||||
static bool check_resourcesForInterference(const NR_CSI_MeasConfig_t *meas, NR_CSI_ResourceConfigId_t res_id, bool is_CSIIM)
|
static bool check_resourcesForInterference(const NR_CSI_MeasConfig_t *meas, NR_CSI_ResourceConfigId_t res_id, bool is_CSIIM)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user