ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
Trigger.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_TRIGGER_H_
15#define ETISS_FAULT_TRIGGER_H_
16
17#include <iostream>
18#include <stdint.h>
19
20#if CXX0X_UP_SUPPORTED
21#include <memory>
22#endif
23
24#ifndef NO_ETISS
25#include "etiss/Misc.h"
26#include "etiss/fault/Misc.h"
27#else
28#include "fault/Misc.h"
29#endif
30
31#include "enum.h"
32
33namespace etiss
34{
35namespace fault
36{
37
38class Injector;
39class InjectorAddress;
40
41#if CXX0X_UP_SUPPORTED
42typedef std::shared_ptr<Injector> Injector_ptr;
43#else
44typedef Injector *Injector_ptr;
45#endif
46
47BETTER_ENUM(Trigger_Type, char, NOP = 0, META_COUNTER, VARIABLEVALUE, TIME, TIMERELATIVE, ASAP)
48
49class Trigger : public etiss::ToString
50{
51 public:
52 typedef Trigger_Type type_t;
53 // constructors
57 Trigger();
58 // constructors
62 Trigger(const InjectorAddress &target_injector);
69 Trigger(const Trigger &sub, uint64_t count);
75 Trigger(const InjectorAddress &target_injector, const std::string &field, uint64_t value);
81 Trigger(const InjectorAddress &target_injector, uint64_t time_ps, bool relative = false);
82
83 // Copy Constructors
84 Trigger(const Trigger &cpy);
85 Trigger &operator=(const Trigger &cpy);
86
87#if CXX0X_UP_SUPPORTED
88 Trigger(Trigger &&cpy);
89 Trigger &operator=(Trigger &&cpy);
90#endif
91
92 ~Trigger();
93
94 // Getter
95 uint64_t getTriggerCount() const;
96 const Trigger &getSubTrigger() const;
97 uint64_t getTriggerTime() const;
98 const InjectorAddress &getInjectorAddress() const;
99 const Injector_ptr &getInjector() const;
100 bool isNOP() const;
101 const std::string &getTriggerField() const;
102 const uint64_t &getTriggerFieldValue() const;
103 const type_t &getType() const;
104
105 // Members
108 bool check(uint64_t time_ps, etiss::fault::Injector *target_injector);
109
113 void resolveTime(uint64_t time);
117 bool isResolved() const;
118
119 std::string toString() const;
120
121 private: // Attributes
123 std::string field_;
124 std::unique_ptr<Trigger> sub_;
125 std::unique_ptr<InjectorAddress> inj_;
127 uint64_t param1_{ 0 };
128 uint64_t param2_{ 0 };
129
130 // Private Members
131 void ensure(type_t type) const;
132};
133
134#if ETISS_FAULT_XML
135namespace xml
136{
137
138} // namespace xml
139#endif
140
141} // namespace fault
142} // namespace etiss
143
144#endif // ETISS_FAULT_TRIGGER_H_
general configuration and logging
static __inline__ uint64_t
Definition arm_cde.h:31
Marker interface for toString() support.
Definition Misc.h:95
std::unique_ptr< Trigger > sub_
Definition Trigger.h:124
std::unique_ptr< InjectorAddress > inj_
Definition Trigger.h:125
std::string field_
Definition Trigger.h:123
Trigger_Type type_t
Definition Trigger.h:52
general helpers for fault
std::shared_ptr< Injector > Injector_ptr
Definition Defs.h:48
forwards: include/jit/*
Definition Benchmark.h:17
std::string toString(const T &val)
conversion of type T to std::string.
Definition Misc.h:133