#define IS_CPU_TIC3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33)
#define IS_CPU_TIC4X(v) ((v) == 0 || (v) == 40 || (v) == 44)
#define EXTR(inst, m, l) ((inst) << (31 - (m)) >> (31 - ((m) - (l))))
#define EXTRU(inst, m, l) EXTR ((unsigned long)(inst), (m), (l))
#define EXTRS(inst, m, l) EXTR ((long)(inst), (m), (l))
#define INSERTU(inst, val, m, l) (inst |= ((val) << (l)))
#define INSERTS(inst, val, m, l) INSERTU (inst, ((val) & ((1 << ((m) - (l) + 1)) - 1)), m, l)
typedef enum
{
REG_R0, REG_R1, REG_R2, REG_R3,
REG_R4, REG_R5, REG_R6, REG_R7,
REG_AR0, REG_AR1, REG_AR2, REG_AR3,
REG_AR4, REG_AR5, REG_AR6, REG_AR7,
REG_DP, REG_IR0, REG_IR1, REG_BK,
REG_SP, REG_ST, REG_DIE, REG_IIE,
REG_IIF, REG_RS, REG_RE, REG_RC,
REG_R8, REG_R9, REG_R10, REG_R11,
REG_IVTP, REG_TVTP
}
c4x_reg_t;
#define REG_IE REG_DIE
#define REG_IF REG_IIE
#define REG_IOF REG_IIF
#define TIC3X_REG_MAX REG_RC
#define TIC4X_REG_MAX REG_TVTP
#define REG_TABLE_SIZE (TIC4X_REG_MAX + 1)
struct tic4x_register
{
char * name;
unsigned long regno;
};
typedef struct tic4x_register tic4x_register_t;
static const tic4x_register_t tic3x_registers[] =
{
{"f0", REG_R0},
{"r0", REG_R0},
{"f1", REG_R1},
{"r1", REG_R1},
{"f2", REG_R2},
{"r2", REG_R2},
{"f3", REG_R3},
{"r3", REG_R3},
{"f4", REG_R4},
{"r4", REG_R4},
{"f5", REG_R5},
{"r5", REG_R5},
{"f6", REG_R6},
{"r6", REG_R6},
{"f7", REG_R7},
{"r7", REG_R7},
{"ar0", REG_AR0},
{"ar1", REG_AR1},
{"ar2", REG_AR2},
{"ar3", REG_AR3},
{"ar4", REG_AR4},
{"ar5", REG_AR5},
{"ar6", REG_AR6},
{"ar7", REG_AR7},
{"dp", REG_DP},
{"ir0", REG_IR0},
{"ir1", REG_IR1},
{"bk", REG_BK},
{"sp", REG_SP},
{"st", REG_ST},
{"ie", REG_IE},
{"if", REG_IF},
{"iof", REG_IOF},
{"rs", REG_RS},
{"re", REG_RE},
{"rc", REG_RC},
{"", 0}
};
const unsigned int tic3x_num_registers = (((sizeof tic3x_registers) / (sizeof tic3x_registers[0])) - 1);
static const tic4x_register_t tic4x_registers[] =
{
{"die", REG_DIE},
{"iie", REG_IIE},
{"iif", REG_IIF},
{"f8", REG_R8},
{"r8", REG_R8},
{"f9", REG_R9},
{"r9", REG_R9},
{"f10", REG_R10},
{"r10", REG_R10},
{"f11", REG_R11},
{"r11", REG_R11},
{"ivtp", REG_IVTP},
{"tvtp", REG_TVTP},
{"", 0}
};
const unsigned int tic4x_num_registers = (((sizeof tic4x_registers) / (sizeof tic4x_registers[0])) - 1);
struct tic4x_cond
{
char * name;
unsigned long cond;
};
typedef struct tic4x_cond tic4x_cond_t;
static const tic4x_cond_t tic4x_conds[] =
{
{ "u", 0x00 },
{ "c", 0x01 }, { "lo", 0x01 },
{ "ls", 0x02 },
{ "hi", 0x03 },
{ "nc", 0x04 }, { "hs", 0x04 },
{ "z", 0x05 }, { "eq", 0x05 },
{ "nz", 0x06 }, { "ne", 0x06 },
{ "n", 0x07 }, { "l", 0x07 }, { "lt", 0x07 },
{ "le", 0x08 },
{ "p", 0x09 }, { "gt", 0x09 },
{ "nn", 0x0a }, { "ge", 0x0a },
{ "nv", 0x0c },
{ "v", 0x0d },
{ "nuf", 0x0e },
{ "uf", 0x0f },
{ "nlv", 0x10 },
{ "lv", 0x11 },
{ "nluf", 0x12 },
{ "luf", 0x13 },
{ "zuf", 0x14 },
{ "", 0x0}
};
const unsigned int tic4x_num_conds = (((sizeof tic4x_conds) / (sizeof tic4x_conds[0])) - 1);
struct tic4x_indirect
{
char * name;
unsigned long modn;
};
typedef struct tic4x_indirect tic4x_indirect_t;
static const tic4x_indirect_t tic4x_indirects[] =
{
{ "*+a(d)", 0x00 },
{ "*-a(d)", 0x01 },
{ "*++a(d)", 0x02 },
{ "*--a(d)", 0x03 },
{ "*a++(d)", 0x04 },
{ "*a--(d)", 0x05 },
{ "*a++(d)%", 0x06 },
{ "*a--(d)%", 0x07 },
{ "*+a(y)", 0x08 },
{ "*-a(y)", 0x09 },
{ "*++a(y)", 0x0a },
{ "*--a(y)", 0x0b },
{ "*a++(y)", 0x0c },
{ "*a--(y)", 0x0d },
{ "*a++(y)%", 0x0e },
{ "*a--(y)%", 0x0f },
{ "*+a(z)", 0x10 },
{ "*-a(z)", 0x11 },
{ "*++a(z)", 0x12 },
{ "*--a(z)", 0x13 },
{ "*a++(z)", 0x14 },
{ "*a--(z)", 0x15 },
{ "*a++(z)%", 0x16 },
{ "*a--(z)%", 0x17 },
{ "*a", 0x18 },
{ "*a++(y)b", 0x19 },
{ "", 0x0}
};
#define TIC3X_MODN_MAX 0x19
const unsigned int tic4x_num_indirects = (((sizeof tic4x_indirects) / (sizeof tic4x_indirects[0])) - 1);
struct tic4x_inst
{
char * name;
unsigned long opcode;
unsigned long opmask;
char * args;
unsigned long oplevel;
};
typedef struct tic4x_inst tic4x_inst_t;
#define TIC4X_OPERANDS_MAX 7
#define TIC4X_NAME_MAX 16
#define OP_C3X 0x1
#define OP_C4X 0x2
#define OP_ENH 0x4
#define OP_LPWR 0x8
#define OP_IDLE2 0x10
#define A_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q;R", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,R", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,R", level }, \
{ name, opcode|0x00600000, 0xffe00000, "S,R", level }
#define AB_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x40000000, 0xf0600000, "Q;R", level }, \
{ name, opcode|0x40200000, 0xf0600000, "@,R", level }, \
{ name, opcode|0x40400000, 0xf0600000, "*,R", level }, \
{ name, opcode|0x40600000, 0xf0600000, "S,R", level }
#define AU_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q;R", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,R", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,R", level }, \
{ name, opcode|0x00600000, 0xffe00000, "U,R", level }
#define AF_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "q;R", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,R", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,R", level }, \
{ name, opcode|0x00600000, 0xffe00000, "F,R", level }
#define A2_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*", level }, \
{ name, opcode|0x00000000, 0xffe00000, "" , level }
#define A3_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffff0000, "Q", level }, \
{ name, opcode|0x00200000, 0xffff0000, "@", level }, \
{ name, opcode|0x00400000, 0xffff0000, "*", level }, \
{ name, opcode|0x00600000, 0xffff0000, "U", level }
#define A6_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00200000, 0xffe00000, "@,R", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,R", level }
#define A7_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00200000, 0xffe00000, "R,@", level }, \
{ name, opcode|0x00400000, 0xffe00000, "R,*", level }
#define AY_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q,Y", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,Y", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,Y", level }, \
{ name, opcode|0x00600000, 0xffe00000, "S,Y", level }
#define B_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "q;r", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,r", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,r", level }, \
{ name, opcode|0x00600000, 0xffe00000, "F,r", level }
#define BA_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q;r", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,r", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,r", level }, \
{ name, opcode|0x00600000, 0xffe00000, "F,r", level }
#define BB_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x40000000, 0xf0600000, "q;r", level }, \
{ name, opcode|0x40200000, 0xf0600000, "@,r", level }, \
{ name, opcode|0x40400000, 0xf0600000, "*,r", level }, \
{ name, opcode|0x40600000, 0xf0600000, "F,r", level }
#define BI_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00000000, 0xffe00000, "Q;r", level }, \
{ name, opcode|0x00200000, 0xffe00000, "@,r", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,r", level }, \
{ name, opcode|0x00600000, 0xffe00000, "S,r", level }
#define B6_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00200000, 0xffe00000, "@,r", level }, \
{ name, opcode|0x00400000, 0xffe00000, "*,r", level }
#define B7_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x00200000, 0xffe00000, "r,@", level }, \
{ name, opcode|0x00400000, 0xffe00000, "r,*", level }
#define D_CLASS_INSN(name1, name2, opcode, level) \
{ name1, opcode|0x00000000, 0xfe200000, "A,Q", level }, \
{ name1, opcode|0x02000000, 0xfe200000, "A,P", level }, \
{ name2, opcode|0x00000000, 0xfe200000, "A,Q", level }, \
{ name2, opcode|0x02000000, 0xfe200000, "A,P", level }
#define J_CLASS_INSN(name1, name2, opcode, level) \
{ name1, opcode|0x00000000, 0xffe00000, "Q", level }, \
{ name1, opcode|0x02000000, 0xffe00000, "P", level }, \
{ name2, opcode|0x00000000, 0xffe00000, "Q", level }, \
{ name2, opcode|0x02000000, 0xffe00000, "P", level }
#define LL_CLASS_INSN(name, opcode, level) \
{ name "_" name , opcode, 0xfe000000, "i;L|J,K", level }, \
{ name "2_" name "1", opcode, 0xfe000000, "i;L|J,K", level }, \
{ name "1_" name "2", opcode, 0xfe000000, "J,K|i;L", level }
#define LS_CLASS_INSN(name, opcode, level) \
{ name "_" name , opcode, 0xfe000000, "L;i|H,J", level }, \
{ name "2_" name "1", opcode, 0xfe000000, "L;i|H,J", level }, \
{ name "1_" name "2", opcode, 0xfe000000, "H,J|L;i", level }
#define M_CLASS_INSN(namea, nameb, opcode, level) \
{ namea "_" nameb, opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \
{ namea "_" nameb, opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \
{ namea "_" nameb, opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \
{ namea "_" nameb, opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \
{ namea "_" nameb, opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \
{ namea "_" nameb, opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \
{ namea "3_" nameb, opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \
{ namea "3_" nameb, opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \
{ namea "3_" nameb, opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \
{ namea "3_" nameb, opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \
{ namea "3_" nameb, opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \
{ namea "3_" nameb, opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \
{ namea "_" nameb "3", opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \
{ namea "_" nameb "3", opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \
{ namea "_" nameb "3", opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \
{ namea "_" nameb "3", opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \
{ namea "_" nameb "3", opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \
{ namea "_" nameb "3", opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \
{ namea "3_" nameb "3", opcode|0x00000000, 0xff000000, "i;j;N|H;K;M", level }, \
{ namea "3_" nameb "3", opcode|0x01000000, 0xff000000, "j;K;N|H;i;M", level }, \
{ namea "3_" nameb "3", opcode|0x01000000, 0xff000000, "K;j;N|H;i;M", level }, \
{ namea "3_" nameb "3", opcode|0x02000000, 0xff000000, "H;K;N|i;j;M", level }, \
{ namea "3_" nameb "3", opcode|0x03000000, 0xff000000, "j;K;N|i;H;M", level }, \
{ namea "3_" nameb "3", opcode|0x03000000, 0xff000000, "K;j;N|i;H;M", level }, \
{ nameb "_" namea, opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \
{ nameb "_" namea, opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \
{ nameb "_" namea, opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \
{ nameb "_" namea, opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \
{ nameb "_" namea, opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \
{ nameb "_" namea, opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \
{ nameb "3_" namea, opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \
{ nameb "3_" namea, opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \
{ nameb "3_" namea, opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \
{ nameb "3_" namea, opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \
{ nameb "3_" namea, opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \
{ nameb "3_" namea, opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \
{ nameb "_" namea "3", opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \
{ nameb "_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \
{ nameb "_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \
{ nameb "_" namea "3", opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \
{ nameb "_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \
{ nameb "_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }, \
{ nameb "3_" namea "3", opcode|0x00000000, 0xff000000, "H;K;M|i;j;N", level }, \
{ nameb "3_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|j;K;N", level }, \
{ nameb "3_" namea "3", opcode|0x01000000, 0xff000000, "H;i;M|K;j;N", level }, \
{ nameb "3_" namea "3", opcode|0x02000000, 0xff000000, "i;j;M|H;K;N", level }, \
{ nameb "3_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|j;K;N", level }, \
{ nameb "3_" namea "3", opcode|0x03000000, 0xff000000, "i;H;M|K;j;N", level }
#define P_CLASS_INSN(namea, nameb, opcode, level) \
{ namea "_" nameb, opcode, 0xfe000000, "i;L|H,J", level }, \
{ nameb "_" namea, opcode, 0xfe000000, "H,J|i;L", level }
#define Q_CLASS_INSN(namea, nameb, opcode, level) \
{ namea "_" nameb , opcode, 0xfe000000, "K,i;L|H,J", level }, \
{ nameb "_" namea , opcode, 0xfe000000, "H,J|K,i;L", level }, \
{ namea "3_" nameb , opcode, 0xfe000000, "K,i;L|H,J", level }, \
{ nameb "_" namea "3", opcode, 0xfe000000, "H,J|K,i;L", level }
#define QC_CLASS_INSN(namea, nameb, opcode, level) \
{ namea "_" nameb , opcode, 0xfe000000, "i;K;L|H,J", level }, \
{ namea "_" nameb , opcode, 0xfe000000, "K;i;L|H,J", level }, \
{ nameb "_" namea , opcode, 0xfe000000, "H,J|i;K;L", level }, \
{ nameb "_" namea , opcode, 0xfe000000, "H,J|K;i;L", level }, \
{ namea "3_" nameb , opcode, 0xfe000000, "i;K;L|H,J", level }, \
{ namea "3_" nameb , opcode, 0xfe000000, "K;i;L|H,J", level }, \
{ nameb "_" namea "3", opcode, 0xfe000000, "H,J|i;K;L", level }, \
{ nameb "_" namea "3", opcode, 0xfe000000, "H,J|K;i;L", level }
#define R_CLASS_INSN(name, opcode, level) \
{ name, opcode, 0xffe0ffff, "R", level }
#define RF_CLASS_INSN(name, opcode, level) \
{ name, opcode, 0xffe0ffff, "r", level }
#define S_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "e,g;r", level }, \
{ name, opcode|0x20200000, 0xffe00000, "e,J,r", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,g;r", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J,r", level }, \
{ name, opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "e,g;r", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "e,J,r", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,g;r", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J,r", level }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }
#define SC_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "e,g;r", level }, \
{ name, opcode|0x20200000, 0xffe00000, "e,J,r", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,g;r", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J,r", level }, \
{ name, opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "g,C,r", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "e,g;r", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "e,J,r", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,g;r", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J,r", level }, \
{ name "3", opcode|0x30200000, 0xffe00000, "g,C,r", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,g;r", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O,r", OP_C4X }
#define S2_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "e,g", level }, \
{ name, opcode|0x20200000, 0xffe00000, "e,J", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,g", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name, opcode|0x30200000, 0xffe00000, "C,g", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "e,g", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "e,J", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,g", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,g", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }
#define T_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "E,G;R", level }, \
{ name, opcode|0x20200000, 0xffe00000, "E,J,R", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,G;R", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J,R", level }, \
{ name, opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "E,G;R", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "E,J,R", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,G;R", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J,R", level }, \
{ name "3", opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }
#define TC_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "E,G;R", level }, \
{ name, opcode|0x20200000, 0xffe00000, "E,J,R", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,G;R", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J,R", level }, \
{ name, opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \
{ name, opcode|0x30000000, 0xffe00000, "G,W,R", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "G,C,R", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "O,W,R", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "E,G;R", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "E,J,R", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,G;R", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J,R", level }, \
{ name "3", opcode|0x30000000, 0xffe00000, "W,G;R", OP_C4X }, \
{ name "3", opcode|0x30000000, 0xffe00000, "G,W,R", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,G;R", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "G,C,R", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "W,O,R", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "O,W,R", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O,R", OP_C4X }
#define T2_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "E,G", level }, \
{ name, opcode|0x20200000, 0xffe00000, "E,J", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,G", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name, opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "E,G", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "E,J", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,G", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name "3", opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }
#define T2C_CLASS_INSN(name, opcode, level) \
{ name, opcode|0x20000000, 0xffe00000, "E,G", level }, \
{ name, opcode|0x20200000, 0xffe00000, "E,J", level }, \
{ name, opcode|0x20400000, 0xffe00000, "I,G", level }, \
{ name, opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name, opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \
{ name, opcode|0x30000000, 0xffe00000, "G,W", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \
{ name, opcode|0x30200000, 0xffe00000, "G,C", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \
{ name, opcode|0x30400000, 0xffe00000, "O,W", OP_C4X }, \
{ name, opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }, \
{ name "3", opcode|0x20000000, 0xffe00000, "E,G", level }, \
{ name "3", opcode|0x20200000, 0xffe00000, "E,J", level }, \
{ name "3", opcode|0x20400000, 0xffe00000, "I,G", level }, \
{ name "3", opcode|0x20600000, 0xffe00000, "I,J", level }, \
{ name "3", opcode|0x30000000, 0xffe00000, "W,G", OP_C4X }, \
{ name "3", opcode|0x30000000, 0xffe00000, "G,W", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "C,G", OP_C4X }, \
{ name "3", opcode|0x30200000, 0xffe00000, "G,C", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "W,O", OP_C4X }, \
{ name "3", opcode|0x30400000, 0xffe00000, "O,W", OP_C4X }, \
{ name "3", opcode|0x30600000, 0xffe00000, "C,O", OP_C4X }
static const tic4x_inst_t tic4x_insts[] =
{
B_CLASS_INSN( "absf", 0x00000000, OP_C3X ),
P_CLASS_INSN( "absf", "stf", 0xc8000000, OP_C3X ),
A_CLASS_INSN( "absi", 0x00800000, OP_C3X ),
P_CLASS_INSN( "absi", "sti", 0xca000000, OP_C3X ),
A_CLASS_INSN( "addc", 0x01000000, OP_C3X ),
TC_CLASS_INSN( "addc", 0x00000000, OP_C3X ),
B_CLASS_INSN( "addf", 0x01800000, OP_C3X ),
SC_CLASS_INSN( "addf", 0x00800000, OP_C3X ),
QC_CLASS_INSN( "addf", "stf", 0xcc000000, OP_C3X ),
A_CLASS_INSN( "addi", 0x02000000, OP_C3X ),
TC_CLASS_INSN( "addi", 0x01000000, OP_C3X ),
QC_CLASS_INSN( "addi", "sti", 0xce000000, OP_C3X ),
AU_CLASS_INSN( "and", 0x02800000, OP_C3X ),
TC_CLASS_INSN( "and", 0x01800000, OP_C3X ),
QC_CLASS_INSN( "and", "sti", 0xd0000000, OP_C3X ),
AU_CLASS_INSN( "andn", 0x03000000, OP_C3X ),
T_CLASS_INSN( "andn", 0x02000000, OP_C3X ),
A_CLASS_INSN( "ash", 0x03800000, OP_C3X ),
T_CLASS_INSN( "ash", 0x02800000, OP_C3X ),
Q_CLASS_INSN( "ash", "sti", 0xd2000000, OP_C3X ),
J_CLASS_INSN( "bB", "b", 0x68000000, OP_C3X ),
J_CLASS_INSN( "bBd", "bd", 0x68200000, OP_C3X ),
J_CLASS_INSN( "bBaf", "baf", 0x68a00000, OP_C4X ),
J_CLASS_INSN( "bBat", "bat", 0x68600000, OP_C4X ),
{ "br", 0x60000000, 0xff000000, "B" , OP_C3X },
{ "brd", 0x61000000, 0xff000000, "B" , OP_C3X },
{ "call", 0x62000000, 0xff000000, "B" , OP_C3X },
{ "callB", 0x70000000, 0xffe00000, "Q" , OP_C3X },
{ "callB", 0x72000000, 0xffe00000, "P" , OP_C3X },
B_CLASS_INSN( "cmpf", 0x04000000, OP_C3X ),
S2_CLASS_INSN( "cmpf", 0x03000000, OP_C3X ),
A_CLASS_INSN( "cmpi", 0x04800000, OP_C3X ),
T2_CLASS_INSN( "cmpi", 0x03800000, OP_C3X ),
D_CLASS_INSN( "dbB", "db", 0x6c000000, OP_C3X ),
D_CLASS_INSN( "dbBd", "dbd", 0x6c200000, OP_C3X ),
AF_CLASS_INSN( "fix", 0x05000000, OP_C3X ),
P_CLASS_INSN( "fix", "sti", 0xd4000000, OP_C3X ),
BI_CLASS_INSN( "float", 0x05800000, OP_C3X ),
P_CLASS_INSN( "float", "stf", 0xd6000000, OP_C3X ),
B6_CLASS_INSN( "frieee", 0x1c000000, OP_C4X ),
P_CLASS_INSN( "frieee","stf", 0xf2000000, OP_C4X ),
{ "iack", 0x1b200000, 0xffe00000, "@" , OP_C3X },
{ "iack", 0x1b400000, 0xffe00000, "*" , OP_C3X },
{ "idle", 0x06000000, 0xffffffff, "" , OP_C3X },
{ "idlez", 0x06000000, 0xffffffff, "" , OP_C3X },
{ "idle2", 0x06000001, 0xffffffff, "" , OP_IDLE2 },
{ "laj", 0x63000000, 0xff000000, "B" , OP_C4X },
{ "lajB", 0x70200000, 0xffe00000, "Q" , OP_C4X },
{ "lajB", 0x72200000, 0xffe00000, "P" , OP_C4X },
{ "latB", 0x74800000, 0xffe00000, "V" , OP_C4X },
A_CLASS_INSN( "lb0", 0xb0000000, OP_C4X ),
A_CLASS_INSN( "lb1", 0xb0800000, OP_C4X ),
A_CLASS_INSN( "lb2", 0xb1000000, OP_C4X ),
A_CLASS_INSN( "lb3", 0xb1800000, OP_C4X ),
AU_CLASS_INSN( "lbu0", 0xb2000000, OP_C4X ),
AU_CLASS_INSN( "lbu1", 0xb2800000, OP_C4X ),
AU_CLASS_INSN( "lbu2", 0xb3000000, OP_C4X ),
AU_CLASS_INSN( "lbu3", 0xb3800000, OP_C4X ),
AY_CLASS_INSN( "lda", 0x1e800000, OP_C4X ),
B_CLASS_INSN( "lde", 0x06800000, OP_C3X ),
{ "ldep", 0x76000000, 0xffe00000, "X,R" , OP_C4X },
B_CLASS_INSN( "ldf", 0x07000000, OP_C3X ),
LL_CLASS_INSN( "ldf", 0xc4000000, OP_C3X ),
P_CLASS_INSN( "ldf", "stf", 0xd8000000, OP_C3X ),
BB_CLASS_INSN( "ldfC", 0x00000000, OP_C3X ),
B6_CLASS_INSN( "ldfi", 0x07800000, OP_C3X ),
{ "ldhi", 0x1fe00000, 0xffe00000, "U,R" , OP_C4X },
{ "ldhi", 0x1fe00000, 0xffe00000, "#,R" , OP_C4X },
A_CLASS_INSN( "ldi", 0x08000000, OP_C3X ),
LL_CLASS_INSN( "ldi", 0xc6000000, OP_C3X ),
P_CLASS_INSN( "ldi", "sti", 0xda000000, OP_C3X ),
AB_CLASS_INSN( "ldiC", 0x10000000, OP_C3X ),
A6_CLASS_INSN( "ldii", 0x08800000, OP_C3X ),
{ "ldp", 0x50700000, 0xffff0000, "#" , OP_C3X },
B_CLASS_INSN( "ldm", 0x09000000, OP_C3X ),
{ "ldpe", 0x76800000, 0xffe00000, "Q,Z" , OP_C4X },
{ "ldpk", 0x1F700000, 0xffff0000, "#" , OP_C4X },
A_CLASS_INSN( "lh0", 0xba000000, OP_C4X ),
A_CLASS_INSN( "lh1", 0xba800000, OP_C4X ),
AU_CLASS_INSN( "lhu0", 0xbb000000, OP_C4X ),
AU_CLASS_INSN( "lhu1", 0xbb800000, OP_C4X ),
{ "lopower", 0x10800001,0xffffffff, "" , OP_LPWR },
A_CLASS_INSN( "lsh", 0x09800000, OP_C3X ),
T_CLASS_INSN( "lsh", 0x04000000, OP_C3X ),
Q_CLASS_INSN( "lsh", "sti", 0xdc000000, OP_C3X ),
A_CLASS_INSN( "lwl0", 0xb4000000, OP_C4X ),
A_CLASS_INSN( "lwl1", 0xb4800000, OP_C4X ),
A_CLASS_INSN( "lwl2", 0xb5000000, OP_C4X ),
A_CLASS_INSN( "lwl3", 0xb5800000, OP_C4X ),
A_CLASS_INSN( "lwr0", 0xb6000000, OP_C4X ),
A_CLASS_INSN( "lwr1", 0xb6800000, OP_C4X ),
A_CLASS_INSN( "lwr2", 0xb7000000, OP_C4X ),
A_CLASS_INSN( "lwr3", 0xb7800000, OP_C4X ),
{ "maxspeed",0x10800000,0xffffffff, "" , OP_LPWR },
A_CLASS_INSN( "mb0", 0xb8000000, OP_C4X ),
A_CLASS_INSN( "mb1", 0xb8800000, OP_C4X ),
A_CLASS_INSN( "mb2", 0xb9000000, OP_C4X ),
A_CLASS_INSN( "mb3", 0xb9800000, OP_C4X ),
A_CLASS_INSN( "mh0", 0xbc000000, OP_C4X ),
A_CLASS_INSN( "mh1", 0xbc800000, OP_C4X ),
A_CLASS_INSN( "mh2", 0xbd000000, OP_C4X ),
A_CLASS_INSN( "mh3", 0xbd800000, OP_C4X ),
B_CLASS_INSN( "mpyf", 0x0a000000, OP_C3X ),
SC_CLASS_INSN( "mpyf", 0x04800000, OP_C3X ),
M_CLASS_INSN( "mpyf", "addf", 0x80000000, OP_C3X ),
QC_CLASS_INSN( "mpyf", "stf", 0xde000000, OP_C3X ),
M_CLASS_INSN( "mpyf", "subf", 0x84000000, OP_C3X ),
A_CLASS_INSN( "mpyi", 0x0a800000, OP_C3X ),
TC_CLASS_INSN( "mpyi", 0x05000000, OP_C3X ),
M_CLASS_INSN( "mpyi", "addi", 0x88000000, OP_C3X ),
QC_CLASS_INSN( "mpyi", "sti", 0xe0000000, OP_C3X ),
M_CLASS_INSN( "mpyi", "subi", 0x8c000000, OP_C3X ),
A_CLASS_INSN( "mpyshi", 0x1d800000, OP_C4X ),
TC_CLASS_INSN( "mpyshi", 0x28800000, OP_C4X ),
A_CLASS_INSN( "mpyuhi", 0x1e000000, OP_C4X ),
TC_CLASS_INSN( "mpyuhi", 0x29000000, OP_C4X ),
A_CLASS_INSN( "negb", 0x0b000000, OP_C3X ),
B_CLASS_INSN( "negf", 0x0b800000, OP_C3X ),
P_CLASS_INSN( "negf", "stf", 0xe2000000, OP_C3X ),
A_CLASS_INSN( "negi", 0x0c000000, OP_C3X ),
P_CLASS_INSN( "negi", "sti", 0xe4000000, OP_C3X ),
A2_CLASS_INSN( "nop", 0x0c800000, OP_C3X ),
B_CLASS_INSN( "norm", 0x0d000000, OP_C3X ),
AU_CLASS_INSN( "not", 0x0d800000, OP_C3X ),
P_CLASS_INSN( "not", "sti", 0xe6000000, OP_C3X ),
AU_CLASS_INSN( "or", 0x10000000, OP_C3X ),
TC_CLASS_INSN( "or", 0x05800000, OP_C3X ),
QC_CLASS_INSN( "or", "sti", 0xe8000000, OP_C3X ),
R_CLASS_INSN( "pop", 0x0e200000, OP_C3X ),
RF_CLASS_INSN( "popf", 0x0ea00000, OP_C3X ),
R_CLASS_INSN( "push", 0x0f200000, OP_C3X ),
RF_CLASS_INSN( "pushf", 0x0fa00000, OP_C3X ),
BA_CLASS_INSN( "rcpf", 0x1d000000, OP_C4X ),
{ "retiB", 0x78000000, 0xffe00000, "" , OP_C3X },
{ "reti", 0x78000000, 0xffe00000, "" , OP_C3X },
{ "retiBd", 0x78200000, 0xffe00000, "" , OP_C4X },
{ "retid", 0x78200000, 0xffe00000, "" , OP_C4X },
{ "retsB", 0x78800000, 0xffe00000, "" , OP_C3X },
{ "rets", 0x78800000, 0xffe00000, "" , OP_C3X },
B_CLASS_INSN( "rnd", 0x11000000, OP_C3X ),
R_CLASS_INSN( "rol", 0x11e00001, OP_C3X ),
R_CLASS_INSN( "rolc", 0x12600001, OP_C3X ),
R_CLASS_INSN( "ror", 0x12e0ffff, OP_C3X ),
R_CLASS_INSN( "rorc", 0x1360ffff, OP_C3X ),
{ "rptb", 0x64000000, 0xff000000, "B" , OP_C3X },
{ "rptb", 0x79000000, 0xff000000, "Q" , OP_C4X },
{ "rptbd", 0x65000000, 0xff000000, "B" , OP_C4X },
{ "rptbd", 0x79800000, 0xff000000, "Q" , OP_C4X },
A3_CLASS_INSN( "rpts", 0x139b0000, OP_C3X ),
B_CLASS_INSN( "rsqrf", 0x1c800000, OP_C4X ),
{ "sigi", 0x16000000, 0xffe00000, "" , OP_C3X },
A6_CLASS_INSN( "sigi", 0x16000000, OP_C4X ),
B7_CLASS_INSN( "stf", 0x14000000, OP_C3X ),
LS_CLASS_INSN( "stf", 0xc0000000, OP_C3X ),
B7_CLASS_INSN( "stfi", 0x14800000, OP_C3X ),
A7_CLASS_INSN( "sti", 0x15000000, OP_C3X ),
{ "sti", 0x15000000, 0xffe00000, "T,@" , OP_C4X },
{ "sti", 0x15600000, 0xffe00000, "T,*" , OP_C4X },
LS_CLASS_INSN( "sti", 0xc2000000, OP_C3X ),
A7_CLASS_INSN( "stii", 0x15800000, OP_C3X ),
{ "stik", 0x15000000, 0xffe00000, "T,@" , OP_C4X },
{ "stik", 0x15600000, 0xffe00000, "T,*" , OP_C4X },
A_CLASS_INSN( "subb", 0x16800000, OP_C3X ),
T_CLASS_INSN( "subb", 0x06000000, OP_C3X ),
A_CLASS_INSN( "subc", 0x17000000, OP_C3X ),
B_CLASS_INSN( "subf", 0x17800000, OP_C3X ),
S_CLASS_INSN( "subf", 0x06800000, OP_C3X ),
Q_CLASS_INSN( "subf", "stf", 0xea000000, OP_C3X ),
A_CLASS_INSN( "subi", 0x18000000, OP_C3X ),
T_CLASS_INSN( "subi", 0x07000000, OP_C3X ),
Q_CLASS_INSN( "subi", "sti", 0xec000000, OP_C3X ),
A_CLASS_INSN( "subrb", 0x18800000, OP_C3X ),
B_CLASS_INSN( "subrf", 0x19000000, OP_C3X ),
A_CLASS_INSN( "subri", 0x19800000, OP_C3X ),
{ "swi", 0x66000000, 0xffffffff, "" , OP_C3X },
B_CLASS_INSN( "toieee", 0x1b800000, OP_C4X ),
P_CLASS_INSN( "toieee","stf", 0xf0000000, OP_C4X ),
{ "trapB", 0x74000000, 0xffe00000, "V" , OP_C3X },
{ "trap", 0x74000000, 0xffe00000, "V" , OP_C3X },
AU_CLASS_INSN( "tstb", 0x1a000000, OP_C3X ),
T2C_CLASS_INSN("tstb", 0x07800000, OP_C3X ),
AU_CLASS_INSN( "xor", 0x1a800000, OP_C3X ),
TC_CLASS_INSN( "xor", 0x08000000, OP_C3X ),
QC_CLASS_INSN( "xor", "sti", 0xee000000, OP_C3X ),
{ "", 0x0, 0x00, "", 0 }
};
const unsigned int tic4x_num_insts = (((sizeof tic4x_insts) / (sizeof tic4x_insts[0])) - 1);