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

Base class to represent a Simics register bank. More...

#include <bank.h>

Inheritance diagram for simics::Bank:
simics::BankInterface simics::HierarchicalObject simics::HierarchicalObjectInterface simics::PortBank<> simics::BigEndianBank simics::MissPatternBank simics::PortBank< TBank, Args > simics::SharedMemoryBank SampleBank

Public Member Functions

 Bank (MappableConfObject *dev_obj, const std::string &name)
 
 Bank (MappableConfObject *dev_obj, const std::string &name, ByteOrder byte_order)
 
 Bank (const Bank &)=delete
 
Bankoperator= (const Bank &)=delete
 
 Bank (Bank &&rhs)
 
Bankoperator= (Bank &&rhs)
 
virtual ~Bank ()=default
 
std::string_view name () const override
 Get the name of the bank without level delimiters.
 
MappableConfObjectdev_obj () const override
 Get the device object.
 
const std::string & description () const override
 Get the description of the bank.
 
void set_description (std::string_view desc) override
 Set the description for the bank.
 
void add_register (const register_t &reg) override
 Parse a register name and add register to the bank.
 
void add_register (std::string_view name, std::string_view desc, Offset offset, ByteSize number_of_bytes, InitValue init_value, const std::vector< field_t > &fields) override
 Add a register to the bank.
 
unsigned number_of_registers () const override
 Get the number of registers in the bank.
 
std::pair< size_t, RegisterInterface * > register_at_index (unsigned index) const override
 Get the register at a specific index.
 
const std::map< size_t, RegisterInterface * > & mapped_registers () const override
 Get all mapped registers on the bank ordered by offset.
 
void set_callbacks (BankIssueCallbacksInterface *callbacks) override
 Set the callbacks for bank issues.
 
ByteOrder get_byte_order () const override
 Get the byte order of the bank.
 
void set_miss_pattern (uint8_t miss_pattern) override
 Set the miss pattern for the bank.
 
exception_type_t transaction_access (transaction_t *t, uint64_t offset) override
 Entry point for a memory access from the transaction interface.
 
- Public Member Functions inherited from simics::BankInterface
virtual ~BankInterface ()=default
 
virtual std::string_view name () const =0
 Get the name of the bank without level delimiters.
 
virtual MappableConfObjectdev_obj () const =0
 Get the device object.
 
virtual const std::string & description () const =0
 Get the description of the bank.
 
virtual void set_description (std::string_view desc)=0
 Set the description for the bank.
 
virtual void add_register (const register_t &reg)=0
 Parse a register name and add register to the bank.
 
virtual void add_register (std::string_view name, std::string_view desc, Offset offset, ByteSize number_of_bytes, InitValue init_value, const std::vector< field_t > &fields)=0
 Add a register to the bank.
 
virtual unsigned number_of_registers () const =0
 Get the number of registers in the bank.
 
virtual std::pair< size_t, RegisterInterface * > register_at_index (unsigned index) const =0
 Get the register at a specific index.
 
virtual const std::map< size_t, RegisterInterface * > & mapped_registers () const =0
 Get all mapped registers on the bank ordered by offset.
 
virtual void set_callbacks (BankIssueCallbacksInterface *callbacks)=0
 Set the callbacks for bank issues.
 
virtual ByteOrder get_byte_order () const =0
 Get the byte order of the bank.
 
virtual void set_miss_pattern (uint8_t miss_pattern)=0
 Set the miss pattern for the bank.
 
virtual exception_type_t transaction_access (transaction_t *t, uint64_t offset)=0
 Entry point for a memory access from the transaction interface.
 
- Public Member Functions inherited from simics::HierarchicalObject
 HierarchicalObject (MappableConfObject *dev_obj, const std::string &name)
 Constructor for HierarchicalObject.
 
virtual ~HierarchicalObject ()
 
 HierarchicalObject (const HierarchicalObject &)=delete
 
HierarchicalObjectoperator= (const HierarchicalObject &)=delete
 
 HierarchicalObject (HierarchicalObject &&rhs) noexcept
 
