origen 0.60.7 → 0.60.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) 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. data/origen_site_config.yml +2 -0
  124. metadata +9 -27
  125. data/config/rubocop/easy_disabled.yml +0 -275
  126. data/config/rubocop/easy_enabled.yml +0 -727
  127. data/config/rubocop/strict_disabled.yml +0 -251
  128. data/config/rubocop/strict_enabled.yml +0 -751
@@ -229,7 +229,7 @@ end
229
229
 
230
230
  def setup_bundler(origen_root)
231
231
  bundle_path = nil
232
- eval BUNDLER_SETUP # Will update bundle_path
232
+ eval BUNDLER_SETUP # Will update bundle_path
233
233
  bundle_path
234
234
  end
235
235
 
@@ -239,43 +239,41 @@ end
239
239
  gem_dir = Pathname.new(Gem.dir)
240
240
 
241
241
  Origen.site_config.gem_use_from_system.each do |gem, version|
242
- begin
243
- # This will raise an error if the system doesn't have this gem installed, that
244
- # will be rescued below
245
- spec = Gem::Specification.find_by_name(gem, version)
242
+ # This will raise an error if the system doesn't have this gem installed, that
243
+ # will be rescued below
244
+ spec = Gem::Specification.find_by_name(gem, version)
246
245
 
247
- # If the spec has returned a handle to a system installed gem. If this script has been invoked through
248
- # Bundler then it could point to some other gem dir. The only time this should occur is when switching
249
- # from the old system to the new system, but can't work out how to fix it so just disabling in that case.
250
- if spec.gem_dir =~ /#{gem_dir}/
246
+ # If the spec has returned a handle to a system installed gem. If this script has been invoked through
247
+ # Bundler then it could point to some other gem dir. The only time this should occur is when switching
248
+ # from the old system to the new system, but can't work out how to fix it so just disabling in that case.
249
+ if spec.gem_dir =~ /#{gem_dir}/
251
250
 
252
- local_dir = File.join(local_gem_dir, Pathname.new(spec.gem_dir).relative_path_from(gem_dir))
253
- FileUtils.mkdir_p local_dir
254
- FileUtils.cp_r("#{spec.gem_dir}/.", local_dir)
255
-
256
- local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.cache_file).relative_path_from(gem_dir)))
257
- FileUtils.mkdir_p local_file.dirname
258
- FileUtils.cp(spec.cache_file, local_file)
251
+ local_dir = File.join(local_gem_dir, Pathname.new(spec.gem_dir).relative_path_from(gem_dir))
252
+ FileUtils.mkdir_p local_dir
253
+ FileUtils.cp_r("#{spec.gem_dir}/.", local_dir)
259
254
 
260
- if spec.extension_dir && File.exist?(spec.extension_dir)
261
- local_dir = File.join(local_gem_dir, Pathname.new(spec.extension_dir).relative_path_from(gem_dir))
262
- FileUtils.mkdir_p local_dir
263
- FileUtils.cp_r("#{spec.extension_dir}/.", local_dir)
264
- end
255
+ local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.cache_file).relative_path_from(gem_dir)))
256
+ FileUtils.mkdir_p local_file.dirname
257
+ FileUtils.cp(spec.cache_file, local_file)
265
258
 
266
- local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.spec_file).relative_path_from(gem_dir)))
267
- FileUtils.mkdir_p local_file.dirname
268
- FileUtils.cp(spec.spec_file, local_file)
259
+ if spec.extension_dir && File.exist?(spec.extension_dir)
260
+ local_dir = File.join(local_gem_dir, Pathname.new(spec.extension_dir).relative_path_from(gem_dir))
261
+ FileUtils.mkdir_p local_dir
262
+ FileUtils.cp_r("#{spec.extension_dir}/.", local_dir)
263
+ end
269
264
 
270
- puts "Copied #{gem} #{version} from the system into #{bundle_path}"
265
+ local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.spec_file).relative_path_from(gem_dir)))
266
+ FileUtils.mkdir_p local_file.dirname
267
+ FileUtils.cp(spec.spec_file, local_file)
271
268
 
272
- end
269
+ puts "Copied #{gem} #{version} from the system into #{bundle_path}"
273
270
 
274
- rescue Exception # Gem::LoadError # Rescue everything here, this is a try-our-best operation, better to
275
- # continue and try and install the gem if this fails rather than crash
276
- # This just means that one of the gems that should be copied from the system
277
- # was not actually installed in the system, so nothing we can do about that here
278
271
  end
