Class: Origen::Tester::V93K::Generator::TestFunction
- Defined in:
- lib/origen/tester/v93k/generator/test_function.rb
Constant Summary collapse
- ATTRS =
When defining attributes of a given test function here they must be defined in the correct order
{ functional: [], general_pmu: %w(pins force_units force clamp_units clamp precharge_units precharge pass_min_units pass_min pass_max_units pass_max settling_time_units settling_time test_system_state term output_string mode ) }
- ALIASES =
{ desc: :description, general_pmu: { state: :test_system_state } }
- DEFAULTS =
{ description: 'A test function generated by Origen' }
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, attrs = {}) ⇒ TestFunction
constructor
A new instance of TestFunction.
-
#lines ⇒ Object
Returns the fully formatted lines (an array) that should be inserted into a flow sheet to include this test function.
- #parameter_string ⇒ Object
Constructor Details
#initialize(name, type, attrs = {}) ⇒ TestFunction
Returns a new instance of TestFunction.
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 |
# File 'lib/origen/tester/v93k/generator/test_function.rb', line 47 def initialize(name, type, attrs = {}) @type = type self.name = name # Build the type specific attribute accessors ATTRS[@type.to_sym].each do |method| define_singleton_method("#{method}=") do |v| instance_variable_set("@#{method}".to_sym, v) end define_singleton_method("#{method}") do instance_variable_get("@#{method}".to_sym) end end # Build the type specific accessors (aliases) if ALIASES[@type.to_sym] ALIASES[@type.to_sym].each do |_alias, val| define_singleton_method("#{_alias}=") do |v| send("#{val}=", v) end define_singleton_method("#{_alias}") do send(val) end end end # Set the defaults DEFAULTS.each do |key, val| send("#{key}=", val) unless val.is_a?(Hash) end if DEFAULTS[@type.to_sym] DEFAULTS[@type.to_sym].each do |k, v| send("#{k}=", v) end end # Then the values that have been supplied attrs.each do |k, v| m = "#{k}=" send(m, v) if self.respond_to?(m) end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/origen/tester/v93k/generator/test_function.rb', line 6 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/origen/tester/v93k/generator/test_function.rb', line 6 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/origen/tester/v93k/generator/test_function.rb', line 6 def type @type end |
Instance Method Details
#lines ⇒ Object
Returns the fully formatted lines (an array) that should be inserted into a flow sheet to include this test function
88 89 90 91 92 93 94 |
# File 'lib/origen/tester/v93k/generator/test_function.rb', line 88 def lines [ "#{name}:", "testfunction_description = \"#{description}\";", "testfunction_parameters = \"#{type};#{parameter_string}\";" ] end |