ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
Action.h
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.
14#ifndef ETISS_FAULT_ACTION_H_
15#define ETISS_FAULT_ACTION_H_
16
17#include <iostream>
18#include <stdint.h>
19
20#ifndef NO_ETISS
21#include "etiss/Misc.h"
22#include "etiss/fault/Defs.h"
23#else
24#include "fault/Defs.h"
25#endif
26#include "enum.h"
27
28namespace etiss
29{
30namespace fault
31{
32
33class FaultRef;
34class InjectorAddress;
35
36// BITFLIP: applies a bit flip to a bit in a specified field
37// MASK: applies a mask type injection (field <op>= mask;) where <op> can be any MaskOp
38// COMMAND: commands are targetet at Injectors, not fields. in case a command is targetet at a certain field that
39// information must be passed within the command string INJECTION: an action that injects a fault definition (trigger +
40// actions) EJECTION: an action that ejects a referenced fault (which must exist)
41// EVENT: an event that breaks the JIT-block and forces the simulation loop to handle the etiss::RETURNCODE exception
42BETTER_ENUM(Action_Type, char, NOP = 0, BITFLIP, MASK, COMMAND, INJECTION, EJECTION, EVENT)
43BETTER_ENUM(Action_MaskOp, char, NOP = 0, AND, OR, XOR, NAND, NOR)
44
45class Action : public etiss::ToString
46{
47 public:
48 typedef Action_Type type_t;
49 typedef Action_MaskOp mask_op_t;
53 bool is_action_on_field(void) const;
54
55 // Constructors
59 Action();
60#ifndef NO_ETISS
66 Action(int32_t event);
67#endif
73 Action(const InjectorAddress &inj, const std::string &command);
79 Action(const InjectorAddress &inj, const std::string &field, unsigned bit);
85 Action(const InjectorAddress &inj, const std::string &field, mask_op_t mask_op, uint64_t mask_value);
91 Action(const FaultRef &fault_ref, type_t type);
92
93 // Copy Constructors
94 Action(const Action &cpy);
95 Action &operator=(const Action &cpy);
96
97#if CXX0X_UP_SUPPORTED
98 Action(Action &&cpy);
99 Action &operator=(Action &&cpy);
100#endif
101
102 // Getters
103 const type_t &getType() const;
104
105 const InjectorAddress &getInjectorAddress() const;
106
108 const std::string &getCommand() const;
109
111 const std::string &getTargetField() const;
112 unsigned getTargetBit() const;
113
115 const FaultRef &getFaultRef() const;
116
118 const mask_op_t &getMaskOp() const;
119 uint64_t getMaskValue() const;
120#ifndef NO_ETISS
121 int32_t getEvent() const;
122#endif
123 // Members
124 std::string toString() const;
125
126 private: // Attributes
128 std::unique_ptr<InjectorAddress> inj_;
129 std::string command_;
130 std::string field_;
131 unsigned bit_ = { 0 };
132 mask_op_t mask_op_{ mask_op_t::NOP };
133 uint64_t mask_value_{ 0 };
134 std::unique_ptr<FaultRef> fault_ref_;
135#ifndef NO_ETISS
136 int32_t event_{ 0 };
138#endif
139 // private Members
140 void ensure(type_t);
141};
142
143#ifndef NO_ETISS
147bool returncode_fromstring(int32_t &out, const std::string &in);
151std::string returncode_tostring(int32_t in);
152#endif
153
154#if ETISS_FAULT_XML
155
156namespace xml
157{
158
159} // namespace xml
160
161#endif
162
163} // namespace fault
164
165} // namespace etiss
166
167#endif
contains general definitions used by other fault library code
general configuration and logging
static __inline__ uint64_t
Definition arm_cde.h:31
static __inline__ int32_t
Definition arm_mve.h:51
Marker interface for toString() support.
Definition Misc.h:95
std::string command_
command e.g. for booting OR1KVCPU
Definition Action.h:129
std::unique_ptr< InjectorAddress > inj_
Address of Injector.
Definition Action.h:128
std::unique_ptr< FaultRef > fault_ref_
for fault injection
Definition Action.h:134
Action_MaskOp mask_op_t
Definition Action.h:49
std::string field_
concerning Field (for fault injection)
Definition Action.h:130
Action_Type type_t
Definition Action.h:48
type_t type_
type of the Attribute
Definition Action.h:127
bool returncode_fromstring(int32_t &out, const std::string &in)
decode etiss::RETURNCODE from string
Definition Action.cpp:437
std::string returncode_tostring(int32_t in)
encode etiss::RETURNCODE to string
Definition Action.cpp:514
forwards: include/jit/*
Definition Benchmark.h:17
std::string toString(const T &val)
conversion of type T to std::string.
Definition Misc.h:133