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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [debug/] [debug_unit.h] - Blame information for rev 221

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 221 markom
/* debug_unit.h -- Simulation of Or1k debug unit
2
   Copyright (C) 2001 Chris Ziomkowski, chris@asics.ws
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
/* Registers */
21
 
22
/* In general, little endian machines should pack bits from the LSB to
23
   the MSB, while big endian machines should do the reverse. The bit
24
   structures are declared in both orders, and we select which structure
25
   definition to use based on this macro assignment. If your architecture
26
   is special, you may have to redefine the algorithm defined in the
27
   SET_REG32 and GET_REG32 macros below. */
28
 
29
#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
30
#define LITTLE_ENDIAN_BIT_FILL
31
#else
32
#define BIG_ENDIAN_BIT_FILL
33
#endif
34
 
35
typedef enum {
36
  DCR_CT_Disabled = 0,
37
  DCR_CT_InsnAddress = 1,
38
  DCR_CT_LoadAddress = 2,
39
  DCR_CT_StoreAddress = 3,
40
  DCR_CT_LoadData = 4,
41
  DCR_CT_StoreData = 5,
42
  DCR_CT_Reserved1 = 6,
43
  DCR_CT_Reserved2 = 7,
44
} DCR_CT_Settings;
45
 
46
typedef enum {
47
  DCR_SC_Signed = 0,
48
  DCR_SC_Unsigned = 1,
49
} DCR_SC_Settings;
50
 
51
typedef enum {
52
  DCR_CC_Masked = 0,
53
  DCR_CC_Equal = 1,
54
  DCR_CC_LessThan = 2,
55
  DCR_CC_LessEqual = 3,
56
  DCR_CC_GreaterThan = 4,
57
  DCR_CC_GreaterEqual = 5,
58
  DCR_CC_NotEqual = 6,
59
  DCR_CC_Reserved = 7,
60
} DCR_CC_Settings;
61
 
62
typedef enum {
63
  DCR_DP_Absent = 0,
64
  DCR_DP_Present = 1,
65
} DCR_DP_Settings;
66
 
67
#ifdef LITTLE_ENDIAN_BIT_FILL
68
 
69
typedef struct {
70
  DCR_DP_Settings DP:1;
71
  DCR_CC_Settings CC:3;
72
  DCR_SC_Settings SC:1;
73
  DCR_CT_Settings CT:3;
74
  unsigned int reserved:24;
75
} DCRregister;
76
 
77
typedef struct {
78
  unsigned int CW0:2;
79
  unsigned int CW1:2;
80
  unsigned int CW2:2;
81
  unsigned int CW3:2;
82
  unsigned int CW4:2;
83
  unsigned int CW5:2;
84
  unsigned int CW6:2;
85
  unsigned int CW7:2;
86
  unsigned int CW8:2;
87
  unsigned int CW9:2;
88
  unsigned int CW10:2;
89
  unsigned int ST:1;
90
  unsigned int BT:1;
91
  unsigned int DXFW:1;
92
  unsigned int reserved:7;
93
} DMR1register;
94
 
95
typedef struct {
96
  unsigned int WCE0:1;
97
  unsigned int WCE1:1;
98
  unsigned int AWPC:11;
99
  unsigned int WGB:11;
100
  unsigned int reserved:8;
101
} DMR2register;
102
 
103
typedef struct {
104
  unsigned int COUNT:16;
105
  unsigned int MATCH:16;
106
} DWCRregister;
107
 
108
typedef struct {
109
  unsigned int RSTE:1;
110
  unsigned int BUSEE:1;
111
  unsigned int DPFE:1;
112
  unsigned int IPFE:1;
113
  unsigned int LPINTE:1;
114
  unsigned int AE:1;
115
  unsigned int IIE:1;
116
  unsigned int HPINTE:1;
117
  unsigned int DME:1;
118
  unsigned int IME:1;
119
  unsigned int RE:1;
120
  unsigned int SCE:1;
121
  unsigned int BE:1;
122
  unsigned int TE:1;
123
  unsigned int reserved:18;
124
} DSRregister;
125
 
126
typedef struct {
127
  unsigned int RSTE:1;
128
  unsigned int BUSEE:1;
129
  unsigned int DPFE:1;
130
  unsigned int IPFE:1;
131
  unsigned int LPINTE:1;
132
  unsigned int AE:1;
133
  unsigned int IIE:1;
134
  unsigned int HPINTE:1;
135
  unsigned int DME:1;
136
  unsigned int IME:1;
137
  unsigned int RE:1;
138
  unsigned int SCE:1;
139
  unsigned int BE:1;
140
  unsigned int TE:1;
141
  unsigned int reserved:18;
142
} DRRregister;
143
 
