From 195a62b1ad845120ef8a422280355b0fc9e74a50 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Wed, 19 Aug 2020 23:14:43 -0700 Subject: [PATCH] base: Tag API methods and variables in bitfield.hh Change-Id: Ifd7d1b6ba243fd70af6974fde8228fce8aeecb40 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32957 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Daniel Carvalho Reviewed-by: Gabe Black --- src/base/bitfield.hh | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh index 5cde01963..98a93d4fa 100644 --- a/src/base/bitfield.hh +++ b/src/base/bitfield.hh @@ -54,6 +54,8 @@ extern const uint8_t reverseLookUpTable[]; * greater than 64 is given, it is truncated to 64. * * @param nbits The number of bits set in the mask. + * + * @ingroup api_bitfield */ inline uint64_t mask(int nbits) @@ -64,6 +66,8 @@ mask(int nbits) /** * Extract the bitfield from position 'first' to 'last' (inclusive) * from 'val' and right justify it. MSB is numbered 63, LSB is 0. + * + * @ingroup api_bitfield */ template inline @@ -77,6 +81,8 @@ bits(T val, int first, int last) /** * Extract the bit from this position from 'val' and right justify it. + * + * @ingroup api_bitfield */ template inline @@ -89,6 +95,8 @@ bits(T val, int bit) /** * Mask off the given bits in place like bits() but without shifting. * msb = 63, lsb = 0 + * + * @ingroup api_bitfield */ template inline @@ -98,6 +106,9 @@ mbits(T val, int first, int last) return val & (mask(first+1) & ~mask(last)); } +/** + * @ingroup api_bitfield + */ inline uint64_t mask(int first, int last) { @@ -106,6 +117,8 @@ mask(int first, int last) /** * Sign-extend an N-bit value to 64 bits. + * + * @ingroup api_bitfield */ template inline @@ -125,6 +138,8 @@ sext(uint64_t val) * val: 0xFFFF * bit_val: 0x0000 * returned: 0xFF0F + * + * @ingroup api_bitfield */ template inline @@ -139,6 +154,8 @@ insertBits(T val, int first, int last, B bit_val) /** * Overloaded for access to only one bit in value + * + * @ingroup api_bitfield */ template inline @@ -153,6 +170,8 @@ insertBits(T val, int bit, B bit_val) * in place. It is functionally equivalent to insertBits. * * \note "first" is the MSB and "last" is the LSB. "first" >= "last" + * + * @ingroup api_bitfield */ template inline @@ -162,7 +181,11 @@ replaceBits(T& val, int first, int last, B bit_val) val = insertBits(val, first, last, bit_val); } -/** Overloaded function to allow to access only 1 bit*/ +/** + * Overloaded function to allow to access only 1 bit + * + * @ingroup api_bitfield + */ template inline void @@ -182,6 +205,8 @@ replaceBits(T& val, int bit, B bit_val) * @param val: variable lenght word * @param size: number of bytes to mirror * @return mirrored word + * + * @ingroup api_bitfield */ template T @@ -201,6 +226,8 @@ reverseBits(T val, std::size_t size = sizeof(T)) /** * Returns the bit position of the MSB that is set in the input + * + * @ingroup api_bitfield */ inline int @@ -219,6 +246,8 @@ findMsbSet(uint64_t val) { /** * Returns the bit position of the LSB that is set in the input + * + * @ingroup api_bitfield */ inline int findLsbSet(uint64_t val) { @@ -236,6 +265,8 @@ findLsbSet(uint64_t val) { /** * Checks if a number is a power of two, or zero. + * + * @ingroup api_bitfield */ template inline bool @@ -247,6 +278,8 @@ isPow2(T v) { * Returns the number of set ones in the provided value. * PD algorithm from * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + * + * @ingroup api_bitfield */ inline int popCount(uint64_t val) { @@ -277,6 +310,8 @@ popCount(uint64_t val) { * * This code has been modified from the following: * http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 + * + * @ingroup api_bitfield */ inline uint64_t alignToPowerOfTwo(uint64_t val) { @@ -297,6 +332,8 @@ inline uint64_t alignToPowerOfTwo(uint64_t val) * * @param An input value * @return The number of trailing zeros or 32 if the value is zero. + * + * @ingroup api_bitfield */ inline int ctz32(uint32_t value) { @@ -308,6 +345,8 @@ inline int ctz32(uint32_t value) * * @param An input value * @return The number of trailing zeros or 64 if the value is zero. + * + * @ingroup api_bitfield */ inline int ctz64(uint64_t value) { -- 2.30.2