origen 0.60.7 → 0.60.8

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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/config/rubocop/easy.yml +4875 -308
  3. data/config/rubocop/strict.yml +4875 -308
  4. data/config/version.rb +1 -1
  5. data/lib/origen/application/configuration.rb +6 -3
  6. data/lib/origen/application/deployer.rb +4 -4
  7. data/lib/origen/application/environment.rb +4 -2
  8. data/lib/origen/application/lsf.rb +23 -4
  9. data/lib/origen/application/lsf_manager.rb +48 -52
  10. data/lib/origen/application/plugins.rb +7 -7
  11. data/lib/origen/application/release.rb +5 -3
  12. data/lib/origen/application/runner.rb +5 -6
  13. data/lib/origen/application/statistics.rb +1 -0
  14. data/lib/origen/application/target.rb +9 -6
  15. data/lib/origen/application/version_tracker.rb +4 -5
  16. data/lib/origen/application/workspace_manager.rb +5 -2
  17. data/lib/origen/application.rb +9 -9
  18. data/lib/origen/boot/api.rb +3 -0
  19. data/lib/origen/boot/app.rb +28 -30
  20. data/lib/origen/boot.rb +1 -0
  21. data/lib/origen/bugs.rb +2 -2
  22. data/lib/origen/chip_mode.rb +7 -4
  23. data/lib/origen/chip_package.rb +50 -53
  24. data/lib/origen/chips/chip.rb +8 -4
  25. data/lib/origen/chips.rb +16 -12
  26. data/lib/origen/client.rb +1 -0
  27. data/lib/origen/clocks/clock.rb +8 -7
  28. data/lib/origen/clocks/clocks_collection.rb +2 -1
  29. data/lib/origen/code_generators/actions.rb +1 -1
  30. data/lib/origen/code_generators/base.rb +1 -1
  31. data/lib/origen/code_generators.rb +3 -0
  32. data/lib/origen/commands/archive.rb +1 -1
  33. data/lib/origen/commands/compile.rb +2 -2
  34. data/lib/origen/commands/fetch.rb +1 -1
  35. data/lib/origen/commands/generate.rb +3 -3
  36. data/lib/origen/commands/interactive.rb +6 -7
  37. data/lib/origen/commands/lint.rb +1 -1
  38. data/lib/origen/commands/lsf.rb +2 -2
  39. data/lib/origen/commands/new.rb +1 -1
  40. data/lib/origen/commands/plugin.rb +2 -2
  41. data/lib/origen/commands/program.rb +3 -3
  42. data/lib/origen/commands/rc.rb +4 -4
  43. data/lib/origen/commands/save.rb +1 -1
  44. data/lib/origen/commands/time.rb +4 -6
  45. data/lib/origen/commands/web.rb +5 -2
  46. data/lib/origen/commands.rb +1 -1
  47. data/lib/origen/componentable.rb +1 -0
  48. data/lib/origen/controller.rb +11 -13
  49. data/lib/origen/core_ext/array.rb +2 -1
  50. data/lib/origen/core_ext/enumerable.rb +4 -2
  51. data/lib/origen/core_ext/hash.rb +5 -6
  52. data/lib/origen/core_ext/integer.rb +2 -4
  53. data/lib/origen/core_ext/object.rb +2 -2
  54. data/lib/origen/core_ext/option_parser/optparse.rb +1 -1
  55. data/lib/origen/core_ext/string.rb +8 -8
  56. data/lib/origen/database/key_value_store.rb +12 -14
  57. data/lib/origen/database/key_value_stores.rb +1 -0
  58. data/lib/origen/errata/hw_erratum.rb +1 -1
  59. data/lib/origen/errata.rb +7 -8
  60. data/lib/origen/features/feature.rb +1 -0
  61. data/lib/origen/features.rb +4 -6
  62. data/lib/origen/file_handler.rb +8 -7
  63. data/lib/origen/fuses/fuse_field.rb +2 -2
  64. data/lib/origen/generator/compiler.rb +2 -4
  65. data/lib/origen/generator/job.rb +3 -2
  66. data/lib/origen/generator/pattern.rb +3 -3
  67. data/lib/origen/generator/pattern_finder.rb +6 -5
  68. data/lib/origen/generator/pattern_sequence.rb +3 -0
  69. data/lib/origen/generator/renderer.rb +3 -4
  70. data/lib/origen/generator/resources.rb +1 -1
  71. data/lib/origen/generator/stage.rb +3 -0
  72. data/lib/origen/limits/limit.rb +14 -11
  73. data/lib/origen/limits/limit_set.rb +2 -1
  74. data/lib/origen/loader.rb +4 -2
  75. data/lib/origen/log.rb +3 -2
  76. data/lib/origen/memory.rb +1 -0
  77. data/lib/origen/model.rb +10 -4
  78. data/lib/origen/models.rb +2 -2
  79. data/lib/origen/netlist/list.rb +1 -0
  80. data/lib/origen/netlist.rb +5 -7
  81. data/lib/origen/org_file/interceptor.rb +1 -1
  82. data/lib/origen/org_file.rb +4 -1
  83. data/lib/origen/parameters/set.rb +1 -0
  84. data/lib/origen/parameters.rb +3 -1
  85. data/lib/origen/pins/pin.rb +18 -12
  86. data/lib/origen/pins/pin_bank.rb +3 -0
  87. data/lib/origen/pins/pin_clock.rb +3 -2
  88. data/lib/origen/pins/pin_collection.rb +3 -0
  89. data/lib/origen/pins/timing/wave.rb +5 -0
  90. data/lib/origen/pins.rb +7 -1
  91. data/lib/origen/ports.rb +1 -1
  92. data/lib/origen/power_domains/power_domain.rb +5 -2
  93. data/lib/origen/power_domains/power_domains_collection.rb +2 -1
  94. data/lib/origen/registers/bit.rb +21 -17
  95. data/lib/origen/registers/bit_collection.rb +15 -6
  96. data/lib/origen/registers/reg.rb +34 -28
  97. data/lib/origen/registers.rb +25 -24
  98. data/lib/origen/remote_manager.rb +3 -2
  99. data/lib/origen/revision_control/base.rb +1 -4
  100. data/lib/origen/revision_control/design_sync.rb +10 -10
  101. data/lib/origen/revision_control/git.rb +4 -2
  102. data/lib/origen/site_config/config.rb +3 -1
  103. data/lib/origen/site_config.rb +3 -0
  104. data/lib/origen/specs/checkers.rb +12 -8
  105. data/lib/origen/specs/doc_resource.rb +3 -4
  106. data/lib/origen/specs/spec.rb +5 -1
  107. data/lib/origen/specs/version_history.rb +1 -1
  108. data/lib/origen/specs.rb +52 -37
  109. data/lib/origen/sub_blocks.rb +20 -14
  110. data/lib/origen/top_level.rb +2 -1
  111. data/lib/origen/users/user.rb +4 -5
  112. data/lib/origen/utility/csv_data.rb +6 -4
  113. data/lib/origen/utility/diff.rb +9 -9
  114. data/lib/origen/utility/file_diff.rb +4 -0
  115. data/lib/origen/utility/input_capture.rb +6 -6
  116. data/lib/origen/utility/mailer.rb +8 -11
  117. data/lib/origen/utility/time_and_date.rb +1 -2
  118. data/lib/origen/utility.rb +2 -2
  119. data/lib/origen/value.rb +2 -1
  120. data/lib/origen/version_string.rb +33 -41
  121. data/lib/origen.rb +62 -64
  122. data/origen_app_generators/origen_app_generators.gemspec +1 -1
  123. metadata +9 -27
  124. data/config/rubocop/easy_disabled.yml +0 -275
  125. data/config/rubocop/easy_enabled.yml +0 -727
  126. data/config/rubocop/strict_disabled.yml +0 -251
  127. data/config/rubocop/strict_enabled.yml +0 -751
