scc  2022.4.0
SystemC components library
util::range_lut< T > Class Template Reference

range based lookup table More...

#include <range_lut.h>

Classes

struct  lut_entry
 the lut entry More...
 

Public Types

enum  entry_type { BEGIN_RANGE = 1 , END_RANGE = 2 , SINGLE_BYTE_RANGE = 3 }
 the type of lut entry
 
using const_iterator = typename std::map< uint64_t, lut_entry >::const_iterator
 

Public Member Functions

 range_lut (T null_entry)
 
void addEntry (T i, uint64_t base_addr, uint64_t size)
 
bool removeEntry (T i)
 
size_t size () const
 
void clear ()
 
getEntry (uint64_t addr) const
 
void validate () const
 
std::string toString () const
 
const_iterator begin () const
 
const_iterator end () const
 

Public Attributes

const T null_entry
 the null entry
 

Protected Attributes

std::map< uint64_t, lut_entrym_lut {}
 
size_t m_size {0}
 

Detailed Description

template<typename T>
class util::range_lut< T >

range based lookup table

Definition at line 37 of file range_lut.h.

Constructor & Destructor Documentation

◆ range_lut()

template<typename T >
util::range_lut< T >::range_lut ( null_entry)
inline

constructor or the lookup table

Parameters
null_entrythe entry to be used for empty slots

Definition at line 52 of file range_lut.h.

Member Function Documentation

◆ addEntry()

template<typename T >
void util::range_lut< T >::addEntry ( i,
uint64_t  base_addr,
uint64_t  size 
)
inline

add an T to the lut covering the range starting at base_addr until base_addr+size-1

Parameters
ithe entry
base_addrthe base address
sizethe size of the occupied range

Definition at line 131 of file range_lut.h.

◆ clear()

template<typename T >
void util::range_lut< T >::clear ( )
inline

remove all entries from the lut

Definition at line 79 of file range_lut.h.

◆ getEntry()

template<typename T >
T util::range_lut< T >::getEntry ( uint64_t  addr) const
inline

get the entry T associated with a given address

Parameters
addrthe address
Returns
the entry belonging to the address

Definition at line 89 of file range_lut.h.

◆ removeEntry()

template<typename T >
bool util::range_lut< T >::removeEntry ( i)
inline

remove an entry with value i of type T

Parameters
ithe entry to be found
Returns
true if the entry is found and removed, false otherwise

Definition at line 146 of file range_lut.h.

◆ size()

template<typename T >
size_t util::range_lut< T >::size ( ) const
inline

get number of entries in the lookup table

Returns
the size of the underlying container

Definition at line 75 of file range_lut.h.

◆ toString()

template<typename T >
std::string util::range_lut< T >::toString
inline

create a textual representation of the address map (address range->entry association)

Returns

Definition at line 192 of file range_lut.h.

◆ validate()

template<typename T >
void util::range_lut< T >::validate
inline

validate the lookup table wrt. overlaps

Definition at line 165 of file range_lut.h.


The documentation for this class was generated from the following file: