C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
simics Namespace Reference

Namespaces

namespace  detail
 
namespace  iface
 

Classes

class  AfterCall
 
class  AfterCallInterface
 
class  AfterEvent
 
class  AfterInterface
 
class  AliasRegister
 
class  Attribute
 Represents a Simics attribute. More...
 
struct  AttributeAccessor
 A container of get and set callbacks for a class member variable. More...
 
class  AttrValue
 
class  Bank
 Base class to represent a Simics register bank. More...
 
struct  BankAccess
 
class  BankInstrumentationSubscribeConnection
 
class  BankInterface
 An interface implemented by a Simics bank. More...
 
class  BankIssueCallbacksInterface
 
class  BankPort
 Extends Port with bank required interfaces. More...
 
class  BankPortInterface
 
class  BankRegister
 
class  BigEndianBank
 
class  ClassAttribute
 Represents a Simics class attribute. More...
 
class  ClearOnReadField
 
class  ClearOnReadRegister
 
class  ConfClass
 Represents Simics C type conf_class_t. More...
 
class  ConfObject
 Base class for all Simics configuration objects. More...
 
class  ConfObjectInterface
 Abstract C++ interface contains methods for register model defined behavior after the construction and before the destruction. More...
 
class  ConfObjectRef
 Represents Simics C type conf_object_t. More...
 
class  Connect
 A class for connecting with another Simics object. More...
 
class  ConnectBase
 A base class for Simics C++ interface connect class. More...
 
class  ConnectConfig
 By default, all interfaces in the Connect class are required. More...
 
class  ConnectToDescendant
 
class  ConstantField
 
class  ConstantRegister
 
class  CycleEvent
 Cycle-based event type. More...
 
class  CycleEventInterface
 
class  DesignLimitationField
 
class  DesignLimitationRegister
 
class  EnableAfterCall
 
class  Event
 The Event class allows users to define callbacks that will be executed after a specified delay. More...
 
struct  EventInfo
 
class  EventInterface
 An event is required to implement the interface. More...
 
class  ExtendRegisterWithOffset
 
class  Field
 Base class to represent a Simics field. More...
 
class  FieldInterface
 
class  FunctionCall
 
class  HierarchicalObject
 Base class for Bank, Register, and Field classes. More...
 
class  HierarchicalObjectInterface
 Interface for hierarchical objects used in bank register modeling. More...
 
class  IgnoreField
 
class  IgnoreRegister
 
class  IgnoreWriteField
 
class  IgnoreWriteRegister
 
class  MallocAllocator
 
class  MapNameToInterface
 
class  MapNameToInterfaceObject
 Class that supports get/set a pointer to IFACE with a string name. More...
 
class  MappableConfObject
 
class  MapTarget
 
class  MapTargetConnect
 
class  MemberFunctionCall
 
class  MissPatternBank
 
class  MmAllocator
 
class  None
 
class  ObjectFactory
 A factory for creating instances of ConfObject-derived classes. More...
 
class  ObjectFactoryInterface
 Interface for a factory pattern to create ConfObject instances. More...
 
class  ObjectFactoryWithArg
 A factory for creating instances of ConfObject-derived classes with an argument. More...
 
class  OnesField
 
class  OnesRegister
 
class  Port
 Extends ConfObject to add utilities to a Simics port object. More...
 
class  PortBank
 
class  Read0Field
 
class  Read0Register
 
class  ReadConstantField
 
class  ReadConstantRegister
 
class  ReadOnlyClearOnReadField
 
class  ReadOnlyClearOnReadRegister
 
class  ReadOnlyField
 
class  ReadOnlyRegister
 
class  ReadUnimplField
 
class  ReadUnimplRegister
 
class  RegBankFunctionCall
 
class  Register
 Base class to represent a Simics register. More...
 
class  RegisterClassWithSimics
 Utility class for automatic registration of C++ classes with Simics. More...
 
class  RegisterField
 
class  RegisterInterface
 
class  ReservedField
 
