OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_70/] [gdb-5.0/] [opcodes/] [or32.h] - Blame information for rev 1444

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 133 markom
/* Table of opcodes for the OpenRISC 1000 ISA.
2 676 markom
   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 133 markom
   Contributed by Damjan Lampret (lampret@opencores.org).
4
 
5 676 markom
This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
6 133 markom
 
7 676 markom
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 133 markom
 
12 676 markom
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 133 markom
 
17 676 markom
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 133 markom
 
21
/* We treat all letters the same in encode/decode routines so
22 676 markom
   we need to assign some characteristics to them like signess etc.*/
23 133 markom
 
24
#ifndef OR32_H_ISA
25
#define OR32_H_ISA
26
 
27 138 markom
#define NUM_UNSIGNED (0)
28
#define NUM_SIGNED (1)
29 133 markom
 
30
#ifndef PARAMS
31
#define PARAMS(x) x
32
#endif
33
 
34
#ifndef CONST
35
#define CONST const
36
#endif
37
 
38 138 markom
#define MAX_GPRS 32
39 1256 phoenix
#define PAGE_SIZE 8192
40 138 markom
#undef __HALF_WORD_INSN__
41
 
42
#define OPERAND_DELIM (',')
43
 
44
#define OR32_IF_DELAY (1)
45
#define OR32_W_FLAG   (2)
46
#define OR32_R_FLAG   (4)
47
 
48 1444 nogj
#if defined(HAS_EXECUTION)
49
# if SIMPLE_EXECUTION
50
#  include "simpl32_defs.h"
51
# else
52
extern void l_none PARAMS((void));
53
# endif
54
#else
55
extern void l_none PARAMS((void));
56
#endif
57
 
58
 
59 676 markom
struct or32_letter {
60 371 markom
  char letter;
61
  int  sign;
62 676 markom
  /* int  reloc; relocation per letter ??*/
63 133 markom
};
64
 
65 1344 nogj
enum insn_type {
66
 it_unknown,
67
 it_exception,
68
 it_arith,
69
 it_shift,
70
 it_compare,
71
 it_branch,
72
 it_jump,
73
 it_load,
74
 it_store,
75
 it_movimm,
76
 it_move,
77
 it_extend,
78
 it_nop,
79
 it_mac,
80
 it_float };
81
 
82 138 markom
/* Main instruction specification array.  */
83 676 markom
struct or32_opcode {
84 133 markom
  /* Name of the instruction.  */
85
  char *name;
86
 
87
  /* A string of characters which describe the operands.
88
     Valid characters are:
89
     ,() Itself.  Characters appears in the assembly code.
90
     rA  Register operand.
91
     rB  Register operand.
92 1341 nogj
     rD  Register operand (destination).
93 133 markom
     I   An immediate operand, range -32768 to 32767.
94
     J   An immediate operand, range . (unused)
95
     K   An immediate operand, range 0 to 65535.
96
     L   An immediate operand, range 0 to 63.
97
     M   An immediate operand, range . (unused)
98
     N   An immediate operand, range -33554432 to 33554431.
99 676 markom
     O   An immediate operand, range . (unused) */
100 133 markom
  char *args;
101 706 markom
 
102 676 markom
  /* Opcode and operand encoding. */
103 133 markom
  char *encoding;
104 706 markom
 
105 1342 nogj
#ifdef HAS_EXECUTION
106
# if !SIMPLE_EXECUTION
107 706 markom
  char *function_name;
108 1342 nogj
# else /* !SIMPLE_EXECUTION */
109
  void (*exec)(struct iqueue_entry *);
110
# endif
111
#else  /* HAS_EXECUTION */
112
  void (*exec)(void);
113
#endif
114 706 markom
 
115 133 markom
  unsigned int flags;
116 1344 nogj
  enum insn_type func_unit;
117 133 markom
};
118
 