144
typedef struct {
145
  unsigned int CONTIN:1;
146
  unsigned int ENABLE:1;
147
  unsigned int RECSELDEPEND:1;
148
  unsigned int reserved:29;
149
} MODERregister;
150
 
151
typedef struct {
152
  unsigned int WPTRIG:11;
153
  unsigned int WPTRIGVALID:1;
154
  unsigned int BPTRIG:1;
155
  unsigned int BPTRIGVALID:1;
156
  unsigned int reserved2:2;
157
  unsigned int LSSTRIG:4;
158
  unsigned int LSSTRIGVALID:1;
159
  unsigned int ISTRIG:4;
160
  unsigned int ISTRIGVALID:1;
161
  unsigned int reserved1:4;
162
  unsigned int TRIGOP:2;
163
} TSELregister;
164
 
165
typedef struct {
166
  unsigned int WPQUALIF:11;
167
  unsigned int WPQUALIFVALID:1;
168
  unsigned int BPQUALIF:1;
169
  unsigned int BPQUALIFVALID:1;
170
  unsigned int reserved2:2;
171
  unsigned int LSSQUALIF:4;
172
  unsigned int LSSQUALIFVALID:1;
173
  unsigned int ISTQUALIF:4;
174
  unsigned int ISTQUALIFVALID:1;
175
  unsigned int reserved1:4;
176
  unsigned int QUALIFOP:2;
177
} QSELregister;
178
 
179
typedef struct {
180
  unsigned int WPSTOP:11;
181
  unsigned int WPSTOPVALID:1;
182
  unsigned int BPSTOP:1;
183
  unsigned int BPSTOPVALID:1;
184
  unsigned int reserved2:2;
185
  unsigned int LSSSTOP:4;
186
  unsigned int LSSSTOPVALID:1;
187
  unsigned int ISTSTOP:4;
188
  unsigned int ISTSTOPVALID:1;
189
  unsigned int reserved1:4;
190
  unsigned int STOPOP:2;
191
} SSELregister;
192
 
193
typedef struct {
194
  unsigned int RISCSTALL:1;
195
  volatile unsigned int RESET:1;
196
  unsigned int reserved:30;
197
} RISCOPregister;
198
 
199
 
200
typedef struct {
201
  unsigned int RECPC:1;
202
  unsigned int RECLSEA:1;
203
  unsigned int RECLDATA:1;
204
  unsigned int RECSDATA:1;
205
  unsigned int RECREADSPR:1;
206
  unsigned int RECWRITESPR:1;
207
  unsigned int RECINSTR:1;
208
  unsigned int reserved:25;
209
} RECWPregister;
210
 
211
typedef struct {
212
  unsigned int RECPC:1;
213
  unsigned int RECLSEA:1;
214
  unsigned int RECLDATA:1;
215
  unsigned int RECSDATA:1;
216
  unsigned int RECREADSPR:1;
217
  unsigned int RECWRITESPR:1;
218
  unsigned int RECINSTR:1;
219
  unsigned int reserved:25;
220
} RECBPregister;
221
 
222
#else /* BIG_ENDIAN_BIT_FILL */
223
 
224
typedef struct {
225
  unsigned int reserved:24;
226
  DCR_CT_Settings CT:3;
227
  DCR_SC_Settings SC:1;
228
  DCR_CC_Settings CC:3;
229
  DCR_DP_Settings DP:1;
230
} DCRregister;
231
 
232
typedef struct {
233
  unsigned int reserved:7;
234
  unsigned int DXFW:1;
235
  unsigned int BT:1;
236
  unsigned int ST:1;
237
  unsigned int CW10:2;
238
  unsigned int CW9:2;
239
  unsigned int CW8:2;
240
  unsigned int CW7:2;
241
  unsigned int CW6:2;
242
  unsigned int CW5:2;
243
  unsigned int CW4:2;
244
  unsigned int CW3:2;
245
  unsigned int CW2:2;
246
  unsigned int CW1:2;
247
  unsigned int CW0:2;
248
} DMR1register;
249
 
250
typedef struct {
251
  unsigned int reserved:8;
252
  unsigned int WGB:11;
253
  unsigned int AWPC:11;
254
  unsigned int WCE1:1;
255
  unsigned int WCE0:1;
256
} DMR2register;
257
 
258
typedef struct {
259
  unsigned int MATCH:16;
260
  unsigned int COUNT:16;
261
} DWCRregister;
262
 
