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

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [trunk/] [Software/] [AdvancedWatchpointControl/] [src/] [advancedWatchpointControl/] [targetDebugRegisterSet.java] - Blame information for rev 54

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 54 nyawn
////////////////////////////////////////////////////////////////
2
//
3
// targetDebugRegisterSet.java
4
//
5
// Copyright (C) 2010 Nathan Yawn 
6
//                    (nyawn@opencores.org)
7
//
8 51 nyawn
// This class holds a direct, cached copy of the debug registers 
9
// on the OR1000 target CPU.  It relies on other classes to
10
// interpret the meanings of the values.
11 54 nyawn
//
12
////////////////////////////////////////////////////////////////
13
//
14
// This source file may be used and distributed without
15
// restriction provided that this copyright statement is not
16
// removed from the file and that any derivative work contains
17
// the original copyright notice and the associated disclaimer.
18
// 
19
// This source file is free software; you can redistribute it
20
// and/or modify it under the terms of the GNU General
21
// Public License as published by the Free Software Foundation;
22
// either version 3.0 of the License, or (at your option) any
23
// later version.
24
//
25
// This source is distributed in the hope that it will be
26
// useful, but WITHOUT ANY WARRANTY; without even the implied 
27
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28
// PURPOSE.  See the GNU Lesser General Public License for more
29
// details.
30
// 
31
// You should have received a copy of the GNU General
32
// Public License along with this source; if not, download it 
33
// from http://www.gnu.org/licenses/gpl.html
34
//
35
////////////////////////////////////////////////////////////////
36 51 nyawn
package advancedWatchpointControl;
37
 
38
public class targetDebugRegisterSet {
39
 
40
        public enum regType { DCR0, DVR0, DCR1, DVR1, DCR2, DVR2, DCR3, DVR3,
41
                DCR4, DVR4, DCR5, DVR5, DCR6, DVR6, DCR7, DVR7, DMR1, DMR2, DWCR0, DWCR1 }
42
 
43
        // These reflect the values of the registers on the target
44
        // They must be 'long's, because they're unsigned ints.
45
        private long dcr[] = { 1, 1, 0, 0, 1, 1, 1, 1 };
46
        private long dvr[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
47
        private long dmr1 = 0;
48
        private long dmr2 = 0;
49
        private long dwcr0 = 0;
50
        private long dwcr1 = 0;
51
 
52
 
53
        public void setDCR(int which, long val) {
54
                dcr[which] = val;
55
        }
56
 
57
        public long getDCR(int which) {
58
                return dcr[which];
59
        }
60
 
61
        public void setDVR(int which, long val) {
62
                dvr[which] = val;
63
        }
64
 
65
        public long getDVR(int which) {
66
                return dvr[which];
67
        }
68
 
69
        public void setDMR1(long val) {
70
                dmr1 = val;
71
        }
72
 
73
        public long getDMR1() {
74
                return dmr1;
75
        }
76
 
77
        public void setDMR2(long val) {
78
                dmr2 = val;
79
        }
80
 
81
        public long getDMR2() {
82
                return dmr2;
83
        }
84
 
85
        public void setDWCR0(long val) {
86
                dwcr0 = val;
87
        }
88
 
89
        public long getDWCR0() {
90
                return dwcr0;
91
        }
92
 
93
        public void setDWCR1(long val) {
94
                dwcr1 = val;
95
        }
96
 
97
        public long getDWCR1() {
98
                return dwcr1;
99
        }
100
 
101
        public static int getRegisterAddress(regType reg) {
102
                int retval = 0;
103
                int dgroup = 6 << 11;  // DEBUG group is 6, 11 bits is the group offset
104
 
105
                switch(reg) {
106
                case DCR0:
107
                        retval = dgroup | 8;
108
                        break;
109
                case DVR0:
110
                        retval = dgroup | 0;
111
                        break;
112
                case DCR1:
113
                        retval = dgroup | 9;
114
                        break;
115
                case DVR1:
116
                        retval = dgroup | 1;
117
                        break;
118
                case DCR2:
119
                        retval = dgroup | 10;
120
                        break;
121
                case DVR2:
122
                        retval = dgroup | 2;
123
                        break;
124
                case DCR3:
125
                        retval = dgroup | 11;
126
                        break;
127
                case DVR3:
128
                        retval = dgroup | 3;
129
                        break;
130
                case DCR4:
131
                        retval = dgroup | 12;
132
                        break;
133
                case DVR4:
134
                        retval = dgroup | 4;
135
                        break;
136
                case DCR5:
137
                        retval = dgroup | 13;
138
                        break;
139
                case DVR5:
140
                        retval = dgroup | 5;
141
                        break;
142
                case DCR6:
143
                        retval = dgroup | 14;
144
                        break;
145
                case DVR6:
146
                        retval = dgroup | 6;
147
                        break;
148
                case DCR7:
149
                        retval = dgroup | 15;
150
                        break;
151
                case DVR7:
152
                        retval = dgroup | 7;
153
                        break;
154
                case DMR1:
155
                        retval = dgroup | 16;
156
                        break;
157
                case DMR2:
158
                        retval = dgroup | 17;
159
                        break;
160
                case DWCR0:
161
                        retval = dgroup | 18;
162
                        break;
163
                case DWCR1:
164
                        retval = dgroup | 19;
165
                        break;
166
                default:
167
                        break;  // Register address 0 is the version register...read-only and harmless.
168
                }
169
 
170
                return retval;
171
        }
172
 
173
}

powered by: WebSVN 2.1.0

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