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

Subversion Repositories or1k

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

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 261 markom
 
60
  int chip_select;           /* Needed by memory controller; specifies chip select number for this memory area. */
61
 
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 2 cvs
extern unsigned long pc;
71
 
72 167 markom
extern void dumpmemory(unsigned int from, unsigned int to, int disasm);
73 123 markom
extern unsigned long eval_mem32(unsigned long memaddr,int*);
74
extern unsigned short eval_mem16(unsigned long memaddr,int*);
75
extern unsigned char eval_mem8(unsigned long memaddr,int*);
76
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
77
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
78
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
79
 
80 221 markom
unsigned long evalsim_mem32(unsigned long);
81
unsigned short evalsim_mem16(unsigned long);
82
unsigned char evalsim_mem8(unsigned long);
83 123 markom
void setsim_mem32(unsigned long,unsigned long);
84
void setsim_mem16(unsigned long,unsigned short);
85
void setsim_mem8(unsigned long,unsigned char);
86
 
87 221 markom
void sim_read_memory_table (char *filename);
88
 
89 261 markom
/* Register read and write function for a memory area.
90
   addr is inside the area, if addr & addr_mask == addr_compare
91
   (used also by peripheral devices like 16450 UART etc.) */
92
void register_memoryarea_mask(unsigned long addr_mask, unsigned long addr_compare,
93
                         unsigned long size, unsigned granularity,
94
                         unsigned long (readfunc)(unsigned long),
95
                         void (writefunc)(unsigned long, unsigned long));
96
 
97
/* Register read and write function for a memory area.
98
   Memory areas should be aligned. Memory area is rounded up to
99
   fit the nearest 2^n aligment.
100
   (used also by peripheral devices like 16450 UART etc.) */
101
void register_memoryarea(unsigned long addr,
102
                         unsigned long size, unsigned granularity,
103
                         unsigned long (readfunc)(unsigned long),
104
                         void (writefunc)(unsigned long, unsigned long));
105
 
106 221 markom
/* Check if access is to registered area of memory. */
107
struct dev_memarea *verify_memoryarea(unsigned long addr);
108 261 markom
 
109 221 markom
/* Temporary variable to increase speed.  */
110
extern struct dev_memarea *cur_area;
111
 
112 123 markom
/* Added by MM */
113
#ifndef LONGEST
114
#define LONGEST long long
115
#define ULONGEST unsigned long long
116
#endif /* ! LONGEST */

powered by: WebSVN 2.1.0

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