ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
etiss::DataSheetAccurateTiming Class Reference

#include <Timing.h>

Inheritance diagram for etiss::DataSheetAccurateTiming:
Inheritance graph
[legend]
Collaboration diagram for etiss::DataSheetAccurateTiming:
Collaboration graph
[legend]

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 ()
 
InterruptListenerPlugingetInterruptListenerPlugin ()
 
CoroutinePlugingetCoroutinePlugin ()
 
SystemWrapperPlugingetSystemWrapperPlugin ()
 
RegisterDevicePlugingetRegisterDevicePlugin ()
 
TranslationPlugingetTranslationPlugin ()
 
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_CPUplugin_cpu_
 holds a pointer to the cpu structure. will be set before init call and after cleanup call More...
 
ETISS_Systemplugin_system_
 holds a pointer to the system structure. More...
 
CPUArchplugin_arch_
 holds a pointer to the CPUArch instance. will be set before init call and after cleanup call More...
 
CPUCoreplugin_core_
 holds a pointer to the associated CPUCore instance. More...
 

Detailed Description

Definition at line 66 of file Timing.h.

Constructor & Destructor Documentation

◆ DataSheetAccurateTiming()

template<typename... T>
etiss::DataSheetAccurateTiming::DataSheetAccurateTiming ( const std::string &  name,
const T &...  rules 
)
inline

Definition at line 150 of file Timing.h.

References ctor_hlpr().

Here is the call graph for this function:

◆ ~DataSheetAccurateTiming()

etiss::DataSheetAccurateTiming::~DataSheetAccurateTiming ( )
virtual

Definition at line 113 of file Timing.cpp.

References rules_.

Member Function Documentation

◆ _getPluginName()

std::string etiss::DataSheetAccurateTiming::_getPluginName ( ) const
inlineprotectedvirtual

Implements etiss::Plugin.

Definition at line 163 of file Timing.h.

References name_.

◆ addRule() [1/4]

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.

Here is the call graph for this function:

◆ addRule() [2/4]

void etiss::DataSheetAccurateTiming::addRule ( const std::tuple< std::regex, std::regex, std::regex, void(*)(etiss::instr::Instruction &)> &  tuple)
inline

Definition at line 97 of file Timing.h.

References addRule().

Here is the call graph for this function:

◆ addRule() [3/4]

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.

Here is the call graph for this function:

◆ addRule() [4/4]

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

Attention
this function will test ALL rules if they match.

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().

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

◆ ctor_hlpr() [1/2]

void etiss::DataSheetAccurateTiming::ctor_hlpr ( )
inlineprivate

terminates recursion

Definition at line 138 of file Timing.h.

Referenced by ctor_hlpr(), and DataSheetAccurateTiming().

Here is the caller graph for this function:

◆ ctor_hlpr() [2/2]

template<typename A , typename... T>
void etiss::DataSheetAccurateTiming::ctor_hlpr ( const A &  arg,
const T &...  rules 
)
inlineprivate

handles the argument list passed to the template constructor

Definition at line 141 of file Timing.h.

References addRule(), and ctor_hlpr().

Here is the call graph for this function:

◆ handleMatch_cycles()

template<unsigned cycles, bool isNotAdditionalTime = true>
static void etiss::DataSheetAccurateTiming::handleMatch_cycles ( etiss::instr::Instruction instr)
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.

Here is the call graph for this function:

◆ initInstrSet()

void etiss::DataSheetAccurateTiming::initInstrSet ( etiss::instr::ModedInstructionSet mis) const
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.

Here is the call graph for this function:

Member Data Documentation

◆ name_

const std::string etiss::DataSheetAccurateTiming::name_

Definition at line 148 of file Timing.h.

Referenced by _getPluginName().

◆ rules_

std::list<Rule *> etiss::DataSheetAccurateTiming::rules_
private

Definition at line 166 of file Timing.h.

Referenced by addRule(), initInstrSet(), and ~DataSheetAccurateTiming().


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