198b9484cSchristos /* Definitions for decoding the moxie opcode table. 2*aab831ceSchristos Copyright (C) 2009-2024 Free Software Foundation, Inc. 398b9484cSchristos Contributed by Anthony Green (green@moxielogic.com). 498b9484cSchristos 598b9484cSchristos This program is free software; you can redistribute it and/or modify 698b9484cSchristos it under the terms of the GNU General Public License as published by 798b9484cSchristos the Free Software Foundation; either version 3 of the License, or 898b9484cSchristos (at your option) any later version. 998b9484cSchristos 1098b9484cSchristos This program is distributed in the hope that it will be useful, 1198b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1298b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1398b9484cSchristos GNU General Public License for more details. 1498b9484cSchristos 1598b9484cSchristos You should have received a copy of the GNU General Public License 1698b9484cSchristos along with this program; if not, write to the Free Software 1798b9484cSchristos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 1898b9484cSchristos 02110-1301, USA. */ 1998b9484cSchristos 2098b9484cSchristos /* Form 1 instructions come in different flavors: 2198b9484cSchristos 2298b9484cSchristos Some have no arguments (MOXIE_F1_NARG) 2398b9484cSchristos Some only use the A operand (MOXIE_F1_A) 2498b9484cSchristos Some use A and B registers (MOXIE_F1_AB) 2598b9484cSchristos Some use A and consume a 4 byte immediate value (MOXIE_F1_A4) 2698b9484cSchristos Some use just a 4 byte immediate value (MOXIE_F1_4) 2798b9484cSchristos Some use just a 4 byte memory address (MOXIE_F1_M) 2898b9484cSchristos Some use B and an indirect A (MOXIE_F1_AiB) 2998b9484cSchristos Some use A and an indirect B (MOXIE_F1_ABi) 3098b9484cSchristos Some consume a 4 byte immediate value and use X (MOXIE_F1_4A) 31968cf8f2Schristos Some use B and an indirect A plus 2 byte offset (MOXIE_F1_AiB2) 32968cf8f2Schristos Some use A and an indirect B plus 2 byte offset (MOXIE_F1_ABi2) 3398b9484cSchristos 3498b9484cSchristos Form 2 instructions also come in different flavors: 3598b9484cSchristos 3698b9484cSchristos Some have no arguments (MOXIE_F2_NARG) 3798b9484cSchristos Some use the A register and an 8-bit value (MOXIE_F2_A8V) 3898b9484cSchristos 3998b9484cSchristos Form 3 instructions also come in different flavors: 4098b9484cSchristos 4198b9484cSchristos Some have no arguments (MOXIE_F3_NARG) 4298b9484cSchristos Some have a 10-bit PC relative operand (MOXIE_F3_PCREL). */ 4398b9484cSchristos 4498b9484cSchristos #define MOXIE_F1_NARG 0x100 4598b9484cSchristos #define MOXIE_F1_A 0x101 4698b9484cSchristos #define MOXIE_F1_AB 0x102 4798b9484cSchristos /* #define MOXIE_F1_ABC 0x103 */ 4898b9484cSchristos #define MOXIE_F1_A4 0x104 4998b9484cSchristos #define MOXIE_F1_4 0x105 5098b9484cSchristos #define MOXIE_F1_AiB 0x106 5198b9484cSchristos #define MOXIE_F1_ABi 0x107 5298b9484cSchristos #define MOXIE_F1_4A 0x108 53968cf8f2Schristos #define MOXIE_F1_AiB2 0x109 54968cf8f2Schristos #define MOXIE_F1_ABi2 0x10a 5598b9484cSchristos #define MOXIE_F1_M 0x10b 5698b9484cSchristos 5798b9484cSchristos #define MOXIE_F2_NARG 0x200 5898b9484cSchristos #define MOXIE_F2_A8V 0x201 5998b9484cSchristos 6098b9484cSchristos #define MOXIE_F3_NARG 0x300 6198b9484cSchristos #define MOXIE_F3_PCREL 0x301 6298b9484cSchristos 63a2e2270fSchristos #define MOXIE_BAD 0x400 64a2e2270fSchristos 6598b9484cSchristos typedef struct moxie_opc_info_t 6698b9484cSchristos { 6798b9484cSchristos short opcode; 6898b9484cSchristos unsigned itype; 6998b9484cSchristos const char * name; 7098b9484cSchristos } moxie_opc_info_t; 7198b9484cSchristos 72a2e2270fSchristos extern const moxie_opc_info_t moxie_form1_opc_info[128]; 7398b9484cSchristos extern const moxie_opc_info_t moxie_form2_opc_info[4]; 7498b9484cSchristos extern const moxie_opc_info_t moxie_form3_opc_info[16]; 75