data/lib/origen/specs.rb CHANGED
@@ -14,7 +14,7 @@ module Origen
14
14
  require 'origen/specs/checkers'
15
15
  include Checkers
16
16
 
17
- attr_accessor :_specs, :_notes, :_exhibits, :_doc_resources, :_overrides, :_power_supplies, :_mode_selects, :_version_history, :_creation_info, :_spec_features, :_documentation
17
+ attr_writer :_specs, :_notes, :_exhibits, :_doc_resources, :_overrides, :_power_supplies, :_mode_selects, :_version_history, :_creation_info, :_spec_features, :_documentation
18
18
 
19
19
  # Detailed description for the ip block
20
20
  attr_accessor :description
@@ -53,15 +53,15 @@ module Origen
53
53
  }.update(options || {})
54
54
  _specs
55
55
  if s.nil?
56
- return show_specs(options)
56
+ show_specs(options)
57
57
  elsif s.is_a? Hash
58
58
  # no spec was passed but some option was passed
59
59
  options.update(s)
60
- return show_specs(options)
60
+ show_specs(options)
61
61
  else
62
62
  # a spec was passed
63
63
  options[:spec] = s
64
- return show_specs(options)
64
+ show_specs(options)
65
65
  end
66
66
  end
67
67
 
@@ -69,14 +69,16 @@ module Origen
69
69
  def spec(name, type = nil, mode = nil, &block)
