ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
ErrorDefinition.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
8
9#if ETISS_USE_CPP11
10#include <mutex>
11#endif
12
13namespace etiss
14{
15
16namespace error
17{
18
19namespace
20{
21
23{
24 static int cur = -1;
25#if ETISS_USE_CPP11
26 static std::mutex id_lock;
27 std::lock_guard<std::mutex> lock(id_lock);
28#endif
29 int ret = cur;
30 --cur;
31 if (cur >= 0)
32 {
33 std::cerr << "\n\nWARNING: etiss::error::Error ran out of ids. From now on negative ids may be assigned "
34 "multiple times.\n\n"
35 << std::endl;
36 cur = -1;
37 }
38 return ret;
39}
40
41} // namespace
42
43Error::Error(bool persistent, int id, const std::string &name)
44 : persistent_(persistent), id_(id < 0 ? getGlobalId() : id), name_(name)
45{
46}
48
50{
51 uint64_t tmp = var;
52 apply(tmp);
53 var = (uint32_t)tmp;
54}
56{
57 uint64_t tmp = var;
58 apply(tmp);
59 var = (uint16_t)tmp;
60}
62{
63 uint64_t tmp = var;
64 apply(tmp);
65 var = (uint8_t)tmp;
66}
67
69{
70 var ^= flip;
71}
73{
74 var |= high;
75}
77{
78 var &= low;
79}
80
81const std::vector<unsigned> BitFlip::affectedBits()
82{
83 return flipped_positions;
84}
85const std::vector<unsigned> StuckHigh::affectedBits()
86{
87 return high_positions;
88}
89const std::vector<unsigned> StuckLow::affectedBits()
90{
91 return low_positions;
92}
93
94} // namespace error
95
96} // namespace etiss
static __inline__ uint32_t
Definition arm_cde.h:25
static __inline__ uint64_t
Definition arm_cde.h:31
static __inline__ uint8_t
Definition arm_mve.h:323
static __inline__ uint16_t
Definition arm_mve.h:315
virtual const std::vector< unsigned > affectedBits()
std::vector< unsigned > flipped_positions
virtual void apply(uint64_t &var)
Error(bool persistent, int id=-1, const std::string &name="")
virtual void apply(uint64_t &var)=0
std::vector< unsigned > high_positions
virtual void apply(uint64_t &var)
virtual const std::vector< unsigned > affectedBits()
virtual void apply(uint64_t &var)
std::vector< unsigned > low_positions
virtual const std::vector< unsigned > affectedBits()
forwards: include/jit/*
Definition Benchmark.h:17