origen 0.6.5 → 0.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfb17fbaff27198d30ddd8202744f4956bd7cb56
4
- data.tar.gz: 3d2a5b349dd72b01513beab277e1f2aba2f968ea
3
+ metadata.gz: eb7e3006eff54d7d70809e8d54b0b976d1ecb01e
4
+ data.tar.gz: 1932c4799723ef86e1c7564863b310b0a6c271cf
5
5
  SHA512:
6
- metadata.gz: ed4777c6f9c07bfea3dbd590c368ad7973ddc3d1be75c98137762efa514ad238b1178dd81931ef5ec1321cf20fd95feaf2b4fac94ed29f0aec0b7b7f91ce18be
7
- data.tar.gz: d0cb6d346bc8f631cef41e6fa25c81c507a76ed7e0a53ba3d1dd01bbd37a1bace6ea8795f67812613b3b4e393b37a25f009fcd4a457bea7eb1c0e7563a79de01
6
+ metadata.gz: 76e2aaec740bca336ff8de376f0354abdfbbb5706391a5726af8355997fb63a870a84649e75782667d545791f246c032d446e781897ed8ec743182b42bb5bbac
7
+ data.tar.gz: dc7e62542c9d488e5b5629f3dd15bfacd51e0a8390c887ae653a61f14a33a3ea5615c4d9fddce5839dad7e59c3de6f39eda9cf046060e1bae1dbcd50b1bab6d5
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 6
4
- BUGFIX = 5
4
+ BUGFIX = 6
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/origen/pins.rb CHANGED
@@ -176,6 +176,7 @@ module Origen
176
176
  autoload :PinClock, 'origen/pins/pin_clock'
177
177
  autoload :PowerPin, 'origen/pins/power_pin'
178
178
  autoload :GroundPin, 'origen/pins/ground_pin'
179
+ autoload :VirtualPin, 'origen/pins/virtual_pin'
179
180
  autoload :FunctionProxy, 'origen/pins/function_proxy'
180
181
 
181
182
  # @api private
@@ -213,6 +214,7 @@ module Origen
213
214
  id, options = nil, id if id.is_a?(Hash)
214
215
  power_pin = options.delete(:power_pin)
215
216
  ground_pin = options.delete(:ground_pin)
217
+ virtual_pin = options.delete(:virtual_pin)
216
218
  if options[:size] && options[:size] > 1
217
219
  group = PinCollection.new(self, options.merge(placeholder: true))
218
220
  group.id = id if id
@@ -227,6 +229,8 @@ module Origen
227
229
  group[i] = PowerPin.new(i, self, options)
228
230
  elsif ground_pin
229
231
  group[i] = GroundPin.new(i, self, options)
232
+ elsif virtual_pin
233
+ group[i] = VirtualPin.new(i, self, options)
230
234
  else
231
235
  group[i] = Pin.new(i, self, options)
232
236
  end
@@ -247,6 +251,8 @@ module Origen
247
251
  pin = PowerPin.new(id || :temp, self, options)
248
252
  elsif ground_pin
249
253
  pin = GroundPin.new(id || :temp, self, options)
254
+ elsif virtual_pin
255
+ pin = VirtualPin.new(id || :temp, self, options)
250
256
  else
251
257
  pin = Pin.new(id || :temp, self, options)
252
258
  end
@@ -275,6 +281,15 @@ module Origen
275
281
  end
276
282
  alias_method :add_ground_pins, :add_ground_pin
277
283
 
284
+ def add_virtual_pin(id = nil, options = {}, &block)
285
+ id, options = nil, id if id.is_a?(Hash)
286
+ options = {
287
+ virtual_pin: true
288
+ }.merge(options)
289
+ add_pin(id, options, &block)
290
+ end
291
+ alias_method :add_virtual_pins, :add_virtual_pin
292
+
278
293
  # Specify the order that pins will appear in the output pattern, unspecified
279
294
  # pins will appear in an arbitrary order at the end
