summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/uml.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/uml.h')
-rw-r--r--src/devices/cpu/uml.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/devices/cpu/uml.h b/src/devices/cpu/uml.h
index cbc4a82a205..23b6b238c3e 100644
--- a/src/devices/cpu/uml.h
+++ b/src/devices/cpu/uml.h
@@ -14,6 +14,8 @@
#include "drccache.h"
+#include <algorithm>
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -50,6 +52,10 @@ namespace uml
constexpr u8 FLAG_S = 0x08; // sign flag (defined for integer only)
constexpr u8 FLAG_U = 0x10; // unordered flag (defined for FP only)
+ // flag combinations
+ constexpr u8 FLAGS_NONE = 0x00;
+ constexpr u8 FLAGS_ALL = FLAG_U | FLAG_S | FLAG_Z | FLAG_V | FLAG_C;
+
// testable conditions; note that these are defined such that (condition ^ 1) is
// always the opposite
enum condition_t
@@ -384,6 +390,9 @@ namespace uml
class instruction
{
public:
+ // constants
+ static constexpr int MAX_PARAMS = 4;
+
// construction/destruction
constexpr instruction() : m_param{ } { }
@@ -408,6 +417,22 @@ namespace uml
u8 modified_flags() const;
void simplify();
+ // operators
+ bool operator==(instruction const &that) const
+ {
+ if ((m_opcode != that.m_opcode) || (m_condition != that.m_condition) || (m_flags != that.m_flags) || (m_size != that.m_size) || (m_numparams != that.m_numparams))
+ return false;
+ auto const last = m_param + m_numparams;
+ return std::mismatch(std::begin(m_param), last, std::begin(that.m_param)).first == last;
+ }
+ bool operator!=(instruction const &that) const
+ {
+ if ((m_opcode != that.m_opcode) || (m_condition != that.m_condition) || (m_flags != that.m_flags) || (m_size != that.m_size) || (m_numparams != that.m_numparams))
+ return true;
+ auto const last = m_param + m_numparams;
+ return std::mismatch(std::begin(m_param), last, std::begin(that.m_param)).first != last;
+ }
+
// compile-time opcodes
void handle(code_handle &hand) { configure(OP_HANDLE, 4, hand); }
void hash(u32 mode, u32 pc) { configure(OP_HASH, 4, mode, pc); }
@@ -572,9 +597,6 @@ namespace uml
void fdcopyi(parameter dst, parameter src) { configure(OP_FCOPYI, 8, dst, src); }
void icopyfd(parameter dst, parameter src) { configure(OP_ICOPYF, 8, dst, src); }
- // constants
- static constexpr int MAX_PARAMS = 4;
-
private:
// internal configuration
void configure(opcode_t op, u8 size, condition_t cond = COND_ALWAYS);