OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1ksim/] [cpu/] [or1k/] [opcode/] [or32.h] - Blame information for rev 333

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

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

powered by: WebSVN 2.1.0

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