263
typedef struct {
264
  unsigned int reserved:18;
265
  unsigned int TE:1;
266
  unsigned int BE:1;
267
  unsigned int SCE:1;
268
  unsigned int RE:1;
269
  unsigned int IME:1;
270
  unsigned int DME:1;
271
  unsigned int HPINTE:1;
272
  unsigned int IIE:1;
273
  unsigned int AE:1;
274
  unsigned int LPINTE:1;
275
  unsigned int IPFE:1;
276
  unsigned int DPFE:1;
277
  unsigned int BUSEE:1;
278
  unsigned int RSTE:1;
279
} DSRregister;
280
 
281
typedef struct {
282
  unsigned int reserved:18;
283
  unsigned int TE:1;
284
  unsigned int BE:1;
285
  unsigned int SCE:1;
286
  unsigned int RE:1;
287
  unsigned int IME:1;
288
  unsigned int DME:1;
289
  unsigned int HPINTE:1;
290
  unsigned int IIE:1;
291
  unsigned int AE:1;
292
  unsigned int LPINTE:1;
293
  unsigned int IPFE:1;
294
  unsigned int DPFE:1;
295
  unsigned int BUSEE:1;
296
  unsigned int RSTE:1;
297
} DRRregister;
298
 
299
typedef struct {
300
  unsigned int reserved:29;
301
  unsigned int RECSELDEPEND:1;
302
  unsigned int ENABLE:1;
303
  unsigned int CONTIN:1;
304
} MODERregister;
305
 
306
typedef struct {
307
  unsigned int TRIGOP:2;
308
  unsigned int reserved1:4;
309
  unsigned int ISTRIGVALID:1;
310
  unsigned int ISTRIG:4;
311
  unsigned int LSSTRIGVALID:1;
312
  unsigned int LSSTRIG:4;
313
  unsigned int reserved2:2;
314
  unsigned int BPTRIGVALID:1;
315
  unsigned int BPTRIG:1;
316
  unsigned int WPTRIGVALID:1;
317
  unsigned int WPTRIG:11;
318
} TSELregister;
319
 
320
typedef struct {
321
  unsigned int QUALIFOP:2;
322
  unsigned int reserved1:4;
323
  unsigned int ISTQUALIFVALID:1;
324
  unsigned int ISTQUALIF:4;
325
  unsigned int LSSQUALIFVALID:1;
326
  unsigned int LSSQUALIF:4;
327
  unsigned int reserved2:2;
328
  unsigned int BPQUALIFVALID:1;
329
  unsigned int BPQUALIF:1;
330
  unsigned int WPQUALIFVALID:1;
331
  unsigned int WPQUALIF:11;
332
} QSELregister;
333
 
334
typedef struct {
335
  unsigned int STOPOP:2;
336
  unsigned int reserved1:4;
337
  unsigned int ISTSTOPVALID:1;
338
  unsigned int ISTSTOP:4;
339
  unsigned int LSSSTOPVALID:1;
340
  unsigned int LSSSTOP:4;
341
  unsigned int reserved2:2;
342
  unsigned int BPSTOPVALID:1;
343
  unsigned int BPSTOP:1;
344
  unsigned int WPSTOPVALID:1;
345
  unsigned int WPSTOP:11;
346
} SSELregister;
347
 
348
typedef struct {
349
  unsigned int reserved:30;
350
  unsigned int RESET:1;
351
  unsigned int RISCSTALL:1;
352
} RISCOPregister;
353
 
354
typedef struct {
355
  unsigned int reserved:25;
356
  unsigned int RECINSTR:1;
357
  unsigned int RECWRITESPR:1;
358
  unsigned int RECREADSPR:1;
359
  unsigned int RECSDATA:1;
360
  unsigned int RECLDATA:1;
361
  unsigned int RECLSEA:1;
362
  unsigned int RECPC:1;
363
} RECWPregister;
364
 
365
typedef struct {
366
  unsigned int reserved:25;
367
  unsigned int RECINSTR:1;
368
  unsigned int RECWRITESPR:1;
369
  unsigned int RECREADSPR:1;
370
  unsigned int RECSDATA:1;
371
  unsigned int RECLDATA:1;
372
  unsigned int RECLSEA:1;
373
  unsigned int RECPC:1;
374
} RECBPregister;
375
 
376
#endif /* LITTLE_ENDIAN_BIT_FILL */
377
 
378
typedef struct {
379
  unsigned int DVR[8];
380
  DCRregister DCR[8];
381
  unsigned int DCR_hit;
382
  unsigned int watchpoint;
383
  DMR1register DMR1;
384
  DMR2register DMR2;
385
  DWCRregister DWCR[2];
386
  DSRregister DSR;
387
  DRRregister DRR;
388
  unsigned int DIR;
389
} DebugUnit;
390
 
391
typedef enum {
392
  DebugInstructionFetch = 1,
393
  DebugLoadAddress = 2,
394
  DebugStoreAddress = 3,
395
  DebugLoadData = 4,
396
  DebugStoreData = 5,
397
} DebugUnitAction;
398
 