class  ReservedRegister
 
class  SharedMemoryBank
 Normally a bank allocates memory from the device object using the name of the bank as the key. More...
 
class  SilentConstantField
 
class  SilentConstantRegister
 
class  SilentUnimplField
 
class  SilentUnimplRegister
 
class  SimpleBankPort
 
class  StepEvent
 Not commonly used for device model. Step-based event type. More...
 
class  StepEventInterface
 
class  TimeEvent
 Time-based event type. More...
 
class  TimeEventInterface
 
class  UndocumentedField
 
class  UndocumentedRegister
 
class  UnimplField
 
class  UnimplRegister
 
class  UnmappedRegister
 
class  ValueAccessorInterface
 
class  ValueMutatorInterface
 
class  Write0OnlyField
 
class  Write0OnlyRegister
 
class  Write1ClearsField
 
class  Write1ClearsRegister
 
class  Write1OnlyField
 
class  Write1OnlyRegister
 
class  WriteOnceField
 
class  WriteOnceRegister
 
class  WriteOnlyField
 
class  WriteOnlyRegister
 
class  WriteUnimplField
 
class  WriteUnimplRegister
 
class  ZerosField
 
class  ZerosRegister
 

Typedefs

using attr_getter = std::add_pointer_t< attr_value_t(conf_object_t *)>
 
using attr_setter = std::add_pointer_t< set_error_t(conf_object_t *, attr_value_t *)>
 
using ConfClassPtr = std::unique_ptr< ConfClass >
 
using ev_callback = std::add_pointer_t< void(conf_object_t *, void *)>
 
using ev_destroy = ev_callback
 
using ev_value_getter = std::add_pointer_t< attr_value_t(conf_object_t *obj, void *data)>
 
using ev_value_setter = std::add_pointer_t< void *(conf_object_t *obj, attr_value_t value)>
 
using ev_describe = std::add_pointer_t< char *(conf_object_t *obj, void *data)>
 
using bits_type = std::vector< std::pair< uint8_t *, uint8_t > >
 
using LogGroups = std::initializer_list< std::string >
 Type used for log group names.
 
using bank_t = std::tuple< Name, Description, std::vector< register_t > >
 
using bank_memory_t = std::unordered_map< Offset, uint8_t >
 
using Name = detail::HierarchicalObjectName
 Type used to name a resource.
 
using Description = std::string_view
 Type used to describe a resource.
 
using Offset = detail::ConstSizeT
 Type used for memory address offset.
 
using BitWidth = detail::ConstSizeT
 Type used for the number/width of bit.
 
using InitValue = detail::ConstSizeT
 Type used for initial value.
 
using ByteSize = detail::ConstSizeT
 Type used for the number/size of byte TODO(xiuliang): add valid value checker?
 
using Stride = detail::ConstSizeT
 Type used for the stride of register/field array.
 
using field_t = std::tuple< Name, Description, Offset, BitWidth >
 
using register_t = std::tuple< Name, Description, Offset, ByteSize, InitValue, std::vector< field_t > >
 
using register_memory_t = std::vector< uint8_t * >
 

Enumerations

enum class  ByteOrder { BE , LE }
 
enum class  CallbackType : int { AR = 1 , AW , BR , BW }
 
enum class  Inquiry : bool { Inquiry = true , NonInquiry = false }
 
enum class  Level { BANK = 0 , REGISTER = 1 , FIELD = 2 }
 Enum representing the hierarchy level of an object. More...
 

Functions

template<typename Class , typename... Args>
constexpr auto make_reg_bank_function_call (void(Class::*func)(Args...), const std::string &name)
 
template<typename... Args>
constexpr void check_function_call (void(*func)(Args...))
 
template<typename Class , typename... Args>
constexpr void check_function_call (void(Class::*func)(Args...))
 
template<typename... Args>
constexpr auto make_function_call (void(*func)(Args...), const std::string &name)
 
template<typename Class , typename... Args>
constexpr auto make_function_call (void(Class::*func)(Args...), const std::string &name)
 
