|
ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
|
a Field instance represents e.g. More...
#include <VirtualStruct.h>


Classes | |
| class | Listener |
| NOTE: etiss::CPUArch should implement support for Listeners by either using the etiss::VirtualStruct::Field instance to write to listener supported field or it should call the signalWrite() functions of a Field. More... | |
| struct | listener_pair_compare |
Public Types | |
| enum | AccessMode { VIRTUAL , LAMBDA , PREFER_LAMBDA } |
| defines how a field should perform reads/writes. More... | |
Public Member Functions | |
| Field (VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags, size_t width, size_t bitwidth=0) | |
| Field (VirtualStruct &parent, const std::string &name, const std::string &prettyname, int flags, size_t width, bool virtual_enabled, std::function< uint64_t()> lread, std::function< void(uint64_t)> lwrite, size_t bitwidth=0) | |
| virtual | ~Field () |
| uint64_t | read () const |
| function to read bits/a value from the Field. | |
| void | write (uint64_t) |
| function to write bits/a value to the Field. | |
| bool | applyBitflip (unsigned position, uint64_t fault_id) |
| function to write a bitflip to a field | |
| bool | applyAction (const etiss::fault::Fault &f, const etiss::fault::Action &a, std::string &errormsg) |
| advanced fault injection. Field must have the A flag to use this. | |
| void | signalWrite () |
| this function should be called if the listener flag is set and the field changed without using the write() function. | |
| Field * | setDeleteP (std::function< void(Field *)> del) |
| Field & | setDelete (std::function< void(Field *)> del) |
| bool | addListener (Listener *listener, std::shared_ptr< Listener > ref=nullptr) |
| void | removeListener (Listener *listener, std::shared_ptr< Listener > ref=nullptr) |
Public Attributes | |
| VirtualStruct & | parent_ |
| reference to parent virtual struct | |
| const std::string | name_ |
| name of the field. | |
| const std::string | prettyname_ |
| alternative/human readable name of the field. | |
| int | flags_ |
| read write flags as specified by the static const int parameters of Field: R,W,L | |
| const size_t | width_ |
| width in bytes (rounded up if neccessary) | |
| const size_t | bitwidth_ |
| width in bits | |
| const AccessMode | accessMode_ |
| std::function< bool(unsigned position, uint64_t fault_id)> | lapplyBitflip |
| if this function is set the the default implementation of applyBitflip will use it | |
| std::function< void(Field *)> | delete_ |
Static Public Attributes | |
| static const int | R = 1 |
| read flag | |
| static const int | W = 2 |
| write flag | |
| static const int | RW = R | W |
| flags to signal that a field supports read and write operations | |
| static const int | L = 4 |
| supports listener plugins; used for etiss::RegisterDevicePlugins to determine access to a variable/field | |
| static const int | F = 8 |
| supports fault injection/tracing | |
| static const int | A = 16 |
| supports advanced fault injection/tracing with the applyAction function | |
| static const int | P = 32 |
| private field: this flag indicates that this field is an implementation specific field that e.g. | |
Protected Member Functions | |
| virtual uint64_t | _read () const |
| override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA | |
| virtual void | _write (uint64_t) |
| override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA | |
| virtual bool | _applyBitflip (unsigned position, uint64_t fault_id) |
| override this function to implement bitflip applying to a field | |
| virtual bool | _applyAction (const etiss::fault::Fault &f, const etiss::fault::Action &a, std::string &errormsg) |
| override this function to implement advanced action handling | |
Protected Attributes | |
| std::function< uint64_t()> | lread |
| set this function for reads in case of AccessMode::LAMBDA / AccessMode::PREFER_LAMBDA | |
| std::function< void(uint64_t)> | lwrite |
| set this function for writes in case of AccessMode::LAMBDA / AccessMode::PREFER_LAMBDA | |
Private Attributes | |
| std::set< std::pair< Listener *, std::shared_ptr< Listener > >, listener_pair_compare > | listeners |
a Field instance represents e.g.
a field in a structure, a variable/register in a model or anything that can be represented as a sequence of up to 64 bits
Definition at line 109 of file VirtualStruct.h.
defines how a field should perform reads/writes.
default: PREFER_LAMBDA
| Enumerator | |
|---|---|
| VIRTUAL | uses the virtual _read() / _write functions |
| LAMBDA | uses the lread,lwrite functions |
| PREFER_LAMBDA | tries to use the lread,lwrite functions and falls back to virtual functions |
Definition at line 139 of file VirtualStruct.h.
| etiss::VirtualStruct::Field::Field | ( | VirtualStruct & | parent, |
| const std::string & | name, | ||
| const std::string & | prettyname, | ||
| int | flags, | ||
| size_t | width, | ||
| size_t | bitwidth = 0 |
||
| ) |
| width | width of the field in bytes. rounded up in case of bitwidth missmatch |
| bitwidth | width of the field in bits. if 0 then width*8 will be used for bitwidth_ |
Definition at line 17 of file VirtualStruct.cpp.
| etiss::VirtualStruct::Field::Field | ( | VirtualStruct & | parent, |
| const std::string & | name, | ||
| const std::string & | prettyname, | ||
| int | flags, | ||
| size_t | width, | ||
| bool | virtual_enabled, | ||
| std::function< uint64_t()> | lread, | ||
| std::function< void(uint64_t)> | lwrite, | ||
| size_t | bitwidth = 0 |
||
| ) |
Definition at line 29 of file VirtualStruct.cpp.
|
virtual |
Definition at line 44 of file VirtualStruct.cpp.
|
protectedvirtual |
override this function to implement advanced action handling
Definition at line 181 of file VirtualStruct.cpp.
References etiss::fault::Action::getMaskOp(), etiss::fault::Action::getMaskValue(), etiss::fault::Action::getTargetBit(), etiss::fault::Action::getType(), etiss::fault::Fault::id_, etiss::INFO, etiss::log(), and uint64_t.

