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 422

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 420 jeremybenn
 
161 230 jeremybenn
extern unsigned long *or1ksim_automata;
162
extern struct temp_insn_struct *or1ksim_ti;
163 19 jeremybenn
 
164 230 jeremybenn
extern CONST struct  or32_opcode  or1ksim_or32_opcodes[];
165 19 jeremybenn
 
166 230 jeremybenn
extern char *or1ksim_disassembled;
167 19 jeremybenn
 
168 420 jeremybenn
/* trace data */
169
extern int           trace_dest_reg;
170
extern int           trace_store_addr_reg;
171
extern unsigned int  trace_store_imm;
172
extern int           trace_store_val_reg;
173
extern int           trace_store_width;
174
 
175 19 jeremybenn
/* Calculates instruction length in bytes.  Always 4 for OR32. */
176 230 jeremybenn
extern int or1ksim_insn_len PARAMS((int insn_index));
177 19 jeremybenn
 
178
/* MM: Returns instruction name from index.  */
179 230 jeremybenn
extern CONST char *or1ksim_insn_name PARAMS ((int index));
180 19 jeremybenn
 
181 230 jeremybenn
/* MM: Constructs new FSM, based on or1ksim_or32_opcodes.  */
182
extern void or1ksim_build_automata PARAMS ((int  quiet));
183 19 jeremybenn
 
184
/* MM: Destructs FSM.  */
185 230 jeremybenn
extern void or1ksim_destruct_automata PARAMS ((void));
186 19 jeremybenn
 
187 230 jeremybenn
/* MM: Decodes instruction using FSM.  Call or1ksim_build_automata first.  */
188
extern int or1ksim_insn_decode PARAMS((unsigned int insn));
189 19 jeremybenn
 
190
/* Disassemble one instruction from insn to disassemble.
191
   Return the size of the instruction.  */
192 230 jeremybenn
extern int or1ksim_disassemble_insn (unsigned long insn);
193 19 jeremybenn
 
194
/* Disassemble one instruction from insn index.
195
   Return the size of the instruction.  */
196 230 jeremybenn
int or1ksim_disassemble_index (unsigned long insn, int index);
197 19 jeremybenn
 
198 420 jeremybenn
/* Disassemble one instruction from insn index for tracing. */
199
void or1ksim_disassemble_trace_index (unsigned long int  insn,
200
                                      int                index);
201
 
202 19 jeremybenn
/* FOR INTERNAL USE ONLY */
203
/* Automatically does zero- or sign- extension and also finds correct
204
   sign bit position if sign extension is correct extension. Which extension
205
   is proper is figured out from letter description. */
206 230 jeremybenn
unsigned long or1ksim_extend_imm(unsigned long imm, char l);
207 19 jeremybenn
 
208
/* Extracts value from opcode */
209 230 jeremybenn
unsigned long or1ksim_or32_extract(char param_ch, char *enc_initial, unsigned long insn);
210 19 jeremybenn
 
211
#endif
212
 

powered by: WebSVN 2.1.0

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