void checkSizeOverflowSimicsAttribute (size_t size)
 The maximum supported size for a Simics attribute dictionary/list/data is 2**32-1 bytes.
 
template<typename T >
std::enable_if< std::is_enum< T >::value, attr_value_t >::type std_to_attr (const T &src)
 Function transforms C++ enum type T to Simics attr_value_t.
 
template<typename T >
std::enable_if< std::is_base_of< ConnectBase, T >::value, attr_value_t >::type std_to_attr (const T &src)
 Function transforms C++ ConnectBase type T to Simics attr_value_t.
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, attr_value_t >::type std_to_attr (const T &src)
 Function transforms C++ pointer type T to Simics attr_value_t.
 
template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< ConnectBase, T >::value &&!std::is_pointer< T >::value, attr_value_t >::type std_to_attr (const T &src)
 Function transforms C++ standard type T to Simics attr_value_t.
 
template<typename T >
std::enable_if< std::is_enum< T >::value, T >::type attr_to_std (attr_value_t src)
 Function transforms Simics attr_value_t to C++ enum type.
 
template<typename T >
std::enable_if< std::is_base_of< ConnectBase, T >::value, T >::type attr_to_std (attr_value_t src)
 Function transforms Simics attr_value_t to C++ ConnectBase derived type.
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type attr_to_std (attr_value_t src)
 Function transforms Simics attr_value_t to C++ pointer.
 
template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< ConnectBase, T >::value &&!std::is_pointer< T >::value, T >::type attr_to_std (attr_value_t src)
 Function transforms Simics attr_value_t to C++ standard type.
 
template<typename T >
std::string attr_type_str ()
 
template<typename TBankPort >
ConfClassPtr make_bank_port (const std::string &name, const std::string &desc)
 Creates a bank port configuration class with specified attributes.
 
template<typename TBankPort , typename TArg >
ConfClassPtr make_bank_port (const std::string &name, const std::string &desc, TArg *arg)
 
template<typename TParent >
void create_hierarchy_from_register_data (ConfClass *cls, const bank_t &bank)
 Registers bank data as port objects within a configuration class hierarchy.
 
template<typename TParent >
void create_hierarchy_from_register_data (ConfClass *cls, std::initializer_list< bank_t > register_data)
 
template<typename T >
void decorate_class (...)
 Overload it with specific implementation by including the other header before this file.
 
template<typename T >
ConfClassPtr make_class (const std::string &name, const std::string &short_desc, const std::string &description, const class_kind_t kind=Sim_Class_Kind_Vanilla)
 A factory method to create a ConfClassPtr which associate with the C++ class T.
 
template<typename T , typename A >
ConfClassPtr make_class (const std::string &name, const std::string &short_desc, const std::string &description, A *constructor_arg, const class_kind_t kind=Sim_Class_Kind_Vanilla)
 A factory method to create a ConfClassPtr which associate with the C++ class T with argument A.
 
bool operator== (const ConfObjectRef &lhs, const ConfObjectRef &rhs)
 Compares two ConfObjectRef objects for equality.
 
bool operator!= (const ConfObjectRef &lhs, const ConfObjectRef &rhs)
 
template<typename T >
T * from_obj (conf_object_t *obj)
 Utility function to convert a conf_object_t* to a pointer to C++ class derived from simics::ConfObject.
 
int array_index (const std::string &name)
 This function looks for a pattern in the input string that resembles an array index, specifically a substring enclosed in square brackets (e.g., "array[2]").
 
std::vector< std::string > expand_names (const std::string &name, const char delimiter='.')
 If name contains an array indicator, i.e.
 
std::pair< size_t, size_t > overlap_range (size_t r1_start, size_t r1_end, size_t r2_start, size_t r2_end)
 Given two ranges [r1_start, r1_end) and [r2_start, r2_end), return the overlap range [o_start, o_end)
 
size_t hash_str (const std::string &name)
 Hashes a string to a size_t value.
 

Typedef Documentation

