Class: OrigenTesters::IGXLBasedTester::Base::DCSpecsets

Inherits:
Object
  • Object
show all
Includes:
Generator
Defined in:
lib/origen_testers/igxl_based_tester/base/dc_specsets.rb

Direct Known Subclasses

UltraFLEX::DCSpecsets

Constant Summary collapse

OUTPUT_PREFIX =
'SpecsDC'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Generator

#close, #collection, #collection=, #compiler, #current_dir, #dont_diff=, execute_source, #file_extension, #file_pipeline, #filename, #filename=, #finalize, #identity_map, #import, #inhibit_output, #name, #on_close, original_reference_file, original_reference_file=, #output_file, #output_inhibited?, #platform, #reference_file, #render, #set_flow_description, #stats, #to_be_written?, #write_from_template, #write_to_file

Constructor Details

#initializeDCSpecsets

OUTPUT_POSTFIX = ‘SpecsDC’



13
14
15
16
17
18
19
# File 'lib/origen_testers/igxl_based_tester/base/dc_specsets.rb', line 13

def initialize # :nodoc:
  ## Hash Autovivification
  l = ->(h, k) { h[k] = Hash.new(&l) }

  @dc_specs = []
  @dc_specsets = Hash.new(&l)
end

Instance Attribute Details

#dc_specsObject

Returns the value of attribute dc_specs.



7
8
9
# File 'lib/origen_testers/igxl_based_tester/base/dc_specsets.rb', line 7

def dc_specs
  @dc_specs
end

#dc_specsetsObject

Returns the value of attribute dc_specsets.



8
9
10
# File 'lib/origen_testers/igxl_based_tester/base/dc_specsets.rb', line 8

def dc_specsets
  @dc_specsets
end

Instance Method Details

#add(spec, attrs = {}) ⇒ Object

Assigns a DC spec value object to the given variable for this specset

The attrs hash is expected to defined as follows:
  attrs = {
    specset:  :specset_name,    # if not defined, specset = :default
                                # Spec selectors that contain both the scope and value of the spec
    nom:      { typ:  1.8 },    # typ is an example of the UFlex scope, nom is the spec selector
    min:      { min:  1.7 },    # Users can defined any number of selectors in this fashion
    max:      { max:  1.9 }
  }


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/origen_testers/igxl_based_tester/base/dc_specsets.rb', line 30

def add(spec, attrs = {})
  attrs = {
    specset: :default
  }.merge(attrs)

  specset = attrs.delete(:specset)

  @dc_specs << spec unless @dc_specs.include?(spec)

  attrs.each do |selector, value|
    @dc_specsets[specset][spec][selector] = value
  end
end

#format_uflex_dc_spec(data, options = {}) ⇒ Object

Prepare the spec information for file output



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/origen_testers/igxl_based_tester/base/dc_specsets.rb', line 45

def format_uflex_dc_spec(data, options = {})
  options = {
    spec: nil
  }.update(options)

  case options[:spec]
  when /(voh|vol|vt|vcl|vch|vdd)/i
    spec_type = 'volt'
  when /(ioh|iol)/i
    spec_type = 'curr'
  else
    spec_type = nil
  end

  case data
  when NilClass
    data_new = 0
  when Fixnum, Float
    case
    when data == 0
      data_new = data.to_s
    when data.abs < 1e-6
      data_new = (data * 1_000_000_000).round(4).to_s + '*nV' if spec_type == 'volt'
      data_new = (data * 1_000_000_000).round(4).to_s + '*nA' if spec_type == 'curr'
      data_new = data.to_s if spec_type.nil?
    when data.abs < 1e-3
      data_new = (data * 1_000_000).round(4).to_s + '*uV' if spec_type == 'volt'
      data_new = (data * 1_000_000).round(4).to_s + '*uA' if spec_type == 'curr'
      data_new = data.to_s if spec_type.nil?
    when data.abs < 1
      data_new = data.to_s + '*V' if spec_type == 'volt'
      data_new = (data * 1_000).round(4).to_s + '*mA' if spec_type == 'curr'
      data_new = data.to_s if spec_type.nil?
    else
      data_new = data.to_s + '*V' if spec_type == 'volt'
      data_new = data.to_s + '*A' if spec_type == 'curr'
      data_new = data.to_s if spec_type.nil?
    end
    data_new = data_new.gsub(/^/, '=')
  when String
    data_new = data.gsub(/^/, '=').gsub(/(\W)([a-zA-Z])/, '\1_\2')
    # Remove underscores from unit designations
    data_new.gsub!(/(\W)_(nV|uV|mV|V|nA|uA|mA|A)(\W)/i, '\1\2\3')
    data_new.gsub!(/(\W)_(nV|uV|mV|V|nA|uA|mA|A)$/i, '\1\2')
  else
    Origen.log.error "Unknown class type (#{data.class}) for spec value:  #{data}"
    fail
  end
  data_new
end