1 |
2 |
cvs |
/* abstract.c -- Abstract entities header file
|
2 |
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
|
|
|
20 |
|
|
#define MEMORY_LEN 100000
|
21 |
|
|
#define STACK_SIZE 10000
|
22 |
|
|
#define LABELNAME_LEN 30
|
23 |
|
|
#define INSNAME_LEN 13
|
24 |
|
|
#define OPERANDNAME_LEN 30
|
25 |
|
|
|
26 |
|
|
/* This is an abstract memory type rather than physical memory type */
|
27 |
|
|
struct mem_entry {
|
28 |
|
|
unsigned char data;
|
29 |
|
|
unsigned char brk;
|
30 |
|
|
char label[LABELNAME_LEN]; /* label name (optinal) */
|
31 |
|
|
char insn[INSNAME_LEN];
|
32 |
|
|
char op1[OPERANDNAME_LEN];
|
33 |
|
|
char op2[OPERANDNAME_LEN];
|
34 |
|
|
char op3[OPERANDNAME_LEN];
|
35 |
|
|
char op4[OPERANDNAME_LEN];
|
36 |
|
|
};
|
37 |
|
|
|
38 |
|
|
enum insn_type { unknown, arith, shift, compare, branch,
|
39 |
|
|
jump, load, store, movimm, move, extend, nop };
|
40 |
|
|
|
41 |
|
|
/* Instruction queue */
|
42 |
|
|
struct iqueue_entry {
|
43 |
|
|
char insn[INSNAME_LEN];
|
44 |
|
|
enum insn_type func_unit;
|
45 |
|
|
char op1[OPERANDNAME_LEN];
|
46 |
|
|
char op2[OPERANDNAME_LEN];
|
47 |
|
|
char op3[OPERANDNAME_LEN];
|
48 |
|
|
char op4[OPERANDNAME_LEN];
|
49 |
|
|
char *dependdst;
|
50 |
|
|
char *dependsrc1;
|
51 |
|
|
char *dependsrc2;
|
52 |
|
|
unsigned long insn_addr;
|
53 |
|
|
};
|
54 |
|
|
|
55 |
|
|
/* Completition queue */
|
56 |
|
|
struct icomplet_entry {
|
57 |
|
|
char insn[INSNAME_LEN];
|
58 |
|
|
enum insn_type func_unit;
|
59 |
|
|
char op1[OPERANDNAME_LEN];
|
60 |
|
|
char op2[OPERANDNAME_LEN];
|
61 |
|
|
char op3[OPERANDNAME_LEN];
|
62 |
|
|
char op4[OPERANDNAME_LEN];
|
63 |
|
|
char *dependdst;
|
64 |
|
|
char *dependsrc1;
|
65 |
|
|
char *dependsrc2;
|
66 |
|
|
unsigned long insn_addr;
|
67 |
|
|
};
|
68 |
|
|
|
69 |
|
|
extern struct iqueue_entry iqueue[20];
|
70 |
|
|
extern struct icomplet_entry icomplet[20];
|
71 |
|
|
extern unsigned long pc;
|
72 |
|
|
|
73 |
|
|
extern struct mem_entry mem[MEMORY_LEN];
|
74 |
|
|
extern void dumpmemory(unsigned int from, unsigned int to);
|
75 |
|
|
extern unsigned long eval_label(char *label);
|
76 |
|
|
extern unsigned long eval_mem32(unsigned long memaddr);
|
77 |
|
|
extern unsigned short eval_mem16(unsigned long memaddr);
|
78 |
|
|
extern unsigned char eval_mem8(unsigned long memaddr);
|
79 |
|
|
extern void set_mem32(unsigned long memaddr, unsigned long value);
|
80 |
|
|
extern void set_mem16(unsigned long memaddr, unsigned short value);
|
81 |
|
|
extern void set_mem8(unsigned long memaddr, unsigned char value);
|