70
70
  return specs(name, type) unless block_given?
71
71
  fail 'A type argument is required when defining a spec!' unless type
72
+
72
73
  _specs
73
74
  name = name_audit(name)
74
75
  fail 'Specification names must be of SPEC_TYPES Symbol or String and cannot start with a number' if name.nil?
75
76
  fail "Spec type must be one of #{SPEC_TYPES.join(', ')}" unless SPEC_TYPES.include? type
77
+
76
78
  type = type
77
79
  mode = get_mode if mode.nil?
78
80
  owner_name = ''
79
- if self.respond_to?(:name) && send(:name)
81
+ if respond_to?(:name) && send(:name)
80
82
  owner_name = self.name.to_s.downcase.to_sym
81
83
  elsif self == Origen.top_level
82
84
  owner_name = self.class.to_s.split('::').last.downcase.to_sym
@@ -91,6 +93,7 @@ module Origen
91
93
  # This is a fatal error.
92
94
  fail "Spec already exists for name: #{name}, type: #{type}, mode: #{mode} for object #{self}"
93
95
  end
96
+
94
97
  @_specs[name][mode][type][spec_placeholder.sub_type] = spec_placeholder
95
98
  end
96
99
 
@@ -107,9 +110,9 @@ module Origen
107
110
  creating_spec: false
108
111
  }.update(options)
109
112
  if @_specs.nil? || @_specs == {}
110
- return false
113
+ false
111
114
  else
112
- return !!show_specs(options)
115
+ !!show_specs(options)
113
116
  end
114
117
  end
115
118
 
@@ -228,6 +231,7 @@ module Origen
228
231
  }.update(options)
229
232
  return nil if @_notes.nil?
230
233
  return nil if @_notes.empty?
234
+
231
235
  # Empty 2-D Hash to be used for notes found based on id and type
232
236
  notes_found = Hash.new do |h, k|
233
237
  # h is the id portion of the hash
@@ -243,11 +247,11 @@ module Origen
243
247
  end
244
248
  end
245
249
  if notes_found.empty?
246
- return nil
250
+ nil
247
251
  elsif notes_found.size == 1
248
252
  notes_found.values.first.values.first
249
253
  else
250
- return notes_found
254
+ notes_found
251
255
  end
252
256
  end
253
257
 
@@ -259,6 +263,7 @@ module Origen
259
263
  return @_spec_features if options[:id].nil? && options[:device].nil?
260
264
  return nil if @_spec_features.nil?
261
265
  return nil if @_spec_features.empty?
266
+
262
267
  features_found = Hash.new do |h, k|
263
268
  h[k] = {}
264
269
  end
@@ -268,11 +273,11 @@ module Origen
268
273
  end
269
274
  end
270
275
  if features_found.empty?
271
- return nil
276
+ nil
272
277
  elsif features_found.size == 1
273
278
  features_found.values.first.values.first
274
279
  else
275
- return features_found
280
+ features_found
276
281
  end
277
282
  end
278
283
 
@@ -284,6 +289,7 @@ module Origen
284
289
  }.update(options)
285
290
  return nil if @_exhibits.nil?
286
291
  return nil if @_exhibits.empty?
292
+
287
293
  ex_found = Hash.new do |h, k|
288
294
  h[k] = Hash.new do |hh, kk|
289
295
  hh[kk] = {}
@@ -297,9 +303,9 @@ module Origen
297
303
  end
298
304
  end
299
305
  if ex_found.empty?
300
- return nil
306
+ nil
301
307
  else
302
- return ex_found
308
+ ex_found
303
309
  end
304
310
  end
305
311
 
@@ -312,6 +318,7 @@ module Origen
312
318
  }.update(options)
313
319
  return nil if @_doc_resources.nil?
314
320
  return nil if @_doc_resources.empty?
321
+
315
322
  dr_found = Hash.new do |h, k|
316
323
  h[k] = Hash.new do |hh, kk|
317
324
  hh[kk] = Hash.new do |hhh, kkk|
@@ -329,9 +336,9 @@ module Origen
329
336
  end
330
337
  end
331
338
  if dr_found.empty?
332
- return nil
339
+ nil
333
340
  else
334
- return dr_found
341
+ dr_found
335
342
  end
336
343
  end
337
344
 
@@ -347,6 +354,7 @@ module Origen
347
354
  }.update(options)
348
355
  return nil if @_documentation.nil?
349
356
  return nil if @_documentation.empty?
357
+
350
358
  doc_found = Hash.new do |h, k|
351
359
  h[k] = Hash.new do |hh, kk|
352
360
  hh[kk] = Hash.new do |hhh, kkk|
@@ -376,9 +384,9 @@ module Origen
376
384
  end