280
295
  #
@@ -384,6 +399,12 @@ module Origen
384
399
  end
385
400
  alias_method :has_ground_pins?, :has_ground_pin?
386
401
 
402
+ # Equivalent to the has_pin? method but considers virtual pins rather than regular pins
403
+ def has_virtual_pin?(id)
404
+ !!Origen.pin_bank.find(id, virtual_pin: true)
405
+ end
406
+ alias_method :has_virtual_pins?, :has_virtual_pin?
407
+
387
408
  def add_pin_group(id, *pins, &_block)
388
409
  if pins.last.is_a?(Hash)
389
410
  options = pins.pop
@@ -457,6 +478,18 @@ module Origen
457
478
  add_pin_group(id, *pins, options, &block)
458
479
  end
459
480
 
481
+ def add_virtual_pin_group(id, *pins, &block)
482
+ if pins.last.is_a?(Hash)
483
+ options = pins.pop
484
+ else
485
+ options = {}
486
+ end
487
+ options = {
488
+ virtual_pin: true
489
+ }.merge(options)
490
+ add_pin_group(id, *pins, options, &block)
491
+ end
492
+
460
493
  # Similar to the pins method except that this method will bypass the package/mode/configuration
461
494
  # scope.
462
495
  #
@@ -488,6 +521,15 @@ module Origen
488
521
  end
489
522
  end
490
523
 
524
+ # Equivalent to the all_pins method but considers ground pins rather than regular pins
525
+ def all_virtual_pins(id = nil, _options = {}, &_block)
526
+ if id
527
+ pin = Origen.pin_bank.find(id, ignore_context: true, virtual_pin: true)
528
+ else
529
+ Origen.pin_bank.all_virtual_pins
530
+ end
531
+ end
532
+
491
533
  def pin_groups(id = nil, options = {}, &_block)
492
534
  id, options = nil, id if id.is_a?(Hash)
493
535
  if id
@@ -553,6 +595,28 @@ If you meant to define the ground_pin_group then use the add_ground_pin_group me
553
595
  end
554
596
  alias_method :ground_pin_group, :ground_pin_groups
555
597
 
598
+ # Equivalent to the pin_groups method but considers virtual pins rather than regular pins
599
+ def virtual_pin_groups(id = nil, options = {}, &_block)
600
+ id, options = nil, id if id.is_a?(Hash)
601
+ if id
602
+ pin = Origen.pin_bank.find(id, options.merge(virtual_pin: true))
603
+ unless pin
604
+ puts <<-END
605
+ You have tried to reference virtual_pin_group :#{id} within #{self.class} but it does not exist, this could be
606
+ because the pin group has not been defined yet or it is an alias that is not available in the current context.
607
+
608
+ If you meant to define the virtual_pin_group then use the add_virtual_pin_group method instead.
609
+
610
+ END
611
+ fail 'Utility pin group not found'
612
+ end
613
+ pin
614
+ else
615
+ Origen.pin_bank.virtual_pin_groups(options)
616
+ end
617
+ end
618
+ alias_method :virtual_pin_group, :virtual_pin_groups
619
+
556
620
  # Permits access via object.pin(x), returns a hash of all pins if no id
557
621
  # is specified.
558
622
  # ==== Examples
@@ -579,6 +643,8 @@ If you meant to define the pin then use the add_pin method instead.
579
643
  Origen.pin_bank.power_pins
580
644
  elsif options[:ground_pin]
581
645
  Origen.pin_bank.ground_pins
646
+ elsif options[:virtual_pin]
647
+ Origen.pin_bank.virtual_pins
582
648
  else
583
649
  Origen.pin_bank.pins
584
650
  end
@@ -604,6 +670,15 @@ If you meant to define the pin then use the add_pin method instead.
604
670
  pins(id, options, &block)
605
671
  end
606
672
 
