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 1346

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
  unsigned long insn;
42 123 markom
  unsigned long insn_addr;
43 2 cvs
};
44
 
45 30 lampret
/* Memory regions assigned to devices */
46
struct dev_memarea {
47 221 markom
  struct dev_memarea *next;
48 261 markom
  /*unsigned long start;
49 1308 phoenix
  unsigned long end;*/         /* if start + size > end, this block is disabled; to enable it recalculate end addr. */
50 261 markom
  unsigned long addr_mask;
51
  unsigned long addr_compare;
52 123 markom
  unsigned long size;
53 261 markom
  unsigned long size_mask;   /* Address mask, calculated out of size */
54 235 erez
  unsigned long granularity; /* how many bytes read/write accepts: 1/2/4 */
55 424 markom
  int delayr;                /* Read delay */
56
  int delayw;                /* Write delay */
57 261 markom
 
58
  int chip_select;           /* Needed by memory controller; specifies chip select number for this memory area. */
59 543 simons
  int valid;                 /* This bit reflect the memory controler valid bit */
60 426 markom
  FILE *log;                 /* log file if this device is to be logged, NULL otherwise */
61 261 markom
 
62 235 erez
  unsigned long (*readfunc)(unsigned long);
63
  void (*writefunc)(unsigned long, unsigned long);
64 221 markom
  /* private data */
65
  unsigned long misc;
66 30 lampret
};
67
 
68 2 cvs
extern struct iqueue_entry iqueue[20];
69 138 markom
extern struct iqueue_entry icomplet[20];
70 537 markom
extern unsigned long pc;
71
extern int    mem_cycles;   /* Number of memory cycles in during this instruction execution */
72
extern int    cycles;       /* Total number of cycles executed so far */
73 2 cvs
 
74 306 markom
extern void dumpmemory(unsigned int from, unsigned int to, int disasm, int nl);
75 123 markom
extern unsigned long eval_mem32(unsigned long memaddr,int*);
76
extern unsigned short eval_mem16(unsigned long memaddr,int*);
77
extern unsigned char eval_mem8(unsigned long memaddr,int*);
78
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
79
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
80
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
81
 
82 221 markom
unsigned long evalsim_mem32(unsigned long);
83
unsigned short evalsim_mem16(unsigned long);
84
unsigned char evalsim_mem8(unsigned long);
85 1319 phoenix
 
86
unsigned long evalsim_mem32_atomic(unsigned long, int);
87
unsigned short evalsim_mem16_atomic(unsigned long, int);
88
unsigned char evalsim_mem8_atomic(unsigned long, int);
89
 
90 123 markom
void setsim_mem32(unsigned long,unsigned long);
91
void setsim_mem16(unsigned long,unsigned short);
92
void setsim_mem8(unsigned long,unsigned char);
93
 
94 1319 phoenix
void setsim_mem32_atomic(unsigned long,unsigned long, int);
95
void setsim_mem16_atomic(unsigned long,unsigned short, int);
96
void setsim_mem8_atomic(unsigned long,unsigned char, int);
97
 
98 424 markom
void init_memory_table ();
99 221 markom
 
100 424 markom
/* Changes read/write memory in read/write only */
101
void lock_memory_table ();
102
 
103 426 markom
/* Closes files, etc. */
104
void done_memory_table ();
105
 
106 427 markom
/* Displays current memory configuration */
107
void memory_table_status ();
108
 
109 261 markom
/* Register read and write function for a memory area.
110
   addr is inside the area, if addr & addr_mask == addr_compare
111
   (used also by peripheral devices like 16450 UART etc.) */
112
void register_memoryarea_mask(unsigned long addr_mask, unsigned long addr_compare,
113 970 simons
                         unsigned long size, unsigned granularity, unsigned mc_dev,
114 261 markom
                         unsigned long (readfunc)(unsigned long),
115
                         void (writefunc)(unsigned long, unsigned long));
116
 
117
/* Register read and write function for a memory area.
118
   Memory areas should be aligned. Memory area is rounded up to
119
   fit the nearest 2^n aligment.
120 970 simons
   (used also by peripheral devices like 16450 UART etc.)
121
   If mc_dev is 1, this means that this device will be checked first for match
122
   and will be accessed in case in overlaping memory spaces.
123
   Only one device can have this set to 1 (used for memory controller) */
124 261 markom
void register_memoryarea(unsigned long addr,
125 970 simons
                         unsigned long size, unsigned granularity, unsigned mc_dev,
126 261 markom
                         unsigned long (readfunc)(unsigned long),
127
                         void (writefunc)(unsigned long, unsigned long));
128
 
129 882 simons
/* Finds the memory area for the address and adjust the read and write delays for it. */
130
void adjust_rw_delay(unsigned long memaddr, unsigned long delayr, unsigned long delayw);
131
 
132 221 markom
/* Check if access is to registered area of memory. */
133
struct dev_memarea *verify_memoryarea(unsigned long addr);
134 261 markom
 
135 1308 phoenix
/* Outputs time in pretty form to dest string. */
136 897 markom
char *generate_time_pretty (char *dest, long time_ps);
137 433 markom
 
138 1308 phoenix
/* Returns 32-bit values from mem array. */
139
unsigned long eval_insn(unsigned long, int *);
140
 
141
void simmem_write_word(unsigned long addr, unsigned long value);
142
 
143
unsigned long simmem_read_word(unsigned long addr);
144
 
145
unsigned long eval_direct32(unsigned long addr, int *breakpoint, int through_mmu, int through_dc);
146
 
147
void set_direct32(unsigned long addr, unsigned long value, int *breakpoint, int through_mmu, int through_dc);
148
 
149 221 markom
/* Temporary variable to increase speed.  */
150
extern struct dev_memarea *cur_area;
151
 
152 970 simons
/* Virtual address of current access. */
153
extern unsigned long cur_vadd;
154
 
155 638 simons
/* These are set by mmu if cache inhibit bit is set for current acces.  */
156
extern int data_ci, insn_ci;
157
 
158 123 markom
/* Added by MM */
159
#ifndef LONGEST
160
#define LONGEST long long
161
#define ULONGEST unsigned long long
162
#endif /* ! LONGEST */
163 494 markom
 
164
/* Instructions left to execute */
165
extern int cont_run;
166
 
167
/* History of execution */
168
#define HISTEXEC_LEN 200
169
extern int histexec[HISTEXEC_LEN];
170
 

powered by: WebSVN 2.1.0

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