119 1341 nogj
/* This operand is the last in the list */
120 138 markom
#define OPTYPE_LAST (0x80000000)
121 1341 nogj
/* This operand marks the end of the operand sequence (for things like I(rD)) */
122 138 markom
#define OPTYPE_OP   (0x40000000)
123 1341 nogj
/* The operand specifies a register index */
124 138 markom
#define OPTYPE_REG  (0x20000000)
125 1341 nogj
/* The operand must be sign extended */
126 138 markom
#define OPTYPE_SIG  (0x10000000)
127 1341 nogj
/* Operand is a relative address, the `I' in `I(rD)' */
128 138 markom
#define OPTYPE_DIS  (0x08000000)
129 1341 nogj
/* The operand is a destination */
130 138 markom
#define OPTYPE_DST  (0x04000000)
131 1341 nogj
/* Which bit of the operand is the sign bit */
132 138 markom
#define OPTYPE_SBIT (0x00001F00)
133 1341 nogj
/* Amount to shift the instruction word right to get the operand */
134 138 markom
#define OPTYPE_SHR  (0x0000001F)
135
#define OPTYPE_SBIT_SHR (8)
136
 
137
/* MM: Data how to decode operands.  */
138 676 markom
extern struct insn_op_struct {
139 138 markom
  unsigned long type;
140
  unsigned long data;
141
} **op_start;
142
 
143 1342 nogj
/* Leaf flag used in automata building */
144
#define LEAF_FLAG         (0x80000000)
145
 
146
struct temp_insn_struct
147
{
148
  unsigned long insn;
149
  unsigned long insn_mask;
150
  int in_pass;
151
};
152
 
153
extern unsigned long *automata;
154
extern struct temp_insn_struct *ti;
155
 
156 676 markom
extern CONST struct or32_letter or32_letters[];
157 133 markom
 
158 676 markom
extern CONST struct  or32_opcode or32_opcodes[];
159 133 markom
 
160 680 ivang
extern CONST int num_opcodes;
161 133 markom
 
162 676 markom
/* Calculates instruction length in bytes.  Always 4 for OR32. */
163
extern int insn_len PARAMS((int insn_index));
164 133 markom
 
165 676 markom
/* Is individual insn's operand signed or unsigned? */
166
extern int letter_signed PARAMS((char l));
167 133 markom
 
168 676 markom
/* Number of letters in the individual lettered operand. */
169
extern int letter_range PARAMS((char l));
170 133 markom
 
171
/* MM: Returns index of given instruction name.  */
172 676 markom
extern int insn_index PARAMS((char *insn));
173 133 markom
 
174 138 markom
/* MM: Returns instruction name from index.  */
175 676 markom
extern CONST char *insn_name PARAMS ((int index));
176 138 markom
 
177
/* MM: Constructs new FSM, based on or32_opcodes.  */
178
extern void build_automata PARAMS ((void));
179
 
180
/* MM: Destructs FSM.  */
181
extern void destruct_automata PARAMS ((void));
182
 
183
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
184 676 markom
extern int insn_decode PARAMS((unsigned int insn));
185 138 markom
 
186 371 markom
/* Disassemble one instruction from insn to disassemble.
187
   Return the size of the instruction.  */
188 676 markom
int disassemble_insn (unsigned long insn);
189 371 markom
 
190 703 markom
/* Disassemble one instruction from insn index.
191
   Return the size of the instruction.  */
192
int disassemble_index (unsigned long insn, int index);
193
 
194 879 markom
/* FOR INTERNAL USE ONLY */
195
/* Automatically does zero- or sign- extension and also finds correct
196
   sign bit position if sign extension is correct extension. Which extension
197
   is proper is figured out from letter description. */
198
unsigned long extend_imm(unsigned long imm, char l);
199
 
200
/* Extracts value from opcode */
201
unsigned long or32_extract(char param_ch, char *enc_initial, unsigned long insn);
202
 
203 133 markom
#endif
204 676 markom
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.