xref: /netbsd-src/external/gpl3/binutils/dist/include/opcode/csky.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
16f4ced0bSchristos /* C-SKY assembler/disassembler support.
2*cb63e24eSchristos    Copyright (C) 2004-2024 Free Software Foundation, Inc.
36f4ced0bSchristos    Contributed by C-SKY Microsystems and Mentor Graphics.
46f4ced0bSchristos 
56f4ced0bSchristos    This file is part of GDB and GAS.
66f4ced0bSchristos 
76f4ced0bSchristos    GDB and GAS are free software; you can redistribute it and/or
86f4ced0bSchristos    modify it under the terms of the GNU General Public License as
96f4ced0bSchristos    published by the Free Software Foundation; either version 3, or (at
106f4ced0bSchristos    your option) any later version.
116f4ced0bSchristos 
126f4ced0bSchristos    GDB and GAS are distributed in the hope that it will be useful, but
136f4ced0bSchristos    WITHOUT ANY WARRANTY; without even the implied warranty of
146f4ced0bSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
156f4ced0bSchristos    General Public License for more details.
166f4ced0bSchristos 
176f4ced0bSchristos    You should have received a copy of the GNU General Public License
186f4ced0bSchristos    along with GDB or GAS; see the file COPYING3.  If not, write to the
196f4ced0bSchristos    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
206f4ced0bSchristos    MA 02110-1301, USA.  */
216f4ced0bSchristos 
226f4ced0bSchristos #include "dis-asm.h"
236f4ced0bSchristos 
246f4ced0bSchristos /* The following bitmasks control instruction set architecture.  */
254f645668Schristos #define CSKYV1_ISA_E1       ((uint64_t) 1 << 0)
264f645668Schristos #define CSKYV2_ISA_E1       ((uint64_t) 1 << 1)
274f645668Schristos #define CSKYV2_ISA_1E2      ((uint64_t) 1 << 2)
284f645668Schristos #define CSKYV2_ISA_2E3      ((uint64_t) 1 << 3)
294f645668Schristos #define CSKYV2_ISA_3E7      ((uint64_t) 1 << 4)
304f645668Schristos #define CSKYV2_ISA_7E10     ((uint64_t) 1 << 5)
314f645668Schristos #define CSKYV2_ISA_3E3R1    ((uint64_t) 1 << 6)
324f645668Schristos #define CSKYV2_ISA_3E3R2    ((uint64_t) 1 << 7)
334f645668Schristos #define CSKYV2_ISA_10E60    ((uint64_t) 1 << 8)
344f645668Schristos #define CSKYV2_ISA_3E3R3    ((uint64_t) 1 << 9)
356f4ced0bSchristos 
364f645668Schristos #define CSKY_ISA_TRUST      ((uint64_t) 1 << 11)
374f645668Schristos #define CSKY_ISA_CACHE      ((uint64_t) 1 << 12)
384f645668Schristos #define CSKY_ISA_NVIC       ((uint64_t) 1 << 13)
394f645668Schristos #define CSKY_ISA_CP         ((uint64_t) 1 << 14)
404f645668Schristos #define CSKY_ISA_MP         ((uint64_t) 1 << 15)
414f645668Schristos #define CSKY_ISA_MP_1E2     ((uint64_t) 1 << 16)
424f645668Schristos #define CSKY_ISA_JAVA       ((uint64_t) 1 << 17)
434f645668Schristos #define CSKY_ISA_MAC        ((uint64_t) 1 << 18)
444f645668Schristos #define CSKY_ISA_MAC_DSP    ((uint64_t) 1 << 19)
456f4ced0bSchristos 
466f4ced0bSchristos /* Base ISA for csky v1 and v2.  */
474f645668Schristos #define CSKY_ISA_DSP        ((uint64_t) 1 << 20)
484f645668Schristos #define CSKY_ISA_DSP_1E2    ((uint64_t) 1 << 21)
494f645668Schristos #define CSKY_ISA_DSP_ENHANCE ((uint64_t) 1 << 22)
504f645668Schristos #define CSKY_ISA_DSPE60     ((uint64_t) 1 << 23)
516f4ced0bSchristos 
526f4ced0bSchristos /* Base float instruction (803f & 810f).  */
534f645668Schristos #define CSKY_ISA_FLOAT_E1   ((uint64_t) 1 << 25)
546f4ced0bSchristos /* M_FLOAT support (810f).  */
554f645668Schristos #define CSKY_ISA_FLOAT_1E2  ((uint64_t) 1 << 26)
566f4ced0bSchristos /* 803 support (803f).  */
574f645668Schristos #define CSKY_ISA_FLOAT_1E3  ((uint64_t) 1 << 27)
586f4ced0bSchristos /* 807 support (803f & 807f).  */
594f645668Schristos #define CSKY_ISA_FLOAT_3E4  ((uint64_t) 1 << 28)
604f645668Schristos /* 860 support.  */
614f645668Schristos #define CSKY_ISA_FLOAT_7E60 ((uint64_t) 1 << 36)
626f4ced0bSchristos /* Vector DSP support.  */
634f645668Schristos #define CSKY_ISA_VDSP       ((uint64_t) 1 << 29)
644f645668Schristos #define CSKY_ISA_VDSP_2     ((uint64_t) 1 << 30)
656f4ced0bSchristos 
666f4ced0bSchristos /* The following bitmasks control cpu architecture for CSKY.  */
676f4ced0bSchristos #define CSKY_ABI_V1         (1 << 28)
686f4ced0bSchristos #define CSKY_ABI_V2         (2 << 28)
696f4ced0bSchristos #define CSKY_ARCH_MASK      0x0000001F
706f4ced0bSchristos #define CSKY_ABI_MASK       0xF0000000
716f4ced0bSchristos 
726f4ced0bSchristos #define CSKY_ARCH_510       0x1
736f4ced0bSchristos #define CSKY_ARCH_610       0x2
746f4ced0bSchristos #define CSKY_ARCH_801       0xa
756f4ced0bSchristos #define CSKY_ARCH_802       0x10
766f4ced0bSchristos #define CSKY_ARCH_803       0x9
774f645668Schristos /* 804  use the same arch flag as 803 yet.  */
784f645668Schristos #define CSKY_ARCH_804       0x9
794f645668Schristos #define CSKY_ARCH_805       0x11
806f4ced0bSchristos #define CSKY_ARCH_807       0x6
816f4ced0bSchristos #define CSKY_ARCH_810       0x8
824f645668Schristos #define CSKY_ARCH_860       0xb
834f645668Schristos /* 800 is a special arch supporting all instructions for ABIV2.  */
844f645668Schristos #define CSKY_ARCH_800       0x1f
856f4ced0bSchristos 
866f4ced0bSchristos #define CSKY_ARCH_MAC       (1 << 15)
876f4ced0bSchristos #define CSKY_ARCH_DSP       (1 << 14)
886f4ced0bSchristos #define CSKY_ARCH_FLOAT     (1 << 13)
896f4ced0bSchristos #define CSKY_ARCH_SIMD      (1 << 12)
906f4ced0bSchristos #define CSKY_ARCH_CP        (1 << 11)
916f4ced0bSchristos #define CSKY_ARCH_MP        (1 << 10)
926f4ced0bSchristos #define CSKY_ARCH_CACHE     (1 << 9)
936f4ced0bSchristos #define CSKY_ARCH_JAVA      (1 << 8)
946f4ced0bSchristos #define CSKY_ARCH_APS       (1 << 7)
956f4ced0bSchristos 
964f645668Schristos /* eflag's Versions.  */
974f645668Schristos #define CSKY_VERSION_V1     (1 << 24)
984f645668Schristos #define CSKY_VERSION_V2     (2 << 24)
994f645668Schristos #define CSKY_VERSION_V3     (3 << 24)
1004f645668Schristos 
1016f4ced0bSchristos #define IS_CSKY_V1(a) \
1026f4ced0bSchristos   (((a) & CSKY_ABI_MASK) == CSKY_ABI_V1)
1036f4ced0bSchristos #define IS_CSKY_V2(a) \
1046f4ced0bSchristos   (((a) & CSKY_ABI_MASK) == CSKY_ABI_V2)
1056f4ced0bSchristos #define IS_CSKY_ARCH_V1(a) \
1066f4ced0bSchristos   (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510				\
1076f4ced0bSchristos    || ((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610)
1086f4ced0bSchristos #define IS_CSKY_ARCH_V2(a)  \
1096f4ced0bSchristos   (!(IS_CSKY_ARCH_V1 (a)))
1106f4ced0bSchristos 
1116f4ced0bSchristos #define IS_CSKY_ARCH_510(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510)
1126f4ced0bSchristos #define IS_CSKY_ARCH_610(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610)
1136f4ced0bSchristos #define IS_CSKY_ARCH_801(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_801)
1146f4ced0bSchristos #define IS_CSKY_ARCH_802(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_802)
1156f4ced0bSchristos #define IS_CSKY_ARCH_803(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_803)
1166f4ced0bSchristos #define IS_CSKY_ARCH_807(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_807)
1176f4ced0bSchristos #define IS_CSKY_ARCH_810(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_810)
1186f4ced0bSchristos 
1196f4ced0bSchristos #define CPU_ARCH_MASK \
1206f4ced0bSchristos   (CSKY_ARCH_JAVA | CSKY_ARCH_FLOAT | CSKY_ARCH_DSP | CSKY_ARCH_MASK)
1216f4ced0bSchristos 
1226f4ced0bSchristos #ifdef __cplusplus
1236f4ced0bSchristos extern "C" {
1246f4ced0bSchristos #endif
1256f4ced0bSchristos extern int print_insn_csky (bfd_vma memaddr, struct disassemble_info *info);
1266f4ced0bSchristos #ifdef __cplusplus
1276f4ced0bSchristos }
1286f4ced0bSchristos #endif
129