-
Notifications
You must be signed in to change notification settings - Fork 10
/
simrt.h
193 lines (130 loc) · 4.69 KB
/
simrt.h
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#ifndef _SIMRT_H
#define _SIMRT_H
#define REG_EXTERN extern
#include "reg.h"
#include "mem.h"
#include "simbus.h"
#include "transException.h"
#define RT_STACK_A_ADDR 0
#define RT_STACK_A_LEN 0X0100
#define RT_STACK_POINTER_A_ADDR 0X0100
#define RT_STACK_POINTER_B_ADDR 0X0104
//Definition for mode code selective interrupt
#define RT_MODE_CODE_SELECTIVE_INTERRUPT_TABLE_ADDR 0X0108
#define RT_MODE_CODE_SELECTIVE_INTERRUPT_TABLE_LEN 0X0008
#define RT_MODE_CODE_INTERRUPT_MODE_RX_LSB 0X0108
#define RT_MODE_CODE_INTERRUPT_MODE_RX_MSB 0X0109
#define RT_MODE_CODE_INTERRUPT_MODE_TX_LSB 0X010A
#define RT_MODE_CODE_INTERRUPT_MODE_TX_MSB 0X010B
#define RT_MODE_CODE_INTERRUPT_MODE_BCAST_RX_LSB 0X010C
#define RT_MODE_CODE_INTERRUPT_MODE_BCAST_RX_MSB 0X010D
#define RT_MODE_CODE_INTERRUPT_MODE_BCAST_TX_LSB 0X010E
#define RT_MODE_CODE_INTERRUPT_MODE_BCAST_TX_MSB 0X010F
//Definition for mode code
#define RT_MODE_CODE_DATA_ADDR 0X0110
#define RT_MODE_CODE_DATA_LEN 0X0030
#define RT_MODECODE_DATA_RECV_ADDR 0X0110
#define RT_MODECODE_DATA_RECV_LEN 0X0010
#define RT_MODECODE_DATA_TRANSMIT_ADDR 0X0120
#define RT_MODECODE_DATA_TRANSMIT_LEN 0X0010
#define RT_MODECODE_DATA_BCAST_ADDR 0X0130
#define RT_MODECODE_DATA_BCAST_LEN 0X0010
//Define lookup table A area
#define RT_LOOKUP_TABLE_A_ADDR 0X0140
#define RT_LOOKUP_TABLE_A_LEN 0X0080
#define RT_RX_LOOKUP_TABLE_A_ADDR 0X0140
#define RT_RX_LOOKUP_TABLE_A_LEN 0X0020
#define RT_TX_LOOKUP_TABLE_A_ADDR 0X0160
#define RT_TX_LOOKUP_TABLE_A_LEN 0X0020
#define RT_BCAST_LOOKUP_TABLE_A_ADDR 0X0180
#define RT_BCAST_LOOKUP_TABLE_A_LEN 0X0020
#define RT_CONTROLWORD_LOOKUP_TABLE_A_ADDR 0X01A0
#define RT_CONTROLWORD_LOOKUP_TABLE_A_LEN 0X0020
//Define lookup table B area
#define RT_LOOKUP_TABLE_B_ADDR 0X01C0
#define RT_LOOKUP_TABLE_B_LEN 0X0080
#define RT_RX_LOOKUP_TABLE_B_ADDR 0X01C0
#define RT_RX_LOOKUP_TABLE_B_LEN 0X0020
#define RT_TX_LOOKUP_TABLE_B_ADDR 0X01E0
#define RT_TX_LOOKUP_TABLE_B_LEN 0X0020
#define RT_BCAST_LOOKUP_TABLE_B_ADDR 0X0200
#define RT_BCAST_LOOKUP_TABLE_B_LEN 0X0020
#define RT_CONTROLWORD_LOOKUP_TABLE_B_ADDR 0X0220
#define RT_CONTROLWORD_LOOKUP_TABLE_B_LEN 0X0020
#define RT_BUSY_BIT_LOOKUP_TABLE_ADDR 0X0240
#define RT_BUSY_BIT_LOOKUP_TABLE_LEN 0X0008
#define RT_UNUSED_AREA_ADDR 0X0248
#define RT_UNUSED_AREA_LEN 0X0018
#define RT_MSG_BLOCK_ADDR_0_4_ENHANCE_ADDR 0X0260
#define RT_MSG_BLOCK_PER_LEN 0X0020
#define RT_MSG_BLOCK_ADDR_0_4_ENHANCE_LEN 0X00A0
#define RT_MSG_BLOCK_ADDR_5_100_ENHANCE_ADDR 0X0400
#define RT_MSG_BLOCK_ADDR_5_100_ENHANCE_LEN 0X0C00
//For none enhancement mode only
#define RT_MSG_BLOCK_ADDR_0_5_ADDR 0X0240
#define RT_MSG_BLOCK_ADDR_0_5_LEN 0X00C0
#define RT_MSG_BLOCK_ADDR_6_93_ADDR 0X0400
#define RT_MSG_BLOCK_ADDR_6_93_LEN 0X0B00
#define RT_COMMAND_ILLEGALIZAION_TABLE_ADDR 0X0300
#define RT_COMMAND_ILLEGALIZAION_TABLE_LEN 0X0100
//For none enhancement mode only
#define RT_STACK_B_ADDR 0X0F00
#define RT_STACK_B_LEN 0X0100
#define RT_ENHANCED_MODE (sim61580->configReg_3&0X8000)
#define RT_ENHANCED_RT_MEM_MANAGEMENT (sim61580->configReg_2&0X0001)
#define RT_ENHANCED_MODE_CODE_HANDLING ((ENHANCED_RT_MEM_MANAGEMENT&&(sim61580->configReg_3&0X0001)))
enum{vectorWordModeCode=16,lastCmdWordModeCode=18,BITWordModeCode=19};
class SimRT:public Reg, public Mem, public Exception1553B
{
private:
SimRT *m_rtBackUp;
Bus m_busChannelA;
Bus m_busChannelB;
UINT16 m_rtDataIndex;
UINT16 m_rtCurrentMsgCycCount;
UINT16 m_rtCurrentMsgCyc;
UINT16 m_rtCurrentMsgCmdWord;
UINT16 m_rtMsgBlockAddr;
UINT16 m_rtAddress;
UINT16 m_mLastStatusReg;
UINT16 m_rtProcessedMsgCount;
char rtDescription[32];
public:
SimRT(UINT16 addr);
SimRT(UINT16 addr,char *fileName);
~SimRT();
void rtRestore();
void rtSave();
UINT16 rtDump(int len, void * buffAddr);
UINT16 rtAddress()
{
return m_rtAddress;
}
virtual UINT16 memDump();
virtual INT16 initRegAddress(void);
virtual void genIRQ(void);
UINT16 RTStep(void);
UINT16 RTReceiveCMD();
UINT16 RTSingleWordTransfer();
UINT16 RTModeCodeWithDataTransferTX();
UINT16 RTModeCodeWithDataTransferRX();
UINT16 RTModeCodeWithOutDataTransfer();
UINT16 RTTXTransfer();
UINT16 RTRXTransfer();
UINT16 RTStartMsg();
UINT16 RTReturnStatusWord();
UINT16 RTEndMsg();
UINT16 RTCheckCMDType(UINT16 cmd);
UINT16 RTLookupIllegalizationTable(UINT16 cmd);
UINT16 RTLookupBusyTable(UINT16 cmd);
UINT16 RTLoadSubaddressControlWordAndDataAddress(UINT16 cmd);
UINT16 RTUpdateLookupTable(UINT16 cmd);
UINT32 OnData(UINT32, void *);
UINT16 rtRecvImproperWord(UINT16 actualType,UINT16 expectType,UINT16 data);
UINT16 rtRecvTimeout();
UINT16 initForTest();
UINT16 configReg_5_write(UINT16 data);
struct TransException checkIfException();
UINT32 CheckRecvHook(UINT32 len,void *recvData);
};
#endif