base: Tag API methods and variables in bitfield.hh
Change-Id: Ifd7d1b6ba243fd70af6974fde8228fce8aeecb40
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32957
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Gabe Black <gabeblack@google.com>
diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh
index 5cde019..98a93d4 100644
--- a/src/base/bitfield.hh
+++ b/src/base/bitfield.hh
@@ -54,6 +54,8 @@
* 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 @@
/**
* 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 <class T>
inline
@@ -77,6 +81,8 @@
/**
* Extract the bit from this position from 'val' and right justify it.
+ *
+ * @ingroup api_bitfield
*/
template <class T>
inline
@@ -89,6 +95,8 @@
/**
* Mask off the given bits in place like bits() but without shifting.
* msb = 63, lsb = 0
+ *
+ * @ingroup api_bitfield
*/
template <class T>
inline
@@ -98,6 +106,9 @@
return val & (mask(first+1) & ~mask(last));
}
+/**
+ * @ingroup api_bitfield
+ */
inline uint64_t
mask(int first, int last)
{
@@ -106,6 +117,8 @@
/**
* Sign-extend an N-bit value to 64 bits.
+ *
+ * @ingroup api_bitfield
*/
template <int N>
inline
@@ -125,6 +138,8 @@
* val: 0xFFFF
* bit_val: 0x0000
* returned: 0xFF0F
+ *
+ * @ingroup api_bitfield
*/
template <class T, class B>
inline
@@ -139,6 +154,8 @@
/**
* Overloaded for access to only one bit in value
+ *
+ * @ingroup api_bitfield
*/
template <class T, class B>
inline
@@ -153,6 +170,8 @@
* in place. It is functionally equivalent to insertBits.
*
* \note "first" is the MSB and "last" is the LSB. "first" >= "last"
+ *
+ * @ingroup api_bitfield
*/
template <class T, class B>
inline
@@ -162,7 +181,11 @@
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 <class T, class B>
inline
void
@@ -182,6 +205,8 @@
* @param val: variable lenght word
* @param size: number of bytes to mirror
* @return mirrored word
+ *
+ * @ingroup api_bitfield
*/
template <class T>
T
@@ -201,6 +226,8 @@
/**
* Returns the bit position of the MSB that is set in the input
+ *
+ * @ingroup api_bitfield
*/
inline
int
@@ -219,6 +246,8 @@
/**
* 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 @@
/**
* Checks if a number is a power of two, or zero.
+ *
+ * @ingroup api_bitfield
*/
template <class T>
inline bool
@@ -247,6 +278,8 @@
* 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 @@
*
* 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 @@
*
* @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 @@
*
* @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)
{