memory.h
4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* File: memory.h
* Creator: hsa@sgi.com
* Create Date: Mon Feb 14 13:03:50 PST 1994
*
* Include file for the low-level memory module.
* See memory.c for details.
*
*/
#ifndef _rsp_memory_h_
#define _rsp_memory_h_ 1
/*
* Some important RSP memory parameters:
*
* WARNING: I can easily imagine a signed quantity being compared
* with one of these, resulting in problems...
*
*/
#define rsp_DRAM_SIZE8 (0x00400000) /* 4MB */
#define rsp_DCACHE_SIZE8 (4096) /* in bytes */
#define rsp_ICACHE_SIZEI (1024) /* in instructions */
#define rsp_ICACHE_SIZE8 (rsp_ICACHE_SIZEI << 2) /* in bytes */
#define rsp_TRIG_SIZEI (4096) /* in 32-bit words */
#define rsp_TRIG_SIZE8 (rsp_TRIG_SIZEI << 2) /* in bytes */
#define rsp_SCRATCH_SIZE8 (0x00200000) /* 2MB */
#define rsp_DRAM_LOW (0x00000000)
#define rsp_DCACHE_LOW (0x04000000)
#define rsp_ICACHE_LOW (0x04001000)
#define rsp_GPR_LOW (0x10003000)
#define rsp_GPR_SIZE8 (256)
#define rsp_DMA_LOW (0x10003100)
#define rsp_DMA_SIZE8 (256)
#define rsp_TRIG_LOW (0x10010000)
#define rsp_SCRATCH_LOW (0x20000000)
/*
* DCACHE and ICACHE accesses ignore high address bits (low 12 bits are valid)
*/
#define rsp_DCACHE_BITS (0x00000FFF)
#define rsp_ICACHE_BITS (0x00000FFF)
#define rsp_ABSOLUTE_ACCESS (0)
#define rsp_DCACHE_ACCESS (1)
#define rsp_ICACHE_ACCESS (2)
#define rsp_DMA_ACCESS (3) /* is DMA a special case???? */
/*
* actual memory spaces
*/
/*
extern u8 rsp_mainMemory[rsp_DRAM_SIZE8];
extern u8 rsp_dataCache[rsp_DCACHE_SIZE8];
extern u8 rsp_instructionCache[rsp_ICACHE_SIZE8];
extern u8 rsp_scratchMemory[rsp_SCRATCH_SIZE8];
*/
extern u8 *rsp_mainMemory;
extern u8 *rsp_dataCache;
extern u8 *rsp_instructionCache;
extern u8 *rsp_scratchMemory;
/*
* The "scratch" memory area is a a place outside the spec of the machine,
* used for simulation purposes only. For instance, it is impossible to
* develop/debug the RSP/RDP handshaking of data, because there is no
* consumer when running the RSP in a standalone fashion. So we send output
* to this "nether region" where we can dump it out later.
*
* (using any space within the machine would cause lots of clashes with
* things; plus, this area may need to be larger than 2MB...)
*
*/
/*
* byte read
*/
extern u8 rsp_MemReadByte(u32 addr,int memtype);
/*
* halfword read
*/
extern u16 rsp_MemReadHalf(u32 addr,int memtype);
/*
* word read
*/
extern u32 rsp_MemReadWord(u32 addr,int memtype);
/*
* double word read
*/
extern u64 rsp_MemReadDouble(u32 addr,int memtype);
/*
* byte write
*/
extern void rsp_MemWriteByte(u32 addr, u8 byte,int memtype);
/*
* halfword write
*/
extern void rsp_MemWriteHalf(u32 addr, u16 half,int memtype);
/*
* word write
*/
extern void rsp_MemWriteWord(u32 addr, u32 word,int memtype);
/*
* double word write
*/
extern void rsp_MemWriteDouble(u32 addr, u64 dword,int memtype);
/* simulator (debugging) functions: */
extern boolean rsp_MemLoad(char *filename, u32 baseaddr);
extern boolean rsp_MemUnLoad(char *filename, u32 baseaddr, u32 length,
boolean doAppend);
extern boolean rsp_MemBcopy(u32 from, u32 to, u32 length);
extern boolean rsp_MemFromIPC(u32 from, u32 to, u32 length);
extern boolean rsp_MemToIPC(u32 from, u32 to, u32 length);
extern void rsp_MemWriteMap(u32 addr, u32 val);
extern u32 rsp_MemReadMap(u32 addr);
extern u32 rsp_ExamineMemory(u32 address);
extern u32 rsp_ExamineMemory1(u32 address, int memtype);
extern u32 rsp_DepositMemory(u32 address, u32 value);
#endif