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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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