origen 0.60.7 → 0.60.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -27,7 +27,7 @@ module Origen
27
27
  options[:description] = fetch_description(name)
28
28
  end
29
29
  features[name] = Feature.new(name, options)
30
- else # if feature with given name already exists
30
+ else # if feature with given name already exists
31
31
  fail "Feature #{name} already added!"
32
32
  end
33
33
  end
@@ -72,17 +72,15 @@ module Origen
72
72
  end
73
73
  end
74
74
 
75
- public
76
-
77
75
  def has_features?(name = nil)
78
76
  if !name
79
77
  if feature.size == 0
80
- return false
78
+ false
81
79
  else
82
- return true
80
+ true
83
81
  end
84
82
  else
85
- return feature.include?(name)
83
+ feature.include?(name)
86
84
  end
87
85
  end
88
86
  alias_method :has_feature?, :has_features?
@@ -133,14 +133,14 @@ module Origen
133
133
  Pathname.new(m)
134
134
  else
135
135
  if options[:allow_missing]
136
- return nil
136
+ nil
137
137
  else
138
138
  fail "Can't find: #{file}"
139
139
  end
140
140
  end
141
141
  else
142
142
  if options[:allow_missing]
143
- return nil
143
+ nil
144
144
  else
145
145
  fail "Can't find: #{file}"
146
146
  end
@@ -152,17 +152,17 @@ module Origen
152
152
  if file_plugin
153
153
  if Origen.app.plugins.current
154
154
  if file_plugin == Origen.app.plugins.current.name
155
- return path
155
+ path
156
156
  else
157
157
  puts "The requested file is from plugin #{file_plugin} and current system plugin is set to plugin #{Origen.app.plugins.current.name}!"
158
158
  fail 'Incorrect plugin error!'
159
159
  end
160
160
  else
161
161
  Origen.app.plugins.temporary = file_plugin
162
- return path
162
+ path
163
163
  end
164
164
  else
165
- return path
165
+ path
166
166
  end
167
167
  end
168
168
 
@@ -184,13 +184,13 @@ module Origen
184
184
  end
185
185
 
186
186
  if matches.size == 0
187
- return nil
187
+ nil
188
188
  elsif matches.size > 1
189
189
  puts 'The following matches were found:'
190
190
  puts matches
191
191
  fail "Ambiguous file #{file}"
192
192
  else
193
- return check(matches.first)
193
+ check(matches.first)
194
194
  end
195
195
  end
196
196
 
@@ -380,6 +380,7 @@ module Origen
380
380
 
381
381
  def current_directory
382
382
  return @current_directory if @current_directory
383
+
383
384
  @current_directory = clean_path_to(current_file).dirname if current_file
384
385
  end
385
386
 
@@ -33,11 +33,11 @@ module Origen
33
33
  end
34
34
 
35
35
  def reprogrammeable?
36
- self.respond_to?(:reprogrammeable) ? reprogrammeable : true
36
+ respond_to?(:reprogrammeable) ? reprogrammeable : true
37
37
  end
38
38
 
39
39
  def customer_visible?
40
- self.respond_to?(:customer_visible) ? customer_visible : false
40
+ respond_to?(:customer_visible) ? customer_visible : false
41
41
  end
42
42
  end
43
43
  end
@@ -119,7 +119,7 @@ module Origen
119
119
  else
120
120
  File.open(f, 'w') { |out| out.puts output }
121
121
  end
122
- else # Just copy it across
122
+ else # Just copy it across
123
123
  out = output_file(file, options)
124
124
  # Delete the target if it already exists, this prevents permission denied errors when copying
125
125
  FileUtils.rm_f(out.to_s) if File.exist?(out.to_s)
@@ -131,7 +131,7 @@ module Origen
131
131
  if @check_for_changes
132
132
  check_for_changes(output_file(file, options), reference_file(file, options),
133
133
  comment_char: Origen.app.tester ? Origen.app.tester.program_comment_char : nil,
134
- compile_job: true, ignore_blank_lines: options[:ignore_blank_lines])
134
+ compile_job: true, ignore_blank_lines: options[:ignore_blank_lines])
135
135
  end
136
136
  end
