gem5  v20.1.0.0
Macros | Functions | Variables
bitfield.hh File Reference
#include <inttypes.h>
#include <cassert>
#include <cstddef>
#include <type_traits>

Go to the source code of this file.

Macros

#define __has_builtin(foo)   0
 

Functions

uint64_t mask (int nbits)
 Generate a 64-bit mask of 'nbits' 1s, right justified. More...
 
template<class T >
bits (T val, int first, int last)
 Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it. More...
 
template<class T >
bits (T val, int bit)
 Extract the bit from this position from 'val' and right justify it. More...
 
template<class T >
mbits (T val, int first, int last)
 Mask off the given bits in place like bits() but without shifting. More...
 
uint64_t mask (int first, int last)
 
template<int N>
uint64_t sext (uint64_t val)
 Sign-extend an N-bit value to 64 bits. More...
 
template<class T , class B >
insertBits (T val, int first, int last, B bit_val)
 Returns val with bits first to last set to the LSBs of bit_val. More...
 
template<class T , class B >
insertBits (T val, int bit, B bit_val)
 Overloaded for access to only one bit in value. More...
 
template<class T , class B >
void replaceBits (T &val, int first, int last, B bit_val)
 A convenience function to replace bits first to last of val with bit_val in place. More...
 
template<class T , class B >
void replaceBits (T &val, int bit, B bit_val)
 Overloaded function to allow to access only 1 bit. More...
 
template<class T >
reverseBits (T val, std::size_t size=sizeof(T))
 Takes a variable lenght word and returns the mirrored version (Bit by bit, LSB=>MSB). More...
 
int findMsbSet (uint64_t val)
 Returns the bit position of the MSB that is set in the input. More...
 
int findLsbSet (uint64_t val)
 Returns the bit position of the LSB that is set in the input. More...
 
template<class T >
bool isPow2 (T v)
 Checks if a number is a power of two, or zero. More...
 
int popCount (uint64_t val)
 Returns the number of set ones in the provided value. More...
 
uint64_t alignToPowerOfTwo (uint64_t val)
 Align to the next highest power of two. More...
 
int ctz32 (uint32_t value)
 Count trailing zeros in a 32-bit value. More...
 
int ctz64 (uint64_t value)
 Count trailing zeros in a 64-bit value. More...
 

Variables

const uint8_t reverseLookUpTable []
 Lookup table used for High Speed bit reversing. More...
 

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin (   foo)    0

Variable Documentation

◆ reverseLookUpTable

const uint8_t reverseLookUpTable[]

Lookup table used for High Speed bit reversing.

Definition at line 41 of file bitfield.cc.

Referenced by reverseBits().


Generated on Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17