2003-05-14 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / include / opcode / or32.h
CommitLineData
3b16e843
NC
1/* Table of opcodes for the OpenRISC 1000 ISA.
2 Copyright 2002 Free Software Foundation, Inc.
3 Contributed by Damjan Lampret (lampret@opencores.org).
4
5 This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21/* We treat all letters the same in encode/decode routines so
22 we need to assign some characteristics to them like signess etc. */
23
24#ifndef OR32_H_ISA
25#define OR32_H_ISA
26
27#define NUM_UNSIGNED (0)
28#define NUM_SIGNED (1)
29
30#ifndef PARAMS
31#define PARAMS(x) x
32#endif
33
3b16e843
NC
34#define MAX_GPRS 32
35#define PAGE_SIZE 4096
36#undef __HALF_WORD_INSN__
37
38#define OPERAND_DELIM (',')
39
40#define OR32_IF_DELAY (1)
41#define OR32_W_FLAG (2)
42#define OR32_R_FLAG (4)
43
44struct or32_letter
45{
46 char letter;
47 int sign;
48 /* int reloc; relocation per letter ?? */
49};
50
51/* Main instruction specification array. */
52struct or32_opcode
53{
54 /* Name of the instruction. */
55 char *name;
56
57 /* A string of characters which describe the operands.
58 Valid characters are:
59 ,() Itself. Characters appears in the assembly code.
60 rA Register operand.
61 rB Register operand.
62 rD Register operand.
63 I An immediate operand, range -32768 to 32767.
64 J An immediate operand, range . (unused)
65 K An immediate operand, range 0 to 65535.
66 L An immediate operand, range 0 to 63.
67 M An immediate operand, range . (unused)
68 N An immediate operand, range -33554432 to 33554431.
69 O An immediate operand, range . (unused). */
70 char *args;
71
72 /* Opcode and operand encoding. */
73 char *encoding;
74 void (*exec) PARAMS ((void));
75 unsigned int flags;
76};
77
78#define OPTYPE_LAST (0x80000000)
79#define OPTYPE_OP (0x40000000)
80#define OPTYPE_REG (0x20000000)
81#define OPTYPE_SIG (0x10000000)
82#define OPTYPE_DIS (0x08000000)
83#define OPTYPE_DST (0x04000000)
84#define OPTYPE_SBIT (0x00001F00)
85#define OPTYPE_SHR (0x0000001F)
86#define OPTYPE_SBIT_SHR (8)
87
88/* MM: Data how to decode operands. */
89extern struct insn_op_struct
90{
91 unsigned long type;
92 unsigned long data;
93} **op_start;
94
95#ifdef HAS_EXECUTION
96extern void l_invalid PARAMS ((void));
97extern void l_sfne PARAMS ((void));
98extern void l_bf PARAMS ((void));
99extern void l_add PARAMS ((void));
100extern void l_sw PARAMS ((void));
101extern void l_sb PARAMS ((void));
102extern void l_sh PARAMS ((void));
103extern void l_lwz PARAMS ((void));
104extern void l_lbs PARAMS ((void));
105extern void l_lbz PARAMS ((void));
106extern void l_lhs PARAMS ((void));
107extern void l_lhz PARAMS ((void));
108extern void l_movhi PARAMS ((void));
109extern void l_and PARAMS ((void));
110extern void l_or PARAMS ((void));
111extern void l_xor PARAMS ((void));
112extern void l_sub PARAMS ((void));
113extern void l_mul PARAMS ((void));
114extern void l_div PARAMS ((void));
115extern void l_divu PARAMS ((void));
116extern void l_sll PARAMS ((void));
117extern void l_sra PARAMS ((void));
118extern void l_srl PARAMS ((void));
119extern void l_j PARAMS ((void));
120extern void l_jal PARAMS ((void));
121extern void l_jalr PARAMS ((void));
122extern void l_jr PARAMS ((void));
123extern void l_rfe PARAMS ((void));
124extern void l_nop PARAMS ((void));
125extern void l_bnf PARAMS ((void));
126extern void l_sfeq PARAMS ((void));
127extern void l_sfgts PARAMS ((void));
128extern void l_sfges PARAMS ((void));
129extern void l_sflts PARAMS ((void));
130extern void l_sfles PARAMS ((void));
131extern void l_sfgtu PARAMS ((void));
132extern void l_sfgeu PARAMS ((void));
133extern void l_sfltu PARAMS ((void));
134extern void l_sfleu PARAMS ((void));
135extern void l_mtspr PARAMS ((void));
136extern void l_mfspr PARAMS ((void));
137extern void l_sys PARAMS ((void));
138extern void l_trap PARAMS ((void)); /* CZ 21/06/01. */
139extern void l_macrc PARAMS ((void));
140extern void l_mac PARAMS ((void));
141extern void l_msb PARAMS ((void));
142extern void l_invalid PARAMS ((void));
143extern void l_cust1 PARAMS ((void));
144extern void l_cust2 PARAMS ((void));
145extern void l_cust3 PARAMS ((void));
146extern void l_cust4 PARAMS ((void));
147#endif
148extern void l_none PARAMS ((void));
149
150extern const struct or32_letter or32_letters[];
151
152extern const struct or32_opcode or32_opcodes[];
153
154extern const unsigned int or32_num_opcodes;
155
156/* Calculates instruction length in bytes. Always 4 for OR32. */
157extern int insn_len PARAMS ((int));
158
159/* Is individual insn's operand signed or unsigned? */
160extern int letter_signed PARAMS ((char));
161
162/* Number of letters in the individual lettered operand. */
163extern int letter_range PARAMS ((char));
164
165/* MM: Returns index of given instruction name. */
166extern int insn_index PARAMS ((char *));
167
168/* MM: Returns instruction name from index. */
169extern const char *insn_name PARAMS ((int));
170
171/* MM: Constructs new FSM, based on or32_opcodes. */
172extern void build_automata PARAMS ((void));
173
174/* MM: Destructs FSM. */
175extern void destruct_automata PARAMS ((void));
176
177/* MM: Decodes instruction using FSM. Call build_automata first. */
178extern int insn_decode PARAMS ((unsigned int));
179
180/* Disassemble one instruction from insn to disassemble.
181 Return the size of the instruction. */
182int disassemble_insn PARAMS ((unsigned long));
183
184#endif
This page took 0.084003 seconds and 4 git commands to generate.