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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [opcodes/] [or32.h] - Blame information for rev 1771

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

powered by: WebSVN 2.1.0

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