59 throw "wrong action type";
70 std::string(
", command=") + command + std::string(
") called. "));
74 : type_(BITFLIP), inj_(inj), field_(field), bit_(bit)
77 std::string(
", field=") + field + std::string(
", bit=") + std::to_string(bit) +
78 std::string(
") called. "));
84 std::string(
"etiss::fault::Action::Action(Fault &=") + fault.
toString() + std::string(
") called. "));
119 throw "Action doesn't have the type INJECTION: cannot call getFault()";
126 doc.
load(
"<?xml version=\"1.0\"?>");
128 etiss::fault::xml::Diagnostics diag;
130 etiss::fault::xml::write<etiss::fault::Action>(doc.
append_child(
"action"), *
this, diag);
132 std::stringstream ss;
146 std::string(
", Diagnostics) called. "));
149 if (!parse_attr(node,
"type",
type, diag))
151 diag.unexpectedNode(node,
"Failed to parse type of action");
160 else if (
type ==
"BITFLIP")
163 if (!
etiss::cfg().get<bool>(
"faultInjection::allowBitFlip",
true))
165 if (!parse<etiss::fault::InjectorAddress>(findSingleNode(node,
"injector", diag), inj, diag))
167 diag.unexpectedNode(node,
"Failed to parse target injector");
171 if (!parse<std::string>(findSingleNode(node,
"field", diag), field, diag))
173 diag.unexpectedNode(node,
"Failed to parse target field");
178 if (!parse<unsigned>(findSingleNode(node,
"bit", diag), bit, diag))
180 diag.unexpectedNode(node,
"Failed to parse target bit");
183 f = Action(inj, field, bit);
186 else if (
type ==
"COMMAND")
189 if (!parse<etiss::fault::InjectorAddress>(findSingleNode(node,
"injector", diag), inj, diag))
191 diag.unexpectedNode(node,
"Failed to parse target injector");
195 if (!parse<std::string>(findSingleNode(node,
"command", diag), command, diag))
197 diag.unexpectedNode(node,
"Failed to parse target command");
200 f = Action(inj, command);
203 else if (
type ==
"INJECTION")
206 if (!parse<Fault>(findSingleNode(node,
"fault", diag), inj, diag))
208 diag.unexpectedNode(node,
"Failed to parse fault to inject");
216 diag.unexpectedNode(node, std::string(
"Unknown type of action: ") +
type);
225 std::string(
", Diagnostics) called. "));
230 return write_attr<std::string>(node,
"type",
"NOP", diag);
233 ok = ok & write_attr<std::string>(node,
"type",
"BITFLIP", diag);
239 ok = ok & write_attr<std::string>(node,
"type",
"COMMAND", diag);
243 ok = ok & write_attr<std::string>(node,
"type",
"INJECTION", diag);
contains an action class that describes actions associated with a fault
std::vector< Fault > fault_
for other injections
const InjectorAddress & getInjectorAddress() const
@ BITFLIP
applies a bit flip to a bit in a specified field
@ INJECTION
an action that injects a fault definition (trigger + actions)
@ NOP
NO Operation. used by default constructor.
@ COMMAND
commands are targetet at Injectors, not fields.
unsigned bit_
concerning Bit (for fault injection)
std::string toString() const
operator<< can be used.
std::string command_
command e.g. for booting OR1KVCPU
const std::string & getCommand() const
COMMAND only.
const std::string & getTargetField() const
BITFLIP only.
Type type_
type of the Attribute
std::string field_
concerning Field (for fault injection)
const Fault & getFault() const
INJECTION only.
unsigned getTargetBit() const
BITFLIP only.
std::string toString() const
operator<< can be used.
const std::string & getInjectorPath() const
xml_parse_result load(std::basic_istream< char, std::char_traits< char > > &stream, unsigned int options=parse_default, xml_encoding encoding=encoding_auto)
void save(xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, xml_encoding encoding=encoding_auto) const
xml_node append_child(xml_node_type type=node_element)
void setCoreName(std::string &str)
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Configuration & cfg(const std::string &cfgName)
Get reference of the global ETISS configuration object.
void log(Verbosity level, std::string msg)
write log message at the given level.