Class: OrigenTesters::IGXLBasedTester::Base::GlobalSpecs
- Inherits:
-
Object
- Object
- OrigenTesters::IGXLBasedTester::Base::GlobalSpecs
- Includes:
- Generator
- Defined in:
- lib/origen_testers/igxl_based_tester/base/global_specs.rb
Direct Known Subclasses
Constant Summary collapse
- OUTPUT_PREFIX =
'SpecsGlobal'
Instance Attribute Summary collapse
-
#global_specs ⇒ Object
Returns the value of attribute global_specs.
Instance Method Summary collapse
-
#add(spec, attrs = {}) ⇒ Object
Assigns a global spec value object to the given variable The attrs hash is expected to defined as follows: attrs = { job: nil, value: 0 }.
-
#format_uflex_global_spec(data, options = {}) ⇒ Object
Prepare the spec information for file output.
-
#initialize ⇒ GlobalSpecs
constructor
OUTPUT_POSTFIX = ‘SpecsGlobal’.
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
#initialize ⇒ GlobalSpecs
OUTPUT_POSTFIX = ‘SpecsGlobal’
12 13 14 15 16 |
# File 'lib/origen_testers/igxl_based_tester/base/global_specs.rb', line 12 def initialize # :nodoc: ## Hash Autovivification l = ->(h, k) { h[k] = Hash.new(&l) } @global_specs = Hash.new(&l) end |
Instance Attribute Details
#global_specs ⇒ Object
Returns the value of attribute global_specs.
7 8 9 |
# File 'lib/origen_testers/igxl_based_tester/base/global_specs.rb', line 7 def global_specs @global_specs end |
Instance Method Details
#add(spec, attrs = {}) ⇒ Object
Assigns a global spec value object to the given variable
The attrs hash is expected to defined as follows:
attrs = {
job: nil,
value: 0
}
24 25 26 27 28 29 30 31 |
# File 'lib/origen_testers/igxl_based_tester/base/global_specs.rb', line 24 def add(spec, attrs = {}) attrs = { job: :nil, value: 0 }.merge(attrs) @global_specs[spec][attrs.delete(:job)] = attrs end |
#format_uflex_global_spec(data, options = {}) ⇒ Object
Prepare the spec information for file output
34 35 36 37 38 39 40 41 42 43 44 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 |
# File 'lib/origen_testers/igxl_based_tester/base/global_specs.rb', line 34 def format_uflex_global_spec(data, = {}) = { spec: nil }.update() case [:spec] when /fgb_/i spec_type = 'freq' when /vgb_/i spec_type = 'volt' 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.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.to_s if spec_type.nil? when data.abs < 1 data_new = (data * 1_000).round(4).to_s + '*mV' if spec_type == 'volt' 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 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 |