xref: /netbsd-src/external/gpl3/gdb/dist/include/opcode/csky.h (revision 02f41505626a9ceb584d30d0789203495760ac88)
14559860eSchristos /* C-SKY assembler/disassembler support.
2*02f41505Schristos    Copyright (C) 2004-2024 Free Software Foundation, Inc.
34559860eSchristos    Contributed by C-SKY Microsystems and Mentor Graphics.
44559860eSchristos 
54559860eSchristos    This file is part of GDB and GAS.
64559860eSchristos 
74559860eSchristos    GDB and GAS are free software; you can redistribute it and/or
84559860eSchristos    modify it under the terms of the GNU General Public License as
94559860eSchristos    published by the Free Software Foundation; either version 3, or (at
104559860eSchristos    your option) any later version.
114559860eSchristos 
124559860eSchristos    GDB and GAS are distributed in the hope that it will be useful, but
134559860eSchristos    WITHOUT ANY WARRANTY; without even the implied warranty of
144559860eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
154559860eSchristos    General Public License for more details.
164559860eSchristos 
174559860eSchristos    You should have received a copy of the GNU General Public License
184559860eSchristos    along with GDB or GAS; see the file COPYING3.  If not, write to the
194559860eSchristos    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
204559860eSchristos    MA 02110-1301, USA.  */
214559860eSchristos 
224559860eSchristos #include "dis-asm.h"
234559860eSchristos 
244559860eSchristos /* The following bitmasks control instruction set architecture.  */
254b169a6bSchristos #define CSKYV1_ISA_E1       ((uint64_t) 1 << 0)
264b169a6bSchristos #define CSKYV2_ISA_E1       ((uint64_t) 1 << 1)
274b169a6bSchristos #define CSKYV2_ISA_1E2      ((uint64_t) 1 << 2)
284b169a6bSchristos #define CSKYV2_ISA_2E3      ((uint64_t) 1 << 3)
294b169a6bSchristos #define CSKYV2_ISA_3E7      ((uint64_t) 1 << 4)
304b169a6bSchristos #define CSKYV2_ISA_7E10     ((uint64_t) 1 << 5)
314b169a6bSchristos #define CSKYV2_ISA_3E3R1    ((uint64_t) 1 << 6)
324b169a6bSchristos #define CSKYV2_ISA_3E3R2    ((uint64_t) 1 << 7)
334b169a6bSchristos #define CSKYV2_ISA_10E60    ((uint64_t) 1 << 8)
344b169a6bSchristos #define CSKYV2_ISA_3E3R3    ((uint64_t) 1 << 9)
354559860eSchristos 
364b169a6bSchristos #define CSKY_ISA_TRUST      ((uint64_t) 1 << 11)
374b169a6bSchristos #define CSKY_ISA_CACHE      ((uint64_t) 1 << 12)
384b169a6bSchristos #define CSKY_ISA_NVIC       ((uint64_t) 1 << 13)
394b169a6bSchristos #define CSKY_ISA_CP         ((uint64_t) 1 << 14)
404b169a6bSchristos #define CSKY_ISA_MP         ((uint64_t) 1 << 15)
414b169a6bSchristos #define CSKY_ISA_MP_1E2     ((uint64_t) 1 << 16)
424b169a6bSchristos #define CSKY_ISA_JAVA       ((uint64_t) 1 << 17)
434b169a6bSchristos #define CSKY_ISA_MAC        ((uint64_t) 1 << 18)
444b169a6bSchristos #define CSKY_ISA_MAC_DSP    ((uint64_t) 1 << 19)
454559860eSchristos 
464559860eSchristos /* Base ISA for csky v1 and v2.  */
474b169a6bSchristos #define CSKY_ISA_DSP        ((uint64_t) 1 << 20)
484b169a6bSchristos #define CSKY_ISA_DSP_1E2    ((uint64_t) 1 << 21)
494b169a6bSchristos #define CSKY_ISA_DSP_ENHANCE ((uint64_t) 1 << 22)
504b169a6bSchristos #define CSKY_ISA_DSPE60     ((uint64_t) 1 << 23)
514559860eSchristos 
524559860eSchristos /* Base float instruction (803f & 810f).  */
534b169a6bSchristos #define CSKY_ISA_FLOAT_E1   ((uint64_t) 1 << 25)
544559860eSchristos /* M_FLOAT support (810f).  */
554b169a6bSchristos #define CSKY_ISA_FLOAT_1E2  ((uint64_t) 1 << 26)
564559860eSchristos /* 803 support (803f).  */
574b169a6bSchristos #define CSKY_ISA_FLOAT_1E3  ((uint64_t) 1 << 27)
584559860eSchristos /* 807 support (803f & 807f).  */
594b169a6bSchristos #define CSKY_ISA_FLOAT_3E4  ((uint64_t) 1 << 28)
608dffb485Schristos /* 860 support.  */
614b169a6bSchristos #define CSKY_ISA_FLOAT_7E60 ((uint64_t) 1 << 36)
624559860eSchristos /* Vector DSP support.  */
634b169a6bSchristos #define CSKY_ISA_VDSP       ((uint64_t) 1 << 29)
644b169a6bSchristos #define CSKY_ISA_VDSP_2     ((uint64_t) 1 << 30)
654559860eSchristos 
664559860eSchristos /* The following bitmasks control cpu architecture for CSKY.  */
674559860eSchristos #define CSKY_ABI_V1         (1 << 28)
684559860eSchristos #define CSKY_ABI_V2         (2 << 28)
694559860eSchristos #define CSKY_ARCH_MASK      0x0000001F
704559860eSchristos #define CSKY_ABI_MASK       0xF0000000
714559860eSchristos 
724559860eSchristos #define CSKY_ARCH_510       0x1
734559860eSchristos #define CSKY_ARCH_610       0x2
744559860eSchristos #define CSKY_ARCH_801       0xa
754559860eSchristos #define CSKY_ARCH_802       0x10
764559860eSchristos #define CSKY_ARCH_803       0x9
778dffb485Schristos /* 804  use the same arch flag as 803 yet.  */
788dffb485Schristos #define CSKY_ARCH_804       0x9
798dffb485Schristos #define CSKY_ARCH_805       0x11
804559860eSchristos #define CSKY_ARCH_807       0x6
814559860eSchristos #define CSKY_ARCH_810       0x8
828dffb485Schristos #define CSKY_ARCH_860       0xb
838dffb485Schristos /* 800 is a special arch supporting all instructions for ABIV2.  */
848dffb485Schristos #define CSKY_ARCH_800       0x1f
854559860eSchristos 
864559860eSchristos #define CSKY_ARCH_MAC       (1 << 15)
874559860eSchristos #define CSKY_ARCH_DSP       (1 << 14)
884559860eSchristos #define CSKY_ARCH_FLOAT     (1 << 13)
894559860eSchristos #define CSKY_ARCH_SIMD      (1 << 12)
904559860eSchristos #define CSKY_ARCH_CP        (1 << 11)
914559860eSchristos #define CSKY_ARCH_MP        (1 << 10)
924559860eSchristos #define CSKY_ARCH_CACHE     (1 << 9)
934559860eSchristos #define CSKY_ARCH_JAVA      (1 << 8)
944559860eSchristos #define CSKY_ARCH_APS       (1 << 7)
954559860eSchristos 
964b169a6bSchristos /* eflag's Versions.  */
974b169a6bSchristos #define CSKY_VERSION_V1     (1 << 24)
984b169a6bSchristos #define CSKY_VERSION_V2     (2 << 24)
994b169a6bSchristos #define CSKY_VERSION_V3     (3 << 24)
1004b169a6bSchristos 
1014559860eSchristos #define IS_CSKY_V1(a) \
1024559860eSchristos   (((a) & CSKY_ABI_MASK) == CSKY_ABI_V1)
1034559860eSchristos #define IS_CSKY_V2(a) \
1044559860eSchristos   (((a) & CSKY_ABI_MASK) == CSKY_ABI_V2)
1054559860eSchristos #define IS_CSKY_ARCH_V1(a) \
1064559860eSchristos   (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510				\
1074559860eSchristos    || ((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610)
1084559860eSchristos #define IS_CSKY_ARCH_V2(a)  \
1094559860eSchristos   (!(IS_CSKY_ARCH_V1 (a)))
1104559860eSchristos 
1114559860eSchristos #define IS_CSKY_ARCH_510(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510)
1124559860eSchristos #define IS_CSKY_ARCH_610(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610)
1134559860eSchristos #define IS_CSKY_ARCH_801(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_801)
1144559860eSchristos #define IS_CSKY_ARCH_802(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_802)
1154559860eSchristos #define IS_CSKY_ARCH_803(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_803)
1164559860eSchristos #define IS_CSKY_ARCH_807(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_807)
1174559860eSchristos #define IS_CSKY_ARCH_810(a)	(((a) & CSKY_ARCH_MASK) == CSKY_ARCH_810)
1184559860eSchristos 
1194559860eSchristos #define CPU_ARCH_MASK \
1204559860eSchristos   (CSKY_ARCH_JAVA | CSKY_ARCH_FLOAT | CSKY_ARCH_DSP | CSKY_ARCH_MASK)
1214559860eSchristos 
1224559860eSchristos #ifdef __cplusplus
1234559860eSchristos extern "C" {
1244559860eSchristos #endif
1254559860eSchristos extern int print_insn_csky (bfd_vma memaddr, struct disassemble_info *info);
1264559860eSchristos #ifdef __cplusplus
1274559860eSchristos }
1284559860eSchristos #endif
129