ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Trigger.h
Go to the documentation of this file.
1 
52 #ifndef ETISS_FAULT_TRIGGER_H_
53 #define ETISS_FAULT_TRIGGER_H_
54 
55 #include <iostream>
56 #include <stdint.h>
57 
58 #if CXX0X_UP_SUPPORTED
59 #include <memory>
60 #endif
61 
62 #ifndef NO_ETISS
63 #include "etiss/Misc.h"
65 #include "etiss/fault/XML.h"
66 #else
67 #include "fault/InjectorAddress.h"
68 #include "fault/XML.h"
69 #endif
70 
71 namespace etiss
72 {
73 namespace fault
74 {
75 
76 class Injector;
77 
78 #if CXX0X_UP_SUPPORTED
79 typedef std::shared_ptr<Injector> Injector_ptr;
80 #else
81 typedef Injector *Injector_ptr;
82 #endif
83 
84 class Trigger : public etiss::ToString
85 {
86  public:
87  enum Type
88  {
95  NOP
96  };
97 
98  // constructors
102  Trigger();
109  Trigger(const Trigger &sub, uint64_t count);
115  Trigger(const InjectorAddress &target_injector, const std::string &field, uint64_t value);
121  Trigger(const InjectorAddress &target_injector, uint64_t time_ps, bool relative = false);
122 
123  // Copy Constructors
124  Trigger(const Trigger &cpy);
125  Trigger &operator=(const Trigger &cpy);
126 
127 #if CXX0X_UP_SUPPORTED
128  Trigger(Trigger &&cpy);
129  Trigger &operator=(Trigger &&cpy);
130 #endif
131 
132  ~Trigger();
133 
134  // Getter
135  uint64_t getTriggerCount() const;
137  const Trigger &getSubTrigger() const;
138  uint64_t getTriggerTime() const;
139  const InjectorAddress &getInjectorAddress() const;
140  const Injector_ptr &getInjector() const;
141  bool isNOP() const;
142  const std::string &getTriggerField() const;
143  const uint64_t &getTriggerFieldValue() const;
144  Type getType() const;
145 
146  // Members
149  bool fired(uint64_t time_ps, etiss::fault::Injector *target_injector);
150 
154  void resolveTime(uint64_t time);
158  bool isResolved() const;
159 
160  std::string toString() const;
161 
162  private: // Attributes
164  std::string field_;
167  void *fieldptr_;
170 
171  // Private Members
172  void ensure(Type type) const;
173 };
174 
175 #if ETISS_FAULT_XML
176 namespace xml
177 {
178 
179 template <>
180 bool parse<etiss::fault::Trigger *>(pugi::xml_node node, etiss::fault::Trigger *&f, Diagnostics &diag);
181 template <>
182 bool write<const etiss::fault::Trigger *>(pugi::xml_node node, const etiss::fault::Trigger *const &f,
183  Diagnostics &diag);
184 
185 template <>
186 bool parse<etiss::fault::Trigger>(pugi::xml_node node, etiss::fault::Trigger &f, Diagnostics &diag);
187 template <>
188 bool write<etiss::fault::Trigger>(pugi::xml_node node, const etiss::fault::Trigger &f, Diagnostics &diag);
189 
190 } // namespace xml
191 #endif
192 
193 } // namespace fault
194 } // namespace etiss
195 
196 #endif // ETISS_FAULT_TRIGGER_H_
contains a simple class that represents and resolves injector addresses as used by triggers (
general configuration and logging
contains XML related functions.
static __inline__ uint64_t
Definition: arm_cde.h:31
Marker interface for toString() support.
Definition: Misc.h:137
std::string toString() const
operator<< can be used.
Definition: Trigger.cpp:352
const std::string & getTriggerField() const
Definition: Trigger.cpp:327
void ensure(Type type) const
Definition: Trigger.cpp:60
Trigger & getSubTrigger()
Definition: Trigger.cpp:275
const uint64_t & getTriggerFieldValue() const
Definition: Trigger.cpp:337
uint64_t getTriggerCount() const
Definition: Trigger.cpp:270
const Injector_ptr & getInjector() const
Definition: Trigger.cpp:305
Type getType() const
Definition: Trigger.cpp:347
bool fired(uint64_t time_ps, etiss::fault::Injector *target_injector)
this function checks if the Trigger has just fired.
Definition: Trigger.cpp:157
InjectorAddress inj_
Definition: Trigger.h:166
const InjectorAddress & getInjectorAddress() const
Definition: Trigger.cpp:301
Trigger()
Type: NOP (no operation)
Definition: Trigger.cpp:70
std::string field_
Definition: Trigger.h:164
Trigger & operator=(const Trigger &cpy)
Definition: Trigger.cpp:95
bool isNOP() const
Definition: Trigger.cpp:316
uint64_t getTriggerTime() const
Definition: Trigger.cpp:285
bool isResolved() const
returns if the translation from TIMERELATIVE to TIME trigger has taken place
Definition: Trigger.cpp:261
void resolveTime(uint64_t time)
this function calculates in case of a TIMERELATIVE Trigger a constant TIME trigger
Definition: Trigger.cpp:247
@ TIMERELATIVE
needs to be resolved.
Definition: Trigger.h:94
std::shared_ptr< Injector > Injector_ptr
Definition: Defs.h:83
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53