origen_jtag 0.19.1 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +1,49 @@
1
-
2
- Pattern.create(options = { name: 'two_port' }) do
3
-
4
- ss 'test using first jtag port'
5
- jtag = $dut.jtag
6
- reg = $dut.reg(:full16)
7
-
8
- cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
9
- jtag.write_dr 0xFFFF, size: 16, shift_out_data: 0xA5A5
10
-
11
- cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
12
- reg.write(0xFFFF)
13
- reg.bits[0..7].read
14
- jtag.write_dr 0xFFFF, size: 16, shift_out_data: reg
15
-
16
-
17
- cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
18
- reg.write(0xFFFF)
19
- jtag.write_dr reg, shift_out_data: 0xA5A5
20
-
21
- cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
22
- reg.write(0xFFFF)
23
- reg2 = reg.dup
24
- reg2.bits[0..7].read
25
- jtag.write_dr reg, size: 16, shift_out_data: reg2
26
-
27
-
28
- ss 'test using second jtag port'
29
- jtag = $dut.jtag2
30
-
31
- cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
32
- jtag.write_dr 0xFFFF, size: 16, shift_out_data: 0xA5A5
33
-
34
- cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
35
- reg.write(0xFFFF)
36
- reg.bits[0..7].read
37
- jtag.write_dr 0xFFFF, size: 16, shift_out_data: reg
38
-
39
-
40
- cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
41
- reg.write(0xFFFF)
42
- jtag.write_dr reg, shift_out_data: 0xA5A5
43
-
44
- cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
45
- reg.write(0xFFFF)
46
- reg2 = reg.dup
47
- reg2.bits[0..7].read
48
- jtag.write_dr reg, size: 16, shift_out_data: reg2
49
- end
1
+
2
+ Pattern.create(options = { name: 'two_port' }) do
3
+
4
+ ss 'test using first jtag port'
5
+ jtag = $dut.jtag
6
+ reg = $dut.reg(:full16)
7
+
8
+ cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
9
+ jtag.write_dr 0xFFFF, size: 16, shift_out_data: 0xA5A5
10
+
11
+ cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
12
+ reg.write(0xFFFF)
13
+ reg.bits[0..7].read
14
+ jtag.write_dr 0xFFFF, size: 16, shift_out_data: reg
15
+
16
+
17
+ cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
18
+ reg.write(0xFFFF)
19
+ jtag.write_dr reg, shift_out_data: 0xA5A5
20
+
21
+ cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
22
+ reg.write(0xFFFF)
23
+ reg2 = reg.dup
24
+ reg2.bits[0..7].read
25
+ jtag.write_dr reg, size: 16, shift_out_data: reg2
26
+
27
+
28
+ ss 'test using second jtag port'
29
+ jtag = $dut.jtag2
30
+
31
+ cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
32
+ jtag.write_dr 0xFFFF, size: 16, shift_out_data: 0xA5A5
33
+
34
+ cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
35
+ reg.write(0xFFFF)
36
+ reg.bits[0..7].read
37
+ jtag.write_dr 0xFFFF, size: 16, shift_out_data: reg
38
+
39
+
40
+ cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
41
+ reg.write(0xFFFF)
42
+ jtag.write_dr reg, shift_out_data: 0xA5A5
43
+
44
+ cc 'TDO should be XXXX_XXXX_HHHH_HHHH'
45
+ reg.write(0xFFFF)
46
+ reg2 = reg.dup
47
+ reg2.bits[0..7].read
48
+ jtag.write_dr reg, size: 16, shift_out_data: reg2
49
+ end
@@ -1,234 +1,234 @@
1
- % render "layouts/basic.html" do
2
-
3
- %# HTML tags can be embedded in mark down files if you want to do specific custom
4
- %# formatting like this, but in most cases that is not required.
5
- <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
-
7
- ### Purpose
8
-
9
- This plugin provides an ATE driver for an IEEE 1149.1 compliant JTAG interface.
10
-
11
- It makes no assumptions about the instruction or data register attributes or higher
12
- level protocol concerns. For use at DUT model level this plugin would be normally be wrapped in
13
- a higher level protocol such as [Nexus](http://origen-sdk.org/nexus/).
14
-
15
- ### How To Import
16
-
17
- In your Gemfile add:
18
-
19
- ~~~ruby
20
- gem "origen_jtag", ">= <%= Origen.app.version %>"
21
- ~~~
22
-
23
- or if your application is a plugin add this to your <code>.gemspec</code>
24
-
25
- ~~~ruby
26
- spec.add_development_dependency "origen_jtag", ">= <%= Origen.app.version %>"
27
- ~~~
28
-
29
- __NOTE:__ You will also need to include <code>require 'origen_jtag'</code> somewhere in your environment. This can be done in <code>config/environment.rb</code> for example.
30
-
31
- ### How To Use
32
-
33
- #### New Style Example
34
-
35
- The driver no longer requires specific pin names (or aliases), supports sub_block instantiation and DUTs with multiple JTAG ports.
36
- You are no longer required to include "OrigenJTAG" in your DUT class.
37
-
38
- Here is an example integration:
39
-
40
- ~~~ruby
41
- class Pioneer
42
-
43
- include Origen::TopLevel
44
-
45
- def initialize
46
- add_pin :tclk
47
- add_pin :tdi
48
- add_pin :tdo
49
- add_pin :tms
50
-
51
- add_pin :tck2
52
- add_pin :tdi2
53
- add_pin :tdo2
54
- add_pin :tms2
55
-
56
-
57
- # In this first instance TCK covers 4 tester cycles,
58
- # 2 high then 2 low for each effective TCK pulse.
59
- # Strobe TDO only when TCK high. Only store TDO on last cycle (3)
60
-
61
- # several pluggins use dut.jtag, your default port driver should be named jtag for compatibility
62
- sub_block :jtag, class_name: 'OrigenJTAG::Driver',
63
- tclk_format: :rl,
64
- tclk_multiple: 4,
65
- tdo_strobe: :tclk_high,
66
- tdo_store_cycle: 3,
67
- tck_pin: pin(:tclk),
68
- tdi_pin: pin(:tdi),
69
- tdo_pin: pin(:tdo),
70
- tms_pin: pin(:tms)
71
-
72
- # create a driver for a 2nd port like this
73
- # note different configuration settings can be used
74
- sub_block :jtag_port2, class_name: 'OrigenJTAG::Driver',
75
- tclk_format: :rh,
76
- tclk_multiple: 2,
77
- tdo_strobe: :tclk_high,
78
- tdo_store_cycle: 1,
79
- tck_pin: pin(:tck2),
80
- tdi_pin: pin(:tdi2),
81
- tdo_pin: pin(:tdo2),
82
- tms_pin: pin(:tms2)
83
- end
84
-
85
- end
86
-
87
- dut.jtag # => jtag driver for the first port (tclk, tdi, tdo, tms)
88
- dut.jtag_port2 # => jtag driver for the second port (tck2, tdi2, tdo2, tms2)
89
- ~~~
90
-
91
- By default, the driver will apply the conventional '1' and '0' drive values on the TCK pin to turn
92
- the clock on and off, however
93
- this can be overridden by supplying the `:tclk_vals` option as shown in the example below:
94
-
95
- ~~~ruby
96
- # My V93K timing setup uses 'P' to enable a clock pulse instead of '1'
97
- tclk_vals: { on: 'P', off: 0 }
98
- ~~~
99
-
100
-
101
- #### Legacy Example
102
-
103
- Include the <code>OrigenJTAG</code> module to add a JTAG driver to your class and
104
- define the required pins.
105
- Normally the pins would be an alias to existing DUT pins and therefore the
106
- JTAG driver module cannot assume them.
107
-
108
- Including the module adds a <code>jtag</code> method which will return an instance of
109
- [<code>OrigenJTAG::Driver</code>](<%= path "api/OrigenJTAG/Driver.html" %>).
110
-
111
- The following attributes can be customized by defining a <code>JTAG_CONFIG</code>
112
- hash:
113
-
114
- * **tclk_format** - TCLK timing format, Return High (:rh) or Return Low (:rl). Default is :rh.
115
- * **tclk_multiple** - Number of cycles for a single TCLK pulse to cover, to support cases where TCLK needs to be a fraction of another clock period. Assumes 50% duty cycle, specify only even numbers if > 1. Default is :r1.
116
- * **tdo_strobe** - When using multiple cycles for TCK, which state of TCK to strobe for TDO, :tclk_high or :tclk_low or :tclk_all. Default :tclk_high.
117
- * **tdo_store_cycle** - When using multiple cycles for TCK, which cycle of TCK to store for TDO if store requested (0 to number of tclk_multiple-1). Default 0
118
-
119
- Here is an example integration:
120
-
121
- ~~~ruby
122
- class Pioneer
123
-
124
- include OrigenJTAG
125
- include Origen::Pins
126
-
127
- # TCK covers 4 tester cycles, 2 high then 2 low for each effective TCK pulse
128
- # Strobe TDO only when TCK high. Only store TDO on last cycle (3)
129
- JTAG_CONFIG = {
130
- :tclk_format => :rl,
131
- :tclk_multiple => 4,
132
- :tdo_strobe => :tclk_high,
133
- :tdo_store_cycle => 3,
134
- }
135
-
136
- def initialize
137
- add_pin :tclk
138
- add_pin :tdi
139
- add_pin :tdo
140
- add_pin :tms
141
- end
142
-
143
- end
144
-
145
- Pioneer.new.jtag # => An instance of OrigenJTAG::Driver
146
- ~~~
147
-
148
- #### APIs
149
-
150
- Two APIs are provided, the primary one provides canned methods to read and
151
- write to the IR and DR registers.
152
-
153
- These accept either an absolute data value or an Origen register/bit collection.
154
-
155
- ~~~ruby
156
- jtag.write_dr 0x1234, :size => 16
157
-
158
- # The size option is not required when a register is supplied
159
- jtag.write_dr $dut.reg(:clkdiv)
160
-
161
- # Although it can still be added if the register is not the full data width
162
- jtag.write_dr $dut.reg(:clkdiv), :size => 32
163
-
164
- # A rich read method is available which supports bit-level read, store and overlay operations
165
- $dut.reg(:clkdiv).bits(:div).read(0x55)
166
- jtag.read $dut.reg(:clkdiv)
167
-
168
- # In cases where both shift in (TDI) and shift out data (TDO) are critical, (e.g. compare shift
169
- # out data on a write, or shfit in specific data on a read) the shift_in_data and
170
- # shift_out_data options can be specified. By default, TDO will be dont care on writes
171
- # and TDI will be 0 on reads.
172
- jtag.write_dr $dut.reg(:clkdiv), :shift_out_data => 0x4321
173
- jtag.read_dr $udt.reg(:clkdiv), :shift_in_data => 0x5678
174
-
175
- # Similar methods exist for the instruction register
176
- jtag.write_ir 0x1F, :size => 5
177
- jtag.read_ir 0x1F, :size => 5
178
- ~~~
179
-
180
- A secondary API provides low level control of the TAP Controller state machine.
181
-
182
- ~~~ruby
183
- jtag.pause_dr do
184
- jtag.shift_dr do
185
- # The shift method accepts the same arguments as the canned read/write methods
186
- jtag.shift 0x55, :size => 32
187
- end
188
- end
189
- ~~~
190
-
191
- See the [<code>OrigenJTAG::Driver</code>](<%= path "api/OrigenJTAG/Driver.html" %>) and
192
- [<code>OrigenJTAG::TAPController</code>](<%= path "api/OrigenJTAG/TAPController.html" %>)
193
- APIs for more details about the available driver methods.
194
-
195
- Any model/controller within a target runtime environment can listen out for JTAG state
196
- changes by implementing the following callback handler:
197
-
198
- ~~~ruby
199
- def on_jtag_state_change(new_state)
200
- if new_state == :update_dr
201
- # Do something every time we enter this state
202
- end
203
- end
204
- ~~~
205
-
206
-
207
- ### How To Setup a Development Environment
208
-
209
- [Clone the repository from Github](https://github.com/Origen-SDK/origen_jtag).
210
-
211
- An instance of the OrigenJTAG driver is hooked up to a dummy DUT
212
- object for use in the console:
213
-
214
- ~~~
215
- origen i
216
-
217
- > $dut.jtag
218
- => #<OrigenJTAG::Driver:0x0000001ee48e78>
219
- ~~~
220
-
221
- Follow the instructions here if you want to make a 3rd party app
222
- workspace use your development copy of the OrigenJTAG plugin:
223
- [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
224
-
225
- This plugin also contains a test suite, makes sure this passes before committing
226
- any changes!
227
-
228
- ~~~
229
- origen examples
230
- ~~~
231
-
232
- <%= disqus_comments %>
233
-
234
- % end
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Purpose
8
+
9
+ This plugin provides an ATE driver for an IEEE 1149.1 compliant JTAG interface.
10
+
11
+ It makes no assumptions about the instruction or data register attributes or higher
12
+ level protocol concerns. For use at DUT model level this plugin would be normally be wrapped in
13
+ a higher level protocol such as [Nexus](http://origen-sdk.org/nexus/).
14
+
15
+ ### How To Import
16
+
17
+ In your Gemfile add:
18
+
19
+ ~~~ruby
20
+ gem "origen_jtag", ">= <%= Origen.app.version %>"
21
+ ~~~
22
+
23
+ or if your application is a plugin add this to your <code>.gemspec</code>
24
+
25
+ ~~~ruby
26
+ spec.add_development_dependency "origen_jtag", ">= <%= Origen.app.version %>"
27
+ ~~~
28
+
29
+ __NOTE:__ You will also need to include <code>require 'origen_jtag'</code> somewhere in your environment. This can be done in <code>config/environment.rb</code> for example.
30
+
31
+ ### How To Use
32
+
33
+ #### New Style Example
34
+
35
+ The driver no longer requires specific pin names (or aliases), supports sub_block instantiation and DUTs with multiple JTAG ports.
36
+ You are no longer required to include "OrigenJTAG" in your DUT class.
37
+
38
+ Here is an example integration:
39
+
40
+ ~~~ruby
41
+ class Pioneer
42
+
43
+ include Origen::TopLevel
44
+
45
+ def initialize
46
+ add_pin :tclk
47
+ add_pin :tdi
48
+ add_pin :tdo
49
+ add_pin :tms
50
+
51
+ add_pin :tck2
52
+ add_pin :tdi2
53
+ add_pin :tdo2
54
+ add_pin :tms2
55
+
56
+
57
+ # In this first instance TCK covers 4 tester cycles,
58
+ # 2 high then 2 low for each effective TCK pulse.
59
+ # Strobe TDO only when TCK high. Only store TDO on last cycle (3)
60
+
61
+ # several pluggins use dut.jtag, your default port driver should be named jtag for compatibility
62
+ sub_block :jtag, class_name: 'OrigenJTAG::Driver',
63
+ tclk_format: :rl,
64
+ tclk_multiple: 4,
65
+ tdo_strobe: :tclk_high,
66
+ tdo_store_cycle: 3,
67
+ tck_pin: pin(:tclk),
68
+ tdi_pin: pin(:tdi),
69
+ tdo_pin: pin(:tdo),
70
+ tms_pin: pin(:tms)
71
+
72
+ # create a driver for a 2nd port like this
73
+ # note different configuration settings can be used
74
+ sub_block :jtag_port2, class_name: 'OrigenJTAG::Driver',
75
+ tclk_format: :rh,
76
+ tclk_multiple: 2,
77
+ tdo_strobe: :tclk_high,
78
+ tdo_store_cycle: 1,
79
+ tck_pin: pin(:tck2),
80
+ tdi_pin: pin(:tdi2),
81
+ tdo_pin: pin(:tdo2),
82
+ tms_pin: pin(:tms2)
83
+ end
84
+
85
+ end
86
+
87
+ dut.jtag # => jtag driver for the first port (tclk, tdi, tdo, tms)
88
+ dut.jtag_port2 # => jtag driver for the second port (tck2, tdi2, tdo2, tms2)
89
+ ~~~
90
+
91
+ By default, the driver will apply the conventional '1' and '0' drive values on the TCK pin to turn
92
+ the clock on and off, however
93
+ this can be overridden by supplying the `:tclk_vals` option as shown in the example below:
94
+
95
+ ~~~ruby
96
+ # My V93K timing setup uses 'P' to enable a clock pulse instead of '1'
97
+ tclk_vals: { on: 'P', off: 0 }
98
+ ~~~
99
+
100
+
101
+ #### Legacy Example
102
+
103
+ Include the <code>OrigenJTAG</code> module to add a JTAG driver to your class and
104
+ define the required pins.
105
+ Normally the pins would be an alias to existing DUT pins and therefore the
106
+ JTAG driver module cannot assume them.
107
+
108
+ Including the module adds a <code>jtag</code> method which will return an instance of
109
+ [<code>OrigenJTAG::Driver</code>](<%= path "api/OrigenJTAG/Driver.html" %>).
110
+
111
+ The following attributes can be customized by defining a <code>JTAG_CONFIG</code>
112
+ hash:
113
+
114
+ * **tclk_format** - TCLK timing format, Return High (:rh) or Return Low (:rl). Default is :rh.
115
+ * **tclk_multiple** - Number of cycles for a single TCLK pulse to cover, to support cases where TCLK needs to be a fraction of another clock period. Assumes 50% duty cycle, specify only even numbers if > 1. Default is :r1.
116
+ * **tdo_strobe** - When using multiple cycles for TCK, which state of TCK to strobe for TDO, :tclk_high or :tclk_low or :tclk_all. Default :tclk_high.
117
+ * **tdo_store_cycle** - When using multiple cycles for TCK, which cycle of TCK to store for TDO if store requested (0 to number of tclk_multiple-1). Default 0
118
+
119
+ Here is an example integration:
120
+
121
+ ~~~ruby
122
+ class Pioneer
123
+
124
+ include OrigenJTAG
125
+ include Origen::Pins
126
+
127
+ # TCK covers 4 tester cycles, 2 high then 2 low for each effective TCK pulse
128
+ # Strobe TDO only when TCK high. Only store TDO on last cycle (3)
129
+ JTAG_CONFIG = {
130
+ :tclk_format => :rl,
131
+ :tclk_multiple => 4,
132
+ :tdo_strobe => :tclk_high,
133
+ :tdo_store_cycle => 3,
134
+ }
135
+
136
+ def initialize
137
+ add_pin :tclk
138
+ add_pin :tdi
139
+ add_pin :tdo
140
+ add_pin :tms
141
+ end
142
+
143
+ end
144
+
145
+ Pioneer.new.jtag # => An instance of OrigenJTAG::Driver
146
+ ~~~
147
+
148
+ #### APIs
149
+
150
+ Two APIs are provided, the primary one provides canned methods to read and
151
+ write to the IR and DR registers.
152
+
153
+ These accept either an absolute data value or an Origen register/bit collection.
154
+
155
+ ~~~ruby
156
+ jtag.write_dr 0x1234, :size => 16
157
+
158
+ # The size option is not required when a register is supplied
159
+ jtag.write_dr $dut.reg(:clkdiv)
160
+
161
+ # Although it can still be added if the register is not the full data width
162
+ jtag.write_dr $dut.reg(:clkdiv), :size => 32
163
+
164
+ # A rich read method is available which supports bit-level read, store and overlay operations
165
+ $dut.reg(:clkdiv).bits(:div).read(0x55)
166
+ jtag.read $dut.reg(:clkdiv)
167
+
168
+ # In cases where both shift in (TDI) and shift out data (TDO) are critical, (e.g. compare shift
169
+ # out data on a write, or shfit in specific data on a read) the shift_in_data and
170
+ # shift_out_data options can be specified. By default, TDO will be dont care on writes
171
+ # and TDI will be 0 on reads.
172
+ jtag.write_dr $dut.reg(:clkdiv), :shift_out_data => 0x4321
173
+ jtag.read_dr $udt.reg(:clkdiv), :shift_in_data => 0x5678
174
+
175
+ # Similar methods exist for the instruction register
176
+ jtag.write_ir 0x1F, :size => 5
177
+ jtag.read_ir 0x1F, :size => 5
178
+ ~~~
179
+
180
+ A secondary API provides low level control of the TAP Controller state machine.
181
+
182
+ ~~~ruby
183
+ jtag.pause_dr do
184
+ jtag.shift_dr do
185
+ # The shift method accepts the same arguments as the canned read/write methods
186
+ jtag.shift 0x55, :size => 32
187
+ end
188
+ end
189
+ ~~~
190
+
191
+ See the [<code>OrigenJTAG::Driver</code>](<%= path "api/OrigenJTAG/Driver.html" %>) and
192
+ [<code>OrigenJTAG::TAPController</code>](<%= path "api/OrigenJTAG/TAPController.html" %>)
193
+ APIs for more details about the available driver methods.
194
+
195
+ Any model/controller within a target runtime environment can listen out for JTAG state
196
+ changes by implementing the following callback handler:
197
+
198
+ ~~~ruby
199
+ def on_jtag_state_change(new_state)
200
+ if new_state == :update_dr
201
+ # Do something every time we enter this state
202
+ end
203
+ end
204
+ ~~~
205
+
206
+
207
+ ### How To Setup a Development Environment
208
+
209
+ [Clone the repository from Github](https://github.com/Origen-SDK/origen_jtag).
210
+
211
+ An instance of the OrigenJTAG driver is hooked up to a dummy DUT
212
+ object for use in the console:
213
+
214
+ ~~~
215
+ origen i
216
+
217
+ > $dut.jtag
218
+ => #<OrigenJTAG::Driver:0x0000001ee48e78>
219
+ ~~~
220
+
221
+ Follow the instructions here if you want to make a 3rd party app
222
+ workspace use your development copy of the OrigenJTAG plugin:
223
+ [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
224
+
225
+ This plugin also contains a test suite, makes sure this passes before committing
226
+ any changes!
227
+
228
+ ~~~
229
+ origen examples
230
+ ~~~
231
+
232
+ <%= disqus_comments %>
233
+
234
+ % end