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

Subversion Repositories or2k

[/] [or2k/] [trunk/] [analysis-bin/] [insnanalysis/] [or1k-32-insn.h] - Blame information for rev 17

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

Line No. Rev Author Line
1 17 julius
/*
2
  Or1K instruction set-specific decoding and analysis functions.
3 16 julius
 
4 17 julius
  Julius Baxter, julius.baxter@orsoc.se
5 16 julius
 
6 17 julius
*/
7 16 julius
 
8
 
9 17 julius
 
10 16 julius
// Struct for information about the register to be confugred
11
// Set to 1 to enable
12
struct or1k_32_instruction_properties
13
{
14
  int has_jumptarg;
15
  int has_branchtarg;
16
 
17
  int has_imm;
18
  int has_split_imm;
19
 
20
  int has_rD;
21
  int has_rA;
22
  int has_rB;
23
 
24
  char *insn_string;
25
 
26
};
27
 
28 17 julius
// OpenRISC 1000 32-bit instruction defines, helping us
29
// extract fields of the instructions
30
 
31 16 julius
// Instruction decode/set its options
32
int or1k_32_analyse_insn(uint32_t insn,
33
                         struct or1k_32_instruction_properties *insn_props);
34
 
35
 
36
// Stat collection entry-oint
37
void or1k_32_collect_stats(uint32_t insn,
38
                           struct or1k_32_instruction_properties  * insn_props);
39
 
40
 
41
// List management/analysis functions
42
// Reset lists
43
void or1k_32_insn_lists_init(void);
44
 
45
// Check for an instruction
46
int or1k_32_insn_lists_check(uint32_t insn,
47
                             struct or1k_32_instruction_properties *insn_props);
48
 
49
// Add a unique instruction
50
int or1k_32_insn_lists_add_unique_insn(uint32_t insn,
51
                           struct or1k_32_instruction_properties *insn_props);
52
 
53
// Add the stats for this one
54
void or1k_32_insn_lists_add(int index, uint32_t insn,
55
                            struct or1k_32_instruction_properties *insn_props);
56
 
57 17 julius
// Print out some useful information
58
void or1k_32_generate_stats(FILE * stream);
59
 
60 16 julius
// Free lists
61
void or1k_32_insn_lists_free(void);
62
 
63
#define JUMPTARG_MASK 0x3ffffff
64
 
65
#define insn_or1k_opcode(x) (x>>26 & 0x3f)
66
 
67
#define insn_or1k_32_rD(x) (((x>>21)&0x1f))
68
#define insn_or1k_32_rA(x) (((x>>16)&0x1f))
69
#define insn_or1k_32_rB(x) (((x>>11)&0x1f))
70
#define insn_or1k_32_imm(x) (x&0xffff)
71
#define insn_or1k_32_split_imm(x) ((((x>>21)&0x1f)<<11)|(x&0x7ff))
72
 
73
#define insn_or1k_opcode_0x00_get_jumptarg(x) (x&JUMPTARG_MASK)
74
 
75
#define insn_or1k_opcode_0x01_get_jumptarg(x) (x&JUMPTARG_MASK)
76
 
77
#define insn_or1k_opcode_0x03_get_branchoff(x) (x&JUMPTARG_MASK)
78
 
79
#define insn_or1k_opcode_0x04_get_branchoff(x) (x&JUMPTARG_MASK)
80
 
81
#define insn_or1k_opcode_0x05_get_noop_id(x) ((x>>24) & 0x3)
82
#define insn_or1k_opcode_0x05_get_imm(x) insn_or1k_32_imm(x)
83
 
84
#define insn_or1k_opcode_0x06_get_rD(x) insn_or1k_32_rD(x)
85
#define insn_or1k_opcode_0x06_get_id(x) ((x>>16) & 0x1)
86
#define insn_or1k_opcode_0x06_get_imm(x) insn_or1k_32_imm(x)
87
 
88
/* N/A: opcode 0x7 */
89
 
90
#define insn_or1k_opcode_0x08_get_id(x) ((x>>23)&0x7)
91
#define insn_or1k_opcode_0x08_get_imm(x) insn_or1k_32_imm(x)
92
 
93
#define insn_or1k_opcode_0x0a_get_rD(x) insn_or1k_32_rD(x)
94
#define insn_or1k_opcode_0x0a_get_rA(x) insn_or1k_32_rA(x)
95
#define insn_or1k_opcode_0x0a_get_rB(x) insn_or1k_32_rB(x)
96
#define insn_or1k_opcode_0x0a_get_op_hi(x) ((x>>4)&0xf)
97
#define insn_or1k_opcode_0x0a_get_op_lo(x) (x&0xf)
98
 
99
/* N/A: opcodes 0xb,c,d,e,f,10 */
100
 