673
+ # Equivalent to the pins method but considers virtual pins rather than regular pins
674
+ def virtual_pins(id = nil, options = {}, &block)
675
+ id, options = nil, id if id.is_a?(Hash)
676
+ options = {
677
+ virtual_pin: true
678
+ }.merge(options)
679
+ pins(id, options, &block)
680
+ end
681
+
607
682
  def delete_all_pins
608
683
  Origen.pin_bank.send :empty!
609
684
  end
@@ -23,6 +23,8 @@ module Origen
23
23
  bank = all_power_pins
24
24
  elsif pin.is_a?(GroundPin)
25
25
  bank = all_ground_pins
26
+ elsif pin.is_a?(VirtualPin)
27
+ bank = all_virtual_pins
26
28
  else
27
29
  bank = all_pins
28
30
  end
@@ -73,6 +75,12 @@ module Origen
73
75
  end
74
76
  end
75
77
 
78
+ def virtual_pins(options = {})
79
+ all_virtual_pins.select do |_id, pin|
80
+ pin.enabled?(options)
81
+ end
82
+ end
83
+
76
84
  # Returns a hash containing all pin_groups available in the current context stored by their primary ID
77
85
  def pin_groups(options = {})
78
86
  current_pin_group_store(all_pin_groups, options).select do |_id, group|
@@ -94,6 +102,13 @@ module Origen
94
102
  end
95
103
  end
96
104
 
105
+ # Returns a hash containing all virtual_pin_groups available in the current context stored by their primary ID
106
+ def virtual_pin_groups(options = {})
107
+ current_pin_group_store(all_virtual_pin_groups, options).select do |_id, group|
108
+ group.enabled?(options)
109
+ end
110
+ end
111
+
97
112
  # Returns a hash containing all pins stored by their primary ID
98
113
  def all_pins
99
114
  @all_pins ||= {}
@@ -114,6 +129,11 @@ module Origen
114
129
  @all_ground_pins ||= {}
115
130
  end
116
131
 
132
+ # Returns a hash containing all virtual pins stored by their primary ID
133
+ def all_virtual_pins
134
+ @all_virtual_pins ||= {}
135
+ end
136
+
117
137
  # Returns a hash containing all power pin groups stored by context
118
138
  def all_power_pin_groups
119
139
  @all_power_pin_groups ||= {}
@@ -124,12 +144,19 @@ module Origen
124
144
  @all_ground_pin_groups ||= {}
125
145
  end
126
146
 
147
+ # Returns a hash containing all virtual pin groups stored by context
148
+ def all_virtual_pin_groups
149
+ @all_virtual_pin_groups ||= {}
150
+ end
151
+
127
152
  def find(id, options = {})
128
153
  id = id.to_sym
129
154
  if options[:power_pin]
130
155
  pin = all_power_pins[id] || find_pin_group(id, options)
131
156
  elsif options[:ground_pin]
132
157
  pin = all_ground_pins[id] || find_pin_group(id, options)
158
+ elsif options[:virtual_pin]
159
+ pin = all_virtual_pins[id] || find_pin_group(id, options)
133
160
  else
134
161
  pin = all_pins[id] || find_by_alias(id, options) || find_pin_group(id, options)
135
162
  end
@@ -148,6 +175,8 @@ module Origen
148
175
  base = all_power_pin_groups
149
176
  elsif options[:ground_pin]
150
177
  base = all_ground_pin_groups
178
+ elsif options[:virtual_pin]
179
+ base = all_virtual_pin_groups
151
180
  else
152
181
  base = all_pin_groups
153
182
  end
@@ -180,6 +209,8 @@ module Origen
180
209
  bank = all_power_pins
181
210
  elsif pin.is_a?(GroundPin)
182
211
  bank = all_ground_pins
212
+ elsif pin.is_a?(VirtualPin)
213
+ bank = all_virtual_pins
183
214
  else
184
215
  bank = all_pins
185
216
  end
@@ -209,6 +240,8 @@ module Origen
209
240
  base = all_power_pin_groups
210
241
  elsif group.ground_pins?