377
385
  end
378
386
  if doc_found.empty?
379
- return nil
387
+ nil
380
388
  else
381
- return doc_found
389
+ doc_found
382
390
  end
383
391
  end
384
392
 
@@ -392,6 +400,7 @@ module Origen
392
400
  }.update(options)
393
401
  return nil if @_overrides.nil?
394
402
  return nil if @_overrides.empty?
403
+
395
404
  overrides_found = Hash.new do |h, k|
396
405
  h[k] = Hash.new do |hh, kk|
397
406
  hh[kk] = Hash.new do |hhh, kkk|
@@ -413,9 +422,9 @@ module Origen
413
422
  end
414
423
  end
415
424
  if overrides_found.empty?
416
- return nil
425
+ nil
417
426
  else
418
- return overrides_found
427
+ overrides_found
419
428
  end
420
429
  end
421
430
 
@@ -426,7 +435,8 @@ module Origen
426
435
  }.update(options)
427
436
  return nil if @_mode_selects.nil?
428
437
  return nil if @_mode_selects.empty?
429
- modes_found = Hash.new do|h, k|
438
+
439
+ modes_found = Hash.new do |h, k|
430
440
  h[k] = {}
431
441
  end
432
442
  filter_hash(@_mode_selects, options[:block]).each do |block, hash|
@@ -435,9 +445,9 @@ module Origen
435
445
  end
436
446
  end
437
447
  if modes_found.empty?
438
- return nil
448
+ nil
439
449
  else
440
- return modes_found
450
+ modes_found
441
451
  end
442
452
  end
443
453
 
@@ -446,20 +456,21 @@ module Origen
446
456
  gen: nil,
447
457
  act: nil
448
458
  }.update(options)
449
- ps_found = Hash.new do|h, k|
459
+ ps_found = Hash.new do |h, k|
450
460
  h[k] = {}
451
461
  end
452
462
  return nil if @_power_supplies.nil?
453
463
  return nil if @_power_supplies.empty?
464
+
454
465
  filter_hash(@_power_supplies, options[:gen]).each do |gen, hash|
455
466
  filter_hash(hash, options[:act]).each do |act, sel|
456
467
  ps_found[gen][act] = sel
457
468
  end
458
469
  end
459
470
  if ps_found.empty?
460
- return nil
471
+ nil
461
472
  else
462
- return ps_found
473
+ ps_found
463
474
  end
464
475
  end
465
476
 
@@ -476,6 +487,7 @@ module Origen
476
487
  end
477
488
  return nil if @_version_history.nil?
478
489
  return nil if @_version_history.empty?
490
+
479
491
  filter_hash(@_version_history, options[:date]).each do |date, hash|
480
492
  filter_hash(hash, options[:author]).each do |author, hash1|
481
493
  filter_hash(hash1, options[:label]).each do |label, ver|
@@ -484,9 +496,9 @@ module Origen
484
496
  end
485
497
  end
486
498
  if vh_found.empty?
487
- return nil
499
+ nil
488
500
  else
489
- return vh_found
501
+ vh_found
490
502
  end
491
503
  end
492
504
 
@@ -644,6 +656,7 @@ module Origen
644
656
  # Return a hash based on the filter provided
645
657
  def filter_hash(hash, filter, debug = false)
646
658
  fail 'Hash argument is not a Hash!' unless hash.is_a? Hash
659
+
647
660
  filtered_hash = {}
648
661
  select_logic = case filter
649
662
  when String then 'k.nil? ? false : k[Regexp.new(filter)] && k.length == filter.length'
@@ -653,8 +666,7 @@ module Origen
653
666
  'k == filter'
654
667
  when NilClass then true # Return all specs if a filter is set to nil (i.e. user doesn't care about this filter)
655
668
  else true
656
- end
657
- # rubocop:disable UnusedBlockArgument
669
+ end
658
670
  filtered_hash = hash.select do |k, v|
659
671
  # binding.pry if filter == 'SubSection A'
660
672
  [TrueClass, FalseClass].include?(select_logic.class) ? select_logic : eval(select_logic)
@@ -711,14 +723,14 @@ module Origen
711
723
  end
712
724
  end
713
725
  Origen.log.debug "Returning no specs for options #{options}"
714
- return nil
726
+ nil
715
727
  elsif specs_to_be_shown.size == 1
716
728
  print_to_console(specs_to_be_shown) if options[:verbose] == true
717
729
  Origen.log.debug "returning one spec #{specs_to_be_shown.first.name}"
718
- return specs_to_be_shown.first
730
+ specs_to_be_shown.first
719
731
  else
720
732
  Origen.log.debug "returning an array of specs during initial search: #{specs_to_be_shown}"
