origen_jtag 0.21.1 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f63bbad6eac9c0d88a2e7970a16d2746375a25575bbae735b2f2626a457ebf4
4
- data.tar.gz: 8ba113303e5906a9da5c739663600828a57cb74a8953f0d1a967bb655848d6f1
3
+ metadata.gz: 17c3bc0c7a9b380a76c4f69ee0ebf6434d43a5c42456c0fca4c242ad192bb4ce
4
+ data.tar.gz: f828a940f8d87d5fd048aeac363238323df7cadc4b7b9405d6bbcf3601164bc9
5
5
  SHA512:
6
- metadata.gz: 9488fbea2784700dd849ce1eff4c279ff413f7c006dbb358a3cdcd1e7a8955ce42851aea7873c2818eb20821ad3f181f74c556801e6540dec93ec00462f606b2
7
- data.tar.gz: 37709e182313b91c0e4da8464a39e0161e5d89a287ed1eee632ebef60c744f22eb3b875b8a4262b97b15ac50ffb5944d522de2ec5aaa3e83ac5747b89f0fbd3d
6
+ metadata.gz: df5618e789ac6b000b6fa71cf52611df7bb56e5fc4965afeb57fcfc242a456d402c214c48823eccea4f97ccf7cdf036f47e145b871da18cd1fad7e2030cffb76
7
+ data.tar.gz: 6c751a233f7d80c8e2b607b2024fdfb556661d3e34a85dfa92a5728fac1bbfc9581f07dfc3aac856e2015cdf87e458785d4aa4fd934400cc4cb3f05699a60f8b
@@ -1,8 +1,7 @@
1
1
  module OrigenJTAG
2
2
  MAJOR = 0
3
- MINOR = 21
4
- BUGFIX = 1
3
+ MINOR = 22
4
+ BUGFIX = 0
5
5
  DEV = nil
6
-
7
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
7
  end
@@ -35,7 +35,8 @@ module OrigenJTAG
35
35
  alias_method :tclk_format, :tck_format
36
36
  alias_method :tclk_format=, :tck_format=
37
37
 
38
- attr_reader :tdo_strobe
38
+ attr_accessor :tdo_strobe
39
+ attr_accessor :tdo_store_cycle
39
40
 
40
41
  # Set true to print out debug comments about all state transitions
41
42
  attr_accessor :verbose
@@ -57,7 +58,7 @@ module OrigenJTAG
57
58
  end
58
59
 
59
60
  @cycle_callback = options[:cycle_callback]
60
- validate_pins(options) unless @cycle_callback
61
+ @given_options = options.dup # Save these for later use in the pins method
61
62
 
62
63
  # Fallback defaults
