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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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