◆ attr_getter

using simics::attr_getter = typedef std::add_pointer_t<attr_value_t(conf_object_t *)>

◆ attr_setter

using simics::attr_setter = typedef std::add_pointer_t<set_error_t(conf_object_t *, attr_value_t *)>

◆ bank_memory_t

using simics::bank_memory_t = typedef std::unordered_map<Offset, uint8_t>

◆ bank_t

using simics::bank_t = typedef std::tuple<Name, Description, std::vector<register_t> >

◆ bits_type

using simics::bits_type = typedef std::vector<std::pair<uint8_t *, uint8_t> >

◆ BitWidth

Type used for the number/width of bit.

◆ ByteSize

Type used for the number/size of byte TODO(xiuliang): add valid value checker?

◆ ConfClassPtr

using simics::ConfClassPtr = typedef std::unique_ptr<ConfClass>

◆ Description

using simics::Description = typedef std::string_view

Type used to describe a resource.

◆ ev_callback

using simics::ev_callback = typedef std::add_pointer_t<void(conf_object_t *, void *)>

◆ ev_describe

using simics::ev_describe = typedef std::add_pointer_t<char *(conf_object_t *obj, void *data)>

◆ ev_destroy

◆ ev_value_getter

using simics::ev_value_getter = typedef std::add_pointer_t<attr_value_t(conf_object_t *obj, void *data)>

◆ ev_value_setter

using simics::ev_value_setter = typedef std::add_pointer_t<void *(conf_object_t *obj, attr_value_t value)>

◆ field_t

using simics::field_t = typedef std::tuple<Name, Description, Offset, BitWidth>

◆ InitValue

Type used for initial value.

◆ LogGroups

using simics::LogGroups = typedef std::initializer_list<std::string>

Type used for log group names.

◆ Name

Type used to name a resource.

◆ Offset

Type used for memory address offset.

◆ register_memory_t

using simics::register_memory_t = typedef std::vector<uint8_t *>

◆ register_t

using simics::register_t = typedef std::tuple<Name, Description, Offset, ByteSize, InitValue, std::vector<field_t> >

◆ Stride

Type used for the stride of register/field array.

Enumeration Type Documentation

◆ ByteOrder

enum class simics::ByteOrder
strong
Enumerator
BE 
LE 

◆ CallbackType

enum class simics::CallbackType : int
strong
Enumerator
AR 
AW 
BR 
BW 

◆ Inquiry

enum class simics::Inquiry : bool
strong
Enumerator
Inquiry 
NonInquiry 

◆ Level

enum class simics::Level
strong

Enum representing the hierarchy level of an object.

The Level enum is used to indicate the hierarchy level of an object within a bank register model.

Enumerator
BANK 
REGISTER 
FIELD 

Function Documentation

◆ array_index()

int simics::array_index ( const std::string &  name)

This function looks for a pattern in the input string that resembles an array index, specifically a substring enclosed in square brackets (e.g., "array[2]").

It supports only single-dimensional arrays and returns the index as an integer.

Parameters
nameThe string representation of the array (e.g., "array[2]").
Returns
The extracted index if valid; -1 if the format is invalid or if the index is negative or multi-dimensional.

◆ attr_to_std() [1/4]

template<typename T >
std::enable_if< std::is_enum< T >::value, T >::type simics::attr_to_std ( attr_value_t  src)
inline

Function transforms Simics attr_value_t to C++ enum type.

◆ attr_to_std() [2/4]

template<typename T >
std::enable_if< std::is_base_of< ConnectBase, T >::value, T >::type simics::attr_to_std ( attr_value_t  src)
inline

Function transforms Simics attr_value_t to C++ ConnectBase derived type.

◆ attr_to_std() [3/4]

template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type simics::attr_to_std ( attr_value_t  src)
inline

Function transforms Simics attr_value_t to C++ pointer.

◆ attr_to_std() [4/4]

template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< ConnectBase, T >::value &&!std::is_pointer< T >::value, T >::type simics::attr_to_std ( attr_value_t  src)
inline

