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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_1_x/] [or1ksim/] [cpu/] [or1k/] [opcode/] [or32.h] - Blame information for rev 662

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 662 ivang
   Copyright 2002 Free Software Foundation, Inc.
3 133 markom
   Contributed by Damjan Lampret (lampret@opencores.org).
4
 
5 662 ivang
   This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
6 133 markom
 
7 662 ivang
   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 662 ivang
   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 662 ivang
   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 662 ivang
   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
#define PAGE_SIZE 4096
40
#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 662 ivang
struct or32_letter
49
{
50 371 markom
  char letter;
51
  int  sign;
52 662 ivang
  /* int  reloc; relocation per letter ??  */
53 133 markom
};
54
 
55 138 markom
/* Main instruction specification array.  */
56 662 ivang
struct or32_opcode
57
{
58 133 markom
  /* Name of the instruction.  */
59
  char *name;
60
 
61
  /* A string of characters which describe the operands.
62
     Valid characters are:
63
     ,() Itself.  Characters appears in the assembly code.
64
     rA  Register operand.
65
     rB  Register operand.
66
     rD  Register operand.
67
     I   An immediate operand, range -32768 to 32767.
68
     J   An immediate operand, range . (unused)
69
     K   An immediate operand, range 0 to 65535.
70
     L   An immediate operand, range 0 to 63.
71
     M   An immediate operand, range . (unused)
72
     N   An immediate operand, range -33554432 to 33554431.
73 662 ivang
     O   An immediate operand, range . (unused).  */
74 133 markom
  char *args;
75
 
76 662 ivang
  /* Opcode and operand encoding.  */
77 133 markom
  char *encoding;
78 662 ivang
  void (*exec) PARAMS ((void));
79 133 markom
  unsigned int flags;
80
};
81
 
82 138 markom
#define OPTYPE_LAST (0x80000000)
83
#define OPTYPE_OP   (0x40000000)
84
#define OPTYPE_REG  (0x20000000)
85
#define OPTYPE_SIG  (0x10000000)
86
#define OPTYPE_DIS  (0x08000000)
87
#define OPTYPE_DST  (0x04000000)
88
#define OPTYPE_SBIT (0x00001F00)
89
#define OPTYPE_SHR  (0x0000001F)
90
#define OPTYPE_SBIT_SHR (8)
91
 
92
/* MM: Data how to decode operands.  */
93 662 ivang
extern struct insn_op_struct
94
{
95 138 markom
  unsigned long type;
96
  unsigned long data;
97
} **op_start;
98
 
99 133 markom
#ifdef HAS_EXECUTION
100 662 ivang
extern void l_invalid PARAMS ((void));
101
extern void l_sfne    PARAMS ((void));
102
extern void l_bf      PARAMS ((void));
103
extern void l_add     PARAMS ((void));
104
extern void l_sw      PARAMS ((void));
105
extern void l_sb      PARAMS ((void));
106
extern void l_sh      PARAMS ((void));
107
extern void l_lwz     PARAMS ((void));
108
extern void l_lbs     PARAMS ((void));
109
extern void l_lbz     PARAMS ((void));
110
extern void l_lhs     PARAMS ((void));
111
extern void l_lhz     PARAMS ((void));
112
extern void l_movhi   PARAMS ((void));
113
extern void l_and     PARAMS ((void));
114
extern void l_or      PARAMS ((void));
115
extern void l_xor     PARAMS ((void));
116
extern void l_sub     PARAMS ((void));
117
extern void l_mul     PARAMS ((void));
118
extern void l_div     PARAMS ((void));
119
extern void l_divu    PARAMS ((void));
120
extern void l_sll     PARAMS ((void));
121
extern void l_sra     PARAMS ((void));
122
extern void l_srl     PARAMS ((void));
123
extern void l_j       PARAMS ((void));
124
extern void l_jal     PARAMS ((void));
125
extern void l_jalr    PARAMS ((void));
126
extern void l_jr      PARAMS ((void));
127
extern void l_rfe     PARAMS ((void));
128
extern void l_nop     PARAMS ((void));
129
extern void l_bnf     PARAMS ((void));
130
extern void l_sfeq    PARAMS ((void));
131
extern void l_sfgts   PARAMS ((void));
132
extern void l_sfges   PARAMS ((void));
133
extern void l_sflts   PARAMS ((void));
134
extern void l_sfles   PARAMS ((void));
135
extern void l_sfgtu   PARAMS ((void));
136
extern void l_sfgeu   PARAMS ((void));
137
extern void l_sfltu   PARAMS ((void));
138
extern void l_sfleu   PARAMS ((void));
139
extern void l_mtspr   PARAMS ((void));
140
extern void l_mfspr   PARAMS ((void));
141
extern void l_sys     PARAMS ((void));
142
extern void l_trap    PARAMS ((void)); /* CZ 21/06/01.  */
143
extern void l_macrc   PARAMS ((void));
144
extern void l_mac     PARAMS ((void));
145
extern void l_msb     PARAMS ((void));
146
extern void l_invalid PARAMS ((void));
147
extern void l_cust1   PARAMS ((void));
148
extern void l_cust2   PARAMS ((void));
149
extern void l_cust3   PARAMS ((void));
150
extern void l_cust4   PARAMS ((void));
151 133 markom
#endif
152 662 ivang
extern void l_none    PARAMS ((void));
153 133 markom
 
154 662 ivang
extern const struct or32_letter or32_letters[];
155 133 markom
 
156 662 ivang
extern const struct  or32_opcode or32_opcodes[];
157 133 markom
 
158 662 ivang
extern const unsigned int or32_num_opcodes;
159 133 markom
 
160 662 ivang
/* Calculates instruction length in bytes.  Always 4 for OR32.  */
161
extern int insn_len PARAMS ((int));
162 133 markom
 
163 662 ivang
/* Is individual insn's operand signed or unsigned?  */
164
extern int letter_signed PARAMS ((char));
165 133 markom
 
166 662 ivang
/* Number of letters in the individual lettered operand.  */
167
extern int letter_range PARAMS ((char));
168 133 markom
 
169
/* MM: Returns index of given instruction name.  */
170 662 ivang
extern int insn_index PARAMS ((char *));
171 133 markom
 
172 138 markom
/* MM: Returns instruction name from index.  */
173 662 ivang
extern const char *insn_name PARAMS ((int));
174 138 markom
 
175
/* MM: Constructs new FSM, based on or32_opcodes.  */
176
extern void build_automata PARAMS ((void));
177
 
178
/* MM: Destructs FSM.  */
179
extern void destruct_automata PARAMS ((void));
180
 
181
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
182 662 ivang
extern int insn_decode PARAMS ((unsigned int));
183 138 markom
 
184 371 markom
/* Disassemble one instruction from insn to disassemble.
185
   Return the size of the instruction.  */
186 662 ivang
int disassemble_insn PARAMS ((unsigned long));
187 371 markom
 
188 133 markom
#endif

powered by: WebSVN 2.1.0

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