137
137
  end
@@ -179,9 +179,7 @@ module Origen
179
179
  # to get a hold of its internal scope
180
180
  unless b.is_a?(Binding)
181
181
  b.define_singleton_method :_get_binding do |local_opts, &_block|
182
- # rubocop:disable Lint/UselessAssignment
183
182
  options = local_opts
184
- # rubocop:enable Lint/UselessAssignment
185
183
  binding
186
184
  end
187
185
  # Here the global options, the ones visible right now, are passed to into the method defined above,
@@ -54,6 +54,7 @@ module Origen
54
54
  if !@pattern && !@output_file_body
55
55
  fail 'Sorry the output_pattern is not available until the job has been run'
56
56
  end
57
+
57
58
  body = @output_file_body ? @output_file_body : File.basename(@pattern, '.rb')
58
59
  output_prefix + body + output_postfix + split_number + output_extension
59
60
  end
@@ -155,7 +156,7 @@ module Origen
155
156
  else
156
157
  Origen.log.start_job(strip_dir_and_ext(@requested_pattern), :pattern_generator)
157
158
  end
158
- Origen.generator.pattern.reset # Resets the pattern controller ready for a new pattern
159
+ Origen.generator.pattern.reset # Resets the pattern controller ready for a new pattern
159
160
  # Give the app a chance to handle pattern dispatch
160
161
  skip = false
161
162
  Origen.app.listeners_for(:before_pattern_lookup).each do |listener|
@@ -190,7 +191,7 @@ module Origen
190
191
  @output_file_body = @pattern[:output]
191
192
  @pattern = @pattern[:pattern]
192
193
  end
193
- load @pattern unless @pattern == :skip # Run the pattern
194
+ load @pattern unless @pattern == :skip # Run the pattern
194
195
  end
195
196
  end
196
197
  end
@@ -245,7 +245,7 @@ module Origen
245
245
  #
246
246
  # @api private
247
247
  def reset
248
- $desc = nil # Clear the description
248
+ $desc = nil # Clear the description
249
249
  end
250
250
 
251
251
  private
@@ -267,7 +267,7 @@ module Origen
267
267
  # Creates a header and footer for the pattern based on the current tester and any supplied options
268
268
  def pattern_wrapper(iterators, args, options = {})
269
269
  pattern_open(options.merge(iterators: iterators, args: args))
270
- yield # Pass control back to the pattern source
270
+ yield # Pass control back to the pattern source
271
271
  pattern_close(options)
272
272
  end
273
273
 
@@ -400,7 +400,7 @@ module Origen
400
400
  injection = config_loc.config.send(scope).call({})
401
401
  if injection.nil?
402
402
  # Do nothing. It is assumed in this acase that the pattern header has not comments to add at this scope.
403
- return
403
+ nil
404
404
  elsif injection.is_a?(String)
405
405
  c2(' ' * message_spacing + message)
406
406
  c2(' ' * line_spacing + injection.to_s)
@@ -11,7 +11,7 @@ module Origen
11
11
  end
12
12
 
13
13
  name = File.basename(name)
14
- @requested_pattern = name # Remember what was originally asked for in case
14
+ @requested_pattern = name # Remember what was originally asked for in case
15
15
  # it needs to be output in an error message
16
16
 
17
17
  # Strip the prefix if exists
@@ -56,6 +56,7 @@ module Origen
56
56
  end
57
57
  end
58
58
  return :skip unless proceed_with_pattern?(name) # The application has elected not to run this pattern
59
+
59
60
  pats = matching_patterns(name)
60
61
  if pats.size == 0
61
62
  pats = all_matches(name)
@@ -132,20 +133,20 @@ module Origen
132
133
  if file_plugin
133
134
  if Origen.app.plugins.current
134
135
  if file_plugin == Origen.app.plugins.current.name
135
- return proceed_with_pattern?(path) ? path : :skip
136
+ proceed_with_pattern?(path) ? path : :skip
136
137
  elsif !options[:current_plugin]
137
138
  Origen.app.plugins.current.temporary = file_plugin
138
- return proceed_with_pattern?(path) ? path : :skip
139
+ proceed_with_pattern?(path) ? path : :skip
139
140
  else
