Class: OrigenTesters::Charz::SearchRoutine
- Defined in:
- lib/origen_testers/charz/routines/search_routine.rb
Overview
a 1D search routine
Instance Attribute Summary collapse
-
#res ⇒ Numeric
Search resolution.
-
#spec ⇒ Numeric
Spec parameter to be searched.
-
#start ⇒ Numeric
Search start value.
-
#stop ⇒ Numeric
Search stop value.
Attributes inherited from Routine
Instance Method Summary collapse
- #attrs_ok? ⇒ Boolean
-
#initialize(id, options = {}, &block) ⇒ SearchRoutine
constructor
Runs the same initialization as Routine performs some rudimentary quality checks, which can be disabled by setting @quality_check = false.
Methods inherited from Routine
Constructor Details
#initialize(id, options = {}, &block) ⇒ SearchRoutine
Runs the same initialization as Routine performs some rudimentary quality checks, which can be disabled by setting @quality_check = false
17 18 19 20 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 17 def initialize(id, = {}, &block) super attrs_ok? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OrigenTesters::Charz::Routine
Instance Attribute Details
#res ⇒ Numeric
Returns search resolution.
13 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 13 attr_accessor :start, :stop, :res, :spec |
#spec ⇒ Numeric
Returns spec parameter to be searched.
13 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 13 attr_accessor :start, :stop, :res, :spec |
#start ⇒ Numeric
Returns search start value.
13 14 15 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 13 def start @start end |
#stop ⇒ Numeric
Returns search stop value.
13 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 13 attr_accessor :start, :stop, :res, :spec |
Instance Method Details
#attrs_ok? ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/origen_testers/charz/routines/search_routine.rb', line 22 def attrs_ok? return if @quality_check == false @required_attrs ||= [:start, :stop, :res, :spec] attrs = @required_attrs.map { |attr| instance_variable_get("@#{attr}") } if attrs.compact.size != @required_attrs.size Origen.log.error "SearchRoutine #{@id}: unspecified attributes, each of #{@required_attrs} must have a value" fail end return if @attr_value_check == false if [@start, @stop, @res].all? { |attr| attr.is_a? Numeric } unless @res <= (@start - @stop).abs Origen.log.error "SearchRoutine #{@id}: Search resolution (#{@res}) is larger than the search range: #{(@start - @stop).abs}" fail end end end |