Function transforms Simics attr_value_t to C++ standard type.

◆ attr_type_str()

template<typename T >
std::string simics::attr_type_str ( )
inline

◆ check_function_call() [1/2]

template<typename... Args>
constexpr void simics::check_function_call ( void(*)(Args...)  func)
constexpr

◆ check_function_call() [2/2]

template<typename Class , typename... Args>
constexpr void simics::check_function_call ( void(Class::*)(Args...)  func)
constexpr

◆ checkSizeOverflowSimicsAttribute()

void simics::checkSizeOverflowSimicsAttribute ( size_t  size)
inline

The maximum supported size for a Simics attribute dictionary/list/data is 2**32-1 bytes.

◆ create_hierarchy_from_register_data() [1/2]

template<typename TParent >
void simics::create_hierarchy_from_register_data ( ConfClass cls,
const bank_t bank 
)

Registers bank data as port objects within a configuration class hierarchy.

This function facilitates the registration of bank data as port objects, using the provided configuration class (ConfClass) and bank information (bank_t). It supports two overloads: one for a single bank and another for multiple banks using an std::initializer_list.

Template Parameters
TParentThe parent type used in the bank port creation process.
Parameters
clsThe configuration class where the bank ports are registered.
bankThe bank data containing name, description, and registers. The caller must ensure that the bank parameter is not a temporary object (e.g., not an rvalue or a local variable that goes out of scope). The address of the bank object will be stored and used after the function call, so it must remain valid for the lifetime of the simulation.

◆ create_hierarchy_from_register_data() [2/2]

template<typename TParent >
void simics::create_hierarchy_from_register_data ( ConfClass cls,
std::initializer_list< bank_t register_data 
)

◆ decorate_class()

template<typename T >
void simics::decorate_class (   ...)

Overload it with specific implementation by including the other header before this file.

◆ expand_names()

std::vector< std::string > simics::expand_names ( const std::string &  name,
const char  delimiter = '.' 
)

If name contains an array indicator, i.e.

port[N], return a list that contains all expanded index names, i.e. port[0], port[1], ... Otherwise a list with only the name is returned. Multi-dimensional arrays are not supported. Multi-level names with level delimiter is supported, i.e. a[N].b[M] is expanded to N * M names.

◆ from_obj()

template<typename T >
T * simics::from_obj ( conf_object_t *  obj)
inline

Utility function to convert a conf_object_t* to a pointer to C++ class derived from simics::ConfObject.

For performance reasons we cannot use dynamic_cast here, we should use static_cast. The static_assert makes it safe to use static_cast from void* to T*. The intermediate static_cast from void* to ConfObject* avoids undefined behavior if the conf-object data points to a class that does not have ConfObject as first base class.

◆ hash_str()

size_t simics::hash_str ( const std::string &  name)

Hashes a string to a size_t value.

◆ make_bank_port() [1/2]

template<typename TBankPort >
ConfClassPtr simics::make_bank_port ( const std::string &  name,
const std::string &  desc 
)

Creates a bank port configuration class with specified attributes.

This template function provides two overloads for instantiating a configuration class for a bank port, using the provided name and description. It leverages the make_class function to create the class and then adds bank-specific properties to it. The function supports optional additional arguments for enhanced flexibility.

  • Template Parameters
    TBankPortThe type of the bank port to be created.
  • Template Parameters
    TArg(Overload 2) The type of the additional argument passed to the bank port creation process.
    Overload 1:
  • Parameters:
    • Parameters
      nameThe name of the bank port configuration class.
    • Parameters
      descThe description of the bank port configuration class.
  • Usage:
    • Use this overload when you need to create a bank port configuration class without additional arguments.

Overload 2:

  • Parameters:
    • Parameters
      nameThe name of the bank port configuration class.
    • Parameters
      descThe description of the bank port configuration class.
    • Parameters
      argA pointer to an additional argument used in the bank port creation process.
  • Usage:
    • Use this overload when you need to create a bank port configuration class with an additional argument, such as a pointer to bank data.

