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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [insight/] [include/] [opcode/] [or32.h] - Blame information for rev 1765

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 1452 nogj
# elif DYNAMIC_EXECUTION
52
#  include "dyn32_defs.h"
53 1444 nogj
# else
54
extern void l_none PARAMS((void));
55
# endif
56
#else
57
extern void l_none PARAMS((void));
58
#endif
59
 
60
 
61 676 markom
struct or32_letter {
62 371 markom
  char letter;
63
  int  sign;
64 676 markom
  /* int  reloc; relocation per letter ??*/
65 133 markom
};
66
 
67 1344 nogj
enum insn_type {
68
 it_unknown,
69
 it_exception,
70
 it_arith,
71
 it_shift,
72
 it_compare,
73
 it_branch,
74
 it_jump,
75
 it_load,
76
 it_store,
77
 it_movimm,
78
 it_move,
79
 it_extend,
80
 it_nop,
81
 it_mac,
82
 it_float };
83
 
84 138 markom
/* Main instruction specification array.  */
85 676 markom
struct or32_opcode {
86 133 markom
  /* Name of the instruction.  */
87
  char *name;
88
 
89
  /* A string of characters which describe the operands.
90
     Valid characters are:
91
     ,() Itself.  Characters appears in the assembly code.
92
     rA  Register operand.
93
     rB  Register operand.
94 1341 nogj
     rD  Register operand (destination).
95 133 markom
     I   An immediate operand, range -32768 to 32767.
96
     J   An immediate operand, range . (unused)
97
     K   An immediate operand, range 0 to 65535.
98
     L   An immediate operand, range 0 to 63.
99
     M   An immediate operand, range . (unused)
100
     N   An immediate operand, range -33554432 to 33554431.
101 676 markom
     O   An immediate operand, range . (unused) */
102 133 markom
  char *args;
103 706 markom
 
104 676 markom
  /* Opcode and operand encoding. */
105 133 markom
  char *encoding;
106 706 markom
 
107 1342 nogj
#ifdef HAS_EXECUTION
108 1452 nogj
# if COMPLEX_EXECUTION
109 706 markom
  char *function_name;
110 1452 nogj
# elif SIMPLE_EXECUTION
111 1342 nogj
  void (*exec)(struct iqueue_entry *);
112 1452 nogj
# else /* DYNAMIC_EXECUTION */
113
  void (*exec)(struct op_queue *opq, int param_t[3], orreg_t param[3], int);
114 1342 nogj
# endif
115
#else  /* HAS_EXECUTION */
116
  void (*exec)(void);
117
#endif
118 706 markom
 
119 133 markom
  unsigned int flags;
120 1344 nogj
  enum insn_type func_unit;
121 133 markom
};
122
 
123 1341 nogj
/* This operand is the last in the list */
124 138 markom
#define OPTYPE_LAST (0x80000000)
125 1341 nogj
/* This operand marks the end of the operand sequence (for things like I(rD)) */
126 138 markom
#define OPTYPE_OP   (0x40000000)
127 1341 nogj
/* The operand specifies a register index */
128 138 markom
#define OPTYPE_REG  (0x20000000)
129 1341 nogj
/* The operand must be sign extended */
130 138 markom
#define OPTYPE_SIG  (0x10000000)
131 1341 nogj
/* Operand is a relative address, the `I' in `I(rD)' */
132 138 markom
#define OPTYPE_DIS  (0x08000000)
133 1341 nogj
/* The operand is a destination */
134 138 markom
#define OPTYPE_DST  (0x04000000)
135 1341 nogj
/* Which bit of the operand is the sign bit */
136 138 markom
#define OPTYPE_SBIT (0x00001F00)
137 1341 nogj
/* Amount to shift the instruction word right to get the operand */
138 138 markom
#define OPTYPE_SHR  (0x0000001F)
139
#define OPTYPE_SBIT_SHR (8)
140
 
141
/* MM: Data how to decode operands.  */
142 676 markom
extern struct insn_op_struct {
143 138 markom
  unsigned long type;
144
  unsigned long data;
145
} **op_start;
146
 
147 1342 nogj
/* Leaf flag used in automata building */
148
#define LEAF_FLAG         (0x80000000)
149
 
150
struct temp_insn_struct
151
{
152
  unsigned long insn;
153
  unsigned long insn_mask;
154
  int in_pass;
155
};
156
 
157
extern unsigned long *automata;
158
extern struct temp_insn_struct *ti;
159
 
160 676 markom
extern CONST struct or32_letter or32_letters[];
161 133 markom
 
162 676 markom
extern CONST struct  or32_opcode or32_opcodes[];
163 133 markom
 
164 680 ivang
extern CONST int num_opcodes;
165 133 markom
 
166 676 markom
/* Calculates instruction length in bytes.  Always 4 for OR32. */
167
extern int insn_len PARAMS((int insn_index));
168 133 markom
 
169 676 markom
/* Is individual insn's operand signed or unsigned? */
170
extern int letter_signed PARAMS((char l));
171 133 markom
 
172 676 markom
/* Number of letters in the individual lettered operand. */
173
extern int letter_range PARAMS((char l));
174 133 markom
 
175
/* MM: Returns index of given instruction name.  */
176 676 markom
extern int insn_index PARAMS((char *insn));
177 133 markom
 
178 138 markom
/* MM: Returns instruction name from index.  */
179 676 markom
extern CONST char *insn_name PARAMS ((int index));
180 138 markom
 
181
/* MM: Constructs new FSM, based on or32_opcodes.  */
182
extern void build_automata PARAMS ((void));
183
 
184
/* MM: Destructs FSM.  */
185
extern void destruct_automata PARAMS ((void));
186
 
187
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
188 676 markom
extern int insn_decode PARAMS((unsigned int insn));
189 138 markom
 
190 371 markom
/* Disassemble one instruction from insn to disassemble.
191
   Return the size of the instruction.  */
192 676 markom
int disassemble_insn (unsigned long insn);
193 371 markom
 
194 703 markom
/* Disassemble one instruction from insn index.
195
   Return the size of the instruction.  */
196
int disassemble_index (unsigned long insn, int index);
197
 
198 879 markom
/* FOR INTERNAL USE ONLY */
199
/* Automatically does zero- or sign- extension and also finds correct
200
   sign bit position if sign extension is correct extension. Which extension
201
   is proper is figured out from letter description. */
202
unsigned long extend_imm(unsigned long imm, char l);
203
 
204
/* Extracts value from opcode */
205
unsigned long or32_extract(char param_ch, char *enc_initial, unsigned long insn);
206
 
207 133 markom
#endif
208 676 markom
 

powered by: WebSVN 2.1.0

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