15f210c2aSfgsch /* tic54x.h -- Header file for TI TMS320C54X opcode table 25f210c2aSfgsch Copyright 1999, 2000 Free Software Foundation, Inc. 35f210c2aSfgsch Written by Timothy Wall (twall@cygnus.com) 45f210c2aSfgsch 55f210c2aSfgsch This file is part of GDB, GAS, and the GNU binutils. 65f210c2aSfgsch 75f210c2aSfgsch GDB, GAS, and the GNU binutils are free software; you can redistribute 85f210c2aSfgsch them and/or modify them under the terms of the GNU General Public 95f210c2aSfgsch License as published by the Free Software Foundation; either version 105f210c2aSfgsch 1, or (at your option) any later version. 115f210c2aSfgsch 125f210c2aSfgsch GDB, GAS, and the GNU binutils are distributed in the hope that they 135f210c2aSfgsch will be useful, but WITHOUT ANY WARRANTY; without even the implied 145f210c2aSfgsch warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 155f210c2aSfgsch the GNU General Public License for more details. 165f210c2aSfgsch 175f210c2aSfgsch You should have received a copy of the GNU General Public License 185f210c2aSfgsch along with this file; see the file COPYING. If not, write to the Free 195f210c2aSfgsch Software Foundation, 59 Temple Place - Suite 330, Boston, MA 205f210c2aSfgsch 02111-1307, USA. */ 215f210c2aSfgsch 22*d2201f2fSdrahn #ifndef _opcode_tic54x_h_ 23*d2201f2fSdrahn #define _opcode_tic54x_h_ 245f210c2aSfgsch 255f210c2aSfgsch typedef struct _symbol 265f210c2aSfgsch { 275f210c2aSfgsch const char *name; 285f210c2aSfgsch unsigned short value; 295f210c2aSfgsch } symbol; 305f210c2aSfgsch 315f210c2aSfgsch enum optype { 325f210c2aSfgsch OPT = 0x8000, 335f210c2aSfgsch OP_None = 0x0, 345f210c2aSfgsch 355f210c2aSfgsch OP_Xmem, /* AR3 or AR4, indirect */ 365f210c2aSfgsch OP_Ymem, /* AR3 or AR4, indirect */ 375f210c2aSfgsch OP_pmad, /* PROG mem, direct */ 385f210c2aSfgsch OP_dmad, /* DATA mem, direct */ 395f210c2aSfgsch OP_Smem, 405f210c2aSfgsch OP_Lmem, /* 32-bit single-addressed (direct/indirect) */ 415f210c2aSfgsch OP_MMR, 425f210c2aSfgsch OP_PA, 435f210c2aSfgsch OP_Sind, 445f210c2aSfgsch OP_xpmad, 455f210c2aSfgsch OP_xpmad_ms7, 465f210c2aSfgsch OP_MMRX, 475f210c2aSfgsch OP_MMRY, 485f210c2aSfgsch 495f210c2aSfgsch OP_SRC1, /* src accumulator in bit 8 */ 505f210c2aSfgsch OP_SRC, /* src accumulator in bit 9 */ 515f210c2aSfgsch OP_RND, /* rounded result dst accumulator, opposite of bit 8 */ 525f210c2aSfgsch OP_DST, /* dst accumulator in bit 8 */ 535f210c2aSfgsch OP_ARX, /* arX in bits 0-3 */ 545f210c2aSfgsch OP_SHIFT, /* -16 to 15 (SHIFT), bits 0-4 */ 555f210c2aSfgsch OP_SHFT, /* 0 to 15 (SHIFT1 in summary), bits 0-3 */ 565f210c2aSfgsch OP_B, /* ACC B only */ 575f210c2aSfgsch OP_A, /* ACC A only */ 585f210c2aSfgsch 595f210c2aSfgsch OP_lk, /* 16-bit immediate, '#' optional */ 605f210c2aSfgsch OP_TS, 615f210c2aSfgsch OP_k8, /* -128 <= k <= 128 */ 625f210c2aSfgsch OP_16, /* literal "16" */ 635f210c2aSfgsch OP_BITC, /* 0 to 16 */ 645f210c2aSfgsch OP_CC, /* condition code */ 655f210c2aSfgsch OP_CC2, /* 4-bit condition code */ 665f210c2aSfgsch OP_CC3, /* 2-bit condition code */ 675f210c2aSfgsch OP_123, /* 1, 2, or 3 */ 685f210c2aSfgsch OP_031, /* 0-31, numeric */ 695f210c2aSfgsch OP_k5, /* 0 to 31 */ 705f210c2aSfgsch OP_k8u, /* 0 to 255 */ 715f210c2aSfgsch OP_ASM, /* "ASM" */ 725f210c2aSfgsch OP_T, /* "T" */ 735f210c2aSfgsch OP_DP, /* "DP" */ 745f210c2aSfgsch OP_ARP, /* "ARP" */ 755f210c2aSfgsch OP_k3, /* 0-7 */ 765f210c2aSfgsch OP_lku, /* 0 to 65535 */ 775f210c2aSfgsch OP_N, /* 0/1 or ST0/ST1 */ 785f210c2aSfgsch OP_SBIT, /* status bit or 0-15 */ 795f210c2aSfgsch OP_12, /* one or two */ 805f210c2aSfgsch OP_k9, /* 9 bits of data page (DP) address */ 815f210c2aSfgsch OP_TRN, /* "TRN" */ 825f210c2aSfgsch 835f210c2aSfgsch }; 845f210c2aSfgsch 855f210c2aSfgsch typedef struct _template 865f210c2aSfgsch { 875f210c2aSfgsch /* The opcode mnemonic */ 885f210c2aSfgsch const char *name; 895f210c2aSfgsch unsigned int words; /* insn size in words */ 905f210c2aSfgsch int minops, maxops; /* min/max operand count */ 915f210c2aSfgsch /* The significant bits in the opcode. Other bits are zero. 925f210c2aSfgsch Instructions with more than 16 bits of opcode store the rest in the upper 935f210c2aSfgsch 16 bits. 945f210c2aSfgsch */ 955f210c2aSfgsch unsigned short opcode; 965f210c2aSfgsch #define INDIRECT(OP) ((OP)&0x80) 975f210c2aSfgsch #define MOD(OP) (((OP)>>3)&0xF) 985f210c2aSfgsch #define ARF(OP) ((OP)&0x7) 995f210c2aSfgsch #define IS_LKADDR(OP) (INDIRECT(OP) && MOD(OP)>=12) 1005f210c2aSfgsch #define SRC(OP) ((OP)&0x200) 1015f210c2aSfgsch #define DST(OP) ((OP)&0x100) 1025f210c2aSfgsch #define SRC1(OP) ((OP)&0x100) 1035f210c2aSfgsch #define SHIFT(OP) (((OP)&0x10)?(((OP)&0x1F)-32):((OP)&0x1F)) 1045f210c2aSfgsch #define SHFT(OP) ((OP)&0xF) 1055f210c2aSfgsch #define ARX(OP) ((OP)&0x7) 1065f210c2aSfgsch #define XMEM(OP) (((OP)&0x00F0)>>4) 1075f210c2aSfgsch #define YMEM(OP) ((OP)&0x000F) 1085f210c2aSfgsch #define XMOD(C) (((C)&0xC)>>2) 1095f210c2aSfgsch #define XARX(C) (((C)&0x3)+2) 1105f210c2aSfgsch #define CC3(OP) (((OP)>>8)&0x3) 1115f210c2aSfgsch #define SBIT(OP) ((OP)&0xF) 1125f210c2aSfgsch #define MMR(OP) ((OP)&0x7F) 1135f210c2aSfgsch #define MMRX(OP) ((((OP)>>4)&0xF)+16) 1145f210c2aSfgsch #define MMRY(OP) (((OP)&0xF)+16) 1155f210c2aSfgsch 1165f210c2aSfgsch #define OPTYPE(X) ((X)&~OPT) 1175f210c2aSfgsch 1185f210c2aSfgsch /* Ones in this mask indicate which bits must match the opcode field. 1195f210c2aSfgsch Zeroes indicate don't care bits (operands and/or opcode options) */ 1205f210c2aSfgsch unsigned short mask; 1215f210c2aSfgsch 1225f210c2aSfgsch /* An array of operand codes (at most 4 operands) */ 1235f210c2aSfgsch #define MAX_OPERANDS 4 1245f210c2aSfgsch enum optype operand_types[MAX_OPERANDS]; 1255f210c2aSfgsch 1265f210c2aSfgsch /* Special purpose flags (e.g. branch type, parallel, delay, etc) 1275f210c2aSfgsch */ 1285f210c2aSfgsch unsigned short flags; 1295f210c2aSfgsch #define B_NEXT 0 /* normal execution, next insn is next address */ 1305f210c2aSfgsch #define B_BRANCH 1 /* next insn is in opcode */ 1315f210c2aSfgsch #define B_RET 2 /* next insn is on stack */ 1325f210c2aSfgsch #define B_BACC 3 /* next insn is in acc */ 1335f210c2aSfgsch #define B_REPEAT 4 /* next insn repeats */ 1345f210c2aSfgsch #define FL_BMASK 0x07 1355f210c2aSfgsch 1365f210c2aSfgsch #define FL_DELAY 0x10 /* instruction uses delay slots */ 1375f210c2aSfgsch #define FL_EXT 0x20 /* instruction takes two words */ 1385f210c2aSfgsch #define FL_FAR 0x40 /* far mode addressing */ 1395f210c2aSfgsch #define FL_LP 0x80 /* LP-only instruction */ 1405f210c2aSfgsch #define FL_NR 0x100 /* no repeat allowed */ 1415f210c2aSfgsch #define FL_SMR 0x200 /* Smem read (for flagging write-only *+ARx */ 1425f210c2aSfgsch 143*d2201f2fSdrahn #define FL_PAR 0x400 /* Parallel instruction. */ 144*d2201f2fSdrahn 1455f210c2aSfgsch unsigned short opcode2, mask2; /* some insns have an extended opcode */ 1465f210c2aSfgsch 147*d2201f2fSdrahn const char* parname; 148*d2201f2fSdrahn enum optype paroperand_types[MAX_OPERANDS]; 149*d2201f2fSdrahn 1505f210c2aSfgsch } template; 1515f210c2aSfgsch 1525f210c2aSfgsch extern const template tic54x_unknown_opcode; 1535f210c2aSfgsch extern const template tic54x_optab[]; 154*d2201f2fSdrahn extern const template tic54x_paroptab[]; 1555f210c2aSfgsch extern const symbol mmregs[], regs[]; 1565f210c2aSfgsch extern const symbol condition_codes[], cc2_codes[], status_bits[]; 1575f210c2aSfgsch extern const symbol cc3_codes[]; 1585f210c2aSfgsch extern const char *misc_symbols[]; 159*d2201f2fSdrahn struct disassemble_info; 160*d2201f2fSdrahn extern const template* tic54x_get_insn (struct disassemble_info *, 161*d2201f2fSdrahn bfd_vma, unsigned short, int *); 1625f210c2aSfgsch 163*d2201f2fSdrahn #endif /* _opcode_tic54x_h_ */ 164