Return Value:

  • Returns
    A pointer to the created configuration class (ConfClassPtr).

◆ make_bank_port() [2/2]

template<typename TBankPort , typename TArg >
ConfClassPtr simics::make_bank_port ( const std::string &  name,
const std::string &  desc,
TArg *  arg 
)

◆ make_class() [1/2]

template<typename T , typename A >
ConfClassPtr simics::make_class ( const std::string &  name,
const std::string &  short_desc,
const std::string &  description,
A *  constructor_arg,
const class_kind_t  kind = Sim_Class_Kind_Vanilla 
)

A factory method to create a ConfClassPtr which associate with the C++ class T with argument A.

It calls init_class if T defines it.

See also
ConfClass::create
Parameters
namethe name of the creating class.
short_desca short class description for the class.
descriptiona description string describes the class.
constructor_argargument passed to the object factory constructor.
kindan enum determine if the configuration object should be saved when a checkpoint is created.
Returns
a ConfClassPtr

◆ make_class() [2/2]

template<typename T >
ConfClassPtr simics::make_class ( const std::string &  name,
const std::string &  short_desc,
const std::string &  description,
const class_kind_t  kind = Sim_Class_Kind_Vanilla 
)

A factory method to create a ConfClassPtr which associate with the C++ class T.

It calls init_class if T defines it.

See also
ConfClass::create
Parameters
namethe name of the creating class.
short_desca short class description for the class.
descriptiona description string describes the class.
kindan enum determine if the configuration object should be saved when a checkpoint is created.
Returns
a ConfClassPtr

◆ make_function_call() [1/2]

template<typename... Args>
constexpr auto simics::make_function_call ( void(*)(Args...)  func,
const std::string &  name 
)
constexpr

◆ make_function_call() [2/2]

template<typename Class , typename... Args>
constexpr auto simics::make_function_call ( void(Class::*)(Args...)  func,
const std::string &  name 
)
constexpr

◆ make_reg_bank_function_call()

template<typename Class , typename... Args>
constexpr auto simics::make_reg_bank_function_call ( void(Class::*)(Args...)  func,
const std::string &  name 
)
constexpr

◆ operator!=()

bool simics::operator!= ( const ConfObjectRef lhs,
const ConfObjectRef rhs 
)

◆ operator==()

bool simics::operator== ( const ConfObjectRef lhs,
const ConfObjectRef rhs 
)

Compares two ConfObjectRef objects for equality.

Two ConfObjectRef objects are considered equal if both their object() and port_name() are same.

◆ overlap_range()

std::pair< size_t, size_t > simics::overlap_range ( size_t  r1_start,
size_t  r1_end,
size_t  r2_start,
size_t  r2_end 
)

Given two ranges [r1_start, r1_end) and [r2_start, r2_end), return the overlap range [o_start, o_end)

◆ std_to_attr() [1/4]

template<typename T >
std::enable_if< std::is_enum< T >::value, attr_value_t >::type simics::std_to_attr ( const T &  src)
inline

Function transforms C++ enum type T to Simics attr_value_t.

◆ std_to_attr() [2/4]

template<typename T >
std::enable_if< std::is_base_of< ConnectBase, T >::value, attr_value_t >::type simics::std_to_attr ( const T &  src)
inline

Function transforms C++ ConnectBase type T to Simics attr_value_t.

◆ std_to_attr() [3/4]

template<typename T >
std::enable_if< std::is_pointer< T >::value, attr_value_t >::type simics::std_to_attr ( const T &  src)
inline

Function transforms C++ pointer type T to Simics attr_value_t.

◆ std_to_attr() [4/4]

template<typename T >
std::enable_if<!std::is_enum< T >::value &&!std::is_base_of< ConnectBase, T >::value &&!std::is_pointer< T >::value, attr_value_t >::type simics::std_to_attr ( const T &  src)
inline

Function transforms C++ standard type T to Simics attr_value_t.