HierarchicalObjectoperator= (HierarchicalObject &&rhs) noexcept
 
template<typename T >
T * dev_ptr ()
 
const std::string & hierarchical_name () const override
 
std::string_view name () const override
 
const std::string & description () const override
 
void set_description (std::string_view desc) override
 
Level hierarchy_level () const override
 
std::string_view bank_name () const override
 
MappableConfObjectdev_obj () const override
 
ConfObjectRef bank_obj_ref () const override
 
std::string_view parent_name () const override
 
FieldInterfacelookup_field (const std::string &name) const override
 
RegisterInterfacelookup_register (const std::string &name) const override
 
BankInterfacelookup_bank (const std::string &name) const override
 
virtual const std::string & hierarchical_name () const =0
 
virtual std::string_view name () const =0
 
virtual const std::string & description () const =0
 
virtual void set_description (std::string_view desc)=0
 
virtual Level hierarchy_level () const =0
 
virtual std::string_view bank_name () const =0
 
virtual MappableConfObjectdev_obj () const =0
 
virtual ConfObjectRef bank_obj_ref () const =0
 
virtual std::string_view parent_name () const =0
 
virtual FieldInterfacelookup_field (const std::string &name) const =0
 
virtual RegisterInterfacelookup_register (const std::string &name) const =0
 
virtual BankInterfacelookup_bank (const std::string &name) const =0
 

Protected Member Functions

virtual std::vector< uint8_t > read (uint64_t offset, size_t size, Inquiry inquiry=Inquiry::NonInquiry) const
 
virtual void write (uint64_t offset, const std::vector< uint8_t > &value, size_t size, Inquiry inquiry=Inquiry::NonInquiry) const
 
virtual void unmapped_read (size_t offset, size_t size) const
 
virtual void unmapped_write (size_t offset, size_t size) const
 
void allocate_bank_memory (std::string_view name)
 Allocate memory for this bank by name.
 

Additional Inherited Members

- Static Public Member Functions inherited from simics::HierarchicalObject
static bool is_valid_hierarchical_name (std::string_view name)
 
static std::string_view::size_type level_of_hierarchical_name (std::string_view name)
 
- Static Public Attributes inherited from simics::HierarchicalObject
static const uint64_t Register_Read {1}
 Log group ID for Register_Read and Register_Write is fixed.
 
static const uint64_t Register_Write {2}
 
static const uint64_t Register_Read_Exception {3}
 
static const uint64_t Register_Write_Exception {4}
 

Detailed Description

Base class to represent a Simics register bank.

Bank with default behavior which allows access to any offset, without any side-effects. Registers and fields don't have to be mapped as all reads return zero and all writes are ignored.

Constructor & Destructor Documentation

◆ Bank() [1/4]

simics::Bank::Bank ( MappableConfObject dev_obj,
const std::string &  name 
)
Parameters
nameis the bank name alone, e.g., b0

◆ Bank() [2/4]

simics::Bank::Bank ( MappableConfObject dev_obj,
const std::string &  name,
ByteOrder  byte_order 
)
Parameters
byte_orderrepresents the byte endianness

◆ Bank() [3/4]

simics::Bank::Bank ( const Bank )
delete

◆ Bank() [4/4]

simics::Bank::Bank ( Bank &&  rhs)

◆ ~Bank()

virtual simics::Bank::~Bank ( )
virtualdefault

Member Function Documentation

◆ add_register() [1/2]

void simics::Bank::add_register ( const register_t reg)
overridevirtual

Parse a register name and add register to the bank.

Parameters
regThe register data to be added to the bank.

Implements simics::BankInterface.

◆ add_register() [2/2]

void simics::Bank::add_register ( std::string_view  name,
std::string_view  desc,
Offset  offset,
ByteSize  number_of_bytes,
InitValue  init_value,
const std::vector< field_t > &  fields 
)
overridevirtual

Add a register to the bank.