|
protectedvirtual |
override this function to implement bitflip applying to a field
Definition at line 164 of file VirtualStruct.cpp.
References etiss::INFO, etiss::log(), and uint64_t.

|
protectedvirtual |
override this function to implement reads in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
Reimplemented in RegField_RV32IMACFD, pcField_RV32IMACFD, RegField_RV64IMACFD, pcField_RV64IMACFD, and etiss::VirtualStruct::FieldT< structT, retT, field >.
Definition at line 156 of file VirtualStruct.cpp.
|
protectedvirtual |
override this function to implement writes in case of AccessMode::VIRTUAL / AccessMode::PREFER_LAMBDA
Reimplemented in RegField_RV32IMACFD, pcField_RV32IMACFD, RegField_RV64IMACFD, pcField_RV64IMACFD, and etiss::VirtualStruct::FieldT< structT, retT, field >.
Definition at line 160 of file VirtualStruct.cpp.
| bool etiss::VirtualStruct::Field::addListener | ( | Listener * | listener, |
| std::shared_ptr< Listener > | ref = nullptr |
||
| ) |
| ref | optional reference that is stored alongside the pointer |
Definition at line 223 of file VirtualStruct.cpp.
References L.
| bool etiss::VirtualStruct::Field::applyAction | ( | const etiss::fault::Fault & | f, |
| const etiss::fault::Action & | a, | ||
| std::string & | errormsg | ||
| ) |
advanced fault injection. Field must have the A flag to use this.
Definition at line 145 of file VirtualStruct.cpp.
Referenced by etiss::VirtualStruct::applyAction().

function to write a bitflip to a field
Definition at line 130 of file VirtualStruct.cpp.
| uint64_t etiss::VirtualStruct::Field::read | ( | ) | const |
function to read bits/a value from the Field.
may only be called if the R flag is set. in case of less than 64 bit values the msb should be extended according to the default c++ conversion behavior. e.g. int32_t read_value = X; return (uint64_t)read_value;
Definition at line 46 of file VirtualStruct.cpp.
References uint64_t.
Referenced by etiss::plugin::VirtualStructMemory::read(), etiss::VirtualStruct::readField(), and etiss::plugin::VirtualStructMemory::write().

| void etiss::VirtualStruct::Field::removeListener | ( | Listener * | listener, |
| std::shared_ptr< Listener > | ref = nullptr |
||
| ) |
| ref | is ignored and can therfore be null. NEVER write new std::shared_ptr<Listener>(YOURPOINTER) after a shared pointer was already created |
Definition at line 230 of file VirtualStruct.cpp.
Definition at line 227 of file VirtualStruct.h.
References delete_.
Definition at line 222 of file VirtualStruct.h.
References delete_.
| void etiss::VirtualStruct::Field::signalWrite | ( | ) |
this function should be called if the listener flag is set and the field changed without using the write() function.
write() will automatically call this function if the listener flag is set.
Definition at line 119 of file VirtualStruct.cpp.
| void etiss::VirtualStruct::Field::write | ( | uint64_t | val | ) |
function to write bits/a value to the Field.
may only be called if the W flag is set. additional bits are silently discarded if the targt field has less than 64 bits. e.g. int64_t write_target = (int32_t) write_uint64_t;
Definition at line 82 of file VirtualStruct.cpp.
Referenced by etiss::plugin::VirtualStructMemory::write().