101
#define insn_or1k_opcode_0x11_get_rB(x)  insn_or1k_32_rB(x)
102
 
103
#define insn_or1k_opcode_0x12_get_rB(x)  insn_or1k_32_rB(x)
104
 
105
#define insn_or1k_opcode_0x13_get_rA(x) insn_or1k_32_rA(x)
106
#define insn_or1k_opcode_0x13_get_imm(x) insn_or1k_32_split_imm(x)
107
 
108
/* N/A: opcodes 0x14,15, 16, 17, 18, 19, 1a, 1b */
109
 
110
#define insn_or1k_opcode_0x20_get_rD(x) insn_or1k_32_rD(x)
111
#define insn_or1k_opcode_0x20_get_rA(x) insn_or1k_32_rA(x)
112
#define insn_or1k_opcode_0x20_get_imm(x) insn_or1k_32_imm(x)
113
 
114
 
115
#define insn_or1k_opcode_0x21_get_rD(x) insn_or1k_32_rD(x)
116
#define insn_or1k_opcode_0x21_get_rA(x) insn_or1k_32_rA(x)
117
#define insn_or1k_opcode_0x21_get_imm(x) insn_or1k_32_imm(x)
118
 
119
 
120
#define insn_or1k_opcode_0x22_get_rD(x) insn_or1k_32_rD(x)
121
#define insn_or1k_opcode_0x22_get_rA(x) insn_or1k_32_rA(x)
122
#define insn_or1k_opcode_0x22_get_imm(x) insn_or1k_32_imm(x)
123
 
124
 
125
#define insn_or1k_opcode_0x23_get_rD(x) insn_or1k_32_rD(x)
126
#define insn_or1k_opcode_0x23_get_rA(x) insn_or1k_32_rA(x)
127
#define insn_or1k_opcode_0x23_get_imm(x) insn_or1k_32_imm(x)
128
 
129
 
130
#define insn_or1k_opcode_0x24_get_rD(x) insn_or1k_32_rD(x)
131
#define insn_or1k_opcode_0x24_get_rA(x) insn_or1k_32_rA(x)
132
#define insn_or1k_opcode_0x24_get_imm(x) insn_or1k_32_imm(x)
133
 
134
 
135
#define insn_or1k_opcode_0x25_get_rD(x) insn_or1k_32_rD(x)
136
#define insn_or1k_opcode_0x25_get_rA(x) insn_or1k_32_rA(x)
137
#define insn_or1k_opcode_0x25_get_imm(x) insn_or1k_32_imm(x)
138
 
139
 
140
#define insn_or1k_opcode_0x26_get_rD(x) insn_or1k_32_rD(x)
141
#define insn_or1k_opcode_0x26_get_rA(x) insn_or1k_32_rA(x)
142
#define insn_or1k_opcode_0x26_get_imm(x) insn_or1k_32_imm(x)
143
 
144
 
145
#define insn_or1k_opcode_0x27_get_rD(x) insn_or1k_32_rD(x)
146
#define insn_or1k_opcode_0x27_get_rA(x) insn_or1k_32_rA(x)
147
#define insn_or1k_opcode_0x27_get_imm(x) insn_or1k_32_imm(x)
148
 
149
#define insn_or1k_opcode_0x28_get_rD(x) insn_or1k_32_rD(x)
150
#define insn_or1k_opcode_0x28_get_rA(x) insn_or1k_32_rA(x)
151
#define insn_or1k_opcode_0x28_get_imm(x) insn_or1k_32_imm(x)
152
 
153
 
154
#define insn_or1k_opcode_0x29_get_rD(x) insn_or1k_32_rD(x)
155
#define insn_or1k_opcode_0x29_get_rA(x) insn_or1k_32_rA(x)
156
#define insn_or1k_opcode_0x29_get_imm(x) insn_or1k_32_imm(x)
157
 
158
 
159
#define insn_or1k_opcode_0x2a_get_rD(x) insn_or1k_32_rD(x)
160
#define insn_or1k_opcode_0x2a_get_rA(x) insn_or1k_32_rA(x)
161
#define insn_or1k_opcode_0x2a_get_imm(x) insn_or1k_32_imm(x)
162
 
163
 
164
#define insn_or1k_opcode_0x2b_get_rD(x) insn_or1k_32_rD(x)
165
#define insn_or1k_opcode_0x2b_get_rA(x) insn_or1k_32_rA(x)
166
#define insn_or1k_opcode_0x2b_get_imm(x) insn_or1k_32_imm(x)
167
 
168
 
169
#define insn_or1k_opcode_0x2c_get_rD(x) insn_or1k_32_rD(x)
170
#define insn_or1k_opcode_0x2c_get_rA(x) insn_or1k_32_rA(x)
171
#define insn_or1k_opcode_0x2c_get_imm(x) insn_or1k_32_imm(x)
172
 