721
- return specs_to_be_shown
733
+ specs_to_be_shown
722
734
  end
723
735
  end
724
736
 
@@ -727,18 +739,18 @@ module Origen
727
739
  whitespace_padding = 3
728
740
  table = []
729
741
  attrs_to_be_shown = {
730
- name: SpecTableAttr.new('Name', true, 'Name'.length + whitespace_padding),
731
- symbol: SpecTableAttr.new('Symbol', false, 'Symbol'.length + whitespace_padding),
742
+ name: SpecTableAttr.new('Name', true, 'Name'.length + whitespace_padding),
743
+ symbol: SpecTableAttr.new('Symbol', false, 'Symbol'.length + whitespace_padding),
732
744
  mode: SpecTableAttr.new('Mode', true, 'Mode'.length + whitespace_padding),
733
745
  type: SpecTableAttr.new('Type', true, 'Type'.length + whitespace_padding),
734
- sub_type: SpecTableAttr.new('Sub-Type', false, 'Sub-Type'.length + whitespace_padding),
746
+ sub_type: SpecTableAttr.new('Sub-Type', false, 'Sub-Type'.length + whitespace_padding),
735
747
  # spec SpecTableAttribute :description is called parameter in the spec table output to match historical docs
736
748
  description: SpecTableAttr.new('Parameter', false, 'Parameter'.length + whitespace_padding),
737
749
  min: SpecTableAttr.new('Min', false, 'Min'.length + whitespace_padding),
738
750
  typ: SpecTableAttr.new('Typ', false, 'Typ'.length + whitespace_padding),
739
751
  max: SpecTableAttr.new('Max', false, 'Max'.length + whitespace_padding),
740
- unit: SpecTableAttr.new('Unit', false, 'Unit'.length + whitespace_padding),
741
- audience: SpecTableAttr.new('Audience', false, 'Audience'.length + whitespace_padding)
752
+ unit: SpecTableAttr.new('Unit', false, 'Unit'.length + whitespace_padding),
753
+ audience: SpecTableAttr.new('Audience', false, 'Audience'.length + whitespace_padding)
742
754
  # notes: SpecTableAttr.new('Notes', false, 'Notes'.length + whitespace_padding)
743
755
  }
744
756
  # Calculate the padding needed in the spec table for the longest attr of all specs
@@ -747,6 +759,7 @@ module Origen
747
759
  unless spec.send(attr_name).nil?
748
760
  if spec.send(attr_name).class == Origen::Specs::Spec::Limit
749
761
  next if spec.send(attr_name).value.nil?
762
+
750
763
  current_padding = spec.send(attr_name).value.to_s.length + whitespace_padding
751
764
  else
752
765
  current_padding = spec.send(attr_name).to_s.length + whitespace_padding
@@ -760,6 +773,7 @@ module Origen
760
773
  header = ''
761
774
  attrs_to_be_shown.each do |_attr_name, attr_struct|
762
775
  next if attr_struct.show == false
776
+
763
777
  header += "| #{attr_struct.table_text}".ljust(attr_struct.padding)
764
778
  end
765
779
  header += '|'
@@ -775,6 +789,7 @@ module Origen
775
789
  data = ''
776
790
  attrs_to_be_shown.each do |attr_name, attr_struct|
777
791
  next if attr_struct.show == false
792
+
778
793
  if spec.send(attr_name).class == Origen::Specs::Spec::Limit
779
794
  data += "| #{spec.send(attr_name).value}".ljust(attr_struct.padding)
780
795
  else
@@ -17,7 +17,7 @@ module Origen
17
17
  # address API, but will accept any of these
18
18
  @reg_base_address = options.delete(:reg_base_address) ||
19
19
  options.delete(:base_address) || options.delete(:base) || 0
20
- if options[:_instance] # to be deprecated as part of multi-instance removal below
20
+ if options[:_instance] # to be deprecated as part of multi-instance removal below
21
21
  if @reg_base_address.is_a?(Array)
22
22
  @reg_base_address = @reg_base_address[options[:_instance]]
23
23
  elsif options[:base_address_step]
@@ -179,6 +179,7 @@ module Origen
179
179
 
180
180
  def path(options = {})
181
181
  return abs_path if abs_path
182
+
182
183
  if is_a?(Origen::Registers::BitCollection)
183
184
  # Special case where path relative to the register has been requested
184
185
  if options[:relative_to] == parent
@@ -264,9 +265,7 @@ module Origen
264
265
  # Note that this returns an array instead of a hash since there could be naming collisions in the
265
266
  # hash keys
266
267
  def all_sub_blocks