63
64
  options = {
@@ -211,7 +212,7 @@ module OrigenJTAG
211
212
  overlay_options = {}
212
213
  if tester.respond_to?(:source_memory) && !cycle_callback?
213
214
  if ovl_reg[i] && ovl_reg[i].has_overlay? && !Origen.mode.simulation?
214
- overlay_options[:pins] = @pins[:tdi]
215
+ overlay_options[:pins] = pins[:tdi]
215
216
  if global_ovl
216
217
  overlay_options[:overlay_str] = global_ovl
217
218
  else
@@ -280,7 +281,7 @@ module OrigenJTAG
280
281
  overlay_options[:change_data] = false # data change only on first cycle if overlay
281
282
  end
282
283
  end
283
- @pins[:tdo].dont_care unless cycle_callback?
284
+ pins[:tdo].dont_care unless cycle_callback?
284
285
  else
285
286
  @deferred_compare = true
286
287
  @deferred_store = true if store_tdo_this_tck
@@ -323,7 +324,7 @@ module OrigenJTAG
323
324
 
324
325
  # If TDO is already suspended (by an application) then don't do the
325
326
  # suspends below since the resume will clear the application's suspend
326
- tdo_already_suspended = !cycle_callback? && @pins[:tdo].suspended? && !@tdo_suspended_by_driver
327
+ tdo_already_suspended = !cycle_callback? && pins[:tdo].suspended? && !@tdo_suspended_by_driver
327
328
 
328
329
  @tck_multiple.times do |i|
329
330
  # 50% duty cycle if @tck_multiple is even, otherwise slightly off
@@ -332,26 +333,26 @@ module OrigenJTAG
332
333
 
333
334
  if i < (@tck_multiple + 1) / 2
334
335
  # first half of cycle
335
- @pins[:tck].drive(@tck_vals ? @tck_vals[:on] : tck_val)
336
+ pins[:tck].drive(@tck_vals ? @tck_vals[:on] : tck_val)
336
337
  unless tdo_already_suspended
337
338
  if mask_tdo_half0
338
339
  @tdo_suspended_by_driver = true
339
- @pins[:tdo].suspend
340
+ pins[:tdo].suspend
340
341
  else
341
342
  @tdo_suspended_by_driver = false
342
- @pins[:tdo].resume
343
+ pins[:tdo].resume
343
344
  end
344
345
  end
345
346
  else
346
347
  # second half of cycle
347
- @pins[:tck].drive(@tck_vals ? @tck_vals[:off] : (1 - tck_val))
348
+ pins[:tck].drive(@tck_vals ? @tck_vals[:off] : (1 - tck_val))
348
349
  unless tdo_already_suspended
349
350
  if mask_tdo_half1
350
351
  @tdo_suspended_by_driver = true
351
- @pins[:tdo].suspend
352
+ pins[:tdo].suspend
352
353
  else
353
354
  @tdo_suspended_by_driver = false
354
- @pins[:tdo].resume
355
+ pins[:tdo].resume
355
356
  end
356
357
  end
357
358
  end
@@ -359,7 +360,7 @@ module OrigenJTAG
359
360
  end
360
361
  if @tdo_suspended_by_driver
361
362
  @tdo_suspended_by_driver = false
362
- @pins[:tdo].resume
363
+ pins[:tdo].resume
363
364
  end
364
365
  end
365
366
  end
@@ -548,10 +549,10 @@ module OrigenJTAG
548
549
  if cycle_callback?
549
550
  @owner.send(@cycle_callback, @actions, options)
550
551
  else
551
- apply_action(@pins[:tms], @actions[:tms])
552
- apply_action(@pins[:tdi], @actions[:tdi])
553
- apply_action(@pins[:tdo], @actions[:tdo])
554
- tester.store_next_cycle(@pins[:tdo]) if @actions[:store]
552
+ apply_action(pins[:tms], @actions[:tms])
553
+ apply_action(pins[:tdi], @actions[:tdi])
554
+ apply_action(pins[:tdo], @actions[:tdo])
555
+ tester.store_next_cycle(pins[:tdo]) if @actions[:store]
555
556
  tester.cycle(options)
556
557
  end
557
558
  clear_actions
@@ -665,30 +666,42 @@ module OrigenJTAG
665
666
  tdo
666
667
  end
667
668
 
668
- # Validates that the parent object (the owner) has defined the necessary
669
- # pins to implement the JTAG
670
- def validate_pins(options)
671
- @pins = {}
672
- @pins[:tck] = options[:tck_pin]
673
- @pins[:tdi] = options[:tdi_pin]
674
- @pins[:tdo] = options[:tdo_pin]
675
- @pins[:tms] = options[:tms_pin]
676
-
677
- # Support legacy implementation where tck was incorrectly called tclk, in case of both being
678
- # defined then :tck has priority
679
- @pins[:tck] ||= @owner.pin(:tck) if @owner.has_pin?(:tck)
680
- @pins[:tck] ||= @owner.pin(:tclk)
681
- @pins[:tdi] ||= @owner.pin(:tdi)
682
- @pins[:tdo] ||= @owner.pin(:tdo)
683
- @pins[:tms] ||= @owner.pin(:tms)
669
+ def to_pin(pin_or_id)
670
+ if pin_or_id
671
+ if pin_or_id.is_a?(Symbol) || pin_or_id.is_a?(String)
672
+ @owner.pin(pin_or_id)
673
+ else
674
+ pin_or_id
675
+ end
676
+ end
677
+ end
678
+
679
+ def pins
680
+ @pins ||= begin
681
+ pins = {}
682
+ pins[:tck] = to_pin(@given_options[:tck_pin])
683
+ pins[:tdi] = to_pin(@given_options[:tdi_pin])
684
+ pins[:tdo] = to_pin(@given_options[:tdo_pin])
685
+ pins[:tms] = to_pin(@given_options[:tms_pin])
686
+
687
+ # Support legacy implementation where tck was incorrectly called tclk, in case of both being
688
+ # defined then :tck has priority
689
+ pins[:tck] ||= @owner.pin(:tck) if @owner.has_pin?(:tck)
690
+ pins[:tck] ||= @owner.pin(:tclk)
691
+ pins[:tdi] ||= @owner.pin(:tdi)
692
+ pins[:tdo] ||= @owner.pin(:tdo)
693
+ pins[:tms] ||= @owner.pin(:tms)
694
+
695
+ pins
696
+ end
684
697
  rescue
685
698
  puts 'Missing JTAG pins!'
686
699
  puts "In order to use the JTAG driver your #{owner.class} class must either define"
687
700
  puts 'the following pins (an alias is fine):'
688
701
  puts REQUIRED_PINS
689
702
  puts '-- or --'
690
- puts 'Pass the pins in the initialization options:'
691
- puts "sub_block :jtag, class_name: 'OrigenJTAG::Driver', tck_pin: dut.pin(:tck), tdi_pin: dut.pin(:tdi), tdo_pin: dut.pin(:tdo), tms_pin: dut.pin(:tms)"
703
+ puts 'Pass the pin IDs to be used instead in the initialization options:'
704
+ puts "sub_block :jtag, class_name: 'OrigenJTAG::Driver', tck_pin: :clk, tdi_pin: :gpio1, tdo_pin: :gpio2, tms_pin: :gpio3"
692
705
  raise 'JTAG driver error!'
693
706
  end
694
707
  end
@@ -30,7 +30,8 @@ module OrigenJTAGDev
30
30
  instantiate_pins(options)
31
31
  sub_block :jtag, { class_name: 'OrigenJTAG::Driver' }.merge(@jtag_config)
32
32
  if options[:extra_port]
33
- sub_block :jtag2, { class_name: 'OrigenJTAG::Driver', tck_pin: pin(:tck_2), tdi_pin: pin(:tdi_2), tdo_pin: pin(:tdo_2), tms_pin: pin(:tms_2) }.merge(@jtag_config)
33
+ # Test supplying both pin IDs (recommended) and pin objects (legacy)
34
+ sub_block :jtag2, { class_name: 'OrigenJTAG::Driver', tck_pin: :tck_2, tdi_pin: :tdi_2, tdo_pin: pin(:tdo_2), tms_pin: pin(:tms_2) }.merge(@jtag_config)
34
35
  end
35
36
  end
36
37
 
@@ -89,10 +89,10 @@ class MyApp::MyDUT
89
89
  tck_multiple: 2,
90
90
  tdo_strobe: :tck_high,
91
91
  tdo_store_cycle: 1,
92
- tck_pin: pin(:tck2),
93
- tdi_pin: pin(:tdi2),
94
- tdo_pin: pin(:tdo2),
95
- tms_pin: pin(:tms2)
92
+ tck_pin: :tck2,
93
+ tdi_pin: :tdi2,
94
+ tdo_pin: :tdo2,
95
+ tms_pin: :tms2
96
96
  end
97
97
  end
98
98
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_jtag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.1
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen