Back to index

cell-binutils  2.17cvs20070401
msp430.h
Go to the documentation of this file.
00001 /* Opcode table for the TI MSP430 microcontrollers
00002 
00003    Copyright 2002, 2004 Free Software Foundation, Inc.
00004    Contributed by Dmitry Diky <diwil@mail.ru>
00005    
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 #ifndef __MSP430_H_
00021 #define __MSP430_H_
00022 
00023 struct msp430_operand_s
00024 {
00025   int ol;     /* Operand length words.  */
00026   int am;     /* Addr mode.  */
00027   int reg;    /* Register.  */
00028   int mode;   /* Pperand mode.  */
00029 #define OP_REG              0
00030 #define OP_EXP              1
00031 #ifndef DASM_SECTION
00032   expressionS exp;
00033 #endif
00034 };
00035 
00036 #define BYTE_OPERATION  (1 << 6)  /* Byte operation flag for all instructions.  */
00037 
00038 struct  msp430_opcode_s
00039 {
00040   char *name;
00041   int fmt;
00042   int insn_opnumb;
00043   int bin_opcode;
00044   int bin_mask;
00045 };
00046 
00047 #define MSP_INSN(name, size, numb, bin, mask) { #name, size, numb, bin, mask }
00048 
00049 static struct msp430_opcode_s msp430_opcodes[] = 
00050 {
00051   MSP_INSN (and,   1, 2, 0xf000, 0xf000),
00052   MSP_INSN (inv,   0, 1, 0xe330, 0xfff0),
00053   MSP_INSN (xor,   1, 2, 0xe000, 0xf000),
00054   MSP_INSN (setz,  0, 0, 0xd322, 0xffff),
00055   MSP_INSN (setc,  0, 0, 0xd312, 0xffff),
00056   MSP_INSN (eint,  0, 0, 0xd232, 0xffff),
00057   MSP_INSN (setn,  0, 0, 0xd222, 0xffff),
00058   MSP_INSN (bis,   1, 2, 0xd000, 0xf000),
00059   MSP_INSN (clrz,  0, 0, 0xc322, 0xffff),
00060   MSP_INSN (clrc,  0, 0, 0xc312, 0xffff),
00061   MSP_INSN (dint,  0, 0, 0xc232, 0xffff),
00062   MSP_INSN (clrn,  0, 0, 0xc222, 0xffff),
00063   MSP_INSN (bic,   1, 2, 0xc000, 0xf000),
00064   MSP_INSN (bit,   1, 2, 0xb000, 0xf000),
00065   MSP_INSN (dadc,  0, 1, 0xa300, 0xff30),
00066   MSP_INSN (dadd,  1, 2, 0xa000, 0xf000),
00067   MSP_INSN (tst,   0, 1, 0x9300, 0xff30),
00068   MSP_INSN (cmp,   1, 2, 0x9000, 0xf000),
00069   MSP_INSN (decd,  0, 1, 0x8320, 0xff30),
00070   MSP_INSN (dec,   0, 1, 0x8310, 0xff30),
00071   MSP_INSN (sub,   1, 2, 0x8000, 0xf000),
00072   MSP_INSN (sbc,   0, 1, 0x7300, 0xff30),
00073   MSP_INSN (subc,  1, 2, 0x7000, 0xf000),
00074   MSP_INSN (adc,   0, 1, 0x6300, 0xff30),
00075   MSP_INSN (rlc,   0, 2, 0x6000, 0xf000),
00076   MSP_INSN (addc,  1, 2, 0x6000, 0xf000),
00077   MSP_INSN (incd,  0, 1, 0x5320, 0xff30),
00078   MSP_INSN (inc,   0, 1, 0x5310, 0xff30),
00079   MSP_INSN (rla,   0, 2, 0x5000, 0xf000),
00080   MSP_INSN (add,   1, 2, 0x5000, 0xf000),
00081   MSP_INSN (nop,   0, 0, 0x4303, 0xffff),
00082   MSP_INSN (clr,   0, 1, 0x4300, 0xff30),
00083   MSP_INSN (ret,   0, 0, 0x4130, 0xff30),
00084   MSP_INSN (pop,   0, 1, 0x4130, 0xff30),
00085   MSP_INSN (br,    0, 3, 0x4000, 0xf000),
00086   MSP_INSN (mov,   1, 2, 0x4000, 0xf000),
00087   MSP_INSN (jmp,   3, 1, 0x3c00, 0xfc00),
00088   MSP_INSN (jl,    3, 1, 0x3800, 0xfc00),
00089   MSP_INSN (jge,   3, 1, 0x3400, 0xfc00),
00090   MSP_INSN (jn,    3, 1, 0x3000, 0xfc00),
00091   MSP_INSN (jc,    3, 1, 0x2c00, 0xfc00),
00092   MSP_INSN (jhs,   3, 1, 0x2c00, 0xfc00),
00093   MSP_INSN (jnc,   3, 1, 0x2800, 0xfc00),
00094   MSP_INSN (jlo,   3, 1, 0x2800, 0xfc00),
00095   MSP_INSN (jz,    3, 1, 0x2400, 0xfc00),
00096   MSP_INSN (jeq,   3, 1, 0x2400, 0xfc00),
00097   MSP_INSN (jnz,   3, 1, 0x2000, 0xfc00),
00098   MSP_INSN (jne,   3, 1, 0x2000, 0xfc00),
00099   MSP_INSN (reti,  2, 0, 0x1300, 0xffc0),
00100   MSP_INSN (call,  2, 1, 0x1280, 0xffc0),
00101   MSP_INSN (push,  2, 1, 0x1200, 0xff80),
00102   MSP_INSN (sxt,   2, 1, 0x1180, 0xffc0),
00103   MSP_INSN (rra,   2, 1, 0x1100, 0xff80),
00104   MSP_INSN (swpb,  2, 1, 0x1080, 0xffc0),
00105   MSP_INSN (rrc,   2, 1, 0x1000, 0xff80),
00106   /* Simple polymorphs.  */
00107   MSP_INSN (beq,   4, 0, 0, 0xffff),
00108   MSP_INSN (bne,   4, 1, 0, 0xffff),
00109   MSP_INSN (blt,   4, 2, 0, 0xffff),
00110   MSP_INSN (bltu,  4, 3, 0, 0xffff),
00111   MSP_INSN (bge,   4, 4, 0, 0xffff),
00112   MSP_INSN (bgeu,  4, 5, 0, 0xffff),
00113   MSP_INSN (bltn,  4, 6, 0, 0xffff),
00114   MSP_INSN (jump,  4, 7, 0, 0xffff),
00115   /* Long polymorphs.  */
00116   MSP_INSN (bgt,   5, 0, 0, 0xffff),
00117   MSP_INSN (bgtu,  5, 1, 0, 0xffff),
00118   MSP_INSN (bleu,  5, 2, 0, 0xffff),
00119   MSP_INSN (ble,   5, 3, 0, 0xffff),
00120 
00121   /* End of instruction set.  */
00122   { NULL, 0, 0, 0, 0 }
00123 };
00124 
00125 #endif