|
static |
supports advanced fault injection/tracing with the applyAction function
Definition at line 157 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::applyAction().
| const AccessMode etiss::VirtualStruct::Field::accessMode_ |
Definition at line 184 of file VirtualStruct.h.
| const size_t etiss::VirtualStruct::Field::bitwidth_ |
width in bits
Definition at line 183 of file VirtualStruct.h.
| std::function<void(Field *)> etiss::VirtualStruct::Field::delete_ |
Definition at line 221 of file VirtualStruct.h.
Referenced by setDelete(), and setDeleteP().
|
static |
supports fault injection/tracing
Definition at line 156 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::applyAction(), and etiss::VirtualStruct::update_field_access_rights().
| int etiss::VirtualStruct::Field::flags_ |
read write flags as specified by the static const int parameters of Field: R,W,L
Definition at line 181 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::applyAction(), etiss::VirtualStruct::readField(), and etiss::VirtualStruct::update_field_access_rights().
|
static |
supports listener plugins; used for etiss::RegisterDevicePlugins to determine access to a variable/field
Definition at line 154 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::addField(), addListener(), etiss::VirtualStruct::allocateFromC(), and etiss::CPUArchRegListenerInterface::signalChangedRegisterValue().
| std::function<bool(unsigned position, uint64_t fault_id)> etiss::VirtualStruct::Field::lapplyBitflip |
if this function is set the the default implementation of applyBitflip will use it
Definition at line 218 of file VirtualStruct.h.
|
private |
Definition at line 245 of file VirtualStruct.h.
|
protected |
set this function for reads in case of AccessMode::LAMBDA / AccessMode::PREFER_LAMBDA
Definition at line 211 of file VirtualStruct.h.
|
protected |
set this function for writes in case of AccessMode::LAMBDA / AccessMode::PREFER_LAMBDA
Definition at line 214 of file VirtualStruct.h.
| const std::string etiss::VirtualStruct::Field::name_ |
name of the field.
should be a simple/easy to parse name. e.g. representing the "SR" OR1K CPU register: SPR[0][17]
Definition at line 177 of file VirtualStruct.h.
Referenced by RegField_RV32IMACFD::_write(), pcField_RV32IMACFD::_write(), RegField_RV64IMACFD::_write(), pcField_RV64IMACFD::_write(), etiss::VirtualStruct::addField(), etiss::plugin::VirtualStructMemory::write(), and LegacyRegisterDevicePluginListener::write().
|
static |
private field: this flag indicates that this field is an implementation specific field that e.g.
is not to be copied by etiss::copy()
Definition at line 158 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::allocateFromC(), etiss::copy(), etiss::CPUCore::CPUCore(), and etiss::parseName().
| VirtualStruct& etiss::VirtualStruct::Field::parent_ |
reference to parent virtual struct
Definition at line 176 of file VirtualStruct.h.
Referenced by RegField_RV32IMACFD::_read(), pcField_RV32IMACFD::_read(), RegField_RV64IMACFD::_read(), pcField_RV64IMACFD::_read(), etiss::VirtualStruct::FieldT< structT, retT, field >::_read(), RegField_RV32IMACFD::_write(), pcField_RV32IMACFD::_write(), RegField_RV64IMACFD::_write(), pcField_RV64IMACFD::_write(), and etiss::VirtualStruct::FieldT< structT, retT, field >::_write().
| const std::string etiss::VirtualStruct::Field::prettyname_ |
alternative/human readable name of the field.
e.g. representing the "SR" OR1K CPU register: "SR" or "SupervisorRegister"
Definition at line 179 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::addField(), and etiss::plugin::VirtualStructMemory::write().
|
static |
read flag
Definition at line 151 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::addField(), etiss::VirtualStruct::allocateFromC(), etiss::CPUCore::CPUCore(), and etiss::VirtualStruct::readField().
flags to signal that a field supports read and write operations
Definition at line 153 of file VirtualStruct.h.
|
static |
write flag
Definition at line 152 of file VirtualStruct.h.
Referenced by etiss::VirtualStruct::addField(), etiss::VirtualStruct::allocateFromC(), etiss::copy(), and etiss::CPUCore::CPUCore().
| const size_t etiss::VirtualStruct::Field::width_ |
width in bytes (rounded up if neccessary)
Definition at line 182 of file VirtualStruct.h.
Referenced by etiss::plugin::VirtualStructMemory::VirtualStructMemory().