OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1ksim/] [cpu/] [common/] [abstract.h] - Blame information for rev 265

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

Line No. Rev Author Line
1 19 jeremybenn
/* abstract.h -- Abstract entities header file
2
 
3
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of OpenRISC 1000 Architectural Simulator.
9
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
22
 
23
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25
 
26
 
27
#ifndef ABSTRACT__H
28
#define ABSTRACT__H
29
 
30
/* Autoconf and/or portability configuration */
31
#include "port.h"
32
 
33
/* System includes */
34
#include <stdio.h>
35
 
36
/* Package includes */
37
#include "arch.h"
38
 
39
#define DEFAULT_MEMORY_START         0
40
#define DEFAULT_MEMORY_LEN    0x800000
41
#define STACK_SIZE                  20
42
#define LABELNAME_LEN               50
43
#define INSNAME_LEN                 15
44
#define OPERANDNAME_LEN             50
45
#define MAX_OPERANDS                 5
46
 
47
#define OP_MEM_ACCESS       0x80000000
48
 
49
/* Cache tag types.  */
50
#define CT_NONE                      0
51
#define CT_VIRTUAL                   1
52
#define CT_PHYSICAL                  2
53
 
54
/* History of execution */
55
#define HISTEXEC_LEN               200
56
 
57
/* Added by MM */
58
#ifndef LONGEST
59
#define LONGEST long long
60
#endif /* LONGEST */
61
 
62
#ifndef ULONGEST
63
#define ULONGEST unsigned long long
64
#endif /* ULONGEST */
65
 
66
/* Endianness convenience macros */
67
#define LE16(x) bswap_16(x)
68
 
69
/*! Instruction queue */
70
struct iqueue_entry
71
{
72
  int       insn_index;
73
  uint32_t  insn;
74
  oraddr_t  insn_addr;
75
};
76
 
77
/*! All the memory operations possible */
78
struct mem_ops
79
{
80
 
81
  /* Read functions */
82
  uint32_t    (*readfunc32) (oraddr_t, void *);
83
  uint16_t    (*readfunc16) (oraddr_t, void *);
84
  uint8_t     (*readfunc8) (oraddr_t, void *);
85
 
86
  /* Read functions' data */
87
  void       *read_dat8;
88
  void       *read_dat16;
89
  void       *read_dat32;
90
 
91
  /* Write functions */
92
  void        (*writefunc32) (oraddr_t, uint32_t, void *);
93
  void        (*writefunc16) (oraddr_t, uint16_t, void *);
94
  void        (*writefunc8) (oraddr_t, uint8_t, void *);
95
 
96
  /* Write functions' data */
97
  void       *write_dat8;
98
  void       *write_dat16;
99
  void       *write_dat32;
100
 
101
  /* Program load function.  If you have unwritteable memory but you would like
102
   * it if a program would be loaded here, make sure to set this.  If this is
103
   * not set, then writefunc8 will be called to load the program */
104
  void        (*writeprog32) (oraddr_t, uint32_t, void *);
105
  void        (*writeprog8) (oraddr_t, uint8_t, void *);
106
 
107
  /* Program load functions' data */
108
  void       *writeprog32_dat;
109
  void       *writeprog8_dat;
110
 
111
  /* Read/Write delays */
112
  int         delayr;
113
  int         delayw;
114
 
115
  /* Name of log file */
116
  const char *log;
117
};
118
 
119
/*! Memory regions assigned to devices */
120
struct dev_memarea
121
{
122
  struct dev_memarea *next;
123
  oraddr_t            addr_mask;
124
  oraddr_t            addr_compare;
125
  uint32_t            size;
126
  oraddr_t            size_mask;        /* Addr mask, calculated out of size */
127
  int                 valid;            /* Mirrors memory controler valid bit */
128
  FILE               *log;              /* log file (NULL if no logging) */
129
  struct mem_ops      ops;
130
  struct mem_ops      direct_ops;
131
};
132
 
133
/* Externally visible data */
134
extern struct dev_memarea *cur_area;
135
extern int                 data_ci;
136
extern int                 insn_ci;
137
extern struct hist_exec   *hist_exec_tail;
138
 
139
/* Function prototypes for external use */
140
extern uint32_t            eval_mem32 (oraddr_t memaddr, int *);
141
extern uint16_t            eval_mem16 (oraddr_t memaddr, int *);
142
extern uint8_t             eval_mem8 (oraddr_t memaddr, int *);
143
extern void                set_mem32 (oraddr_t memaddr, uint32_t value, int *);
144
extern void                set_mem16 (oraddr_t memaddr, uint16_t value, int *);
145
extern void                set_mem8 (oraddr_t memaddr, uint8_t value, int *);
146
extern void                dump_memory (oraddr_t  from,
147
                                        oraddr_t  to);
148
extern void                disassemble_memory (oraddr_t  from,
149
                                               oraddr_t  to,
150
                                               int       nl);
151
extern uint32_t            evalsim_mem32 (oraddr_t, oraddr_t);
152
extern uint16_t            evalsim_mem16 (oraddr_t, oraddr_t);
153
extern uint8_t             evalsim_mem8 (oraddr_t, oraddr_t);
154
extern void                setsim_mem32 (oraddr_t, oraddr_t, uint32_t);
155
extern void                setsim_mem16 (oraddr_t, oraddr_t, uint16_t);
156
extern void                setsim_mem8 (oraddr_t, oraddr_t, uint8_t);
157
extern void                done_memory_table ();
158
extern void                memory_table_status (void);
159
extern struct dev_memarea *reg_mem_area (oraddr_t        addr,
160
                                         uint32_t        size,
161
                                         unsigned        mc_dev,
162
                                         struct mem_ops *ops);
163
extern void                adjust_rw_delay (struct dev_memarea *mem,
164
                                            int                 delayr,
165
                                            int                 delayw);
166
extern void                set_mem_valid (struct dev_memarea *mem,
167
                                          int                 valid);
168
extern struct dev_memarea *verify_memoryarea (oraddr_t addr);
169
extern char               *generate_time_pretty (char *dest,
170
                                                 long  time_ps);
171
extern uint32_t            eval_insn (oraddr_t, int *);
172
extern uint32_t            eval_direct32 (oraddr_t  addr,
173
                                          int       through_mmu,
174
                                          int       through_dc);
175
extern uint16_t            eval_direct16 (oraddr_t  memaddr,
176
                                          int       through_mmu,
177
                                          int       through_dc);
178
extern uint8_t             eval_direct8 (oraddr_t   memaddr,
179
                                         int        through_mmu,
180
                                         int        through_dc);
181
extern void                set_direct8 (oraddr_t, uint8_t, int, int);
182
extern void                set_direct16 (oraddr_t, uint16_t, int, int);
183
extern void                set_direct32 (oraddr_t, uint32_t, int, int);
184
extern void                set_program32 (oraddr_t  memaddr,
185
                                          uint32_t  value);
186
extern void                set_program8 (oraddr_t  memaddr,
187
                                         uint8_t   value);
188
 
189
#endif /*  ABSTRACT__H */

powered by: WebSVN 2.1.0

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