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 51

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

Line No. Rev Author Line
1 51 nyawn
// This class holds a direct, cached copy of the debug registers 
2
// on the OR1000 target CPU.  It relies on other classes to
3
// interpret the meanings of the values.
4
 
5
package advancedWatchpointControl;
6
 
7
public class targetDebugRegisterSet {
8
 
9
        public enum regType { DCR0, DVR0, DCR1, DVR1, DCR2, DVR2, DCR3, DVR3,
10
                DCR4, DVR4, DCR5, DVR5, DCR6, DVR6, DCR7, DVR7, DMR1, DMR2, DWCR0, DWCR1 }
11
 
12
        // These reflect the values of the registers on the target
13
        // They must be 'long's, because they're unsigned ints.
14
        private long dcr[] = { 1, 1, 0, 0, 1, 1, 1, 1 };
15
        private long dvr[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
16
        private long dmr1 = 0;
17
        private long dmr2 = 0;
18
        private long dwcr0 = 0;
19
        private long dwcr1 = 0;
20
 
21
 
22
        public void setDCR(int which, long val) {
23
                dcr[which] = val;
24
        }
25
 
26
        public long getDCR(int which) {
27
                return dcr[which];
28
        }
29
 
30
        public void setDVR(int which, long val) {
31
                dvr[which] = val;
32
        }
33
 
34
        public long getDVR(int which) {
35
                return dvr[which];
36
        }
37
 
38
        public void setDMR1(long val) {
39
                dmr1 = val;
40
        }
41
 
42
        public long getDMR1() {
43
                return dmr1;
44
        }
45
 
46
        public void setDMR2(long val) {
47
                dmr2 = val;
48
        }
49
 
50
        public long getDMR2() {
51
                return dmr2;
52
        }
53
 
54
        public void setDWCR0(long val) {
55
                dwcr0 = val;
56
        }
57
 
58
        public long getDWCR0() {
59
                return dwcr0;
60
        }
61
 
62
        public void setDWCR1(long val) {
63
                dwcr1 = val;
64
        }
65
 
66
        public long getDWCR1() {
67
                return dwcr1;
68
        }
69
 
70
        public static int getRegisterAddress(regType reg) {
71
                int retval = 0;
72
                int dgroup = 6 << 11;  // DEBUG group is 6, 11 bits is the group offset
73
 
74
                switch(reg) {
75
                case DCR0:
76
                        retval = dgroup | 8;
77
                        break;
78
                case DVR0:
79
                        retval = dgroup | 0;
80
                        break;
81
                case DCR1:
82
                        retval = dgroup | 9;
83
                        break;
84
                case DVR1:
85
                        retval = dgroup | 1;
86
                        break;
87
                case DCR2:
88
                        retval = dgroup | 10;
89
                        break;
90
                case DVR2:
91
                        retval = dgroup | 2;
92
                        break;
93
                case DCR3:
94
                        retval = dgroup | 11;
95
                        break;
96
                case DVR3:
97
                        retval = dgroup | 3;
98
                        break;
99
                case DCR4:
100
                        retval = dgroup | 12;
101
                        break;
102
                case DVR4:
103
                        retval = dgroup | 4;
104
                        break;
105
                case DCR5:
106
                        retval = dgroup | 13;
107
                        break;
108
                case DVR5:
109
                        retval = dgroup | 5;
110
                        break;
111
                case DCR6:
112
                        retval = dgroup | 14;
113
                        break;
114
                case DVR6:
115
                        retval = dgroup | 6;
116
                        break;
117
                case DCR7:
118
                        retval = dgroup | 15;
119
                        break;
120
                case DVR7:
121
                        retval = dgroup | 7;
122
                        break;
123
                case DMR1:
124
                        retval = dgroup | 16;
125
                        break;
126
                case DMR2:
127
                        retval = dgroup | 17;
128
                        break;
129
                case DWCR0:
130
                        retval = dgroup | 18;
131
                        break;
132
                case DWCR1:
133
                        retval = dgroup | 19;
134
                        break;
135
                default:
136
                        break;  // Register address 0 is the version register...read-only and harmless.
137
                }
138
 
139
                return retval;
140
        }
141
 
142
}

powered by: WebSVN 2.1.0

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