140
141
  puts "The requested pattern is from plugin #{file_plugin} and current system plugin is set to plugin #{Origen.app.plugins.current.name}!"
141
142
  fail 'Incorrect plugin error!'
142
143
  end
143
144
  else
144
145
  Origen.app.plugins.current.temporary = file_plugin
145
- return proceed_with_pattern?(path) ? path : :skip
146
+ proceed_with_pattern?(path) ? path : :skip
146
147
  end
147
148
  else
148
- return proceed_with_pattern?(path) ? path : :skip
149
+ proceed_with_pattern?(path) ? path : :skip
149
150
  end
150
151
  end
151
152
 
@@ -89,6 +89,7 @@ module Origen
89
89
  end
90
90
  # Just continue if this thread is not in the list
91
91
  return unless ids.include?(current_thread.id)
92
+
92
93
  # If we have entered the same sync up point after having previously completed it,
93
94
  # then clear it and start again
94
95
  if @sync_ups[location] && @sync_ups[location][:completed]
@@ -139,6 +140,7 @@ module Origen
139
140
  # It should be possible to get an execution profile in these cases if someone were to invest the
140
141
  # time in it to workout why this variable is not set upstream in these cases.
141
142
  return unless @cycle_count_stop
143
+
142
144
  cycles_per_tick = (@cycle_count_stop / (line_size * 1.0)).ceil
143
145
  if tester.try(:sim?)
144
146
  execution_time = tester.execution_time_in_ns / 1_000_000_000.0
@@ -193,6 +195,7 @@ module Origen
193
195
 
194
196
  def pretty_time(time, number_decimal_places = 0)
195
197
  return '0' if time == 0
198
+
196
199
  if time < 1.us
197
200
  "%.#{number_decimal_places}fns" % (time * 1_000_000_000)
198
201
  elsif time < 1.ms
@@ -5,11 +5,11 @@ module Origen
5
5
  module Renderer
6
6
  def render(file, options = {}, &block)
7
7
  fail 'File argument is nil' unless file
8
+
8
9
  file = Origen.file_handler.clean_path_to_sub_template(file)
9
10
  current_pipeline << { file: file, options: options,
10
11
  placeholder: placeholder, block: block,
11
- indent: options[:indent] || 0
12
- }
12
+ indent: options[:indent] || 0 }
13
13
  if block_given?
14
14
  self.current_buffer += current_pipeline.last[:placeholder] + "\n"
15
15
  end
@@ -47,8 +47,7 @@ module Origen
47
47
  output = compile(current[:file],
48
48
  sub_template: true,
49
49
  block: current[:block],
50
- scope: @scope
51
- )
50
+ scope: @scope)
52
51
  if current[:indent] && current[:indent] > 0
53
52
  indent = ' ' * current[:indent]
54
53
  output = output.split("\n").map { |l| indent + l }.join("\n")
@@ -9,7 +9,7 @@ module Origen
9
9
  Origen.app.reload_target!
10
10
  Origen.tester.generating = :program
11
11
  sub_flow = @top_level
12
- @top_level = true unless @top_level
12
+ @top_level ||= true
13
13
  job.output_file_body = options.delete(:name).to_s if options[:name]
14
14
  if sub_flow
15
15
  interface = Origen.interface
@@ -19,8 +19,10 @@ module Origen
19
19
  i = current_bank.size - 1
20
20
  while offset >= 0
21
21
  return nil if i < 0
22
+
22
23
  unless current_bank[i].is_a?(String)
23
24
  return current_bank[i] if offset == 0
25
+
24
26
  offset -= 1
25
27
  end
26
28
  i -= 1
@@ -74,6 +76,7 @@ module Origen
74
76
 
75
77
  def current_bank
76
78
  return @vault[@bank] if @vault[@bank]
79
+
77
80
  @vault[@bank] = []
78
81
  end
79
82
 
@@ -1,7 +1,8 @@
1
1
  module Origen
2
2
  module Limits
3
3
  class Limit
4
- attr_accessor :expr, :value, :owner, :type
4
+ attr_accessor :expr, :owner, :type
5
+ attr_writer :value
5
6
 
