ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
the interface to translate instructions of and processor architecture More...
#include <CPUArch.h>
Public Member Functions | |
CPUArch (std::string archname) | |
virtual | ~CPUArch () |
std::string | getArchName () const |
returns the name of this architecture. More... | |
std::string | getName () const |
returns the name of this architecture. More... | |
virtual ETISS_CPU * | newCPU ()=0 |
allocate new cpu structure More... | |
virtual void | resetCPU (ETISS_CPU *cpu, etiss::uint64 *startpointer)=0 |
reset cpu (structure) More... | |
virtual void | deleteCPU (ETISS_CPU *)=0 |
delete cpu structure More... | |
virtual unsigned | getMaximumInstructionSizeInBytes ()=0 |
used for variable instruction size and delay slots More... | |
virtual unsigned | getMaximumInstructionsPerMetaInstruction () |
maximum number of instructions in a meta instruction More... | |
virtual unsigned | getInstructionSizeInBytes ()=0 |
size of one instruction/ smalest data unit for instructions of variable length More... | |
virtual unsigned | getSuperInstructionCount () |
fixed number of sub instructions per instruction (e.g. More... | |
virtual std::string | getBlockGlobalCode () |
get c++ code snippet that is placed at the top of a translated block More... | |
virtual bool | unlikelyInstruction (etiss::uint8 *instr, unsigned length, bool &ismetainstruction) |
return true if the given data is unlikely to be an instruction. More... | |
virtual const std::set< std::string > & | getHeaders () const =0 |
set of code header files e.g. More... | |
virtual etiss::int32 | handleException (etiss::int32 code, ETISS_CPU *cpu) |
translate/process exceptions that occur at runtime More... | |
virtual etiss::InterruptVector * | createInterruptVector (ETISS_CPU *cpu) |
allocate a new interrupt vector object for the given cpu More... | |
virtual void | deleteInterruptVector (etiss::InterruptVector *vec, ETISS_CPU *cpu) |
delete an allocated interrupt vector object More... | |
virtual etiss::InterruptEnable * | createInterruptEnable (ETISS_CPU *cpu) |
virtual void | deleteInterruptEnable (etiss::InterruptEnable *en, ETISS_CPU *cpu) |
virtual etiss::plugin::gdb::GDBCore & | getGDBCore () |
returns arch dependent gdb functions. More... | |
virtual std::string | getIncludePath () |
returns a path that will be used to look up header files More... | |
virtual void | finalizeInstrSet (etiss::instr::ModedInstructionSet &) const |
the default behavior of this function of a cpu arch is to add "cpu->cpuTime_ps += cpu->cpuCycleTime_ps;" if the cpu time update group is not in use More... | |
virtual void | compensateEndianess (ETISS_CPU *cpu, etiss::instr::BitArray &ba) const |
this function should compensate for any endianess on a BitArray so that bit 0 is always the LSB. More... | |
virtual etiss::mm::MMU * | newMMU (ETISS_CPU *cpu) |
It is an interface to instanciate a Memory Management Unit. More... | |
Public Member Functions inherited from etiss::CPUArchRegListenerInterface | |
virtual | ~CPUArchRegListenerInterface () |
virtual const std::set< std::string > & | getListenerSupportedRegisters ()=0 |
Public Member Functions inherited from etiss::CPUArchCPUManipulation | |
virtual | ~CPUArchCPUManipulation () |
virtual std::shared_ptr< etiss::VirtualStruct > | getVirtualStruct (ETISS_CPU *cpu)=0 |
this function must return a valid pointer to a virtual struct More... | |
Public Member Functions inherited from etiss::CPUArchDefaultPlugins | |
virtual | ~CPUArchDefaultPlugins () |
virtual etiss::Plugin * | newTimer (ETISS_CPU *cpu) |
create a simple default timer implementaion instance for this architecture. More... | |
virtual void | deleteTimer (etiss::Plugin *timer) |
delete timer instance More... | |
Public Member Functions inherited from etiss::TranslationPlugin | |
TranslationPlugin () | |
virtual | ~TranslationPlugin () |
virtual void | initInstrSet (etiss::instr::ModedInstructionSet &) const |
called to add instructions to the instruction set More... | |
virtual void | initCodeBlock (etiss::CodeBlock &) const |
called before instructions are translated for the code block More... | |
virtual void | finalizeCodeBlock (etiss::CodeBlock &) const |
called after all instructions have been translated for the code block More... | |
virtual void * | getPluginHandle () |
called to get the handle that is available in translated code via getPoinerCode(). [default: this] More... | |
Public Member Functions inherited from etiss::Plugin | |
virtual | ~Plugin () |
unsigned | getType () |
InterruptListenerPlugin * | getInterruptListenerPlugin () |
CoroutinePlugin * | getCoroutinePlugin () |
SystemWrapperPlugin * | getSystemWrapperPlugin () |
RegisterDevicePlugin * | getRegisterDevicePlugin () |
TranslationPlugin * | getTranslationPlugin () |
std::string | getPluginName () const |
const std::string & | getLastAssignedCoreName () |
std::string | toString () const |
Public Member Functions inherited from etiss::ToString | |
ToString () | |
virtual | ~ToString () |
Protected Member Functions | |
virtual std::string | _getPluginName () const |
do not override. maps to getName(). More... | |
Protected Member Functions inherited from etiss::TranslationPlugin | |
std::string | getPointerCode () const |
returns a C code expression that allows to get or assign a pointer to the variable assigned to this translation plugin. More... | |
Protected Member Functions inherited from etiss::Plugin | |
Plugin (unsigned type=0) | |
virtual void | init (ETISS_CPU *cpu, ETISS_System *system, CPUArch *arch) |
this function is called before the plugin is used in the cpu execution loop (etiss::CPUCore::execute). More... | |
virtual void | cleanup () |
this function is called after cpu execution loop (etiss::CPUCore::execute) finished. More... | |
void | setCorrespondingCPUCoreName (std::string name) |
virtual void | addedToCPUCore (etiss::CPUCore *core) |
called as soon a plugin has been added to its CPUCore. More... | |
virtual void | removedFromCPUCore (etiss::CPUCore *core) |
called as soon a plugin has been removed from its CPUCore. More... | |
Private Attributes | |
etiss::plugin::gdb::GDBCore | gdbcore_ |
std::string | archname_ |
Friends | |
class | LibraryInterface |
Additional Inherited Members | |
Static Public Member Functions inherited from etiss::CPUArchRegListenerInterface | |
static void | signalChangedRegisterValue (ETISS_CPU *cpu, const char *registerName) |
call this function to inform RegisterDevicePlugins about changed special register values. More... | |
Static Public Attributes inherited from etiss::Plugin | |
static const unsigned | INTERRUPTLISTENER = 1 << 0 |
access to translated code More... | |
static const unsigned | COROUTINE = 1 << 1 |
callback after execution of each translated block More... | |
static const unsigned | SYSTEMWRAPPER = 1 << 2 |
can wrap/change ETISS_System structure at execution start More... | |
static const unsigned | REGISTERDEVICE |
gets noticed of changes to special registers (e.g. mmu register etc. [depends on architecture]) More... | |
static const unsigned | TRANSLATION |
access to translated code during translation phase or when instruction tree is built More... | |
Protected Attributes inherited from etiss::Plugin | |
ETISS_CPU * | plugin_cpu_ |
holds a pointer to the cpu structure. will be set before init call and after cleanup call More... | |
ETISS_System * | plugin_system_ |
holds a pointer to the system structure. More... | |
CPUArch * | plugin_arch_ |
holds a pointer to the CPUArch instance. will be set before init call and after cleanup call More... | |
CPUCore * | plugin_core_ |
holds a pointer to the associated CPUCore instance. More... | |
the interface to translate instructions of and processor architecture
CPUArch::CPUArch | ( | std::string | archname | ) |
archname | must match the returned string of LibraryInterface::nameCPUArch(unsigned)/YOURLIBRARY_nameCPUArch(unsigned) |
Definition at line 74 of file CPUArch.cpp.
References etiss::CPUCore::getNextID(), and etiss::Plugin::setCorrespondingCPUCoreName().
|
virtual |
Definition at line 79 of file CPUArch.cpp.
|
protectedvirtual |
do not override. maps to getName().
Implements etiss::Plugin.
Definition at line 155 of file CPUArch.cpp.
References getName().
|
virtual |
this function should compensate for any endianess on a BitArray so that bit 0 is always the LSB.
the function etiss::instr::BitArray::recoverFromEndianness() can be used or the operation can be performed directly on th byte array with etiss::instr::BitArray::internalBuffer() by default bigendian aligned to 4 bytes is assumed
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 188 of file CPUArch.cpp.
References etiss::_BIG_ENDIAN_, etiss::instr::Buffer::data(), etiss::instr::BitArray::intCount(), etiss::instr::Buffer::recoverFromEndianness(), and etiss::instr::BitArray::set_value().
Referenced by etiss::Translation::translateBlock().
|
virtual |
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 138 of file CPUArch.cpp.
|
virtual |
allocate a new interrupt vector object for the given cpu
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 128 of file CPUArch.cpp.
|
pure virtual |
delete cpu structure
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
|
virtual |
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 141 of file CPUArch.cpp.
|
virtual |
delete an allocated interrupt vector object
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 132 of file CPUArch.cpp.
|
virtual |
the default behavior of this function of a cpu arch is to add "cpu->cpuTime_ps += cpu->cpuCycleTime_ps;" if the cpu time update group is not in use
Reimplemented from etiss::TranslationPlugin.
Definition at line 181 of file CPUArch.cpp.
References CPUArch_finalizeInstrSet(), etiss::instr::VariableInstructionSet::foreach(), and etiss::instr::ModedInstructionSet::foreach().
std::string CPUArch::getArchName | ( | ) | const |
returns the name of this architecture.
this name was passed to the constructor and must match the returned string of LibraryInterface::nameCPUArch(unsigned)/YOURLIBRARY_nameCPUArch(unsigned)
Definition at line 81 of file CPUArch.cpp.
References archname_.
Referenced by getName().
|
virtual |
get c++ code snippet that is placed at the top of a translated block
Definition at line 107 of file CPUArch.cpp.
|
virtual |
returns arch dependent gdb functions.
althought not required it is strongly recommended to implement this
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 145 of file CPUArch.cpp.
References gdbcore_.
Referenced by etiss::plugin::gdb::Server::handlePacket(), and etiss::plugin::gdb::Server::preInstructionCallback().
|
pure virtual |
set of code header files e.g.
CustomCPU.h containing a cpu register structure needed to compile the generated code
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
|
virtual |
returns a path that will be used to look up header files
Definition at line 150 of file CPUArch.cpp.
References etiss::cfg(), etiss::Configuration::get(), and getName().
Referenced by etiss::Translation::getBlock().
|
pure virtual |
size of one instruction/ smalest data unit for instructions of variable length
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
Referenced by getMaximumInstructionsPerMetaInstruction().
|
pure virtual |
used for variable instruction size and delay slots
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
Referenced by getMaximumInstructionsPerMetaInstruction().
|
virtual |
maximum number of instructions in a meta instruction
TODO update to remove deprecated function
Definition at line 112 of file CPUArch.cpp.
References getInstructionSizeInBytes(), and getMaximumInstructionSizeInBytes().
|
inline |
returns the name of this architecture.
this name was passed to the constructor and must match the returned string of LibraryInterface::nameCPUArch(unsigned)/YOURLIBRARY_nameCPUArch(unsigned)
Definition at line 184 of file CPUArch.h.
References getArchName().
Referenced by _getPluginName(), etiss::errorMessage(), getIncludePath(), and etiss::Translation::init().
|
virtual |
fixed number of sub instructions per instruction (e.g.
thumb -> 2 16bit instructions per 1 32bit instruction)
Definition at line 118 of file CPUArch.cpp.
|
virtual |
translate/process exceptions that occur at runtime
Reimplemented in RV64IMACFDArch, and RV32IMACFDArch.
Definition at line 123 of file CPUArch.cpp.
Referenced by etiss_CPUCore_handleException().
|
pure virtual |
allocate new cpu structure
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
|
inlinevirtual |
|
pure virtual |
reset cpu (structure)
Implemented in RV64IMACFDArch, and RV32IMACFDArch.
|
virtual |
return true if the given data is unlikely to be an instruction.
used for precompilation. default implementation returns true if data is all zeros
Definition at line 86 of file CPUArch.cpp.
References length().
|
friend |
|
private |
Definition at line 276 of file CPUArch.h.
Referenced by getArchName().
|
private |
Definition at line 275 of file CPUArch.h.
Referenced by getGDBCore().