399
extern DebugUnit debug_unit;
400
void InitializeDebugUnit(void);
401
void InduceImmediateInstruction(unsigned long);
402
void SetCPUStallState(int state);
403
 
404
typedef enum {
405
  JTAG_CHAIN_GLOBAL = 0,
406
  JTAG_CHAIN_DEBUG_UNIT = 1,
407
  JTAG_CHAIN_TEST = 2,
408
  JTAG_CHAIN_TRACE = 3,
409
  JTAG_CHAIN_DEVELOPMENT = 4,
410
  JTAG_CHAIN_WISHBONE = 5,
411
  JTAG_CHAIN_BLOCK1 = 6,
412
  JTAG_CHAIN_BLOCK2 = 7,
413
  JTAG_CHAIN_OPTIONAL0 = 8,
414
  JTAG_CHAIN_OPTIONAL1 = 9,
415
  JTAG_CHAIN_OPTIONAL2 = 10,
416
  JTAG_CHAIN_OPTIONAL3 = 11,
417
  JTAG_CHAIN_OPTIONAL4 = 12,
418
  JTAG_CHAIN_OPTIONAL5 = 13,
419
  JTAG_CHAIN_OPTIONAL6 = 14,
420
  JTAG_CHAIN_OPTIONAL7 = 15,
421
} DebugScanChainIDs;
422
 
423
typedef struct {
424
  MODERregister  MODER;
425
  TSELregister   TSEL;
426
  QSELregister   QSEL;
427
  SSELregister   SSEL;
428
  RISCOPregister RISCOP;
429
  RECWPregister  RECWP[11];
430
  RECBPregister  RECBP[1];
431
} DevelopmentInterface;
432
 
433
typedef enum {
434
  DEVELOPINT_MODER = 0,
435
  DEVELOPINT_TSEL = 1,
436
  DEVELOPINT_QSEL = 2,
437
  DEVELOPINT_SSEL = 3,
438
  DEVELOPINT_RISCOP = 4,
439
  DEVELOPINT_RECWP0 = 16,
440
  DEVELOPINT_RECWP1 = 17,
441
  DEVELOPINT_RECWP2 = 18,
442
  DEVELOPINT_RECWP3 = 19,
443
  DEVELOPINT_RECWP4 = 20,
444
  DEVELOPINT_RECWP5 = 21,
445
  DEVELOPINT_RECWP6 = 22,
446
  DEVELOPINT_RECWP7 = 23,
447
  DEVELOPINT_RECWP8 = 24,
448
  DEVELOPINT_RECWP9 = 25,
449
  DEVELOPINT_RECWP10 = 26,
450
  DEVELOPINT_RECBP0 = 27,
451
} DevelopmentInterfaceAddressSpace;
452
 
453
typedef enum {
454
  DEBUGINT_DVR0 = 0,
455
  DEBUGINT_DVR1 = 1,
456
  DEBUGINT_DVR2 = 2,
457
  DEBUGINT_DVR3 = 3,
458
  DEBUGINT_DVR4 = 4,
459
  DEBUGINT_DVR5 = 5,
460
  DEBUGINT_DVR6 = 6,
461
  DEBUGINT_DVR7 = 7,
462
  DEBUGINT_DCR0 = 8,
463
  DEBUGINT_DCR1 = 9,
464
  DEBUGINT_DCR2 = 10,
465
  DEBUGINT_DCR3 = 11,
466
  DEBUGINT_DCR4 = 12,
467
  DEBUGINT_DCR5 = 13,
468
  DEBUGINT_DCR6 = 14,
469
  DEBUGINT_DCR7 = 15,
470
  DEBUGINT_DMR1 = 16,
471
  DEBUGINT_DMR2 = 17,
472
  DEBUGINT_DWCR0 = 18,
473
  DEBUGINT_DWCR1 = 19,
474
  DEBUGINT_DSR = 20,
475
  DEBUGINT_DRR = 21,
476
  DEBUGINT_DIR = 22,
477
} DebugInterfaceAddressSpace;
478
 
479
/* This assumes a pointer to a 32 bit aligned bit field has
480
   been passed and that the compiler aligns bit fields on
481
   32 bit boundaries in big endian order. If either one of
482
   these two conditions are not true for your architecture
483
   you may need to adjust this macro. */
484
#define SET_REG32(x,y)  *((uint32_t*)&x) = (uint32_t)y
485
#define GET_REG32(x,y)  y = *((uint32_t*)&x)
486
 
487
#ifdef DEBUGMOD_OFF
488
#define CheckDebugUnit(x,y) 0
489
#endif
490
 

powered by: WebSVN 2.1.0

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