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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc2/] [or1ksim/] [cpu/] [common/] [abstract.h] - Blame information for rev 1538

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 426 markom
#include <stdio.h>
21
 
22 261 markom
#define DEFAULT_MEMORY_START  0
23
#define DEFAULT_MEMORY_LEN  0x800000
24
#define STACK_SIZE  20
25
#define LABELNAME_LEN 50
26
#define INSNAME_LEN 15
27 26 lampret
#define OPERANDNAME_LEN 50
28 2 cvs
 
29 1319 phoenix
#define MAX_OPERANDS    (5)
30 138 markom
 
31 134 markom
#define OP_MEM_ACCESS 0x80000000
32
 
33 429 markom
/* Cache tag types.  */
34
#define CT_NONE            0
35
#define CT_VIRTUAL         1
36
#define CT_PHYSICAL        2
37
 
38 2 cvs
/* Instruction queue */
39
struct iqueue_entry {
40 138 markom
  int insn_index;
41 1350 nogj
  uint32_t insn;
42
  oraddr_t insn_addr;
43 2 cvs
};
44
 
45 1486 nogj
struct mem_ops {
46
  /* Read functions */
47
  uint32_t (*readfunc32)(oraddr_t, void *);
48
  uint16_t (*readfunc16)(oraddr_t, void *);
49
  uint8_t (*readfunc8)(oraddr_t, void *);
50
 
51
  /* Read functions' data */
52
  void *read_dat8;
53
  void *read_dat16;
54
  void *read_dat32;
55
 
56
  /* Write functions */
57
  void (*writefunc32)(oraddr_t, uint32_t, void *);
58
  void (*writefunc16)(oraddr_t, uint16_t, void *);
59
  void (*writefunc8)(oraddr_t, uint8_t, void *);
60
 
61
  /* Write functions' data */
62
  void *write_dat8;
63
  void *write_dat16;
64
  void *write_dat32;
65
 
66
  /* Program load function.  If you have unwritteable memory but you would like
67
   * it if a program would be loaded here, make sure to set this.  If this is
68
   * not set, then writefunc32 will be called to load the program */
69
  void (*writeprog)(oraddr_t, uint32_t, void *);
70
  void *writeprog_dat;
71
 
72
  /* Read/Write delays */
73
  int delayr;
74
  int delayw;
75
 
76
  /* Name of log file */
77
  const char *log;
78
};
79
 
80 30 lampret
/* Memory regions assigned to devices */
81
struct dev_memarea {
82 221 markom
  struct dev_memarea *next;
83 1350 nogj
  oraddr_t addr_mask;
84
  oraddr_t addr_compare;
85
  uint32_t size;
86 1486 nogj
  oraddr_t size_mask;        /* Address mask, calculated out of size */
87 261 markom
 
88 1486 nogj
  int valid;                 /* This bit reflects the memory controler valid bit */
89 426 markom
  FILE *log;                 /* log file if this device is to be logged, NULL otherwise */
90 261 markom
 
91 1486 nogj
  struct mem_ops ops;
92
  struct mem_ops direct_ops;
93 30 lampret
};
94
 
95 1350 nogj
extern void dumpmemory(oraddr_t from, oraddr_t to, int disasm, int nl);
96
extern uint32_t eval_mem32(oraddr_t memaddr,int*);
97
extern uint16_t eval_mem16(oraddr_t memaddr,int*);
98
extern uint8_t eval_mem8(oraddr_t memaddr,int*);
99
void set_mem32(oraddr_t memaddr, uint32_t value,int*);
100
extern void set_mem16(oraddr_t memaddr, uint16_t value,int*);
101
extern void set_mem8(oraddr_t memaddr, uint8_t value,int*);
102 123 markom
 
103 1486 nogj
uint32_t evalsim_mem32(oraddr_t, oraddr_t);
104
uint16_t evalsim_mem16(oraddr_t, oraddr_t);
105
uint8_t evalsim_mem8(oraddr_t, oraddr_t);
106 1319 phoenix
 
107 1486 nogj
void setsim_mem32(oraddr_t, oraddr_t, uint32_t);
108
void setsim_mem16(oraddr_t, oraddr_t, uint16_t);
109
void setsim_mem8(oraddr_t, oraddr_t, uint8_t);
110 1319 phoenix
 
111 426 markom
/* Closes files, etc. */
112 1486 nogj
void done_memory_table (void);
113 426 markom
 
114 427 markom
/* Displays current memory configuration */
115 1486 nogj
void memory_table_status (void);
116 427 markom
 
117 1486 nogj
/* Register memory area */
118
struct dev_memarea *reg_mem_area(oraddr_t addr, uint32_t size, unsigned mc_dev,
119
                                 struct mem_ops *ops);
120 261 markom
 
121 1486 nogj
/* Adjusts the read and write delays for the memory area pointed to by mem. */
122
void adjust_rw_delay(struct dev_memarea *mem, int delayr, int delayw);
123 261 markom
 
124 1486 nogj
/* Sets the valid bit (Used only by memory controllers) */
125
void set_mem_valid(struct dev_memarea *mem, int valid);
126 882 simons
 
127 221 markom
/* Check if access is to registered area of memory. */
128 1350 nogj
struct dev_memarea *verify_memoryarea(oraddr_t addr);
129 261 markom
 
130 1308 phoenix
/* Outputs time in pretty form to dest string. */
131 897 markom
char *generate_time_pretty (char *dest, long time_ps);
132 433 markom
 
133 1308 phoenix
/* Returns 32-bit values from mem array. */
134 1350 nogj
uint32_t eval_insn(oraddr_t, int *);
135 1308 phoenix
 
136 1487 nogj
uint32_t eval_insn_direct(oraddr_t memaddr, int through_mmu);
137 1452 nogj
 
138 1487 nogj
uint8_t eval_direct8(oraddr_t memaddr, int through_mmu, int through_dc);
139
uint16_t eval_direct16(oraddr_t memaddr, int through_mmu, int through_dc);
140
uint32_t eval_direct32(oraddr_t addr, int through_mmu, int through_dc);
141 1308 phoenix
 
142 1487 nogj
void set_direct8(oraddr_t, uint8_t, int, int);
143
void set_direct16(oraddr_t, uint16_t, int, int);
144
void set_direct32(oraddr_t, uint32_t, int, int);
145 1308 phoenix
 
146 1486 nogj
/* Same as set_direct32, but it also writes to memory that is non-writeable to
147
 * the rest of the sim.  Used to do program loading. */
148
void set_program32(oraddr_t memaddr, uint32_t value);
149
 
150 221 markom
/* Temporary variable to increase speed.  */
151
extern struct dev_memarea *cur_area;
152
 
153 638 simons
/* These are set by mmu if cache inhibit bit is set for current acces.  */
154
extern int data_ci, insn_ci;
155
 
156 123 markom
/* Added by MM */
157
#ifndef LONGEST
158
#define LONGEST long long
159
#define ULONGEST unsigned long long
160
#endif /* ! LONGEST */
161 494 markom
 
162 1452 nogj
/* Returns the page that addr belongs to */
163 1538 nogj
#define IADDR_PAGE(addr) ((addr) & config.immu.page_mask)
164 1452 nogj
 
165 494 markom
/* History of execution */
166
#define HISTEXEC_LEN 200
167 1352 nogj
struct hist_exec {
168
  oraddr_t addr;
169
  struct hist_exec *prev;
170
  struct hist_exec *next;
171
};
172 494 markom
 
173 1352 nogj
extern struct hist_exec *hist_exec_tail;

powered by: WebSVN 2.1.0

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