272
+
273
+ rescue Exception # Gem::LoadError # Rescue everything here, this is a try-our-best operation, better to
274
+ # continue and try and install the gem if this fails rather than crash
275
+ # This just means that one of the gems that should be copied from the system
276
+ # was not actually installed in the system, so nothing we can do about that here
279
277
  end
280
278
  end
281
279
  end
data/lib/origen/boot.rb CHANGED
@@ -140,6 +140,7 @@ elsif Origen.site_config.gem_manage_bundler && (Origen.site_config.user_install_
140
140
  if STDOUT.tty?
141
141
  begin
142
142
  fail OrigenBootError unless File.exist?(ENV['BUNDLE_BIN'])
143
+
143
144
  Bundler.setup
144
145
  fail OrigenBootError unless File.exist?(ENV['BUNDLE_BIN'])
145
146
  rescue Gem::LoadError, Bundler::BundlerError, OrigenBootError => e
data/lib/origen/bugs.rb CHANGED
@@ -2,7 +2,7 @@ module Origen
2
2
  module Bugs
3
3
  extend ActiveSupport::Concern
4
4
 
5
- autoload :Bug, 'origen/bugs/bug'
5
+ autoload :Bug, 'origen/bugs/bug'
6
6
 
7
7
  module ClassMethods # :nodoc:
8
8
  # Define a bug on the given IP
@@ -23,7 +23,7 @@ module Origen
23
23
  # Returns true if the version of the IP represented by the object has the bug of the
24
24
  # given name
25
25
  def has_bug?(name, _options = {})
26
- unless self.respond_to?(:version) && version
26
+ unless respond_to?(:version) && version
27
27
  puts 'To test for the presence of a bug the object must implement an attribute'
28
28
  puts "called 'version' which returns the IP version represented by the the object."
29
29
  fail 'Version undefined!'
@@ -4,12 +4,14 @@ module Origen
4
4
  attr_accessor :brief_description
5
5
  attr_accessor :description
6
6
  attr_writer :name
7
- attr_accessor :data_rate
7
+ attr_writer :data_rate
8
8
  attr_accessor :data_rate_unit
9
9
  attr_accessor :minimum_version_enabled
10
+
10
11
  alias_writer :min_ver_enabled, :minimum_version_enabled
11
12
  alias_writer :min_version_enabled, :minimum_version_enabled
12
13
  attr_accessor :audience
14
+
13
15
  alias_writer :full_name, :name
14
16
  # Returns the object that owns the mode (the SoC instance usually)
15
17
  attr_accessor :owner
@@ -47,15 +49,15 @@ module Origen
47
49
  # in theory but should still check if it returns a numeric
48
50
  value = @data_rate.send(@data_rate_unit.to_sym)
49
51
  if value.is_a?(Numeric)
50
- return value
52
+ value
51
53
  else
52
54
  Origen.log.error "@data_rate '#{@data_rate}' conversion using @data_rate_unit '#{@data_rate_unit}' did not product a Numeric, exiting..."
53
55
  end
54
56
  else
55
- return @data_rate
57
+ @data_rate
56
58
  end
57
59
  else
58
- return @data_rate
60
+ @data_rate
59
61
  end
60
62
  end
61
63
 
@@ -82,6 +84,7 @@ module Origen
82
84
  instance_variable_get(ivar)
83
85
  end
84
86
  end
87
+
85
88
  send(method_name, *arguments, &block)
86
89
  end
87
90
 
@@ -6,7 +6,7 @@ module Origen
6
6
  attr_accessor :number_of_rows
7
7
  attr_accessor :number_of_columns
8
8
  attr_accessor :interconnects
9
- attr_accessor :types
9
+ attr_writer :types
10
10
  attr_reader :upper_axes
11
11
  attr_reader :lower_axes
12
12
  attr_reader :rows
@@ -14,10 +14,11 @@ module Origen
14
14
  attr_reader :field
15
15
  attr_reader :obj
16
16
  attr_reader :groups
17
- attr_reader :group_list
17
+ # attr_reader :group_list # method is redefined further down
18
18
  attr_reader :last_empty_char
19
19
  attr_reader :plottable
20
20
  attr_writer :name
21
+
21
22
  alias_writer :full_name, :name
22
23
  # Returns the owner that $owns the mode (the SoC instance usually)
23
24
  attr_accessor :owner
@@ -57,7 +58,7 @@ module Origen
57
58
  #
58
59
  def prepare_plot
59
60
  @plottable = types.any? { |x| /BGA/i =~ x }
60
- if @plottable
61
+ if @plottable
61
62
  @last_empty_char = '.'
62
63
  @field = []
63
64
  @groups = []
@@ -69,7 +70,7 @@ module Origen
69
70
  (1..@number_of_columns).map { |item| @columns << item }
70
71
  @upper_axes = []
71
72
  @lower_axes = []
72
- @columns.each_with_index do|column, index|
73
+ @columns.each_with_index do |column, index|
73
74
  # if index % 2 == 0
74
75
  if index.even?
75
76
  temp = column.to_s
@@ -96,20 +97,20 @@ module Origen
96
97
  # 2. It concatenates the array elements into printable rows, and prints
97
98
  # them.
98
99
  #
99
- def generate_field(emptyChar = @last_empty_char)
100
+ def generate_field(empty_char = @last_empty_char)
100
101
  if plottable
101
102
  new_field = []
102
103
  @field.each do |rows|
103
104
  rows.each do |items|
104
105
  if items.length == 0
105
- items.insert(0, "#{emptyChar} ")
106
- elsif emptyChar != @last_empty_char && items == ["#{last_empty_char} "]
107
- items[0] = "#{emptyChar} "
106
+ items.insert(0, "#{empty_char} ")
107
+ elsif empty_char != @last_empty_char && items == ["#{last_empty_char} "]
108
+ items[0] = "#{empty_char} "
108
109
  end
109
110
  end
110
111
  new_field.insert(-1, rows.join(''))
111
112
  end
112
- @last_empty_char = emptyChar
113
+ @last_empty_char = empty_char
113
114
  package = (owner.package.nil?) ? 'No package chosen.' : owner.package.to_s
114
115
  puts "\nPin field: #{package}\n\n"
115
116
  group_display = @groups.join("\n")
@@ -129,13 +130,12 @@ module Origen
129
130
  @groups << "#{marker} - Power"
130
131
  pin_list.each do |item|
131
132
  # puts items,owner.pins[items].location
132
- begin
133
- coordinates = coordinate(item.location)
134
- @field[coordinates[0]][coordinates[1]] = [marker.red + ' ']
135
- rescue
136
- puts "#{item} doesn't appear to have a physical location in this configuration."
137
- puts "Current package = #{owner.package}"
138
- end
133
+
134
+ coordinates = coordinate(item.location)
135
+ @field[coordinates[0]][coordinates[1]] = [marker.red + ' ']
136
+ rescue
137
+ puts "#{item} doesn't appear to have a physical location in this configuration."
138
+ puts "Current package = #{owner.package}"
139
139
  end
140
140
  generate_field
141
141
  end
@@ -151,12 +151,10 @@ module Origen
151
151
  pin_list = owner.ground_pins.map { |_ken, pin| pin }
152
152
  @groups << "#{marker} - Ground"
153
153
  pin_list.each do |item|
154
- begin
155
- coordinates = coordinate(item.location)
156
- @field[coordinates[0]][coordinates[1]] = [marker.green + ' ']
157
- rescue
158
- puts "#{item} doesn't appear to have a physical location in this configuration."
159
- end
154
+ coordinates = coordinate(item.location)
155
+ @field[coordinates[0]][coordinates[1]] = [marker.green + ' ']
156
+ rescue
157
+ puts "#{item} doesn't appear to have a physical location in this configuration."
160
158
  end
161
159
  generate_field
162
160
  end
@@ -183,16 +181,16 @@ module Origen
183
181
  if plottable
184
182
  puts "\nPLOTTING GROUPS:"
185
183
  puts '$dut.package.list_groups <-- to see available group names'
186
- puts "$dut.package.plot(\"ddr_interface_1\")"
184
+ puts '$dut.package.plot("ddr_interface_1")'
187
185
  puts "$dut.package.plot_group(\"serdes_1\",'Z') <--denotes custom legend marker, Z"
188
186
  puts "\nPLOTTING INDIVIDUAL PINS:"
189
- puts "$dut.package.plot(\"d1_mdqs00\")"
187
+ puts '$dut.package.plot("d1_mdqs00")'
190
188
  puts "\nPLOTTING WITH REGEXP:"
191
- puts "$dut.package.plot(\"d1_mdqs\") <-- Plot all controller 1 DQS pins."
192
- puts "$dut.package.plot(\"d1_mdqs0[0-9]\") <-- Plot d1_mdqs00 - d1_mdqs09."
189
+ puts '$dut.package.plot("d1_mdqs") <-- Plot all controller 1 DQS pins.'
190
+ puts '$dut.package.plot("d1_mdqs0[0-9]") <-- Plot d1_mdqs00 - d1_mdqs09.'
193
191
  puts "\nADDING POWER/GROUND:"
194
- puts "$dut.package.plot(\"grounds\")"
195
- puts "$dut.package.plot(\"power\")"
192
+ puts '$dut.package.plot("grounds")'
193
+ puts '$dut.package.plot("power")'
196
194
  puts "\nVIEW CURRENT PLOT\n"
197
195
  puts '$dut.package.show'
198
196
  else
@@ -206,7 +204,7 @@ module Origen
206
204
  grps = owner.pins.map { |_key, val| val.group }
207
205
  grps.uniq!
208
206
  rescue
209
- return []
207
+ []
210
208
  end
211
209
  alias_method :group_list, :list_groups
212
210
 
@@ -216,7 +214,7 @@ module Origen
216
214
  pin_list[0].compact!
217
215
  puts 'No pins found under that group name.' unless pin_list.any?
218
216
  rescue
219
- return []
217
+ []
220
218
  end
221
219
 
222
220
  # ##############################################################
@@ -235,6 +233,7 @@ module Origen
235
233
  row = location[0..split_index]
236
234
  column = location[split_index + 1..-1]
237
235
  fail ArgumentError, error unless row.length > 0 && column.length > 0
236
+
238
237
  ## Now convert alphanumeric row to jedec equiv' with to_row() method
239
238
  # and return coordinates.
240
239
  coordinates = [to_row(row), column.to_i - 1]
@@ -264,48 +263,46 @@ module Origen
264
263
  # $dut.package.plot("d1_mdq37","$") # plots controller 1 mdq 37, and uses $ as a legend marker
265
264
  # $dut.package.plot("d2_mdq[3-6]0) # plots d2_mdq30, d2_mdq40, d2_md520, and d2_md620
266
265
  #
267
- def plot(pinName, marker = nil)
266
+ def plot(pin_name, marker = nil)
268
267
  prepare_plot if field.nil?
269
- if plottable && pinName.is_a?(String) && /ground/ =~ pinName.downcase
268
+ if plottable && pin_name.is_a?(String) && /ground/ =~ pin_name.downcase
270
269
  add_grounds('G')
271
- elsif plottable && pinName.is_a?(String) && /power/ =~ pinName.downcase
270
+ elsif plottable && pin_name.is_a?(String) && /power/ =~ pin_name.downcase
272
271
  add_power('P')
273
- elsif plottable && pinName.is_a?(String)
272
+ elsif plottable && pin_name.is_a?(String)
274
273
  found_pins = []
275
- owner.pins.map { |pin| found_pins << pin[1] if /#{pinName}/ =~ pin[1].name.to_s || /#{pinName}/ =~ pin[1].group.to_s }
274
+ owner.pins.map { |pin| found_pins << pin[1] if /#{pin_name}/ =~ pin[1].name.to_s || /#{pin_name}/ =~ pin[1].group.to_s }
276
275
  if found_pins.size == 1 && marker.nil?
277
- marker = initial(pinName.to_s)
278
- while @groups.index { |grpName| grpName =~ /#{marker} -/ }
276
+ marker = initial(pin_name.to_s)
277
+ while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
279
278
  marker.next!
280
279
  marker = '0' unless marker.size < 2
281
280
  end
282
281
  coordinates = coordinate(found_pins[0].location)
283
282
  @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
284
- @groups.delete_if { |group| /#{pinName.to_s}/ =~ group }
283
+ @groups.delete_if { |group| /#{pin_name}/ =~ group }
285
284
  @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
286
285
  elsif found_pins.size == 1
287
286
  coordinates = coordinate(found_pins[0].location)
288
287
  @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
289
- @groups.delete_if { |group| /#{pinName.to_s}/ =~ group }
288
+ @groups.delete_if { |group| /#{pin_name}/ =~ group }
290
289
  @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
291
290
  else
292
291
  if marker.nil?
293
- marker = initial(pinName.to_s)
294
- while @groups.index { |grpName| grpName =~ /#{marker} -/ }
292
+ marker = initial(pin_name.to_s)
293
+ while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
295
294
  marker.next!
296
295
  marker = '0' unless marker.size < 2
297
296
  end
298
297
  end
299
- reg_state = quote_regex(pinName)
298
+ reg_state = quote_regex(pin_name)
300
299
  found_pins.each do |item|
301
- begin
302
- coordinates = coordinate(item.location)
303
- @field[coordinates[0]][coordinates[1]] = [marker + ' ']
304
- @groups.delete_if { |group| "#{marker} - \"#{reg_state}\"" == group }
305
- @groups << "#{marker} - \"#{pinName}\""
306
- rescue
307
- raise "\n#{item} doesn't appear to have a physical location in this configuration."
308
- end
300
+ coordinates = coordinate(item.location)
301
+ @field[coordinates[0]][coordinates[1]] = [marker + ' ']
302
+ @groups.delete_if { |group| "#{marker} - \"#{reg_state}\"" == group }
303
+ @groups << "#{marker} - \"#{pin_name}\""
304
+ rescue
305
+ raise "\n#{item} doesn't appear to have a physical location in this configuration."
309
306
  end
310
307
  end
311
308
  generate_field
@@ -328,20 +325,20 @@ module Origen
328
325
  owner.pins.map { |pin| found_pins << pin[1] if coord == pin[1].location.to_s }
329
326
  if marker.nil?
330
327
  marker = initial(coord.to_s)
331
- while @groups.index { |grpName| grpName =~ /#{marker} -/ }
328
+ while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
332
329
  marker.next!
333
330
  marker = '0' unless marker.size < 2
334
331
  end
335
332
  found_pins.each do |pin|
336
333
  coordinates = coordinate(pin.location)
337
334
  @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
338
- @groups.delete_if { |group| /#{coord.to_s}/ =~ group }
335
+ @groups.delete_if { |group| /#{coord}/ =~ group }
339
336
  @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
340
337
  end
341
338
  else
342
339
  coordinates = coordinate(found_pins[0].location)
343
340
  @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
344
- @groups.delete_if { |group| /#{coord.to_s}/ =~ group }
341
+ @groups.delete_if { |group| /#{coord}/ =~ group }
345
342
  @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
346
343
  end
347
344
  if found_pins.size > 0
@@ -70,11 +70,11 @@ module Origen
70
70
  end
71
71
  end
72
72
  if notes_found.empty?
73
- return nil
73
+ nil
74
74
  elsif notes_found.size == 1
75
75
  notes_found.values.first.values.first
76
76
  else
77
- return notes_found
77
+ notes_found
78
78
  end
79
79
  end
80
80
 
@@ -122,6 +122,8 @@ module Origen
122
122
 
123
123
  private
124
124
 
125
+ # rubocop:disable Lint/DuplicateMethods
126
+
125
127
  # Two-dimensional hash with note id and type as the keys
126
128
  def _notes
127
129
  @_notes ||= Hash.new do |h, k|
@@ -143,9 +145,12 @@ module Origen
143
145
  end
144
146
  end
145
147
 
148
+ # rubocop:enable Lint/DuplicateMethods
149
+
146
150
  # Return a hash based on the filter provided
147
151
  def filter_hash(hash, filter)
148
152
  fail 'Hash argument is not a Hash!' unless hash.is_a? Hash
153
+
149
154
  filtered_hash = {}
150
155
  select_logic = case filter
151
156
  when String then 'k[Regexp.new(filter)]'
@@ -155,8 +160,7 @@ module Origen
155
160
  'k == filter'
156
161
  when NilClass then true # Return all specs if a filter is set to nil (i.e. user doesn't care about this filter)
157
162
  else true
158
- end
159
- # rubocop:disable UnusedBlockArgument
163
+ end
160
164
  filtered_hash = hash.select do |k, v|
161
165
  [TrueClass, FalseClass].include?(select_logic.class) ? select_logic : eval(select_logic)
162
166
  end
data/lib/origen/chips.rb CHANGED
@@ -37,13 +37,13 @@ module Origen
37
37
  }.update(options || {})
38
38
  _chips
39
39
  if s.nil?
40
- return show_chips(options)
40
+ show_chips(options)
41
41
  elsif s.is_a? Hash
42
42
  options.update(s)
43
- return show_chips(options)
43
+ show_chips(options)
44
44
  else
45
45
  options[:chip] = s
46
- return show_chips(options)
46
+ show_chips(options)
47
47
  end
48
48
  end
49
49
 
@@ -61,6 +61,7 @@ module Origen
61
61
  if has_chip?(name, group: group, family: family, performance: performance, creating_chip: true)
62
62
  fail "Chip already exists for chip: #{name}, group: #{group}, family: #{family} for object #{self}"
63
63
  end
64
+
64
65
  @_chips[group][family][performance][name] = chip_holder
65
66
  end
66
67
 
@@ -76,9 +77,9 @@ module Origen
76
77
  creating_chip: false
77
78
  }.update(options)
78
79
  if @_chips.nil? || @_chips == {}
79
- return false
80
+ false
80
81
  else
81
- return !!show_chips(options)
82
+ !!show_chips(options)
82
83
  end
83
84
  end
84
85
 
@@ -127,11 +128,11 @@ module Origen
127
128
  end
128
129
  end
129
130
  if notes_found.empty?
130
- return nil
131
+ nil
131
132
  elsif notes_found.size == 1
132
133
  notes_found.values.first.values.first
133
134
  else
134
- return notes_found
135
+ notes_found
135
136
  end
136
137
  end
137
138
 
@@ -184,6 +185,8 @@ module Origen
184
185
 
185
186
  private
186
187
 
188
+ # rubocop:disable Lint/DuplicateMethods
189
+
187
190
  def _chips
188
191
  # 4D hash with group, family, and performance
189
192
  @_chips ||= Hash.new do |h, k|
@@ -215,10 +218,12 @@ module Origen
215
218
  h[k] = {}
216
219
  end
217
220
  end
221
+ # rubocop:enable Lint/DuplicateMethods
218
222
 
219
223
  # Return a hash based on the filter provided
220
224
  def filter_hash(hash, filter)
221
225
  fail 'Hash argument is not a Hash!' unless hash.is_a? Hash
226
+
222
227
  filtered_hash = {}
223
228
  select_logic = case filter
224
229
  when String then 'k[Regexp.new(filter)]'
@@ -228,8 +233,7 @@ module Origen
228
233
  'k == filter'
229
234
  when NilClass then true # Return all specs if a filter is set to nil (i.e. user doesn't care about this filter)
230
235
  else true
231
- end
232
- # rubocop:disable UnusedBlockArgument
236
+ end
233
237
  filtered_hash = hash.select do |k, v|
234
238
  [TrueClass, FalseClass].include?(select_logic.class) ? select_logic : eval(select_logic)
235
239
  end
@@ -268,13 +272,13 @@ module Origen
268
272
  return show_chips(options)
269
273
  end
270
274
  Origen.log.debug "Returning no chips for options #{options}"
271
- return nil
275
+ nil
272
276
  elsif chips_to_be_shown.size == 1
273
277
  Origen.log.debug "returning one spec #{chips_to_be_shown.first.part_name}"
274
- return chips_to_be_shown.first
278
+ chips_to_be_shown.first
275
279
  else
276
280
  Origen.log.debug "returning an array of specs during initial search: #{chips_to_be_shown}"
277
- return chips_to_be_shown
281
+ chips_to_be_shown
278
282
  end
279
283
  end
280
284
  end
data/lib/origen/client.rb CHANGED
@@ -54,6 +54,7 @@ module Origen
54
54
  # Returns an array of data packets for all plugins
55
55
  def plugins
56
56
  return @plugins if @plugins
57
+
57
58
  response = get('plugins')
58
59
  @plugins = JSON.parse(response.body, symbolize_names: true)[:plugins]
59
60
  end
@@ -1,7 +1,8 @@
1
1
  module Origen
2
2
  module Clocks
3
3
  class Clock
4
- attr_accessor :id, :owner, :users, :freq_target, :freq_range, :setpoint, :instantiate_users
4
+ attr_accessor :id, :owner, :instantiate_users
5
+ attr_writer :users, :freq_target, :freq_range
5
6
 
6
7
  def initialize(id, owner, options = {}, &block)
7
8
  @id = id
@@ -37,17 +38,17 @@ module Origen
37
38
  val = @setpoint if val.nil?
38
39
  if @freq_range == :fixed
39
40
  if val == @freq_target
40
- return true
41
+ true
41
42
  else
42
43
  Origen.log.warn("Clock '#{id}' is a fixed clock with a target frequency of #{@freq_target.as_Hz}")
43
- return false
44
+ false
44
45
  end
45
46
  else
46
47
  if @freq_range.include?(val)
47
- return true
48
+ true
48
49
  else
49
50
  Origen.log.warn("Setpoint (#{setpoint_string(val)}) for clock '#{id}' is not within the frequency range (#{freq_range_string})")
50
- return false
51
+ false
51
52
  end
52
53
  end
53
54
  end
@@ -100,10 +101,10 @@ module Origen
100
101
  def users_defined?
101
102
  undefined_ips = ips - Origen.all_sub_blocks
102
103
  if undefined_ips.empty?
103
- return true
104
+ true
104
105
  else
105
106
  Origen.log.warn("Clock '#{id}' has the following IP undefined: #{undefined_ips}")
106
- return false
107
+ false
107
108
  end
108
109
  end
109
110
 
@@ -18,6 +18,7 @@ module Origen
18
18
  attr_getter = attr.to_s[/\@(\S+)/, 1].to_sym
19
19
  attr_val = clk.send attr_getter
20
20
  next unless [String, Numeric, Float, Integer, Symbol, Range].include? attr_val.class
21
+
21
22
  headers << attr_getter unless headers.include?(attr_getter)
22
23
  str = case attr_val
23
24
  when Numeric
@@ -29,7 +30,7 @@ module Origen
29
30
  "#{start_frequency.as_Hz}\.\.#{end_frequency.as_Hz}"
30
31
  else
31
32
  attr_val.to_s
32
- end
33
+ end
33
34
  curr_longest = [attr_getter, str].max_by(&:length).size + 2 # Add 2 for the whitespace
34
35
  if colhash[attr].nil? || (colhash[attr] < curr_longest)
35
36
  colhash[attr] = curr_longest
@@ -354,7 +354,7 @@ module Origen
354
354
  # done of the name and it is assumed that it is a valid class name including the application namespace.
355
355
  def class_name_to_blocks_dir(name)
356
356
  name = name.split('::')
357
- name.shift # Drop the application name
357
+ name.shift # Drop the application name
358
358
  dir = Origen.root.join('app', 'blocks')
359
359
  name.each_with_index do |n, i|
360
360
  if i == 0
@@ -40,7 +40,7 @@ module Origen
40
40
 
41
41
  # Cache source root and add lib/generators/base/generator/templates to
42
42
  # source paths.
43
- def self.inherited(base) #:nodoc:
43
+ def self.inherited(base) # :nodoc:
44
44
  super
45
45
  if base.name && base.name !~ /Base$/
46
46
  if base.namespace == 'origen'
@@ -28,6 +28,7 @@ module Origen
28
28
 
29
29
  def self.load_generators
30
30
  return if @generators_loaded
31
+
31
32
  # Load Origen's generators
32
33
  require_relative 'code_generators/block_common'
33
34
  require_relative 'code_generators/dut'
@@ -43,6 +44,7 @@ module Origen
43
44
  # Loaded separately so as not to pollute the generated list of generators available to users
44
45
  def self.load_internal_generators
45
46
  return if @internal_generators_loaded
47
+
46
48
  require_relative 'code_generators/semver'
47
49
  require_relative 'code_generators/timever'
48
50
  @internal_generators_loaded = true
@@ -121,6 +123,7 @@ END
121
123
  end
122
124
  plugin_generators.each do |namespace, generators|
123
125
  next if namespace.to_s == 'origen_app_generators'
126
+
124
127
  puts
125
128
  generators.each do |_name, gen|
126
129
  puts "#{namespace}:#{gen}"
@@ -16,7 +16,7 @@ opt_parser.parse! ARGV
16
16
 
17
17
  origen_binstub = File.join(Origen.root, 'lbin', 'origen')
18
18
 
19
- unless File.exist?(origen_binstub) && File.read(origen_binstub) =~ /This file was generated by Origen/
19
+ unless File.exist?(origen_binstub) && File.read(origen_binstub) =~ /This file was generated by Origen/
20
20
  puts 'An archive can only be created after your application is running the latest Origen boot system,'
21
21
  puts 'run the following command to update your application and then try again:'
22
22
  puts