Class: OrigenTesters::IGXLBasedTester::Base::ACSpecsets

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

Direct Known Subclasses

UltraFLEX::ACSpecsets

Constant Summary collapse

OUTPUT_PREFIX =
'SpecsAC'

Instance Attribute Summary collapse

Attributes included from Generator

#output_directory

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

#initializeACSpecsets

OUTPUT_POSTFIX = 'SpecsAC'



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

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

  @ac_specs = []
  @ac_specsets = Hash.new(&l)
end

Instance Attribute Details

#ac_specsObject

Returns the value of attribute ac_specs.



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

def ac_specs
  @ac_specs
end

#ac_specsetsObject

Returns the value of attribute ac_specsets.



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

def ac_specsets
  @ac_specsets
end

Instance Method Details

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

Assigns an AC 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/ac_specsets.rb', line 30

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

  specset = attrs.delete(:specset)

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

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

#format_uflex_ac_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
# File 'lib/origen_testers/igxl_based_tester/base/ac_specsets.rb', line 45

def format_uflex_ac_spec(data, options = {})
  case data
  when NilClass
    data_new = 0
  when Fixnum, Float
    case
    when data == 0
      data_new = data.to_s
    when data.abs < 1e-9
      data_new = (data * 1_000_000_000_000).round(4).to_s + '*ps'
    when data.abs < 1e-6
      data_new = (data * 1_000_000_000).round(4).to_s + '*ns'
    when data.abs < 1e-3
      data_new = (data * 1_000_000).round(4).to_s + '*us'
    when data.abs < 1
      data_new = (data * 1_000).round(4).to_s + '*ms'
    else
      data_new = data.to_s
    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)_(nS|uS|mS|S)(\W)/i, '\1\2\3')
    data_new.gsub!(/(\W)_(nS|uS|mS|S)$/i, '\1\2')
  else
    Origen.log.error "Unknown class type (#{data.class}) for spec value:  #{data}"
    fail
  end
  data_new
end