6
7
  def initialize(expr, type, owner, options = {})
7
8
  @expr = expr
@@ -35,6 +36,7 @@ module Origen
35
36
  return owner.limits(ref).send(type).value
36
37
  # Check if the reference is to a power domain
37
38
  end
39
+
38
40
  if Origen.top_level.respond_to? :power_domains
39
41
  if Origen.top_level.power_domains.include? ref
40
42
  # Need to check the limit type and retrieve the appropriate value
@@ -52,9 +54,9 @@ module Origen
52
54
  # Need to check the limit type and retrieve the appropriate value
53
55
  case @type.to_s
54
56
  when /target|typ/
55
- return Origen.top_level.clocks(ref).freq_target
57
+ Origen.top_level.clocks(ref).freq_target
56
58
  else
57
- return Origen.top_level.clocks(ref).send(@type)
59
+ Origen.top_level.clocks(ref).send(@type)
58
60
  end
59
61
  end
60
62
  end
@@ -63,6 +65,7 @@ module Origen
63
65
  def evaluate_expr
64
66
  return @expr if @expr.is_a?(Numeric)
65
67
  return nil if @expr.nil?
68
+
66
69
  if @expr.is_a? Symbol
67
70
  @expr = ':' + @expr.to_s
68
71
  else
@@ -109,16 +112,16 @@ module Origen
109
112
  begin
110
113
  result = eval(@expr)
111
114
  return result.round(4) if result.is_a? Numeric
112
- rescue ::SyntaxError, ::NameError, ::TypeError
113
- Origen.log.debug "Limit '#{@expr}' had to be rescued, storing it as a #{@expr.class}"
114
- if @expr.is_a? Symbol
115
- return @expr
116
- else
117
- return "#{@expr}"
118
- end
115
+ rescue ::SyntaxError, ::NameError, ::TypeError
116
+ Origen.log.debug "Limit '#{@expr}' had to be rescued, storing it as a #{@expr.class}"
117
+ if @expr.is_a? Symbol
118
+ @expr
119
+ else
120
+ "#{@expr}"
121
+ end
119
122
  end
120
123
  else
121
- return result
124
+ result
122
125
  end
123
126
  end
124
127
  end
@@ -2,7 +2,8 @@ require_relative './limit'
2
2
  module Origen
3
3
  module Limits
4
4
  class LimitSet
5
- attr_accessor :id, :min, :typ, :max, :target, :description, :static, :owner, :type
5
+ attr_accessor :id, :description, :static, :owner, :type
6
+ attr_reader :min, :typ, :max, :target
6
7
 
7
8
  def initialize(id, owner, options)
8
9
  @id = id
data/lib/origen/loader.rb CHANGED
@@ -121,7 +121,7 @@ module Origen
121
121
  # as well unless disable_bug_inheritance or disable_feature_inheritance options are passed
122
122
  # Returns true if a model is found and loaded, otherwise nil.
123
123
  def self.load_block(model, options = {})
124
- model = model.model # Ensure we have a handle on the model and not its controller
124
+ model = model.model # Ensure we have a handle on the model and not its controller
125
125
  loaded = nil
126
126
 
127
127
  if options[:inherit]
@@ -139,7 +139,7 @@ module Origen
139
139
  local_full_paths = Array(options[:path])
140
140
  else
141
141
  local_full_paths = model.class.to_s.split('::')
142
- local_full_paths.shift # Throw away the app namespace
142
+ local_full_paths.shift # Throw away the app namespace
143
143
  local_full_paths = [local_full_paths.join('/')]
144
144
  end
145
145
  app_paths_map = { local_app => local_full_paths }
@@ -213,6 +213,7 @@ module Origen
213
213
  base.class_eval do
214
214
  # Emulate #exclude via an ivar
215
215
  return if defined?(@_const_missing) && @_const_missing
216
+
216
217
  @_const_missing = instance_method(:const_missing)
217
218
  remove_method(:const_missing)
218
219
  end
@@ -256,6 +257,7 @@ module Origen
256
257
  name = "#{self}::#{name}"
257
258
  end
258
259
  return nil if @_checking_name == name
