60 etiss::uintMax and_, etiss::uintMax or_)
61 : reg(reg), errorid(errorid), time_ps(time_ps), xor_(xor_), and_(and_), or_(or_)
78 etiss::uintMax and_, etiss::uintMax or_)
102 return ETISS_RETURNCODE_GENERALERROR;
109 val = (
etiss::uint8)(((val ^ iter->xor_) & iter->and_) | iter->or_);
116 val = (
etiss::uint16)(((val ^ iter->xor_) & iter->and_) | iter->or_);
123 std::cout << iter->reg <<
": old:" << val;
124 val = (
etiss::uint32)(((val ^ iter->xor_) & iter->and_) | iter->or_);
125 std::cout <<
"new: " << val << std::endl;
132 val = (
etiss::uint64)(((val ^ iter->xor_) & iter->and_) | iter->or_);
140 std::stringstream ss;
141 ss <<
"BlockAccurateHandler: injected error (id: " << iter->errorid <<
")";
160 std::ifstream file(filename);
163 std::cout <<
"failed to load error definition file " << filename << std::endl;
170 std::getline(file, line);
171 std::stringstream ls(line);
173 while (ls.peek() ==
' ' || ls.peek() ==
'\t')
179 if (ls.peek() ==
'#')
184 tmp_cf = tmp_cf * 1000;
187 printf(
"Invalid line in error definition file\n");
192 if (ls.fail() || semicolon !=
';')
194 printf(
"Invalid line in error definition file\n");
201 printf(
"Invalid line in error definition file\n");
206 unsigned errorid = 0;
207 if (!ls.fail() && semicolon ==
';')
213 static unsigned global_errorid_max = 1024;
216 ((etiss::uintMax)1) << tmp_f));
218 std::cout << reg <<
": Error ";
221 std::cout << errorid <<
" ";
223 std::cout <<
"scheduled for time (ps)" << tmp_cf <<
"; bit " << tmp_f << std::endl;
240 return "BlockAccurateHandler";
contains neccesary interfaces for instruction translation.
defines main cpu core interface
bool etiss_BlockAccurateHandler_cmp(const BlockAccurateHandler::Error &o1, const BlockAccurateHandler::Error &o2)
__device__ __2f16 float c
the interface to translate instructions of and processor architecture
virtual std::shared_ptr< VirtualStruct > getStruct()
Get the virtual structure of this CPUCore instance.
CPUCore * plugin_core_
holds a pointer to the associated CPUCore instance.
Error(std::string reg, unsigned errorid, etiss::uint64 time_ps, etiss::uintMax xor_, etiss::uintMax and_=(etiss::uintMax)(etiss::intMax) -1, etiss::uintMax or_=0)
etiss::uint64 last_time_ps
virtual std::string _getPluginName() const
void add(etiss::uint64 time_ps, unsigned errorid, std::string register_, etiss::uintMax xor_, etiss::uintMax and_=(etiss::uintMax)(etiss::intMax) -1, etiss::uintMax or_=0)
schedule an error
std::list< Error > errors_
virtual etiss::int32 execute()
call to apply errors
virtual void init(ETISS_CPU *cpu, ETISS_System *system, CPUArch *arch)
this function is called before the plugin is used in the cpu execution loop (etiss::CPUCore::execute)...
virtual void cleanup()
this function is called after cpu execution loop (etiss::CPUCore::execute) finished.
etiss::uint64 next_time_ps
void parseFile(std::string filename, std::string reg)
reads a file and adds the errors.
MM_EXPORT const int32_t NOERROR
void log(Verbosity level, std::string msg)
write log message at the given level.
int printf(__constant const char *st,...) __attribute__((format(printf
basic cpu state structure needed for execution of any cpu architecture.
etiss_uint64 cpuTime_ps
simulation time of cpu
memory access and time synchronization functions.