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 18

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