173
 
174
#define insn_or1k_opcode_0x2d_get_rD(x) insn_or1k_32_rD(x)
175
#define insn_or1k_opcode_0x2d_get_rA(x) insn_or1k_32_rA(x)
176
#define insn_or1k_opcode_0x2d_get_imm(x) insn_or1k_32_imm(x)
177
 
178
 
179
#define insn_or1k_opcode_0x2e_get_rD(x) insn_or1k_32_rD(x)
180
#define insn_or1k_opcode_0x2e_get_rA(x) insn_or1k_32_rA(x)
181
#define insn_or1k_opcode_0x2e_get_op(x) ((x>>6)&0x3)
182
#define insn_or1k_opcode_0x2e_get_imm(x) ((x&3f))
183
 
184
 
185
#define insn_or1k_opcode_0x2f_get_op(x) insn_or1k_32_rD(x)
186
#define insn_or1k_opcode_0x2f_get_rA(x) insn_or1k_32_rA(x)
187
#define insn_or1k_opcode_0x2f_get_imm(x) insn_or1k_32_imm(x)
188
 
189
 
190
#define insn_or1k_opcode_0x30_get_rA(x) insn_or1k_32_rA(x)
191
#define insn_or1k_opcode_0x30_get_rB(x) insn_or1k_32_rB(x)
192
#define insn_or1k_opcode_0x30_get_imm(x) insn_or1k_32_split_imm(x)
193
 
194
 
195
#define insn_or1k_opcode_0x31_get_rA(x) insn_or1k_32_rA(x)
196
#define insn_or1k_opcode_0x31_get_rB(x) insn_or1k_32_rB(x)
197
#define insn_or1k_opcode_0x31_get_op(x) (x&0xf)
198
 
199
 
200
#define insn_or1k_opcode_0x32_get_rD(x) insn_or1k_32_rD(x)
201
#define insn_or1k_opcode_0x32_get_rA(x) insn_or1k_32_rA(x)
202
#define insn_or1k_opcode_0x32_get_rB(x) insn_or1k_32_rB(x)
203
#define insn_or1k_opcode_0x32_get_op_hi(x) ((x>>4)&0xf)
204
#define insn_or1k_opcode_0x32_get_op_lo(x) ((x&0xf))
205
 
206
/* N/A: opcodes 0x33 */
207
 
208
#define insn_or1k_opcode_0x34_get_rD(x) insn_or1k_32_rA(x)
209
#define insn_or1k_opcode_0x34_get_rB(x) insn_or1k_32_rB(x)
210
#define insn_or1k_opcode_0x34_get_imm(x) insn_or1k_32_split_imm(x)
211
 
212
 
213
#define insn_or1k_opcode_0x35_get_rD(x) insn_or1k_32_rA(x)
214
#define insn_or1k_opcode_0x35_get_rB(x) insn_or1k_32_rB(x)
215
#define insn_or1k_opcode_0x35_get_imm(x) insn_or1k_32_split_imm(x)
216
 
217
 
218
#define insn_or1k_opcode_0x36_get_rD(x) insn_or1k_32_rA(x)
219
#define insn_or1k_opcode_0x36_get_rB(x) insn_or1k_32_rB(x)
220
#define insn_or1k_opcode_0x36_get_imm(x) insn_or1k_32_split_imm(x)
221
 
222
 
223
#define insn_or1k_opcode_0x37_get_rD(x) insn_or1k_32_rA(x)
224
#define insn_or1k_opcode_0x37_get_rB(x) insn_or1k_32_rB(x)
225
#define insn_or1k_opcode_0x37_get_imm(x) insn_or1k_32_split_imm(x)
226
 
227
 
228
#define insn_or1k_opcode_0x38_get_rD(x) insn_or1k_32_rD(x)
229
#define insn_or1k_opcode_0x38_get_rA(x) insn_or1k_32_rA(x)
230
#define insn_or1k_opcode_0x38_get_rB(x) insn_or1k_32_rB(x)
231
#define insn_or1k_opcode_0x38_get_op_hi_2bit(x) ((x>>8)&0x3)
232
#define insn_or1k_opcode_0x38_get_op_hi_4bit(x) ((x>>6)&0xf)
233
#define insn_or1k_opcode_0x38_get_op_lo(x) ((x&0xf))
234
 
235
#define insn_or1k_opcode_0x39_get_op(x) insn_or1k_32_rD(x)
236
#define insn_or1k_opcode_0x39_get_rA(x) insn_or1k_32_rA(x)
237
#define insn_or1k_opcode_0x39_get_rB(x) insn_or1k_32_rB(x)
238
 
239
/* N/A: opcodes 0x3a,3b */

powered by: WebSVN 2.1.0

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