267
- @all_sub_blocks ||= begin
268
- (sub_blocks_array + sub_blocks_array.map(&:all_sub_blocks)).flatten
269
- end
268
+ @all_sub_blocks ||= (sub_blocks_array + sub_blocks_array.map(&:all_sub_blocks)).flatten
270
269
  end
271
270
 
272
271
  # Returns true if the given sub block owns at least one register
@@ -301,7 +300,7 @@ module Origen
301
300
  # permit creating multiple instances of a particular sub_block class
302
301
  # can pass array for base_address, which will be processed above
303
302
  Origen.deprecate 'instances: option to sub_block is deprecated, use sub_block_groups instead'
304
- group_name = name =~ /s$/ ? name : "#{name}s" # take care if name already with 's' is passed
303
+ group_name = name =~ /s$/ ? name : "#{name}s" # take care if name already with 's' is passed
305
304
  unless respond_to?(group_name)
306
305
  sub_block_groups group_name do
307
306
  i.times do |j|
@@ -341,6 +340,7 @@ module Origen
341
340
  skip_require_files = options[:skip_require_files] || %w(attributes parameters pins registers sub_blocks timesets)
342
341
  Dir.glob("#{block_dir}/*.rb").each do |file|
343
342
  next if skip_require_files.include?(Pathname.new(file).basename('.rb').to_s)
343
+
344
344
  require file
345
345
  end
346
346
  end
@@ -362,7 +362,7 @@ module Origen
362
362
  else
363
363
  sub_blocks[name] = block
364
364
  end
365
- unless @current_group.nil? # a group is currently open, store sub_block id only
365
+ unless @current_group.nil? # a group is currently open, store sub_block id only
366
366
  @current_group << name
367
367
  end
368
368
  if options.key?(:lazy)
@@ -417,14 +417,14 @@ module Origen
417
417
  if options[:class_name]
418
418
  b = Object.const_get(options[:class_name]).new
419
419
  else
420
- b = [] # Will use Array if no class defined
420
+ b = [] # Will use Array if no class defined
421
421
  end
422
422
  # Add sub_blocks to group
423
423
  my_group.each do |group_id|
424
424
  b << send(group_id)
425
425
  end
426
426
  sub_block_groups[id] = b
427
- @current_group = nil # close group
427
+ @current_group = nil # close group
428
428
  end
429
429
  alias_method :sub_blocks_group, :sub_block_group
430
430
 
@@ -442,18 +442,18 @@ module Origen
442
442
  current_namespace = remaining_namespace.shift
443
443
  if current_namespace
444
444
  if current_path.join(current_namespace).exist?
445
- return _find_block_dir(options, current_path.join(current_namespace), remaining_namespace)
445
+ _find_block_dir(options, current_path.join(current_namespace), remaining_namespace)
446
446
  elsif current_path.join("derivatives/#{current_namespace}").exist?
447
- return _find_block_dir(options, current_path.join("derivatives/#{current_namespace}"), remaining_namespace)
447
+ _find_block_dir(options, current_path.join("derivatives/#{current_namespace}"), remaining_namespace)
448
448
  elsif current_path.join("sub_blocks/#{current_namespace}").exist?
449
- return _find_block_dir(options, current_path.join("sub_blocks/#{current_namespace}"), remaining_namespace)
449
+ _find_block_dir(options, current_path.join("sub_blocks/#{current_namespace}"), remaining_namespace)
450
450
  else
451
451
  Origen.log.error "Could not find block dir for namespace #{options[:class_name]}!"
452
452
  fail
453
453
  end
454
454
  else
455
455
  if current_path.join('model.rb').exist?
456
- return current_path.to_s
456
+ current_path.to_s
457
457
  else
458
458
  Origen.log.error "Could not find block dir for namespace #{options[:class_name]}!"
459
459
  fail
@@ -463,6 +463,7 @@ module Origen
463
463
 
464
464
  def instantiate_sub_block(name, klass, options)
465
465
  return sub_blocks[name] unless sub_blocks[name].is_a?(Placeholder)
466
+
466
467
  sub_blocks[name] = klass.new(options.merge(parent: self, name: name))
467
468
  end
468
469
 
@@ -491,6 +492,7 @@ module Origen
491
492
  # looking up and loaded by the autoload system straight away, especially if the sub-block
492
493
  # has been specified to lazy load
493
494
  return false if klass == Hash || klass == Array
495
+
494
496
  klass == self.klass || klass == Placeholder
495
497
  end
496
498
 
@@ -557,16 +559,19 @@ module Origen
557
559
  klass = eval(tmp_class)
558
560
  rescue NameError => e
559
561
  raise if e.message !~ /^uninitialized constant (.*)$/ || tmp_class !~ /#{Regexp.last_match(1)}/
562
+
560
563
  begin
