ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Action.h
Go to the documentation of this file.
1 
52 #ifndef ETISS_FAULT_ACTION_H_
53 #define ETISS_FAULT_ACTION_H_
54 
55 #include <iostream>
56 #include <stdint.h>
57 
58 #ifndef NO_ETISS
59 #include "etiss/fault/Defs.h"
60 #include "etiss/fault/Fault.h"
62 #include "etiss/fault/XML.h"
63 #else
64 #include "fault/Defs.h"
65 #include "fault/Fault.h"
66 #include "fault/InjectorAddress.h"
67 #include "fault/XML.h"
68 #endif
69 
70 namespace etiss
71 {
72 namespace fault
73 {
74 
75 class Fault;
76 
77 class Action : public etiss::ToString
78 {
79  public:
80  enum Type
81  {
88  NOP,
90  INJECTION
91  };
92 
93  // Constructors
97  Action();
103  Action(const InjectorAddress &inj, const std::string &command);
109  Action(const InjectorAddress &inj, const std::string &field, unsigned bit);
115  Action(const Fault &fault);
116 
117  // Getters
118  Type getType() const;
119  const InjectorAddress &getInjectorAddress() const;
120 
122  const std::string &getCommand() const;
123 
125  const std::string &getTargetField() const;
126  unsigned getTargetBit() const;
127 
129  const Fault &getFault() const;
130 
131  // Members
132  std::string toString() const;
133 
134  private: // Attributes
137  std::string command_;
138  std::string field_;
139  unsigned bit_;
140  std::vector<Fault> fault_;
141 
142  // private Members
143  void ensure(Type);
144 };
145 
146 #if ETISS_FAULT_XML
147 
148 namespace xml
149 {
150 
151 template <>
152 bool parse<etiss::fault::Action>(pugi::xml_node node, etiss::fault::Action &f, Diagnostics &diag);
153 template <>
154 bool write<etiss::fault::Action>(pugi::xml_node node, const etiss::fault::Action &f, Diagnostics &diag);
155 
156 } // namespace xml
157 
158 #endif
159 
160 } // namespace fault
161 
162 } // namespace etiss
163 
164 #endif
contains general definitions used by other fault library code
contains the fault container class that stores triggers and actions for fault injection
contains a simple class that represents and resolves injector addresses as used by triggers (
contains XML related functions.
Marker interface for toString() support.
Definition: Misc.h:137
std::vector< Fault > fault_
for other injections
Definition: Action.h:140
InjectorAddress inj_
Definition: Action.h:136
const InjectorAddress & getInjectorAddress() const
Definition: Action.cpp:93
@ BITFLIP
applies a bit flip to a bit in a specified field
Definition: Action.h:83
@ INJECTION
an action that injects a fault definition (trigger + actions)
Definition: Action.h:90
@ NOP
NO Operation. used by default constructor.
Definition: Action.h:88
@ COMMAND
commands are targetet at Injectors, not fields.
Definition: Action.h:86
unsigned bit_
concerning Bit (for fault injection)
Definition: Action.h:139
std::string toString() const
operator<< can be used.
Definition: Action.cpp:123
std::string command_
command e.g. for booting OR1KVCPU
Definition: Action.h:137
Type getType() const
Definition: Action.cpp:88
const std::string & getCommand() const
COMMAND only.
Definition: Action.cpp:99
const std::string & getTargetField() const
BITFLIP only.
Definition: Action.cpp:105
Type type_
type of the Attribute
Definition: Action.h:135
std::string field_
concerning Field (for fault injection)
Definition: Action.h:138
const Fault & getFault() const
INJECTION only.
Definition: Action.cpp:116
unsigned getTargetBit() const
BITFLIP only.
Definition: Action.cpp:111
void ensure(Type)
Definition: Action.cpp:56
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53