Commit | Line | Data |
---|---|---|
3f8107ab | 1 | /* Definitions for decoding the ft32 opcode table. |
2571583a | 2 | Copyright (C) 2013-2017 Free Software Foundation, Inc. |
3f8107ab AM |
3 | Contributed by FTDI (support@ftdichip.com) |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA | |
18 | 02110-1301, USA. */ | |
19 | ||
20 | typedef struct ft32_opc_info_t | |
21 | { | |
22 | const char *name; | |
23 | int dw; | |
24 | unsigned int mask; | |
25 | unsigned int bits; | |
26 | int fields; | |
27 | } ft32_opc_info_t; | |
28 | ||
29 | #define FT32_PAT_ALUOP 0x08 | |
30 | #define FT32_PAT_LDA 0x18 | |
31 | #define FT32_PAT_TOCI 0x01 | |
32 | #define FT32_PAT_CMPOP 0x0b | |
33 | #define FT32_PAT_STA 0x17 | |
34 | #define FT32_PAT_EXA 0x07 | |
35 | #define FT32_PAT_LDK 0x0c | |
36 | #define FT32_PAT_FFUOP 0x1e | |
37 | #define FT32_PAT_LDI 0x15 | |
38 | #define FT32_PAT_STI 0x16 | |
39 | #define FT32_PAT_EXI 0x1d | |
40 | #define FT32_PAT_POP 0x11 | |
41 | #define FT32_PAT_LPM 0x0d | |
42 | #define FT32_PAT_LINK 0x12 | |
43 | #define FT32_PAT_TOC 0x00 | |
44 | #define FT32_PAT_PUSH 0x10 | |
45 | #define FT32_PAT_RETURN 0x14 | |
46 | #define FT32_PAT_UNLINK 0x13 | |
47 | #define FT32_PAT_LPMI 0x19 | |
48 | ||
49 | #define FT32_FLD_CBCRCV (1 << 0) | |
50 | #define FT32_FLD_INT (1 << 1) | |
51 | #define FT32_FLD_INT_BIT 26 | |
52 | #define FT32_FLD_INT_SIZ 1 | |
53 | #define FT32_FLD_DW (1 << 2) | |
54 | #define FT32_FLD_DW_BIT 25 | |
55 | #define FT32_FLD_DW_SIZ 2 | |
56 | #define FT32_FLD_CB (1 << 3) | |
57 | #define FT32_FLD_CB_BIT 22 | |
58 | #define FT32_FLD_CB_SIZ 5 | |
59 | #define FT32_FLD_R_D (1 << 4) | |
60 | #define FT32_FLD_R_D_BIT 20 | |
61 | #define FT32_FLD_R_D_SIZ 5 | |
62 | #define FT32_FLD_CR (1 << 5) | |
63 | #define FT32_FLD_CR_BIT 20 | |
64 | #define FT32_FLD_CR_SIZ 2 | |
65 | #define FT32_FLD_CV (1 << 6) | |
66 | #define FT32_FLD_CV_BIT 19 | |
67 | #define FT32_FLD_CV_SIZ 1 | |
68 | #define FT32_FLD_BT (1 << 7) | |
69 | #define FT32_FLD_BT_BIT 18 | |
70 | #define FT32_FLD_BT_SIZ 1 | |
71 | #define FT32_FLD_R_1 (1 << 8) | |
72 | #define FT32_FLD_R_1_BIT 15 | |
73 | #define FT32_FLD_R_1_SIZ 5 | |
74 | #define FT32_FLD_RIMM (1 << 9) | |
75 | #define FT32_FLD_RIMM_BIT 4 | |
76 | #define FT32_FLD_RIMM_SIZ 11 | |
77 | #define FT32_FLD_R_2 (1 << 10) | |
78 | #define FT32_FLD_R_2_BIT 4 | |
79 | #define FT32_FLD_R_2_SIZ 5 | |
80 | #define FT32_FLD_K20 (1 << 11) | |
81 | #define FT32_FLD_K20_BIT 0 | |
82 | #define FT32_FLD_K20_SIZ 20 | |
83 | #define FT32_FLD_PA (1 << 12) | |
84 | #define FT32_FLD_PA_BIT 0 | |
85 | #define FT32_FLD_PA_SIZ 18 | |
86 | #define FT32_FLD_AA (1 << 13) | |
87 | #define FT32_FLD_AA_BIT 0 | |
88 | #define FT32_FLD_AA_SIZ 17 | |
89 | #define FT32_FLD_K16 (1 << 14) | |
90 | #define FT32_FLD_K16_BIT 0 | |
91 | #define FT32_FLD_K16_SIZ 16 | |
92 | #define FT32_FLD_K8 (1 << 15) | |
93 | #define FT32_FLD_K8_BIT 0 | |
94 | #define FT32_FLD_K8_SIZ 8 | |
95 | #define FT32_FLD_AL (1 << 16) | |
96 | #define FT32_FLD_AL_BIT 0 | |
97 | #define FT32_FLD_AL_SIZ 4 | |
98 | ||
71f4ed30 | 99 | #define FT32_IS_CALL(inst) (((inst) & 0xfffc0000) == 0x00340000) |
100 | #define FT32_IS_PUSH(inst) (((inst) & 0xfff00000) == 0x84000000) | |
101 | #define FT32_PUSH_REG(inst) (((inst) >> 15) & 0x1f) | |
102 | #define FT32_IS_LINK(inst) (((inst) & 0xffff0000) == 0x95d00000) | |
103 | #define FT32_LINK_SIZE(inst) ((inst) & 0xffff) | |
104 | ||
3f8107ab AM |
105 | #define FT32_FLD_R_D_POST (1 << 17) |
106 | #define FT32_FLD_R_1_POST (1 << 18) |