Class: OrigenTesters::SmartestBasedTester::V93K_SMT8::ShmooTestAxis

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/smartest_based_tester/v93k_smt8/shmoo_test.rb

Constant Summary collapse

ATTRS =
%w(
  name

  resource_type
  resource_name
  setup_signal

  range_resolution
  range_steps
  range_fast_steps
  range_scale
  range_list
  range_start
  range_stop
  range_relative_percentage_start
  range_relative_percentage_stop
  range_relative_value_start
  range_relative_value_stop
  tracking
)
ALIASES =
{
  resolution: :range_resolution,
  steps:      :range_steps,
  fast_steps: :range_fast_steps
}

Instance Method Summary collapse

Constructor Details

#initialize(name, attrs = {}) ⇒ ShmooTestAxis

Returns a new instance of ShmooTestAxis.



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/origen_testers/smartest_based_tester/v93k_smt8/shmoo_test.rb', line 185

def initialize(name, attrs = {})
  @name = name

  @resource_type = attrs.delete(:resource_type)
  @resource_name = attrs.delete(:resource_name)
  @setup_signal = attrs.delete(:setup_signal)

  if range_list = attrs.delete(:range_list)
    @range_list = range_list
  elsif attrs[:range] && attrs[:range].is_a?(Array)
    @range_list = attrs.delete(:range)
  else
    if range = attrs.delete(:range)
      if range.is_a?(Range)
        @range_start = range.begin
        @range_stop = range.end
        @range_steps = attrs.delete(:range_steps) || attrs.delete(:steps)
        @range_resolution = attrs.delete(:range_resolution) || attrs.delete(:resolution)
        @range_fast_steps = attrs.delete(:range_fast_steps) || attrs.delete(:fast_steps)
      elsif range.is_a?(Hash)
        @range_start = range[:start]
        @range_stop = range[:stop]
        @range_steps = range[:steps]
        @range_resolution = range[:resolution]
        @range_fast_steps = range[:fast_steps]
      end
    elsif range_relative_percentage = attrs.delete(:range_relative_percentage)
      if range_relative_percentage.is_a?(Range)
        @range_relative_percentage_start = range_relative_percentage.begin
        @range_relative_percentage_stop = range_relative_percentage.end
        @range_steps = attrs.delete(:range_steps) || attrs.delete(:steps)
        @range_resolution = attrs.delete(:range_resolution) || attrs.delete(:resolution)
        @range_fast_steps = attrs.delete(:range_fast_steps) || attrs.delete(:fast_steps)
      elsif range_relative_percentage.is_a?(Hash)
        @range_relative_percentage_start = range_relative_percentage[:start]
        @range_relative_percentage_stop = range_relative_percentage[:stop]
        @range_steps = range_relative_percentage[:steps]
        @range_resolution = range_relative_percentage[:resolution]
        @range_fast_steps = range_relative_percentage[:fast_steps]
      end
    elsif range_relative_value = attrs.delete(:range_relative_value)
      if range_relative_value.is_a?(Range)
        @range_relative_value_start = range_relative_value.begin
        @range_relative_value_stop = range_relative_value.end
        @range_steps = attrs.delete(:range_steps) || attrs.delete(:steps)
        @range_resolution = attrs.delete(:range_resolution) || attrs.delete(:resolution)
        @range_fast_steps = attrs.delete(:range_fast_steps) || attrs.delete(:fast_steps)
      elsif range_relative_value.is_a?(Hash)
        @range_relative_value_start = range_relative_value[:start]
        @range_relative_value_stop = range_relative_value[:stop]
        @range_steps = range_relative_value[:steps]
        @range_resolution = range_relative_value[:resolution]
        @range_fast_steps = range_relative_value[:fast_steps]
      end
    else
      attrs.each do |k, v|
        send("#{k}=", v) if respond_to?("#{k}=") && k.to_sym != :name
      end
    end
  end

  if tracking = attrs.delete(:tracking)
    tracking = [tracking] unless tracking.is_a?(Array)
    tracking.each_with_index do |t, i|
      tname = t.delete(:name) || "tracking#{i + 1}"
      if trackings_names.include?(tname.to_sym)
        fail "Tracking name #{tname} is already used in shmoo test axis '#{@name}'"
      end
      trackings << ShmooTestTracking.new(tname.to_sym, t)
    end
  end

  attrs.each do |k, v|
    send("#{k}=", v) if respond_to?("#{k}=") && k.to_sym != :name
  end
end

Instance Method Details

#linesObject



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/origen_testers/smartest_based_tester/v93k_smt8/shmoo_test.rb', line 262

def lines
  l = []
  l << "    axis [#{name}] = {"
  if resource_type
    l << "        resourceType = #{resource_type};"
  else
    fail 'Shmoo Axis must have a resource type'
  end
  if resource_name
    l << "        resourceName = \"#{resource_name}\";"
  else
    fail 'Shmoo Axis must have a resource name'
  end
  l << "        setup_signal = \"#{setup_signal}\";" if setup_signal
  if range_list
    l << "        range.list = \#[#{range_list.map(&:to_s).join(',')}];"
  elsif range_start && range_stop
    l << "        range.start = #{range_start};"
    l << "        range.stop = #{range_stop};"
  elsif range_relative_percentage_start && range_relative_percentage_stop
    l << "        range.relativePercentage.start = #{range_relative_percentage_start};"
    l << "        range.relativePercentage.stop = #{range_relative_percentage_stop};"
  elsif range_relative_value_start && range_relative_value_stop
    l << "        range.relativeValue.start = #{range_relative_value_start};"
    l << "        range.relativeValue.stop = #{range_relative_value_stop};"
  else
    fail 'Shmoo Axis must have a range (start & stop) or range list'
  end
  if range_resolution && range_steps.nil?
    l << "        range.resolution = #{range_resolution};"
    if range_fast_steps
      fail 'Shmoo Axis cannot have range fast steps with range resolution'
    end
  elsif range_steps && range_resolution.nil?
    l << "        range.steps = #{range_steps};"
    if range_fast_steps
      l << "        range.fastSteps = #{range_fast_steps};"
    end
  elsif range_resolution.nil? && range_steps.nil?
    fail 'Shmoo Axis must define either range resolution or range steps'
  else
    fail 'Shmoo Axis must define either range resolution or range steps, but not both'
  end
  l << '' if trackings.length > 0
  trackings.each do |t|
    t.lines.each do |tl|
      l << tl
    end
  end

  l << '    };'
  l
end

#trackingsObject



316
317
318
# File 'lib/origen_testers/smartest_based_tester/v93k_smt8/shmoo_test.rb', line 316

def trackings
  @trackings ||= []
end

#trackings_namesObject



320
321
322
# File 'lib/origen_testers/smartest_based_tester/v93k_smt8/shmoo_test.rb', line 320

def trackings_names
  trackings.map(&:name)
end