260
+
259
261
  names = name.split('::')
260
262
  namespace = names.shift
261
263
  if app = Origen::Application.from_namespace(namespace)
data/lib/origen/log.rb CHANGED
@@ -55,6 +55,7 @@ module Origen
55
55
  unless LEVELS.include?(val)
56
56
  fail "Unknown log level, valid values are: #{LEVELS}"
57
57
  end
58
+
58
59
  # Map the log4r levels to our simplified 3 level system
59
60
  # log4r level order is DEBUG < INFO < WARN < ERROR < FATAL
60
61
  case val
@@ -291,9 +292,9 @@ module Origen
291
292
  def call_interceptor(interceptors, msg, type, options, &original)
292
293
  interceptor = interceptors.shift
293
294
  if interceptors.empty?
294
- func = -> (msg, type, options) { original.call(msg, type, options) }
295
+ func = ->(msg, type, options) { original.call(msg, type, options) }
295
296
  else
296
- func = -> (msg, type, options) { call_interceptor(interceptors, msg, type, options, &original) }
297
+ func = ->(msg, type, options) { call_interceptor(interceptors, msg, type, options, &original) }
297
298
  end
298
299
  interceptor.call(msg, type, options, func)
299
300
  end
data/lib/origen/memory.rb CHANGED
@@ -41,6 +41,7 @@ module Origen
41
41
  if @memory_width
42
42
  fail 'The memory width cannot be changed after a memory location has been referenced'
43
43
  end
44
+
44
45
  @memory_width = size
45
46
  else
46
47
  Origen.top_level.memory_width = size
data/lib/origen/model.rb CHANGED
@@ -114,11 +114,13 @@ module Origen
114
114
 
115
115
  def write_memory(*args)
116
116
  return super if defined?(super)
117
+
117
118
  write_register(*args)
118
119
  end
119
120
 
120
121
  def read_memory(*args)
121
122
  return super if defined?(super)
123
+
122
124
  read_register(*args)
123
125
  end
124
126
 
@@ -128,7 +130,7 @@ module Origen
128
130
 
129
131
  def wrap_in_controller
130
132
  c = Origen.controllers.find do |params|
131
- self.is_a?(params[:model_class]) if params[:model_class]
133
+ is_a?(params[:model_class]) if params[:model_class]
132
134
  end
133
135
  if c
134
136
  c = c[:controller_class].send(:allocate)
@@ -176,7 +178,7 @@ module Origen
176
178
  end
177
179
 
178
180
  def current_configuration
179
- if self.respond_to?(:configuration)
181
+ if respond_to?(:configuration)
180
182
  configuration
181
183
  end
182
184
  end
@@ -222,12 +224,14 @@ module Origen
222
224
  def current_mode
223
225
  if @current_mode
224
226
  return _modes[@current_mode] if _modes[@current_mode]
227
+
225
228
  fail "The mode #{@current_mode} of #{self.class} has not been defined!"
226
229
  else
227
230
  unless top_level?
228
231
  # Need to do this in case a class besides SubBlock includes Origen::Model
229
232
  obj_above_self = parent.nil? ? Origen.top_level : parent
230
233
  return nil if obj_above_self.nil?
234
+
231
235
  if obj_above_self.current_mode
232
236
  _modes[obj_above_self.current_mode.id] if _modes.include? obj_above_self.current_mode.id
233
237
  end
@@ -242,7 +246,7 @@ module Origen
242
246
  Origen.app.listeners_for(:on_mode_changed).each do |listener|
243
247
  listener.on_mode_changed(mode: @current_mode, instance: self)
244
248
  end
245
- @current_mode
249
+ @current_mode # rubocop:disable Lint/Void
246
250
  end
247
251
  alias_method :mode=, :current_mode=
248
252
 
@@ -308,7 +312,7 @@ module Origen
308
312
  def find_specs
309
313
  specs_found = []
310
314
  # Check for specs the object owns
311
- if self.respond_to? :specs
315
+ if respond_to? :specs
312
316
  object_specs = specs
313
317
  unless object_specs.nil?
314
318
  if object_specs.class == Origen::Specs::Spec
@@ -320,6 +324,7 @@ module Origen
320
324
  end