211
242
  base = all_ground_pin_groups
243
+ elsif group.virtual_pins?
244
+ base = all_virtual_pin_groups
212
245
  else
213
246
  base = all_pin_groups
214
247
  end
@@ -252,6 +285,8 @@ module Origen
252
285
  base = all_power_pin_groups
253
286
  elsif group.ground_pins?
254
287
  base = all_ground_pin_groups
288
+ elsif group.virtual_pins?
289
+ base = all_virtual_pin_groups
255
290
  else
256
291
  base = all_pin_groups
257
292
  end
@@ -332,9 +367,11 @@ module Origen
332
367
  @all_pins = nil
333
368
  @all_power_pins = nil
334
369
  @all_ground_pins = nil
370
+ @all_virtual_pins = nil
335
371
  @all_pin_groups = nil
336
372
  @all_power_pin_groups = nil
337
373
  @all_ground_pin_groups = nil
374
+ @all_virtual_pin_groups = nil
338
375
  end
339
376
 
340
377
  def known_aliases
@@ -16,6 +16,7 @@ module Origen
16
16
  }.merge(options)
17
17
  @power_pins = options.delete(:power_pin) || options.delete(:power_pins)
18
18
  @ground_pins = options.delete(:ground_pin) || options.delete(:ground_pins)
19
+ @virtual_pins = options.delete(:virtual_pin) || options.delete(:virtual_pins)
19
20
  @endian = options[:endian]
20
21
  @description = options[:description] || options[:desc]
21
22
  @options = options
@@ -81,6 +82,11 @@ module Origen
81
82
  @ground_pins
82
83
  end
83
84
 
85
+ # Returns true if the pin collection contains virtual pins rather than regular pins
86
+ def virtual_pins?
87
+ @virtual_pins
88
+ end
89
+
84
90
  def id
85
91
  @id
86
92
  end
@@ -176,6 +182,8 @@ module Origen
176
182
  pin = owner.power_pins(pin)
177
183
  elsif ground_pins?
178
184
  pin = owner.ground_pins(pin)
185
+ elsif virtual_pins?
186
+ pin = owner.virtual_pins(pin)
179
187
  else
180
188
  pin = owner.pins(pin)
181
189
  end
@@ -0,0 +1,16 @@
1
+ module Origen
2
+ module Pins
3
+ class VirtualPin < Pin
4
+ # Pin Types
5
+ TYPES = [:virtual_bit, :ate_ch]
6
+
7
+ def type=(value)
8
+ if TYPES.include? value
9
+ @type = value
10
+ else
11
+ fail "VirtualPin type '#{value}' must be set to one of the following: #{TYPES.join(', ')}"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/origen/specs.rb CHANGED
@@ -215,6 +215,8 @@ module Origen
215
215
  id: nil,
216
216
  type: nil
217
217
  }.update(options)
218
+ return nil if @_notes.nil?
219
+ return nil if @_notes.empty?
218
220
  # Empty 2-D Hash to be used for notes found based on id and type
219
221
  notes_found = Hash.new do |h, k|
220
222
  # h is the id portion of the hash
@@ -244,6 +246,8 @@ module Origen
244
246
  device: nil
245
247
  }.update(options)
246
248
  return @_spec_features if options[:id].nil? && options[:device].nil?
249
+ return nil if @_spec_features.nil?
250
+ return nil if @_spec_features.empty?
247
251
  features_found = Hash.new do |h, k|
248
252
  h[k] = {}
249
253
  end
@@ -267,12 +271,14 @@ module Origen
267
271
  id: nil,
268
272
  type: nil
269
273
  }.update(options)
274
+ return nil if @_exhibits.nil?
275
+ return nil if @_exhibits.empty?
270
276
  ex_found = Hash.new do |h, k|
271
277
  h[k] = Hash.new do |hh, kk|
272
278
  hh[kk] = {}
273
279
  end
274
280
  end
