ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
#include <Timing.h>
Classes | |
struct | Rule |
Public Member Functions | |
void | addRule (std::function< bool(uint32_t)> matchesMode, std::function< bool(unsigned)> matchesWidth, std::function< bool(etiss::instr::Instruction &)> matchesInstr, std::function< void(etiss::instr::Instruction &)> handleMatch) |
this is the main add rule function. More... | |
void | addRule (const std::tuple< uint32_t, unsigned, const char *, std::function< void(etiss::instr::Instruction &)>> &tuple) |
adds a rule for the given mode,width and instruction name More... | |
void | addRule (const std::tuple< std::regex, std::regex, std::regex, std::function< void(etiss::instr::Instruction &)>> &tuple) |
adds a rule that uses regular expressions to match mode,width and instruction name More... | |
void | addRule (const std::tuple< std::regex, std::regex, std::regex, void(*)(etiss::instr::Instruction &)> &tuple) |
template<typename... T> | |
DataSheetAccurateTiming (const std::string &name, const T &... rules) | |
virtual | ~DataSheetAccurateTiming () |
virtual void | initInstrSet (etiss::instr::ModedInstructionSet &) const |
performs lookups for instructions that are in the modded instruction set to add timing code (e.g. More... | |
Public Member Functions inherited from etiss::TranslationPlugin | |
TranslationPlugin () | |
virtual | ~TranslationPlugin () |
virtual void | finalizeInstrSet (etiss::instr::ModedInstructionSet &) const |
called after all instructions have been added to allow last changes 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 () |
Static Public Member Functions | |
template<unsigned cycles, bool isNotAdditionalTime = true> | |
static void | handleMatch_cycles (etiss::instr::Instruction &instr) |
simple template function that adds the given number of cycles to the cpu time if the related rule matches if isNotAdditionalTime is true then this handler will signal that no other main timing rules need to be applied. More... | |
Public Attributes | |
const std::string | name_ |
Protected Member Functions | |
std::string | _getPluginName () const |
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 Member Functions | |
void | ctor_hlpr () |
terminates recursion More... | |
template<typename A , typename... T> | |
void | ctor_hlpr (const A &arg, const T &... rules) |
handles the argument list passed to the template constructor More... | |
Private Attributes | |
std::list< Rule * > | rules_ |
Additional Inherited Members | |
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... | |
|
inline |
Definition at line 150 of file Timing.h.
References ctor_hlpr().
|
virtual |
Definition at line 113 of file Timing.cpp.
References rules_.
|
inlineprotectedvirtual |
void etiss::DataSheetAccurateTiming::addRule | ( | const std::tuple< std::regex, std::regex, std::regex, std::function< void(etiss::instr::Instruction &)>> & | tuple | ) |
adds a rule that uses regular expressions to match mode,width and instruction name
Definition at line 99 of file Timing.cpp.
References addRule(), get_metrics::mode, etiss::toString(), and uint32_t.
|
inline |
void etiss::DataSheetAccurateTiming::addRule | ( | const std::tuple< uint32_t, unsigned, const char *, std::function< void(etiss::instr::Instruction &)>> & | tuple | ) |
adds a rule for the given mode,width and instruction name
Definition at line 86 of file Timing.cpp.
References addRule(), get_metrics::mode, and uint32_t.
void etiss::DataSheetAccurateTiming::addRule | ( | std::function< bool(uint32_t)> | matchesMode, |
std::function< bool(unsigned)> | matchesWidth, | ||
std::function< bool(etiss::instr::Instruction &)> | matchesInstr, | ||
std::function< void(etiss::instr::Instruction &)> | handleMatch | ||
) |
this is the main add rule function.
any other addRule function must map to this
Definition at line 48 of file Timing.cpp.
References etiss::DataSheetAccurateTiming::Rule::handler, etiss::DataSheetAccurateTiming::Rule::instr, etiss::log(), etiss::DataSheetAccurateTiming::Rule::mode, rules_, uint32_t, etiss::WARNING, and etiss::DataSheetAccurateTiming::Rule::width.
Referenced by addRule(), and ctor_hlpr().
|
inlineprivate |
terminates recursion
Definition at line 138 of file Timing.h.
Referenced by ctor_hlpr(), and DataSheetAccurateTiming().
|
inlineprivate |
handles the argument list passed to the template constructor
Definition at line 141 of file Timing.h.
References addRule(), and ctor_hlpr().
|
inlinestatic |
simple template function that adds the given number of cycles to the cpu time if the related rule matches if isNotAdditionalTime is true then this handler will signal that no other main timing rules need to be applied.
usually this should prevent the CPUArch implementation from adding the default timing
Definition at line 110 of file Timing.h.
References etiss::instr::Instruction::addCallback(), etiss::CodePart::code(), etiss::CodePart::getAffectedRegisters(), etiss::CodePart::INITIALREQUIRED, etiss::CodeSet::prepend(), static_assert, etiss::toString(), and uint32_t.
|
virtual |
performs lookups for instructions that are in the modded instruction set to add timing code (e.g.
"cpu->cpuTime_ps += X * cpu->cycleTime_ps;")
TODO? pass mode parameter in foreach/ store mode with vis
Reimplemented from etiss::TranslationPlugin.
Definition at line 122 of file Timing.cpp.
References etiss::instr::InstructionSet::foreach(), etiss::instr::VariableInstructionSet::foreach(), etiss::instr::ModedInstructionSet::foreach(), etiss::instr::ModedInstructionSet::getMode(), etiss::DataSheetAccurateTiming::Rule::mode, get_metrics::mode, etiss::instr::VariableInstructionSet::parent_, rules_, and uint32_t.
const std::string etiss::DataSheetAccurateTiming::name_ |
Definition at line 148 of file Timing.h.
Referenced by _getPluginName().
|
private |
Definition at line 166 of file Timing.h.
Referenced by addRule(), initInstrSet(), and ~DataSheetAccurateTiming().