Parameters
nameThe name of the register.
descThe description of the register.
offsetThe offset of the register within the bank.
number_of_bytesThe size of the register in bytes.
init_valueThe initial value of the register.
fieldsA vector of fields associated with the register.

Implements simics::BankInterface.

◆ allocate_bank_memory()

void simics::Bank::allocate_bank_memory ( std::string_view  name)
protected

Allocate memory for this bank by name.

◆ description()

const std::string & simics::Bank::description ( ) const
inlineoverridevirtual

Get the description of the bank.

Returns
A reference to the string containing the bank description.

Implements simics::BankInterface.

◆ dev_obj()

MappableConfObject * simics::Bank::dev_obj ( ) const
inlineoverridevirtual

Get the device object.

Returns
A pointer to the MappableConfObject.

Implements simics::BankInterface.

◆ get_byte_order()

ByteOrder simics::Bank::get_byte_order ( ) const
inlineoverridevirtual

Get the byte order of the bank.

Implements simics::BankInterface.

◆ mapped_registers()

const std::map< size_t, RegisterInterface * > & simics::Bank::mapped_registers ( ) const
overridevirtual

Get all mapped registers on the bank ordered by offset.

Implements simics::BankInterface.

◆ name()

std::string_view simics::Bank::name ( ) const
inlineoverridevirtual

Get the name of the bank without level delimiters.

Returns
A string view representing the bank name.

Implements simics::BankInterface.

◆ number_of_registers()

unsigned simics::Bank::number_of_registers ( ) const
overridevirtual

Get the number of registers in the bank.

Implements simics::BankInterface.

◆ operator=() [1/2]

Bank & simics::Bank::operator= ( Bank &&  rhs)

◆ operator=() [2/2]

Bank & simics::Bank::operator= ( const Bank )
delete

◆ read()

virtual std::vector< uint8_t > simics::Bank::read ( uint64_t  offset,
size_t  size,
Inquiry  inquiry = Inquiry::NonInquiry 
) const
protectedvirtual

◆ register_at_index()

std::pair< size_t, RegisterInterface * > simics::Bank::register_at_index ( unsigned  index) const
overridevirtual

Get the register at a specific index.

Parameters
indexThe index of the register.
Returns
register offset and interface with an index into a sorted registers by their offsets on the bank. {0, nullptr} is returned for an outbound access.

Implements simics::BankInterface.

◆ set_callbacks()

void simics::Bank::set_callbacks ( BankIssueCallbacksInterface callbacks)
inlineoverridevirtual

Set the callbacks for bank issues.

Implements simics::BankInterface.

◆ set_description()

void simics::Bank::set_description ( std::string_view  desc)
inlineoverridevirtual

Set the description for the bank.

Parameters
descA string view containing the new description for the bank.

Implements simics::BankInterface.

◆ set_miss_pattern()

void simics::Bank::set_miss_pattern ( uint8_t  miss_pattern)
inlineoverridevirtual

Set the miss pattern for the bank.

Implements simics::BankInterface.

◆ transaction_access()

exception_type_t simics::Bank::transaction_access ( transaction_t *  t,
uint64_t  offset 
)
overridevirtual

Entry point for a memory access from the transaction interface.

This function handles memory access requests by extracting the necessary information from the transaction object, invoking the appropriate access methods (read or write), and updating the transaction object accordingly.

Parameters
offsetThe memory offset relative to the bank.
Returns
Sim_PE_No_Exception if the access succeeded, or SIM_PE_IO_Not_Taken if the access was not handled.

Implements simics::BankInterface.

◆ unmapped_read()

virtual void simics::Bank::unmapped_read ( size_t  offset,
size_t  size 
) const
protectedvirtual

◆ unmapped_write()

virtual void simics::Bank::unmapped_write ( size_t  offset,
size_t  size 
) const
protectedvirtual

◆ write()

virtual void simics::Bank::write ( uint64_t  offset,
const std::vector< uint8_t > &  value,
size_t  size,
Inquiry  inquiry = Inquiry::NonInquiry 
) const
protectedvirtual

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