561
564
  tmp_class = "::#{class_name}"
562
565
  klass = eval(tmp_class)
563
566
  rescue NameError => e
564
567
  raise if e.message !~ /^uninitialized constant (.*)$/ || tmp_class !~ /#{Regexp.last_match(1)}/
568
+
565
569
  begin
566
570
  tmp_class = "#{owner.class}::#{class_name}"
567
571
  klass = eval(tmp_class)
568
572
  rescue NameError => e
569
573
  raise if e.message !~ /^uninitialized constant (.*)$/ || tmp_class !~ /#{Regexp.last_match(1)}/
574
+
570
575
  puts "Could not find class: #{class_name}"
571
576
  raise 'Unknown sub block class!'
572
577
  end
@@ -609,8 +614,9 @@ module Origen
609
614
  def method_missing(method, *args, &block)
610
615
  super
611
616
  rescue NoMethodError
612
- return regs(method) if self.has_reg?(method)
613
- return ports(method) if self.has_port?(method)
617
+ return regs(method) if has_reg?(method)
618
+ return ports(method) if has_port?(method)
619
+
614
620
  if method.to_s =~ /=$/
615
621
  define_singleton_method(method) do |val|
616
622
  instance_variable_set("@#{method.to_s.sub('=', '')}", val)
@@ -79,7 +79,7 @@ module Origen
79
79
  val.id
80
80
  else
81
81
  packages.include?(val) ? val : nil
82
- end
82
+ end
83
83
  end
84
84
  alias_method :package=, :current_package=
85
85
 
@@ -88,6 +88,7 @@ module Origen
88
88
  def current_package(_options = {})
89
89
  if @current_package_id
90
90
  return _packages[@current_package_id] if _packages[@current_package_id]
91
+
91
92
  fail "The package #{@current_package_id} of #{self.class} has not been defined!"
92
93
  end
93
94
  end
@@ -87,11 +87,10 @@ module Origen
87
87
  end
88
88
  end
89
89
  else
90
- @email ||= begin
91
- if Origen.site_config.email_domain
92
- "#{id}@#{Origen.site_config.email_domain}"
93
- end
94
- end
90
+ @email ||= if Origen.site_config.email_domain
91
+ "#{id}@#{Origen.site_config.email_domain}"
92
+ end
93
+
95
94
  end
96
95
  end
97
96
 
@@ -34,7 +34,7 @@ module Origen
34
34
  # end
35
35
  def parse(options = {})
36
36
  csv_data = extract_csv_data(options)
37
- if block_given? # doesn't do much at this point
37
+ if block_given? # doesn't do much at this point
38
38
  csv_data.each do |dataset|
39
39
  yield dataset
40
40
  end
@@ -69,9 +69,11 @@ module Origen
69
69
 
70
70
  # Returns an array containing all data from given CSV file
71
71
  def extract_csv_data(options = {}) # :nodoc:
