ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
defines the relevant bits and their value to identify an instruction. More...
#include <Instruction.h>
Public Member Functions | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
OPCode (unsigned width, const T code, const T mask) | |
ctor that uses integral values for mask and code More... | |
OPCode (const BitArray &code, const BitArray &mask) | |
OPCode (const OPCode &cpy) | |
copy ctor More... | |
bool | operator< (const OPCode &o) const |
comparison operator for map/sets. More... | |
bool | operator== (const OPCode &o) const |
bool | operator!= (const OPCode &o) const |
Public Attributes | |
const BitArray | code_ |
const BitArray | mask_ |
defines the relevant bits and their value to identify an instruction.
e.g. l.add of the or1k architecture:
opcode: 0x38 (bit 31-25), 0x0 (bit 9-8), 0x0 (bit 3-0)
the resulting code as passed to the constructor would be: 0xE0000000 the resulting mask as passed to the constructor would be: 0xFC00030F
to simplify that procedure a simple language is provided to generate those values from a representation that is much more similar to the opcode definition in text form.
see uint32_t parse_i32(const char * s) or for a more general implementation see template <typename T> T parse_i(const char * s)
if there is c++11 support then the literal operator ""_i32 can be used instead of parse_i32()
the syntax for parse_i/parse_i32 is very simple. the number of bits is followed by an 'x' and the value represented in hex (additional bits from the hex representation are discarded). further such definitions are seperated by a space character. the definitions further to the left will be left shifted by the length of followind definitions. e.g for l.add:
uint32_t code = parse_i32("6x32 16x0 2x0 4x0 4x0"); // or parse_i32("6x32 26x0") or parse_i32("6x32 15x0 1x0 2x0 4x0 4x0") uint32_t mask = parse_i32("6xFF 16x0 2xF 4x0 4xF");
Definition at line 271 of file Instruction.h.
|
inline |
ctor that uses integral values for mask and code
width | width in bits |
Definition at line 283 of file Instruction.h.
References etiss::log(), etiss::toString(), etiss::VERBOSE, and etiss::WARNING.
Definition at line 221 of file Instruction.cpp.
References code_, etiss::ERROR, etiss::log(), mask_, and etiss::WARNING.
etiss::instr::OPCode::OPCode | ( | const OPCode & | cpy | ) |
copy ctor
Definition at line 236 of file Instruction.cpp.
Definition at line 314 of file Instruction.h.
comparison operator for map/sets.
compares mask and code to provide some sort of order. has no further meaning.
Definition at line 238 of file Instruction.cpp.
Definition at line 313 of file Instruction.h.
const BitArray etiss::instr::OPCode::code_ |
Definition at line 274 of file Instruction.h.
Referenced by OPCode(), and operator<().
const BitArray etiss::instr::OPCode::mask_ |
Definition at line 275 of file Instruction.h.
Referenced by OPCode(), and operator<().