Class: OrigenARMDebug::JTAG_DPController
- Inherits:
-
Object
- Object
- OrigenARMDebug::JTAG_DPController
show all
- Includes:
- Origen::Controller, DPController, Helpers
- Defined in:
- lib/origen_arm_debug/jtag_dp_controller.rb
Instance Method Summary
collapse
#ctrl_stat, #select_ap_reg
Methods included from Helpers
#extract_address, #extract_data, #log
Instance Method Details
#base_address ⇒ Object
141
142
143
|
# File 'lib/origen_arm_debug/jtag_dp_controller.rb', line 141
def base_address
model.base_address
end
|
#read_register(reg, options = {}) ⇒ Object
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
|
# File 'lib/origen_arm_debug/jtag_dp_controller.rb', line 63
def read_register(reg, options = {})
unless reg.readable?
fail "The :#{reg.name} register is not readable!"
end
if reg.owner == model
if reg.name == :ir
dut.jtag.read_ir(reg)
else
log "Read JTAG-DP register #{reg.name.to_s.upcase}: #{Origen::Utility.read_hex(reg)}" do
if reg.name == :idcode
ir.write!(reg.offset)
dut.jtag.read_dr(reg)
elsif reg.name == :ctrlstat || reg.name == :select || reg.name == :rdbuff
dr.reset
dr.overlay(nil)
dr[0].write(1)
dr[2..1].write(reg.offset >> 2)
dr[34..3].write(0)
ir.write!(dpacc_select)
dut.jtag.write_dr(dr)
dr.reset
dr.overlay(nil)
dr[0].write(1)
dr[2..1].write(rdbuff.offset >> 2)
dr[34..3].copy_all(reg)
options[:mask] = options[:mask] << 3 unless options[:mask].nil?
dut.jtag.read_dr(dr, options)
else
fail "Can't read #{reg.name}"
end
end
end
else
unless reg.owner.is_a?(AP)
fail 'The JTAG-DP can only write to DP or AP registers!'
end
select_ap_reg(reg)
dr.reset
dr.overlay(nil)
dr[0].write(1)
dr[2..1].write(reg.offset >> 2)
dr[34..3].write(0)
ir.write!(apacc_select)
dut.jtag.write_dr(dr)
if options[:apacc_wait_states]
options[:apacc_wait_states].cycles
end
dr.reset
dr.overlay(nil)
dr[0].write(1)
dr[2..1].write(rdbuff.offset >> 2)
dr[34..3].copy_all(reg)
options[:mask] = options[:mask] << 3 unless options[:mask].nil?
ir.write!(dpacc_select)
dut.jtag.read_dr(dr, options)
end
end
|
#write_register(reg, options = {}) ⇒ Object
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
|
# File 'lib/origen_arm_debug/jtag_dp_controller.rb', line 7
def write_register(reg, options = {})
unless reg.writable?
fail "The :#{reg.name} register is not writeable!"
end
if reg.owner == model
if reg.name == :ir
dut.jtag.write_ir(reg)
else
log "Write JTAG-DP register #{reg.name.to_s.upcase}: #{reg.data.to_hex}" do
if reg.name == :abort
ir.write!(reg.offset)
dr.reset
dr.overlay(nil)
dr[2..0].write(0)
dr[34..3].copy_all(reg)
dut.jtag.write_dr(dr)
elsif reg.name == :ctrlstat || reg.name == :select
dr.reset
dr.overlay(nil)
dr[0].write(0)
dr[2..1].write(reg.offset >> 2)
dr[34..3].copy_all(reg)
ir.write!(dpacc_select)
dut.jtag.write_dr(dr)
else
fail "Can't write #{reg.name}"
end
end
end
else
unless reg.owner.is_a?(AP)
fail 'The JTAG-DP can only write to DP or AP registers!'
end
select_ap_reg(reg)
dr.reset
dr.overlay(nil)
dr[0].write(0)
dr[2..1].write(reg.offset >> 2)
dr[34..3].copy_all(reg)
ir.write!(apacc_select)
dut.jtag.write_dr(dr, options)
end
end
|