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

Subversion Repositories or1k

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

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 221 markom
#define DEFAULT_MEMORY_START    0
21
#define DEFAULT_MEMORY_LEN      0x800000
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 138 markom
#define MAX_OPERANDS    (4)
28
 
29 28 lampret
/* Structure for holding several labels of a particular memory location */
30
struct label_entry {
31 123 markom
  char *name;
32
  struct label_entry *next;
33 28 lampret
};
34
 
35 134 markom
#define OP_MEM_ACCESS 0x80000000
36
 
37
/* This is an abstract memory type rather than physical memory type.  It holds
38
disassembled instructions.  */
39 2 cvs
struct mem_entry {
40 123 markom
  unsigned char data;
41
  unsigned char brk;
42
  struct label_entry *label; /* labels */
43 2 cvs
};
44
 
45 22 lampret
enum insn_type { unknown, exception, arith, shift, compare, branch,
46 123 markom
                 jump, load, store, movimm, move, extend, nop, mac };
47 2 cvs
 
48
/* Instruction queue */
49
struct iqueue_entry {
50 123 markom
  enum insn_type func_unit;
51 138 markom
  int insn_index;
52
  unsigned long insn;
53
  unsigned long op[2 * MAX_OPERANDS];
54 123 markom
  unsigned long insn_addr;
55 2 cvs
};
56
 
57 30 lampret
/* Memory regions assigned to devices */
58
struct dev_memarea {
59 221 markom
  struct dev_memarea *next;
60
  unsigned long start;
61
  unsigned long end;
62 123 markom
  unsigned long size;
63 235 erez
  unsigned long granularity; /* how many bytes read/write accepts: 1/2/4 */
64
  unsigned long (*readfunc)(unsigned long);
65
  void (*writefunc)(unsigned long, unsigned long);
66 221 markom
  struct mem_entry* (*getentry) (unsigned long);
67
  /* private data */
68
  unsigned long misc;
69 30 lampret
};
70
 
71 2 cvs
extern struct iqueue_entry iqueue[20];
72 138 markom
extern struct iqueue_entry icomplet[20];
73 2 cvs
extern unsigned long pc;
74
 
75 167 markom
extern void dumpmemory(unsigned int from, unsigned int to, int disasm);
76 2 cvs
extern unsigned long eval_label(char *label);
77 123 markom
extern unsigned long eval_mem32(unsigned long memaddr,int*);
78
extern unsigned short eval_mem16(unsigned long memaddr,int*);
79
extern unsigned char eval_mem8(unsigned long memaddr,int*);
80
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
81
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
82
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
83
 
84 221 markom
unsigned long evalsim_mem32(unsigned long);
85
unsigned short evalsim_mem16(unsigned long);
86
unsigned char evalsim_mem8(unsigned long);
87 123 markom
void setsim_mem32(unsigned long,unsigned long);
88
void setsim_mem16(unsigned long,unsigned short);
89
void setsim_mem8(unsigned long,unsigned char);
90
 
91 221 markom
void sim_read_memory_table (char *filename);
92
 
93
/* Register read and write function for a memory area (used by peripheral
94
   devices like 16450 UART etc.) */
95 235 erez
void register_memoryarea(unsigned long start, unsigned long size,
96
                                                 unsigned granularity,
97
                         unsigned long (readfunc)(unsigned long),
98
                         void (writefunc)(unsigned long, unsigned long),
99
                         struct mem_entry *(getentry)(unsigned long));
100 221 markom
/* Check if access is to registered area of memory. */
101
struct dev_memarea *verify_memoryarea(unsigned long addr);
102
/* Temporary variable to increase speed.  */
103
extern struct dev_memarea *cur_area;
104
 
105 167 markom
#ifndef DEBUGMOD_OFF
106 123 markom
extern int GlobalMode; /* Added by CZ 26/05/01 */
107 167 markom
#else /* DEBUGMOD_OFF */
108
#define GlobalMode 0
109
#endif /* DEBUGMOD_OFF */
110 123 markom
 
111
/* Added by MM */
112
#ifndef LONGEST
113
#define LONGEST long long
114
#define ULONGEST unsigned long long
115
#endif /* ! LONGEST */

powered by: WebSVN 2.1.0

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