| 1 | /////////////////////////////////////////////////////////////// |
| 2 | // File: v810_opt.h |
| 3 | // |
| 4 | // Description: Defines used in v810_dis.cpp |
| 5 | // |
| 6 | |
| 7 | #ifndef V810_OPT_H_ |
| 8 | #define V810_OPT_H_ |
| 9 | |
| 10 | #define sign_26(num) ((uint32)sign_x_to_s32(26, num)) |
| 11 | #define sign_16(num) ((uint32)(int16)(num)) |
| 12 | #define sign_14(num) ((uint32)sign_x_to_s32(14, num)) |
| 13 | #define sign_12(num) ((uint32)sign_x_to_s32(12, num)) |
| 14 | #define sign_9(num) ((uint32)sign_x_to_s32(9, num)) |
| 15 | #define sign_8(_value) ((uint32)(int8)(_value)) |
| 16 | #define sign_5(num) ((uint32)sign_x_to_s32(5, num)) |
| 17 | |
| 18 | /////////////////////////////////////////////////////////////////// |
| 19 | // Define Modes |
| 20 | #define AM_I 0x01 |
| 21 | #define AM_II 0x02 |
| 22 | #define AM_III 0x03 |
| 23 | #define AM_IV 0x04 |
| 24 | #define AM_V 0x05 |
| 25 | #define AM_VIa 0x06 // Mode6 form1 |
| 26 | #define AM_VIb 0x0A // Mode6 form2 |
| 27 | #define AM_VII 0x07 |
| 28 | #define AM_VIII 0x08 |
| 29 | #define AM_IX 0x09 |
| 30 | #define AM_BSTR 0x0B // Bit String Instructions |
| 31 | #define AM_FPP 0x0C // Floating Point Instructions |
| 32 | #define AM_UDEF 0x0D // Unknown/Undefined Instructions |
| 33 | |
| 34 | /////////////////////////////////////////////////////////////////// |
| 35 | // Table of Instructions Address Modes |
| 36 | |
| 37 | static const int addr_mode[80] = { |
| 38 | AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, |
| 39 | AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, AM_I, |
| 40 | AM_II, AM_II, AM_II, AM_II, AM_II, AM_II, AM_II, AM_II, |
| 41 | AM_II, AM_IX, AM_IX, AM_UDEF, AM_II, AM_II, AM_II, AM_BSTR, |
| 42 | AM_UDEF, AM_UDEF, AM_UDEF, AM_UDEF, AM_UDEF, AM_UDEF, AM_UDEF, AM_UDEF, |
| 43 | AM_V, AM_V, AM_IV, AM_IV, AM_V, AM_V, AM_V, AM_V, |
| 44 | AM_VIa, AM_VIa, AM_UDEF, AM_VIa, AM_VIb, AM_VIb, AM_UDEF, AM_VIb, |
| 45 | AM_VIa, AM_VIa, AM_VIa, AM_VIa, AM_VIb, AM_VIb, AM_FPP, AM_VIb, |
| 46 | AM_III, AM_III, AM_III, AM_III, AM_III, AM_III, AM_III, AM_III, |
| 47 | AM_III, AM_III, AM_III, AM_III, AM_III, AM_III, AM_III, AM_III |
| 48 | }; |
| 49 | // All instructions greater than 0x50 are undefined (this should not be posible of cource) |
| 50 | |
| 51 | |
| 52 | /////////////////////////////////////////////////////////////////// |
| 53 | // Opcodes for V810 Instruction set |
| 54 | #define MOV 0x00 |
| 55 | #define ADD 0x01 |
| 56 | #define SUB 0x02 |
| 57 | #define CMP 0x03 |
| 58 | #define SHL 0x04 |
| 59 | #define SHR 0x05 |
| 60 | #define JMP 0x06 |
| 61 | #define SAR 0x07 |
| 62 | #define MUL 0x08 |
| 63 | #define DIV 0x09 |
| 64 | #define MULU 0x0A |
| 65 | #define DIVU 0x0B |
| 66 | #define OR 0x0C |
| 67 | #define AND 0x0D |
| 68 | #define XOR 0x0E |
| 69 | #define NOT 0x0F |
| 70 | #define MOV_I 0x10 |
| 71 | #define ADD_I 0x11 |
| 72 | #define SETF 0x12 |
| 73 | #define CMP_I 0x13 |
| 74 | #define SHL_I 0x14 |
| 75 | #define SHR_I 0x15 |
| 76 | #define EI 0x16 |
| 77 | #define SAR_I 0x17 |
| 78 | #define TRAP 0x18 |
| 79 | #define RETI 0x19 |
| 80 | #define HALT 0x1A |
| 81 | //0x1B |
| 82 | #define LDSR 0x1C |
| 83 | #define STSR 0x1D |
| 84 | #define DI 0x1E |
| 85 | #define BSTR 0x1F //Special Bit String Inst |
| 86 | //0x20 - 0x27 // Lost to Branch Instructions |
| 87 | #define MOVEA 0x28 |
| 88 | #define ADDI 0x29 |
| 89 | #define JR 0x2A |
| 90 | #define JAL 0x2B |
| 91 | #define ORI 0x2C |
| 92 | #define ANDI 0x2D |
| 93 | #define XORI 0x2E |
| 94 | #define MOVHI 0x2F |
| 95 | #define LD_B 0x30 |
| 96 | #define LD_H 0x31 |
| 97 | //0x32 |
| 98 | #define LD_W 0x33 |
| 99 | #define ST_B 0x34 |
| 100 | #define ST_H 0x35 |
| 101 | //0x36 |
| 102 | #define ST_W 0x37 |
| 103 | #define IN_B 0x38 |
| 104 | #define IN_H 0x39 |
| 105 | #define CAXI 0x3A |
| 106 | #define IN_W 0x3B |
| 107 | #define OUT_B 0x3C |
| 108 | #define OUT_H 0x3D |
| 109 | #define FPP 0x3E //Special Float Inst |
| 110 | #define OUT_W 0x3F |
| 111 | |
| 112 | |
| 113 | // Branch Instructions ( Extended opcode only for Branch command) |
| 114 | // Common instrcutions commented out |
| 115 | |
| 116 | #define BV 0x40 |
| 117 | #define BL 0x41 |
| 118 | #define BE 0x42 |
| 119 | #define BNH 0x43 |
| 120 | #define BN 0x44 |
| 121 | #define BR 0x45 |
| 122 | #define BLT 0x46 |
| 123 | #define BLE 0x47 |
| 124 | #define BNV 0x48 |
| 125 | #define BNL 0x49 |
| 126 | #define BNE 0x4A |
| 127 | #define BH 0x4B |
| 128 | #define BP 0x4C |
| 129 | #define NOP 0x4D |
| 130 | #define BGE 0x4E |
| 131 | #define BGT 0x4F |
| 132 | |
| 133 | //#define BC 0x41 |
| 134 | //#define BZ 0x42 |
| 135 | //#define BNC 0x49 |
| 136 | //#define BNZ 0x4A |
| 137 | |
| 138 | // Bit String Subopcodes |
| 139 | #define SCH0BSU 0x00 |
| 140 | #define SCH0BSD 0x01 |
| 141 | #define SCH1BSU 0x02 |
| 142 | #define SCH1BSD 0x03 |
| 143 | |
| 144 | #define ORBSU 0x08 |
| 145 | #define ANDBSU 0x09 |
| 146 | #define XORBSU 0x0A |
| 147 | #define MOVBSU 0x0B |
| 148 | #define ORNBSU 0x0C |
| 149 | #define ANDNBSU 0x0D |
| 150 | #define XORNBSU 0x0E |
| 151 | #define NOTBSU 0x0F |
| 152 | |
| 153 | |
| 154 | // Floating Point Subopcodes |
| 155 | #define CMPF_S 0x00 |
| 156 | |
| 157 | #define CVT_WS 0x02 |
| 158 | #define CVT_SW 0x03 |
| 159 | #define ADDF_S 0x04 |
| 160 | #define SUBF_S 0x05 |
| 161 | #define MULF_S 0x06 |
| 162 | #define DIVF_S 0x07 |
| 163 | #define XB 0x08 |
| 164 | #define XH 0x09 |
| 165 | #define REV 0x0A |
| 166 | #define TRNC_SW 0x0B |
| 167 | #define MPYHW 0x0C |
| 168 | |
| 169 | #endif //DEFINE_H |
| 170 |