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 424

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 261 markom
#define DEFAULT_MEMORY_START  0
21
#define DEFAULT_MEMORY_LEN  0x800000
22
#define STACK_SIZE  20
23
#define LABELNAME_LEN 50
24
#define INSNAME_LEN 15
25 26 lampret
#define OPERANDNAME_LEN 50
26 2 cvs
 
27 138 markom
#define MAX_OPERANDS    (4)
28
 
29 134 markom
#define OP_MEM_ACCESS 0x80000000
30
 
31
/* This is an abstract memory type rather than physical memory type.  It holds
32
disassembled instructions.  */
33 2 cvs
struct mem_entry {
34 123 markom
  unsigned char data;
35 2 cvs
};
36
 
37 22 lampret
enum insn_type { unknown, exception, arith, shift, compare, branch,
38 261 markom
     jump, load, store, movimm, move, extend, nop, mac };
39 2 cvs
 
40
/* Instruction queue */
41
struct iqueue_entry {
42 123 markom
  enum insn_type func_unit;
43 138 markom
  int insn_index;
44
  unsigned long insn;
45
  unsigned long op[2 * MAX_OPERANDS];
46 123 markom
  unsigned long insn_addr;
47 2 cvs
};
48
 
49 30 lampret
/* Memory regions assigned to devices */
50
struct dev_memarea {
51 221 markom
  struct dev_memarea *next;
52 261 markom
  /*unsigned long start;
53
  unsigned long end;         /* if start + size > end, this block is disabled; to enable it recalculate end addr. */
54
  unsigned long addr_mask;
55
  unsigned long addr_compare;
56 123 markom
  unsigned long size;
57 261 markom
  unsigned long size_mask;   /* Address mask, calculated out of size */
58 235 erez
  unsigned long granularity; /* how many bytes read/write accepts: 1/2/4 */
59 424 markom
  int delayr;                /* Read delay */
60
  int delayw;                /* Write delay */
61 261 markom
 
62
  int chip_select;           /* Needed by memory controller; specifies chip select number for this memory area. */
63
 
64 235 erez
  unsigned long (*readfunc)(unsigned long);
65
  void (*writefunc)(unsigned long, unsigned long);
66 221 markom
  /* private data */
67
  unsigned long misc;
68 30 lampret
};
69
 
70 2 cvs
extern struct iqueue_entry iqueue[20];
71 138 markom
extern struct iqueue_entry icomplet[20];
72 2 cvs
extern unsigned long pc;
73
 
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 123 markom
void setsim_mem32(unsigned long,unsigned long);
86
void setsim_mem16(unsigned long,unsigned short);
87
void setsim_mem8(unsigned long,unsigned char);
88
 
89 424 markom
void init_memory_table ();
90 221 markom
 
91 424 markom
/* Changes read/write memory in read/write only */
92
void lock_memory_table ();
93
 
94 261 markom
/* Register read and write function for a memory area.
95
   addr is inside the area, if addr & addr_mask == addr_compare
96
   (used also by peripheral devices like 16450 UART etc.) */
97
void register_memoryarea_mask(unsigned long addr_mask, unsigned long addr_compare,
98
                         unsigned long size, unsigned granularity,
99
                         unsigned long (readfunc)(unsigned long),
100
                         void (writefunc)(unsigned long, unsigned long));
101
 
102
/* Register read and write function for a memory area.
103
   Memory areas should be aligned. Memory area is rounded up to
104
   fit the nearest 2^n aligment.
105
   (used also by peripheral devices like 16450 UART etc.) */
106
void register_memoryarea(unsigned long addr,
107
                         unsigned long size, unsigned granularity,
108
                         unsigned long (readfunc)(unsigned long),
109
                         void (writefunc)(unsigned long, unsigned long));
110
 
111 221 markom
/* Check if access is to registered area of memory. */
112
struct dev_memarea *verify_memoryarea(unsigned long addr);
113 261 markom
 
114 221 markom
/* Temporary variable to increase speed.  */
115
extern struct dev_memarea *cur_area;
116
 
117 123 markom
/* Added by MM */
118
#ifndef LONGEST
119
#define LONGEST long long
120
#define ULONGEST unsigned long long
121
#endif /* ! LONGEST */

powered by: WebSVN 2.1.0

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