72
- options = { field_names_only: false, # whether to obtain field names only
73
- comment_char: '#', # ignore lines that start with comment character
72
+ # rubocop:disable Layout/MultilineHashBraceLayout
73
+ options = { field_names_only: false, # whether to obtain field names only
74
+ comment_char: '#' # ignore lines that start with comment character
74
75
  }.merge(options)
76
+ # rubocop:enable Layout/MultilineHashBraceLayout
75
77
 
76
78
  field_names = []
77
79
  field_values = []
@@ -87,7 +89,7 @@ module Origen
87
89
  end
88
90
  if line_no == 1 # Field names
89
91
  field_names = line.split(',')
90
- else # Field values
92
+ else # Field values
91
93
  field_values = line.split(',')
92
94
  if field_names.length != field_values.length
93
95
  abort "ERROR! Invalid number of fields (#{field_values.length}) in CVS file on line # #{line_no}. Should be #{field_names.length}.\n"
@@ -48,14 +48,14 @@ module Origen
48
48
  lines_remaining = true
49
49
 
50
50
  while lines_remaining
51
- a = get_next_line_a(content_a) # Get the next vectors
51
+ a = get_next_line_a(content_a) # Get the next vectors
52
52
  b = get_next_line_b(content_b)
53
53
  if !a && !b # If both patterns finished
54
54
  lines_remaining = false
55
55
  elsif !a || !b # If only 1 pattern finished
56
56
  lines_remaining = false
57
- changes = true unless @suspend_diff # There are extra vectors in one of the patterns
58
- elsif a != b # If the vectors don't match
57
+ changes = true unless @suspend_diff # There are extra vectors in one of the patterns
58
+ elsif a != b # If the vectors don't match
59
59
  changes = true unless @suspend_diff
60
60
  end
61
61
  if @resume_diff # resume checking diffs for subsequent lines
@@ -112,8 +112,8 @@ module Origen
112
112
  end
113
113
  # This rescue is a crude way to guard against non-ASCII files that find
114
114
  # their way in here
115
- rescue
116
- return line
115
+ rescue
116
+ line
117
117
  end
118
118
  else
119
119
  line.strip
@@ -144,10 +144,10 @@ module Origen
144
144
  else
145
145
  matched = true
146
146
  end
147
- # This rescue is a crude way to guard against non-ASCII files that find
148
- # there way in here
149
- rescue
150
- matched = true
147
+ # This rescue is a crude way to guard against non-ASCII files that find
148
+ # there way in here
149
+ rescue
150
+ matched = true
151
151
  end
152
152
  end
153
153
  ix
@@ -25,9 +25,11 @@ module Origen
25
25
  class OutputFile < Array
26
26
  class Line < String
27
27
  attr_accessor :type, :original_number
28
+
28
29
  def initialize(type, input_file)
29
30
  self.type = type
30
31
  return unless input_file
32
+
31
33
  replace(input_file.current_line)
32
34
  self.original_number = input_file.pointer + 1
33
35
  input_file.advance_pointer!
@@ -59,6 +61,7 @@ module Origen
59
61
  class Processor
60
62
  attr_accessor :source, :target
61
63
  attr_accessor :source_output, :target_output
64
+
62
65
  def initialize(source_file_name, target_file_name)
63
66
  self.source = InputFile.new
64
67
  self.target = InputFile.new
@@ -125,6 +128,7 @@ module Origen
125
128
  module Formatter
126
129
  class Base
127
130
  attr_accessor :source_output, :target_output, :file
131
+
128
132
  def initialize(processed_diff, output_file_name)
129
133
  self.source_output = processed_diff.source_output
130
134
  self.target_output = processed_diff.target_output
@@ -5,14 +5,16 @@ module Origen
5
5
  # Gets text input from the user
6
6
  # Supply an optional default value in the event that the user enters nothing
7
7
  def get_text(options = {})
8
+ # rubocop:disable Layout/MultilineHashBraceLayout
8
9
  options = { default: false,
9
- single: false, # Set if only a single line entry is expected
10
+ single: false, # Set if only a single line entry is expected
10
11
  confirm: false,
11
- accept: false, # Supply and array of entries you are willing to accept
12
+ accept: false, # Supply and array of entries you are willing to accept
12
13
  case_sensitive: false, # If accept values are supplied they will be treated as case
13
14
  # in-sensitive by default
14
- wrap: true, # Automatically split long lines
15
+ wrap: true # Automatically split long lines
15
16
  }.merge(options)
17
+ # rubocop:enable Layout/MultilineHashBraceLayout
16
18
  if options[:confirm]
17
19
  puts "Type 'yes' or 'no' to confirm or 'quit' to abort."
18
20
  elsif options[:accept]
@@ -65,9 +67,7 @@ module Origen
65
67
  end
66
68
  if confirm == 'yes' || confirm == 'y'
67
69
  if options[:confirm] == :return_boolean
68
- return true
69
- else
70
- return
70
+ true
71
71
  end
72
72
  else
73
73
  get_text(options)
@@ -18,8 +18,7 @@ module Origen
18
18
  domain: (Origen.site_config.email_domain || ''),
19
19
 
20
20
  auth_user: (Origen.site_config.email_auth_user || current_user.email),
21
- auth_password: (Origen.site_config.email_auth_password || current_user.password)
22
- }.merge(options)
21
+ auth_password: (Origen.site_config.email_auth_password || current_user.password) }.merge(options)
23
22
 
24
23
  # Force to an array
25
24
  to = options[:to].respond_to?('each') ? options[:to] : [options[:to]]
@@ -52,15 +51,13 @@ END_OF_MESSAGE
52
51
  smtp = Net::SMTP.new(options[:server], options[:port])
53
52
  smtp.enable_starttls if options[:authentication] != :none
54
53
 
55
- opts = begin
56
- if options[:authentication] == :none
57
- # Trying to add username and password if there's no authentication will actually be rejected by
58
- # the server.
59
- [options[:domain]]
60
- else
61
- [options[:domain], options[:auth_user], options[:auth_password], options[:authentication]]
62
- end
63
- end
54
+ opts = if options[:authentication] == :none
55
+ # Trying to add username and password if there's no authentication will actually be rejected by
56
+ # the server.
57
+ [options[:domain]]
58
+ else
59
+ [options[:domain], options[:auth_user], options[:auth_password], options[:authentication]]
60
+ end
64
61
 
65
62
  smtp.start(*opts) do |m|
66
63
  m.send_message(msg, options[:from], addr)