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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [common/] [abstract.h] - Blame information for rev 134

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

Line No. Rev Author Line
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 30 lampret
#define MEMORY_START    0
21 134 markom
#define MEMORY_LEN      502400
22 37 lampret
#define STACK_SIZE      20
23 28 lampret
#define LABELNAME_LEN   50
24 26 lampret
#define INSNAME_LEN     15
25
#define OPERANDNAME_LEN 50
26 2 cvs
 
27 28 lampret
/* Structure for holding several labels of a particular memory location */
28
struct label_entry {
29 123 markom
  char *name;
30
  struct label_entry *next;
31 28 lampret
};
32
 
33 134 markom
/* Structure that holds disassembled instruction.  */
34 28 lampret
struct insn_entry {
35 123 markom
  char *op1;
36
  char *op2;
37
  char *op3;
38
  char *op4;
39 134 markom
  /* MM: Instruction index instead of insn name.  */
40 123 markom
  int insn_index;
41 134 markom
  unsigned int op[4][2];
42 28 lampret
};
43
 
44 134 markom
#define OP_MEM_ACCESS 0x80000000
45
 
46
/* This is an abstract memory type rather than physical memory type.  It holds
47
disassembled instructions.  */
48 2 cvs
struct mem_entry {
49 123 markom
  unsigned char data;
50
  unsigned char brk;
51
  struct label_entry *label; /* labels */
52
  struct insn_entry *insn; /* insn */
53 2 cvs
};
54
 
55 22 lampret
enum insn_type { unknown, exception, arith, shift, compare, branch,
56 123 markom
                 jump, load, store, movimm, move, extend, nop, mac };
57 2 cvs
 
58
/* Instruction queue */
59
struct iqueue_entry {
60 123 markom
  enum insn_type func_unit;
61
  int insn_index;
62
  char op1[OPERANDNAME_LEN];
63
  char op2[OPERANDNAME_LEN];
64
  char op3[OPERANDNAME_LEN];
65
  char op4[OPERANDNAME_LEN];
66
  char *dependdst;
67
  char *dependsrc1;
68
  char *dependsrc2;
69
  unsigned long insn_addr;
70 2 cvs
};
71
 
72
/* Completition queue */
73
struct icomplet_entry {
74 123 markom
  enum insn_type func_unit;
75
  int  insn_index;
76
  char op1[OPERANDNAME_LEN];
77
  char op2[OPERANDNAME_LEN];
78
  char op3[OPERANDNAME_LEN];
79
  char op4[OPERANDNAME_LEN];
80
  char *dependdst;
81
  char *dependsrc1;
82
  char *dependsrc2;
83
  unsigned long insn_addr;
84 2 cvs
};
85
 
86 30 lampret
/* Memory regions assigned to devices */
87
struct dev_memarea {
88 123 markom
  struct dev_memarea *next;
89
  unsigned long baseaddr;
90
  unsigned long size;
91
  unsigned char (*readfunc)(unsigned long);
92
  void (*writefunc)(unsigned long, unsigned char);
93 30 lampret
};
94
 
95 2 cvs
extern struct iqueue_entry iqueue[20];
96
extern struct icomplet_entry icomplet[20];
97
extern unsigned long pc;
98
 
99
extern struct mem_entry mem[MEMORY_LEN];
100
extern void dumpmemory(unsigned int from, unsigned int to);
101
extern unsigned long eval_label(char *label);
102 123 markom
extern unsigned long eval_mem32(unsigned long memaddr,int*);
103
extern unsigned short eval_mem16(unsigned long memaddr,int*);
104
extern unsigned char eval_mem8(unsigned long memaddr,int*);
105
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
106
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
107
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
108
 
109
unsigned long evalsim_mem32(unsigned long,int*);
110
unsigned short evalsim_mem16(unsigned long,int*);
111
unsigned char evalsim_mem8(unsigned long,int*);
112
void setsim_mem32(unsigned long,unsigned long);
113
void setsim_mem16(unsigned long,unsigned short);
114
void setsim_mem8(unsigned long,unsigned char);
115
 
116
extern int GlobalMode; /* Added by CZ 26/05/01 */
117
 
118
/* Added by MM */
119
#ifndef LONGEST
120
 
121
#ifdef BFD64
122
 
123
#define LONGEST BFD_HOST_64_BIT
124
#define ULONGEST BFD_HOST_U_64_BIT
125
 
126
#else /* No BFD64 */
127
 
128
#ifdef CC_HAS_LONG_LONG
129
#define LONGEST long long
130
#define ULONGEST unsigned long long
131
#else
132
#ifdef BFD_HOST_64_BIT
133
/* BFD_HOST_64_BIT is defined for some hosts that don't have long long
134
   (e.g. i386-windows) so try it.  */
135
#define LONGEST BFD_HOST_64_BIT
136
#define ULONGEST BFD_HOST_U_64_BIT
137
#else
138
#define LONGEST long
139
#define ULONGEST unsigned long
140
#endif
141
#endif
142
 
143
#endif /* No BFD64 */
144
 
145
#endif /* ! LONGEST */

powered by: WebSVN 2.1.0

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