ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
InstructionAccurateCallback.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
6
9
10#include "etiss/CPUCore.h"
11#include "etiss/Instruction.h"
12
13extern "C"
14{
20}
21
22namespace etiss
23{
24
25namespace plugin
26{
27
30
32{
33 block.fileglobalCode().insert("extern etiss_int32 etiss_plugin_InstructionAccurateCallback_OnEntry(void *); ");
34}
35
37{
38 mis.foreach (
40 {
41 vis.foreach (
43 {
44 is.foreach (
46 {
49 {
51 pp.code() =
52 std::string(
53 "etiss_int32 ret_iac = etiss_plugin_InstructionAccurateCallback_OnEntry(") +
54 getPointerCode() + ");\nif(ret_iac != 0)return(ret_iac);";
55 return true;
56 },
57 0);
58 });
59 });
60 });
61}
62
64{
65 return std::string("InstructionAccurateCallback");
66}
67
69{
70 bool trigger_fired = false;
71 auto time = plugin_cpu_->cpuTime_ps;
72
74
75 trigger_fired |= plugin_core_->getStruct()->instructionAccurateCallback(
76 time); // call instruction callback of plugin-associated core
77 plugin_core_->getStruct()->foreachStruct( // call instruction callback of all VirtualStructs mounted on core
78 [time, &trigger_fired](const std::string &name, VirtualStruct &vs)
79 { trigger_fired |= vs.instructionAccurateCallback(time); });
80
81 return (trigger_fired ? etiss::fault::Stressor::get_event()
82 : 0); // signal that a trigger has thrown an exception back to the JIT code calling
83}
84
85} // namespace plugin
86
87} // namespace etiss
defines main cpu core interface
etiss_int32 etiss_plugin_InstructionAccurateCallback_OnEntry(void *ptr)
contains container classes to store instruction definitions + translation functions and build a trans...
contains the stressor class that loads and activates faults.
int32_t etiss_int32
Definition types.h:54
virtual std::shared_ptr< VirtualStruct > getStruct()
Get the virtual structure of this CPUCore instance.
Definition CPUCore.h:122
A list of CodeSets.
Definition CodePart.h:532
std::set< std::string > & fileglobalCode()
Definition CodePart.h:566
Contains a small code snipped.
Definition CodePart.h:348
std::string & code()
Definition CodePart.h:378
A set of CodeParts.
Definition CodePart.h:399
CodePart & prepend(CodePart::TYPE type)
Definition CodePart.h:465
CPUCore * plugin_core_
holds a pointer to the associated CPUCore instance.
Definition Plugin.h:160
ETISS_CPU * plugin_cpu_
holds a pointer to the cpu structure. will be set before init call and after cleanup call
Definition Plugin.h:155
std::string getPointerCode() const
returns a C code expression that allows to get or assign a pointer to the variable assigned to this t...
Definition Plugin.cpp:63
abstract representation of an module of a simulation which could be a embedded device of the cpu of a...
virtual bool instructionAccurateCallback(uint64_t time_ps)
Definition Injector.cpp:103
static etiss::int32 get_event(void)
Definition Stressor.h:54
static void reset_event(void)
Definition Stressor.h:65
stores a bit vector
this class contains parameters that persist in between instruction lookpus/translation within a trans...
holds etiss::instr::Instruction instances and handles automatic instruction tree creation.
void foreach(std::function< void(Instruction &)> func)
holds information and translation callbacks for an instruction.
bool addCallback(std::function< bool(BitArray &, etiss::CodeSet &, InstructionContext &)> callback, uint32_t builtinGroups, const std::set< uint32_t > &groups=std::set< uint32_t >())
holds etiss::instr::VariableInstructionSet instances for different modes.
void foreach(std::function< void(VariableInstructionSet &)> call)
holds etiss::instr::InstructionSet instances with different bit widths.
void foreach(std::function< void(InstructionSet &)> func)
writes the value of a field before each instruction
virtual void initCodeBlock(etiss::CodeBlock &block) const
called before instructions are translated for the code block
virtual void finalizeInstrSet(etiss::instr::ModedInstructionSet &) const
called after all instructions have been added to allow last changes
forwards: include/jit/*
Definition Benchmark.h:17
etiss_uint64 cpuTime_ps
simulation time of cpu
Definition CPU.h:59