275
- filter_hash(_exhibits, options[:block]).each do |_block, hash|
281
+ filter_hash(@_exhibits, options[:block]).each do |_block, hash|
276
282
  filter_hash(hash, options[:id]).each do |_id, hash_|
277
283
  filter_hash(hash_, options[:type]).each do |_type, exh|
278
284
  ex_found[_block][_id][_type] = exh
@@ -293,6 +299,8 @@ module Origen
293
299
  sub_type: nil,
294
300
  audience: nil
295
301
  }.update(options)
302
+ return nil if @_doc_resources.nil?
303
+ return nil if @_doc_resources.empty?
296
304
  dr_found = Hash.new do |h, k|
297
305
  h[k] = Hash.new do |hh, kk|
298
306
  hh[kk] = Hash.new do |hhh, kkk|
@@ -300,7 +308,7 @@ module Origen
300
308
  end
301
309
  end
302
310
  end
303
- filter_hash(_doc_resources, options[:mode]).each do |_mode, hash|
311
+ filter_hash(@_doc_resources, options[:mode]).each do |_mode, hash|
304
312
  filter_hash(hash, options[:type]).each do |_type, hash_|
305
313
  filter_hash(hash_, options[:sub_type]).each do |_sub_type, hash__|
306
314
  filter_hash(hash__, options[:audience]).each do |_audience, spec|
@@ -324,6 +332,8 @@ module Origen
324
332
  sub_type: nil,
325
333
  audience: nil
326
334
  }.update(options)
335
+ return nil if @_overrides.nil?
336
+ return nil if @_overrides.empty?
327
337
  overrides_found = Hash.new do |h, k|
328
338
  h[k] = Hash.new do |hh, kk|
329
339
  hh[kk] = Hash.new do |hhh, kkk|
@@ -333,7 +343,7 @@ module Origen
333
343
  end
334
344
  end
335
345
  end
336
- filter_hash(_overrides, options[:block]).each do |_block, hash|
346
+ filter_hash(@_overrides, options[:block]).each do |_block, hash|
337
347
  filter_hash(hash, options[:spec_ref]).each do |_spec_ref, hash_|
338
348
  filter_hash(hash_, options[:mode_ref]).each do |_mode_ref, hash__|
339
349
  filter_hash(hash__, options[:sub_type]).each do |_sub_type, hash___|
@@ -356,10 +366,12 @@ module Origen
356
366
  block: nil,
357
367
  mode: nil
358
368
  }.update(options)
369
+ return nil if @_mode_selects.nil?
370
+ return nil if @_mode_selects.empty?
359
371
  modes_found = Hash.new do|h, k|
360
372
  h[k] = {}
361
373
  end
362
- filter_hash(_mode_selects, options[:block]).each do |block, hash|
374
+ filter_hash(@_mode_selects, options[:block]).each do |block, hash|
363
375
  filter_hash(hash, options[:mode]).each do |mode, sel|
364
376
  modes_found[block][mode] = sel
365
377
  end
@@ -379,7 +391,9 @@ module Origen
379
391
  ps_found = Hash.new do|h, k|
380
392
  h[k] = {}
381
393
  end
382
- filter_hash(_power_supplies, options[:gen]).each do |gen, hash|
394
+ return nil if @_power_supplies.nil?
395
+ return nil if @_power_supplies.empty?
396
+ filter_hash(@_power_supplies, options[:gen]).each do |gen, hash|
383
397
  filter_hash(hash, options[:act]).each do |act, sel|
384
398
  ps_found[gen][act] = sel
385
399
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -551,6 +551,7 @@ files:
551
551
  - lib/origen/pins/pin_collection.rb
552
552
  - lib/origen/pins/pin_common.rb
553
553
  - lib/origen/pins/power_pin.rb
554
+ - lib/origen/pins/virtual_pin.rb
554
555
  - lib/origen/ports.rb
555
556
  - lib/origen/ports/bit_collection.rb
556
557
  - lib/origen/ports/port.rb