321
325
  sub_blocks.each do |_name, sb|
322
326
  next unless sb.respond_to? :specs
327
+
323
328
  child_specs = sb.specs
324
329
  unless child_specs.nil?
325
330
  if child_specs.class == Origen::Specs::Spec
@@ -340,6 +345,7 @@ module Origen
340
345
  obj.delete_all_exhibits
341
346
  obj.children.each do |_name, child|
342
347
  next unless child.has_specs?
348
+
343
349
  delete_all_specs_and_notes(child)
344
350
  end
345
351
  end
data/lib/origen/models.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Origen
2
2
  module Models
3
- autoload :ScanRegister, 'origen/models/scan_register'
4
- autoload :Mux, 'origen/models/mux'
3
+ autoload :ScanRegister, 'origen/models/scan_register'
4
+ autoload :Mux, 'origen/models/mux'
5
5
  end
6
6
  end
@@ -29,6 +29,7 @@ module Origen
29
29
  elsif bits.size == 0
30
30
  return undefined
31
31
  end
32
+
32
33
  bits.first
33
34
  end
34
35
 
@@ -4,13 +4,11 @@ module Origen
4
4
  autoload :Connectable, 'origen/netlist/connectable'
5
5
 
6
6
  def netlist
7
- @netlist ||= begin
8
- if netlist_top_level == self
9
- List.new(self)
10
- else
11
- netlist_top_level.netlist
12
- end
13
- end
7
+ @netlist ||= if netlist_top_level == self
8
+ List.new(self)
9
+ else
10
+ netlist_top_level.netlist
11
+ end
14
12
  end
15
13
 
16
14
  def netlist_top_level
@@ -89,7 +89,7 @@ module Origen
89
89
  private
90
90
 
91
91
  def debugger
92
- ::Kernel.debugger
92
+ ::Kernel.debugger # rubocop:disable Lint/Debugger
93
93
  end
94
94
 
95
95
  def default_org_file_captures
@@ -8,12 +8,14 @@ module Origen
8
8
  if @internal_new
9
9
  super
10
10
  else
11
- open(*args, &block)
11
+ # Kernel#open is a serious security risk
12
+ open(*args, &block) # rubocop:disable Security/Open
12
13
  end
13
14
  end
14
15
 
15
16
  def open(id, options = {})
16
17
  fail "An org_file is already open with id: #{id}" if open_files[id]
18
+
17
19
  @internal_new = true
18
20
  f = OrgFile.new(id, options)
19
21
  @internal_new = nil
@@ -28,6 +30,7 @@ module Origen
28
30
 
29
31
  def close(id, options = {})
30
32
  fail "An org_file with this ID has not been opened id: #{id}" unless open_files[id]
33
+
31
34
  open_files[id].close unless options[:_internal_org_file_call_]
32
35
  open_files.delete(id)
33
36
  end
@@ -115,6 +115,7 @@ module Origen
115
115
 
116
116
  def defining?
117
117
  return true if Origen::Parameters.transaction_open
118
+
118
119
  if top_level?
119
120
  @defining
120
121
  else
@@ -88,6 +88,7 @@ module Origen
88
88
  unless valid
89
89
  fail 'Invalid parameters context, must be :top or a string path to a model object'
90
90
  end
91
+
91
92
  @parameters_context = obj
92
93
  else
93
94
  @parameters_context
@@ -136,6 +137,7 @@ module Origen
136
137
  redefine_children.each { |model, set_name| Origen::Parameters.redefine(model, set_name) }
137
138
  end
138
139
  end
140
+
139
141
  _parameter_sets[name]
140
142
  end
141
143
  alias_method :define_parameters, :define_params
@@ -231,7 +233,7 @@ module Origen
231
233
  end
232
234
  end
233
235
  if param_context[:obj]._parameter_sets.key?(param_context[:context])
234
- return param_context
236
+ param_context
235
237
  else
236
238
  puts "Unknown parameter set :#{param_context[:context]} requested for #{param_context[:obj].class}, these are the valid sets:"
237
239
  param_context[:obj]._parameter_sets.keys.each { |k| puts " :#{k}" }