1 /* tic54x.h -- Header file for TI TMS320C54X opcode table
2 Copyright 1999, 2000 Free Software Foundation, Inc.
3 Written by Timothy Wall (twall@cygnus.com)
5 This file is part of GDB, GAS, and the GNU binutils.
7 GDB, GAS, and the GNU binutils are free software; you can redistribute
8 them and/or modify them under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either version
10 1, or (at your option) any later version.
12 GDB, GAS, and the GNU binutils are distributed in the hope that they
13 will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this file; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 typedef struct _symbol
35 OP_Xmem
, /* AR3 or AR4, indirect */
36 OP_Ymem
, /* AR3 or AR4, indirect */
37 OP_pmad
, /* PROG mem, direct */
38 OP_dmad
, /* DATA mem, direct */
40 OP_Lmem
, /* 32-bit single-addressed (direct/indirect) */
49 OP_SRC1
, /* src accumulator in bit 8 */
50 OP_SRC
, /* src accumulator in bit 9 */
51 OP_RND
, /* rounded result dst accumulator, opposite of bit 8 */
52 OP_DST
, /* dst accumulator in bit 8 */
53 OP_ARX
, /* arX in bits 0-3 */
54 OP_SHIFT
, /* -16 to 15 (SHIFT), bits 0-4 */
55 OP_SHFT
, /* 0 to 15 (SHIFT1 in summary), bits 0-3 */
56 OP_B
, /* ACC B only */
57 OP_A
, /* ACC A only */
59 OP_lk
, /* 16-bit immediate, '#' optional */
61 OP_k8
, /* -128 <= k <= 128 */
62 OP_16
, /* literal "16" */
63 OP_BITC
, /* 0 to 16 */
64 OP_CC
, /* condition code */
65 OP_CC2
, /* 4-bit condition code */
66 OP_CC3
, /* 2-bit condition code */
67 OP_123
, /* 1, 2, or 3 */
68 OP_031
, /* 0-31, numeric */
70 OP_k8u
, /* 0 to 255 */
76 OP_lku
, /* 0 to 65535 */
77 OP_N
, /* 0/1 or ST0/ST1 */
78 OP_SBIT
, /* status bit or 0-15 */
79 OP_12
, /* one or two */
80 OP_k9
, /* 9 bits of data page (DP) address */
85 typedef struct _template
87 /* The opcode mnemonic */
90 unsigned int words
; /* insn size in words */
91 int minops
, maxops
; /* min/max operand count */
92 /* The significant bits in the opcode. Other bits are zero.
93 Instructions with more than 16 bits of opcode store the rest in the upper
96 unsigned short opcode
;
97 #define INDIRECT(OP) ((OP)&0x80)
98 #define MOD(OP) (((OP)>>3)&0xF)
99 #define ARF(OP) ((OP)&0x7)
100 #define IS_LKADDR(OP) (INDIRECT(OP) && MOD(OP)>=12)
101 #define SRC(OP) ((OP)&0x200)
102 #define DST(OP) ((OP)&0x100)
103 #define SRC1(OP) ((OP)&0x100)
104 #define SHIFT(OP) (((OP)&0x10)?(((OP)&0x1F)-32):((OP)&0x1F))
105 #define SHFT(OP) ((OP)&0xF)
106 #define ARX(OP) ((OP)&0x7)
107 #define XMEM(OP) (((OP)&0x00F0)>>4)
108 #define YMEM(OP) ((OP)&0x000F)
109 #define XMOD(C) (((C)&0xC)>>2)
110 #define XARX(C) (((C)&0x3)+2)
111 #define CC3(OP) (((OP)>>8)&0x3)
112 #define SBIT(OP) ((OP)&0xF)
113 #define MMR(OP) ((OP)&0x7F)
114 #define MMRX(OP) ((((OP)>>4)&0xF)+16)
115 #define MMRY(OP) (((OP)&0xF)+16)
117 #define OPTYPE(X) ((X)&~OPT)
119 /* Ones in this mask indicate which bits must match the opcode field.
120 Zeroes indicate don't care bits (operands and/or opcode options) */
123 /* An array of operand codes (at most 4 operands) */
124 #define MAX_OPERANDS 4
125 enum optype operand_types
[MAX_OPERANDS
];
127 /* Special purpose flags (e.g. branch type, parallel, delay, etc)
129 unsigned short flags
;
130 #define B_NEXT 0 /* normal execution, next insn is next address */
131 #define B_BRANCH 1 /* next insn is in opcode */
132 #define B_RET 2 /* next insn is on stack */
133 #define B_BACC 3 /* next insn is in acc */
134 #define B_REPEAT 4 /* next insn repeats */
135 #define FL_BMASK 0x07
137 #define FL_DELAY 0x10 /* instruction uses delay slots */
138 #define FL_EXT 0x20 /* instruction takes two words */
139 #define FL_FAR 0x40 /* far mode addressing */
140 #define FL_LP 0x80 /* LP-only instruction */
141 #define FL_NR 0x100 /* no repeat allowed */
142 #define FL_SMR 0x200 /* Smem read (for flagging write-only *+ARx */
144 unsigned short opcode2
, mask2
; /* some insns have an extended opcode */
148 typedef struct _partemplate
{
151 unsigned int words
; /* length in words */
152 int minops
, maxops
; /* min/max operand count for 2nd part of insn */
153 unsigned short opcode
;
155 enum optype operand_types
[MAX_OPERANDS
];
156 enum optype paroperand_types
[MAX_OPERANDS
];
159 extern const template tic54x_unknown_opcode
;
160 extern const template tic54x_optab
[];
161 extern const partemplate tic54x_paroptab
[];
162 extern const symbol mmregs
[], regs
[];
163 extern const symbol condition_codes
[], cc2_codes
[], status_bits
[];
164 extern const symbol cc3_codes
[];
165 extern const char *misc_symbols
[];
167 #endif /* TIC54X_H */