ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Static Public Member Functions | List of all members
etiss::CPUArchRegListenerInterface Class Referenceabstract

allows to inform plugins about changes to a register that is present in the cpu structure. More...

#include <CPUArch.h>

Inheritance diagram for etiss::CPUArchRegListenerInterface:
Inheritance graph
[legend]

Public Member Functions

virtual ~CPUArchRegListenerInterface ()
 
virtual const std::set< std::string > & getListenerSupportedRegisters ()=0
 

Static Public Member Functions

static void signalChangedRegisterValue (ETISS_CPU *cpu, const char *registerName)
 call this function to inform RegisterDevicePlugins about changed special register values. More...
 

Detailed Description

allows to inform plugins about changes to a register that is present in the cpu structure.

an architecture should provide information about configuration registers (e.g. special purpose registers) so that plugins may simulate additional hardware. if such a register value has changed the etiss::CPUArch implementation is required to call etiss::CPUArch::signalChangedRegisterValue(ETISS_CPU* cpu,const char * registerName).

Definition at line 82 of file CPUArch.h.

Constructor & Destructor Documentation

◆ ~CPUArchRegListenerInterface()

CPUArchRegListenerInterface::~CPUArchRegListenerInterface ( )
virtual

Definition at line 60 of file CPUArch.cpp.

Member Function Documentation

◆ getListenerSupportedRegisters()

virtual const std::set<std::string>& etiss::CPUArchRegListenerInterface::getListenerSupportedRegisters ( )
pure virtual

◆ signalChangedRegisterValue()

void CPUArchRegListenerInterface::signalChangedRegisterValue ( ETISS_CPU cpu,
const char *  registerName 
)
static

call this function to inform RegisterDevicePlugins about changed special register values.

call must be done by the architecture implementation!!!

example pseudo implementation: Instruction: write value 13 to special purpose register Y Translated code: YOURARCH_writeToSPR(cpu,Y,13); declaration of YOURARCH_writeToSPR: extern void YOURARCH_writeToSPR(ETISS_CPU*cpu,etiss_uint32 Y,etiss_uint32 X); implementation of YOURARCH_writeToSPR: void YOURARCH_writeToSPR(ETISS_CPU*cpu,etiss_uint32 Y,etiss_uint32 X){ set value of register first ((YOURARCH*)cpu)->Y = X; signal change CPUArch::signalChangedRegisterValue(cpu,"nameOfRegisterY"); // very important } alternatively void ETISS_signalChangedRegisterValue(ETISS_CPU* cpu,const char * registerName) may be used as a C function (e.g. call it directly from the translated code)

Attention
may only be called from within the etiss::CPUCore::execute() function.
this function is not very performant. to improve performance a bit call etiss::VirtualStruct::Field::signalWrite() directly for the appropriate field. in general it must be avaioded to use listeners on registers that are frequently changed (e.g. general purpose registers, special purpose registers for flags of arithmetic operations, etc.
See also
CPUCore.cpp (implemented there)
etiss/CPUArch.h

Definition at line 43 of file CPUCore.cpp.

References ETISS_CPU::_etiss_private_handle_, etiss::ERROR, etiss::CPUCore::getStruct(), if(), etiss::VirtualStruct::Field::L, and etiss::log().

Referenced by ETISS_signalChangedRegisterValue().

Here is the call graph for this function:
Here is the caller graph for this function:

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