Skip to content

Commit a9cfda1

Browse files
authored
or1ksim_trace: Expose api for or1k_trace fusesoc core (#29)
2 parents be3612f + 508ea05 commit a9cfda1

File tree

7 files changed

+362
-195
lines changed

7 files changed

+362
-195
lines changed

cpu/or1k/opcode/or32.h

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@
3131
#ifndef OR32_H_ISA
3232
#define OR32_H_ISA
3333

34+
#include <stdint.h>
35+
3436
#define NUM_UNSIGNED (0)
3537
#define NUM_SIGNED (1)
3638

3739
#ifndef PARAMS
3840
#define PARAMS(x) x
3941
#endif
4042

41-
#ifndef CONST
42-
#define CONST const
43-
#endif
44-
4543
#define MAX_GPRS 32
4644
#define PAGE_SIZE 8192
4745
#undef __HALF_WORD_INSN__
@@ -85,7 +83,7 @@ enum insn_type {
8583
/* Main instruction specification array. */
8684
struct or32_opcode {
8785
/* Name of the instruction. */
88-
char *name;
86+
const char *name;
8987

9088
/* A string of characters which describe the operands.
9189
Valid characters are:
@@ -100,14 +98,14 @@ struct or32_opcode {
10098
M An immediate operand, range . (unused)
10199
N An immediate operand, range -33554432 to 33554431.
102100
O An immediate operand, range . (unused) */
103-
char *args;
101+
const char *args;
104102

105103
/* Opcode and operand encoding. */
106-
char *encoding;
104+
const char *encoding;
107105

108106
#ifdef HAVE_EXECUTION
109107
# if COMPLEX_EXECUTION
110-
char *function_name;
108+
const char *function_name;
111109
# elif SIMPLE_EXECUTION
112110
void (*exec)(struct iqueue_entry *);
113111
# endif
@@ -153,16 +151,16 @@ struct temp_insn_struct
153151
int in_pass;
154152
};
155153

156-
157154
extern unsigned long *or1ksim_automata;
158155
extern struct temp_insn_struct *or1ksim_ti;
159156

160-
extern CONST struct or32_opcode or1ksim_or32_opcodes[];
157+
extern const struct or32_opcode or1ksim_or32_opcodes[];
161158

162159
extern char *or1ksim_disassembled;
163160

164161
/* trace data */
165162
extern int trace_dest_reg;
163+
extern int trace_src_reg;
166164
extern int trace_store_addr_reg;
167165
extern unsigned int trace_store_imm;
168166
extern int trace_store_val_reg;
@@ -173,28 +171,28 @@ extern int trace_dest_spr;
173171
extern int or1ksim_insn_len PARAMS((int insn_index));
174172

175173
/* MM: Returns instruction name from index. */
176-
extern CONST char *or1ksim_insn_name PARAMS ((int index));
174+
extern const char *or1ksim_insn_name PARAMS ((int index));
177175

178-
/* MM: Constructs new FSM, based on or1ksim_or32_opcodes. */
179-
extern void or1ksim_build_automata PARAMS ((int quiet));
176+
/* MM: Constructs new FSM, based on or1ksim_or32_opcodes. */
177+
extern void or1ksim_build_automata PARAMS ((int quiet));
180178

181-
/* MM: Destructs FSM. */
179+
/* MM: Destructs FSM. */
182180
extern void or1ksim_destruct_automata PARAMS ((void));
183181

184182
/* MM: Decodes instruction using FSM. Call or1ksim_build_automata first. */
185-
extern int or1ksim_insn_decode PARAMS((unsigned int insn));
183+
extern int or1ksim_insn_decode PARAMS((uint32_t insn));
186184

187185
/* Disassemble one instruction from insn to disassemble.
188186
Return the size of the instruction. */
189-
extern int or1ksim_disassemble_insn (unsigned long insn);
187+
extern int or1ksim_disassemble_insn (uint32_t insn);
190188

191189
/* Disassemble one instruction from insn index.
192190
Return the size of the instruction. */
193-
int or1ksim_disassemble_index (unsigned long insn, int index);
191+
int or1ksim_disassemble_index (uint32_t insn, int index);
194192

195193
/* Disassemble one instruction from insn index for tracing. */
196-
void or1ksim_disassemble_trace_index (unsigned long int insn,
197-
int index);
194+
void or1ksim_disassemble_trace_index (uint32_t insn,
195+
int index);
198196

199197
/* FOR INTERNAL USE ONLY */
200198
/* Automatically does zero- or sign- extension and also finds correct
@@ -203,7 +201,6 @@ void or1ksim_disassemble_trace_index (unsigned long int insn,
203201
unsigned long or1ksim_extend_imm(unsigned long imm, char l);
204202

205203
/* Extracts value from opcode */
206-
unsigned long or1ksim_or32_extract(char param_ch, char *enc_initial, unsigned long insn);
204+
unsigned long or1ksim_or32_extract(char param_ch, const char *enc_initial, uint32_t insn);
207205

208206
#endif
209-

0 commit comments

Comments
 (0)