origen_swd 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/boot.rb +2 -0
- data/config/commands.rb +0 -2
- data/config/version.rb +2 -2
- data/lib/origen_swd/driver.rb +108 -95
- data/lib/{origen_swd → origen_swd_dev}/dut.rb +2 -4
- data/pattern/example_api.rb +17 -33
- data/templates/web/index.md.erb +26 -4
- metadata +8 -26
- data/config/development.rb +0 -15
- data/config/environment.rb +0 -1
- data/config/users.rb +0 -19
- data/pattern/example.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8c309c479f7909b8266f9e642dbbe614b0ef8ed
|
4
|
+
data.tar.gz: 0623f5d41b8a0ae7cb9fa527ecbdf1fbdf940ef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b52f1c3ea5db823849cc1afb0dbea312a7aab30d41a389a101215059b82e4318346395e3443b1aa0557c900ab55705b1d2c4eda7f11721de355a2630c9d503a
|
7
|
+
data.tar.gz: f2cc61effbb85769c07d915ca27c44befe1664c86f362e8e8faabd2e417604edfe9e2a6da04b50a2efeb39713b7ea307eec948aef98f6c7285eb3205508013c1
|
data/config/boot.rb
ADDED
data/config/commands.rb
CHANGED
@@ -22,8 +22,6 @@ when "examples"
|
|
22
22
|
status = 0
|
23
23
|
|
24
24
|
# Pattern generator tests
|
25
|
-
ARGV = %w(example -t debug -r approved)
|
26
|
-
load "#{Origen.top}/lib/origen/commands/generate.rb"
|
27
25
|
ARGV = %w(example_api -t debug -r approved)
|
28
26
|
load "#{Origen.top}/lib/origen/commands/generate.rb"
|
29
27
|
ARGV = %w(example_reg -t debug -r approved)
|
data/config/version.rb
CHANGED
data/lib/origen_swd/driver.rb
CHANGED
@@ -11,6 +11,8 @@ module OrigenSWD
|
|
11
11
|
# Returns the parent object that instantiated the driver, could be
|
12
12
|
# either a DUT object or a protocol abstraction
|
13
13
|
attr_reader :owner
|
14
|
+
|
15
|
+
# Customiz-ible 'turn-round cycle' (TRN) parameter (in cycles)
|
14
16
|
attr_accessor :trn
|
15
17
|
|
16
18
|
# Initialize class variables
|
@@ -24,13 +26,36 @@ module OrigenSWD
|
|
24
26
|
#
|
25
27
|
def initialize(owner, options = {})
|
26
28
|
@owner = owner
|
27
|
-
# validate_pins
|
28
29
|
|
29
30
|
@current_apaddr = 0
|
30
31
|
@orundetect = 0
|
31
32
|
@trn = 0
|
32
33
|
end
|
33
34
|
|
35
|
+
# Write data from Debug Port
|
36
|
+
#
|
37
|
+
# @param [Integer, Origen::Register::Reg, Origen::Register::BitCollection, Origen::Register::Bit] reg_or_val
|
38
|
+
# Value to be shifted. If a reg/bit collection is supplied this can be pre-marked for
|
39
|
+
# read, store or overlay and which will result in the requested action being applied to
|
40
|
+
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
41
|
+
# @param [Hash] options Options to customize the operation
|
42
|
+
def read_dp(reg_or_val, options = {})
|
43
|
+
reg_or_val, options = nil, reg_or_val if reg_or_val.is_a?(Hash)
|
44
|
+
read(0, reg_or_val, options.merge(compare_data: reg_or_val.is_a?(Numeric)))
|
45
|
+
end
|
46
|
+
|
47
|
+
# Write data from Access Port
|
48
|
+
#
|
49
|
+
# @param [Integer, Origen::Register::Reg, Origen::Register::BitCollection, Origen::Register::Bit] reg_or_val
|
50
|
+
# Value to be shifted. If a reg/bit collection is supplied this can be pre-marked for
|
51
|
+
# read, store or overlay and which will result in the requested action being applied to
|
52
|
+
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
53
|
+
# @param [Hash] options Options to customize the operation
|
54
|
+
def read_ap(reg_or_val, options = {})
|
55
|
+
reg_or_val, options = nil, reg_or_val if reg_or_val.is_a?(Hash)
|
56
|
+
read(1, reg_or_val, options.merge(compare_data: reg_or_val.is_a?(Numeric)))
|
57
|
+
end
|
58
|
+
|
34
59
|
# Read data from Debug Port or Access Port
|
35
60
|
#
|
36
61
|
# @param [Integer] ap_dp A single bit indicating whether the Debug Port or the Access Port
|
@@ -41,10 +66,33 @@ module OrigenSWD
|
|
41
66
|
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
42
67
|
# @param [Hash] options Options to customize the operation
|
43
68
|
def read(ap_dp, reg_or_val, options = {})
|
44
|
-
addr = reg_or_val.
|
69
|
+
addr = extract_address(reg_or_val, options.merge(use_reg_or_val_if_you_must: true))
|
45
70
|
send_header(ap_dp, 1, addr) # send read-specific header (rnw = 1)
|
46
71
|
receive_acknowledgement
|
47
72
|
receive_payload(reg_or_val, options)
|
73
|
+
swd_dio.drive(0)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Write data to Debug Port
|
77
|
+
#
|
78
|
+
# @param [Integer, Origen::Register::Reg, Origen::Register::BitCollection, Origen::Register::Bit] reg_or_val
|
79
|
+
# Value to be shifted. If a reg/bit collection is supplied this can be pre-marked for
|
80
|
+
# read, store or overlay and which will result in the requested action being applied to
|
81
|
+
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
82
|
+
# @param [Hash] options Options to customize the operation
|
83
|
+
def write_dp(reg_or_val, options = {})
|
84
|
+
write(0, reg_or_val, options)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Write data to Access Port
|
88
|
+
#
|
89
|
+
# @param [Integer, Origen::Register::Reg, Origen::Register::BitCollection, Origen::Register::Bit] reg_or_val
|
90
|
+
# Value to be shifted. If a reg/bit collection is supplied this can be pre-marked for
|
91
|
+
# read, store or overlay and which will result in the requested action being applied to
|
92
|
+
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
93
|
+
# @param [Hash] options Options to customize the operation
|
94
|
+
def write_ap(reg_or_val, options = {})
|
95
|
+
write(1, reg_or_val, options)
|
48
96
|
end
|
49
97
|
|
50
98
|
# Write data to Debug Port or Access Port
|
@@ -55,81 +103,48 @@ module OrigenSWD
|
|
55
103
|
# Value to be shifted. If a reg/bit collection is supplied this can be pre-marked for
|
56
104
|
# read, store or overlay and which will result in the requested action being applied to
|
57
105
|
# the cycles corresponding to those bits only (don't care cycles will be generated for the others).
|
58
|
-
# @param [Integer] wdata Data to be written
|
59
106
|
# @param [Hash] options Options to customize the operation
|
60
|
-
def write(ap_dp, reg_or_val,
|
61
|
-
|
62
|
-
send_header(ap_dp, 0, addr) # send write-specific header (rnw = 0)
|
63
|
-
receive_acknowledgement
|
107
|
+
def write(ap_dp, reg_or_val, deprecated_wdata = nil, options = {})
|
108
|
+
deprecated_wdata, options = nil, deprecated_wdata if deprecated_wdata.is_a?(Hash)
|
64
109
|
|
65
|
-
if
|
66
|
-
reg_or_val.
|
110
|
+
if deprecated_wdata
|
111
|
+
addr = reg_or_val.respond_to?(:address) ? reg_or_val.address : reg_or_val
|
67
112
|
else
|
68
|
-
|
113
|
+
addr = extract_address(reg_or_val, options)
|
69
114
|
end
|
70
|
-
send_payload(reg_or_val, options)
|
71
|
-
end
|
72
115
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
# Warn caller that this method is being deprecated
|
82
|
-
msg = 'Use swd.write(ap_dp, reg_or_val, wdata, options = {}) instead of send_data(data, size, options = {})'
|
83
|
-
Origen.deprecate msg
|
84
|
-
if options.key?(:overlay)
|
85
|
-
$tester.label(options[:overlay])
|
86
|
-
size.times do |bit|
|
87
|
-
swd_clk.drive(1)
|
88
|
-
$tester.label("// SWD Data Pin #{bit}")
|
89
|
-
swd_dio.drive(data[bit])
|
90
|
-
$tester.cycle
|
91
|
-
end
|
92
|
-
swd_dio.dont_care
|
93
|
-
else
|
94
|
-
size.times do |bit|
|
95
|
-
swd_clk.drive(1)
|
96
|
-
swd_dio.drive(data[bit])
|
97
|
-
$tester.cycle
|
116
|
+
send_header(ap_dp, 0, addr) # send write-specific header (rnw = 0)
|
117
|
+
receive_acknowledgement
|
118
|
+
|
119
|
+
if deprecated_wdata
|
120
|
+
if reg_or_val.respond_to?(:data)
|
121
|
+
reg_or_val.data = deprecated_wdata
|
122
|
+
else
|
123
|
+
reg_or_val = deprecated_wdata
|
98
124
|
end
|
99
|
-
swd_dio.dont_care
|
100
125
|
end
|
126
|
+
send_payload(reg_or_val, options)
|
127
|
+
swd_dio.drive(0)
|
101
128
|
end
|
102
129
|
|
103
|
-
|
104
|
-
#
|
105
|
-
# @param [Integer] size The length of data
|
106
|
-
# @param [Hash] options Options to customize the operation
|
107
|
-
# @option options [String] :compare_data Data to be compared, only compared
|
108
|
-
# if options is set
|
109
|
-
def get_data(size, options = {})
|
110
|
-
# Warn caller that this method is being deprecated
|
111
|
-
msg = 'Use swd.read(ap_dp, reg_or_val, options = {}) instead of get_data(size, options = {})'
|
112
|
-
Origen.deprecate msg
|
113
|
-
should_store = swd_dio.is_to_be_stored?
|
114
|
-
swd_dio.dont_care
|
115
|
-
size.times do |bit|
|
116
|
-
$tester.store_next_cycle($dut.pin(:swd_dio)) if should_store
|
117
|
-
swd_dio.assert(options[:compare_data][bit]) if options.key?(:compare_data)
|
118
|
-
$tester.cycle
|
119
|
-
end
|
120
|
-
end
|
130
|
+
private
|
121
131
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
size.times do |bit|
|
128
|
-
$tester.cycle
|
132
|
+
def extract_data_hex(reg_or_val)
|
133
|
+
if reg_or_val.respond_to?(:data)
|
134
|
+
reg_or_val.data.to_s(16).upcase
|
135
|
+
else
|
136
|
+
reg_or_val.to_s(16).upcase
|
129
137
|
end
|
130
138
|
end
|
131
139
|
|
132
|
-
|
140
|
+
def extract_address(reg_or_val, options)
|
141
|
+
addr = options[:address] || options[:addr]
|
142
|
+
return addr if addr
|
143
|
+
return reg_or_val.address if reg_or_val.respond_to?(:address)
|
144
|
+
return reg_or_val.addr if reg_or_val.respond_to?(:addr)
|
145
|
+
return reg_or_val if reg_or_val && options[:use_reg_or_val_if_you_must]
|
146
|
+
fail 'No address given, if supplying a data value instead of a register object, you must supply an :address option'
|
147
|
+
end
|
133
148
|
|
134
149
|
# Send SWD Packet header
|
135
150
|
# ------------------------------------------------------------------------
|
@@ -145,40 +160,44 @@ module OrigenSWD
|
|
145
160
|
addr = address >> 2
|
146
161
|
parity = apndp ^ rnw ^ (addr >> 3) ^ (addr >> 2) & (0x01) ^ (addr >> 1) & (0x01) ^ addr & 0x01
|
147
162
|
|
148
|
-
cc '
|
163
|
+
cc '[SWD] -----------------------------------------------------------------'
|
164
|
+
cc '[SWD] | Start | AP | Read | AD[2] | AD[3] | Par | Stop | Park |'
|
165
|
+
cc "[SWD] | 1 | #{apndp} | #{rnw} | #{addr[0]} | #{addr[1]} | #{parity[0]} | 0 | 1 |"
|
166
|
+
cc '[SWD] -----------------------------------------------------------------'
|
149
167
|
swd_clk.drive(1)
|
150
|
-
cc 'Send Start Bit'
|
151
168
|
swd_dio.drive!(1) # send start bit (always 1)
|
152
|
-
cc 'Send APnDP Bit (DP or AP Access Register Bit)'
|
153
169
|
swd_dio.drive!(apndp) # send apndp bit
|
154
|
-
cc 'Send RnW Bit (read or write bit)'
|
155
170
|
swd_dio.drive!(rnw) # send rnw bit
|
156
|
-
cc 'Send Address Bits (2 bits)'
|
157
171
|
swd_dio.drive!(addr[0]) # send address[2] bit
|
158
172
|
swd_dio.drive!(addr[1]) # send address[3] bit
|
159
|
-
cc 'Send Parity Bit'
|
160
173
|
swd_dio.drive!(parity[0]) # send parity bit
|
161
|
-
cc 'Send Stop Bit'
|
162
174
|
swd_dio.drive!(0) # send stop bit
|
163
|
-
cc 'Send Park Bit'
|
164
175
|
swd_dio.drive!(1) # send park bit
|
165
176
|
swd_dio.dont_care
|
166
177
|
end
|
167
178
|
|
168
179
|
# Waits appropriate number of cycles for the acknowledgement phase
|
169
180
|
def receive_acknowledgement
|
170
|
-
cc 'Acknowledge Response phase'
|
171
181
|
wait_trn
|
182
|
+
swd_dio.assert!(1)
|
183
|
+
swd_dio.assert!(0)
|
184
|
+
swd_dio.assert!(0)
|
172
185
|
swd_dio.dont_care
|
173
|
-
$tester.cycle(repeat: 3)
|
174
186
|
end
|
175
187
|
|
176
188
|
# Waits for TRN time delay
|
177
189
|
def wait_trn
|
178
|
-
swd_dio.drive(1)
|
179
190
|
$tester.cycle(repeat: trn + 1)
|
180
191
|
end
|
181
192
|
|
193
|
+
def log(msg)
|
194
|
+
cc "[SWD] #{msg}"
|
195
|
+
if block_given?
|
196
|
+
yield
|
197
|
+
cc "[SWD] /#{msg}"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
182
201
|
# Get (read) the data payload
|
183
202
|
#
|
184
203
|
# @param [Integer, Origen::Register::Reg, Origen::Register::BitCollection, Origen::Register::Bit] reg_or_val
|
@@ -188,17 +207,12 @@ module OrigenSWD
|
|
188
207
|
# @option options [String] :overlay String for pattern label to
|
189
208
|
# facilitate pattern overlay
|
190
209
|
def receive_payload(reg_or_val, options)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
shift_payload(reg_or_val, options)
|
196
|
-
|
197
|
-
cc 'SWD 32-Bit Read Data End'
|
198
|
-
cc 'Get Read Parity Bit'
|
210
|
+
log "Read: #{Origen::Utility.read_hex(reg_or_val)}" do
|
211
|
+
options[:read] = true
|
212
|
+
shift_payload(reg_or_val, options)
|
213
|
+
end
|
199
214
|
swd_dio.dont_care
|
200
215
|
$tester.cycle
|
201
|
-
cc 'Send Read ACK bits'
|
202
216
|
wait_trn
|
203
217
|
end
|
204
218
|
|
@@ -211,18 +225,17 @@ module OrigenSWD
|
|
211
225
|
# @option options [String] :overlay String for pattern label to
|
212
226
|
# facilitate pattern overlay
|
213
227
|
def send_payload(reg_or_val, options)
|
214
|
-
cc 'Write Data Payload phase'
|
215
|
-
cc 'Send ACK Bits'
|
216
228
|
wait_trn
|
229
|
+
wdata = reg_or_val.respond_to?(:data) ? reg_or_val.data : reg_or_val
|
217
230
|
|
218
|
-
|
219
|
-
|
220
|
-
|
231
|
+
log "Write: #{wdata.to_hex}" do
|
232
|
+
options[:read] = false
|
233
|
+
shift_payload(reg_or_val, options)
|
234
|
+
end
|
221
235
|
|
222
|
-
cc 'Send Write Parity Bit'
|
223
|
-
wdata = reg_or_val.respond_to?(:data) ? reg_or_val.data : reg_or_val
|
224
236
|
parity_bit = swd_xor_calc(32, wdata)
|
225
237
|
swd_dio.drive!(parity_bit)
|
238
|
+
swd_dio.dont_care
|
226
239
|
end
|
227
240
|
|
228
241
|
# Shift the data payload
|
@@ -259,13 +272,13 @@ module OrigenSWD
|
|
259
272
|
$tester.label(reg_or_val[i].overlay_str)
|
260
273
|
elsif reg_or_val[i].is_to_be_read?
|
261
274
|
swd_dio.assert(reg_or_val[i] ? reg_or_val[i] : 0)
|
262
|
-
elsif options
|
275
|
+
elsif options[:compare_data]
|
263
276
|
swd_dio.assert(reg_or_val[i] ? reg_or_val[i] : 0)
|
264
277
|
else
|
265
278
|
swd_dio.dont_care
|
266
279
|
end
|
267
280
|
else
|
268
|
-
if options
|
281
|
+
if options[:compare_data] && reg_or_val
|
269
282
|
swd_dio.assert(reg_or_val[i] ? reg_or_val[i] : 0)
|
270
283
|
else
|
271
284
|
swd_dio.dont_care
|
@@ -295,12 +308,12 @@ module OrigenSWD
|
|
295
308
|
xor
|
296
309
|
end
|
297
310
|
|
298
|
-
#
|
311
|
+
# Provides shortname access to top-level SWD clock pin
|
299
312
|
def swd_clk
|
300
313
|
owner.pin(:swd_clk)
|
301
314
|
end
|
302
315
|
|
303
|
-
#
|
316
|
+
# Provides shortname access to top-level SWD data I/O pin
|
304
317
|
def swd_dio
|
305
318
|
owner.pin(:swd_dio)
|
306
319
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
module
|
1
|
+
module OrigenSWDDev
|
2
2
|
# This is a dummy DUT model which is used
|
3
3
|
# to instantiate and test the SWD locally
|
4
4
|
# during development.
|
5
5
|
#
|
6
6
|
# It is not included when this library is imported.
|
7
7
|
class DUT
|
8
|
+
include Origen::TopLevel
|
8
9
|
include OrigenSWD
|
9
|
-
include Origen::Callbacks
|
10
|
-
include Origen::Registers
|
11
|
-
include Origen::Pins
|
12
10
|
|
13
11
|
# Initializes simple dut model with test register and required swd pins
|
14
12
|
#
|
data/pattern/example_api.rb
CHANGED
@@ -1,37 +1,21 @@
|
|
1
1
|
Pattern.create do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
dut.control.write(0x00000010)
|
3
|
+
dut.swd.write(0, dut.control)
|
4
|
+
dut.swd.write(0, 0x55, address: 4)
|
5
|
+
dut.swd.write_dp(dut.control)
|
6
|
+
dut.swd.write_dp(0x55, address: 4)
|
7
|
+
dut.swd.write_ap(dut.control)
|
8
|
+
dut.swd.write_ap(0x55, address: 4)
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
$dut.swd.write(DP, $dut.reg(:select), 0x01000000, arm_debug_overlay: 'select_reg')
|
19
|
-
$dut.swd.swd_dio_to_0(10)
|
20
|
-
$dut.swd.read(DP, $dut.reg(:select))
|
21
|
-
$dut.swd.swd_dio_to_0(10)
|
22
|
-
|
23
|
-
$dut.swd.write(DP, $dut.reg(:stat), 0x00000032)
|
24
|
-
$dut.swd.swd_dio_to_0(10)
|
25
|
-
$dut.swd.write(DP, $dut.reg(:control), 0x00000010)
|
26
|
-
$dut.swd.swd_dio_to_0(10)
|
27
|
-
$dut.swd.read(DP, $dut.reg(:control), r_mask: 'store')
|
28
|
-
$dut.swd.swd_dio_to_0(10)
|
29
|
-
$dut.swd.read(DP, $dut.reg(:control), compare_data: 0x00000010)
|
30
|
-
$dut.swd.swd_dio_to_0(10)
|
31
|
-
|
32
|
-
$dut.swd.read(DP, $dut.reg(:control), compare_data: 0x00000010)
|
33
|
-
$dut.swd.swd_dio_to_0(10)
|
34
|
-
$dut.swd.read(DP, $dut.reg(:control), compare_data: 0x00000010)
|
35
|
-
$dut.swd.swd_dio_to_0(10)
|
10
|
+
# Not really supported, can't differentiate between an old-style and new-style
|
11
|
+
# call to do things like enable read by default
|
12
|
+
#dut.swd.read(DP, dut.control)
|
13
|
+
#dut.swd.read(DP, 0x55, address: 4)
|
14
|
+
dut.swd.read_dp(dut.control)
|
15
|
+
dut.swd.read_dp(0x55, address: 4)
|
16
|
+
dut.swd.read_ap(dut.control)
|
17
|
+
dut.swd.read_ap(0x55, address: 4)
|
18
|
+
dut.swd.read_dp(address: 4)
|
19
|
+
dut.swd.read_ap(address: 4)
|
36
20
|
|
37
21
|
end
|
data/templates/web/index.md.erb
CHANGED
@@ -27,7 +27,7 @@ __NOTE:__ You will also need to include <code>require 'origen_swd'</code> somewh
|
|
27
27
|
|
28
28
|
### How To Use
|
29
29
|
|
30
|
-
Include the <code>OrigenSWD</code> module to add a
|
30
|
+
Include the <code>OrigenSWD</code> module to add a SWD driver to your class and then
|
31
31
|
define the required pins.
|
32
32
|
|
33
33
|
Including the module adds a <code>swd</code> method which will return an instance of
|
@@ -38,8 +38,8 @@ Here is an example integration:
|
|
38
38
|
~~~ruby
|
39
39
|
|
40
40
|
class DUT
|
41
|
+
include Origen::TopLevel
|
41
42
|
include OrigenSWD
|
42
|
-
include Origen::Pins
|
43
43
|
|
44
44
|
def initialize(options = {})
|
45
45
|
add_pin :swd_clk
|
@@ -48,7 +48,29 @@ class DUT
|
|
48
48
|
end
|
49
49
|
|
50
50
|
|
51
|
-
|
51
|
+
dut.swd # => An instance of OrigenSWD::Driver
|
52
|
+
|
53
|
+
# Here is the main API for reading and writing the debug and access ports...
|
54
|
+
|
55
|
+
# Registers objects can be supplied to provide the address and data values.
|
56
|
+
# The register bits can be pre-marked for read, store or overlay and which
|
57
|
+
# will result in the requested action being applied to the cycles corresponding
|
58
|
+
# to those bits only (don't care cycles will be generated for the others).
|
59
|
+
dut.swd.write_dp(reg_object)
|
60
|
+
dut.swd.read_dp(reg_object)
|
61
|
+
dut.swd.write_ap(reg_object)
|
62
|
+
dut.swd.read_ap(reg_object)
|
63
|
+
|
64
|
+
# Alternatively, dumb data values can be supplied.
|
65
|
+
dut.swd.write_dp(0x55, address: 10)
|
66
|
+
dut.swd.read_dp(0x55, address: 10)
|
67
|
+
dut.swd.write_ap(0x55, address: 10)
|
68
|
+
dut.swd.read_ap(0x55, address: 10)
|
69
|
+
|
70
|
+
# In the case of read, the data value can be omitted completely, in which case
|
71
|
+
# it will generate a read operation with don't care on all shift out vectors
|
72
|
+
dut.swd.read_dp(address: 10)
|
73
|
+
dut.swd.read_ap(address: 10)
|
52
74
|
~~~
|
53
75
|
|
54
76
|
|
@@ -62,7 +84,7 @@ object for use in the console:
|
|
62
84
|
~~~
|
63
85
|
origen i
|
64
86
|
|
65
|
-
>
|
87
|
+
> dut.swd
|
66
88
|
=> #<OrigenSWD::Driver:0x0000001ee48e78>
|
67
89
|
~~~
|
68
90
|
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen_swd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronnie Lajaunie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.2'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: origen_doc_helpers
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
34
|
-
type: :
|
19
|
+
version: 0.7.36
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
26
|
+
version: 0.7.36
|
41
27
|
description:
|
42
28
|
email:
|
43
29
|
- Ronnie.Lajaunie@freescale.com
|
@@ -46,15 +32,12 @@ extensions: []
|
|
46
32
|
extra_rdoc_files: []
|
47
33
|
files:
|
48
34
|
- config/application.rb
|
35
|
+
- config/boot.rb
|
49
36
|
- config/commands.rb
|
50
|
-
- config/development.rb
|
51
|
-
- config/environment.rb
|
52
|
-
- config/users.rb
|
53
37
|
- config/version.rb
|
54
38
|
- lib/origen_swd.rb
|
55
39
|
- lib/origen_swd/driver.rb
|
56
|
-
- lib/
|
57
|
-
- pattern/example.rb
|
40
|
+
- lib/origen_swd_dev/dut.rb
|
58
41
|
- pattern/example_api.rb
|
59
42
|
- pattern/example_reg.rb
|
60
43
|
- templates/web/index.md.erb
|
@@ -81,9 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
64
|
version: 1.8.11
|
82
65
|
requirements: []
|
83
66
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.5.2
|
85
68
|
signing_key:
|
86
69
|
specification_version: 4
|
87
70
|
summary: Driver for single-wire-debug interface.
|
88
71
|
test_files: []
|
89
|
-
has_rdoc:
|
data/config/development.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file is similar to environment.rb and will be loaded
|
2
|
-
# automatically at the start of each invocation of Origen.
|
3
|
-
#
|
4
|
-
# However the major difference is that it will not be loaded
|
5
|
-
# if the application is imported by a 3rd party app - in that
|
6
|
-
# case only environment.rb is loaded.
|
7
|
-
#
|
8
|
-
# Therefore this file should be used to load anything you need
|
9
|
-
# to setup a development environment for this app, normally
|
10
|
-
# this would be used to define some dummy classes to instantiate
|
11
|
-
# your objects so that they can be tested and/or interacted with
|
12
|
-
# in the console.
|
13
|
-
module OrigenSWD
|
14
|
-
autoload :DUT, "origen_swd/dut"
|
15
|
-
end
|
data/config/environment.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "origen_swd"
|
data/config/users.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# This file defines the users associated with your project, it is basically the
|
2
|
-
# mailing list for release notes.
|
3
|
-
#
|
4
|
-
# You can split your users into "admin" and "user" groups, the main difference
|
5
|
-
# between the two is that admin users will get all tag emails, users will get
|
6
|
-
# emails on external/official releases only.
|
7
|
-
#
|
8
|
-
# Users are also prohibited from running the "origen tag" task, but this is
|
9
|
-
# really just to prevent a casual user from executing it inadvertently and is
|
10
|
-
# not intended to be a serious security gate.
|
11
|
-
module Origen
|
12
|
-
module Users
|
13
|
-
def users
|
14
|
-
@users ||= [
|
15
|
-
|
16
|
-
]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/pattern/example.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
Pattern.create do
|
2
|
-
|
3
|
-
address = 0x00002020
|
4
|
-
rwb = 0
|
5
|
-
ap_dp = 1
|
6
|
-
wdata = 0xAAAA5555
|
7
|
-
start = 1
|
8
|
-
apndp = 1
|
9
|
-
rnw = rwb
|
10
|
-
addr = address >> 2
|
11
|
-
parity_pr = ap_dp ^ rwb ^ (addr >> 3) ^ (addr >> 2) & (0x01) ^ (addr >> 1) & (0x01) ^ addr & 0x01
|
12
|
-
trn = 0
|
13
|
-
data = wdata
|
14
|
-
require_dp = 0
|
15
|
-
line_reset = 0
|
16
|
-
stop = 0
|
17
|
-
park = 1
|
18
|
-
|
19
|
-
cc 'SWD transaction'
|
20
|
-
cc 'Packet Request Phase'
|
21
|
-
|
22
|
-
annotate 'Send Start Bit'
|
23
|
-
$dut.swd.send_data(start, 1)
|
24
|
-
cc('Send APnDP Bit (DP or AP Access Register Bit)', prefix: true)
|
25
|
-
$dut.swd.send_data(apndp, 1)
|
26
|
-
c2 'Send RnW Bit (read or write bit)'
|
27
|
-
$dut.swd.send_data(rnw, 1)
|
28
|
-
c2 'Send Address Bits (2 bits)'
|
29
|
-
$dut.swd.send_data(addr, 2)
|
30
|
-
c2 'Send Parity Bit'
|
31
|
-
$dut.swd.send_data(parity_pr, 1)
|
32
|
-
c2 'Send Stop Bit'
|
33
|
-
$dut.swd.send_data(stop, 1)
|
34
|
-
c2 'Send Park Bit'
|
35
|
-
$dut.swd.send_data(park, 1)
|
36
|
-
|
37
|
-
cc 'Acknowledge Response phase'
|
38
|
-
$dut.swd.send_data(0xf, trn + 1)
|
39
|
-
$dut.swd.get_data(3)
|
40
|
-
|
41
|
-
cc 'Write Data Phase'
|
42
|
-
cc 'Write'
|
43
|
-
cc 'Send ACK Bits'
|
44
|
-
$dut.swd.send_data(0xf, trn + 1)
|
45
|
-
cc 'SWD 32-Bit Write Start'
|
46
|
-
$dut.swd.send_data(data, 32, overlay: 'write_ovl')
|
47
|
-
cc 'SWD 32-Bit Write End'
|
48
|
-
cc 'Send Write Parity Bit'
|
49
|
-
xor = 0
|
50
|
-
32.times do |bit|
|
51
|
-
xor ^= (data >> bit) & 0x01
|
52
|
-
end
|
53
|
-
xor
|
54
|
-
$dut.swd.send_data(xor, 1)
|
55
|
-
|
56
|
-
cc 'SWD DIO to 0 for 10 cycles'
|
57
|
-
$dut.swd.swd_dio_to_0(10)
|
58
|
-
|
59
|
-
end
|