Class: OrigenTesters::IGXLBasedTester::Base::TestInstance
- Inherits:
-
Object
- Object
- OrigenTesters::IGXLBasedTester::Base::TestInstance
- Defined in:
- lib/origen_testers/igxl_based_tester/base/test_instance.rb
Direct Known Subclasses
J750::TestInstance, J750_HPT::TestInstance, UltraFLEX::TestInstance
Instance Attribute Summary collapse
-
#append_version ⇒ Object
Returns the value of attribute append_version.
-
#finalize ⇒ Object
Returns the value of attribute finalize.
-
#index ⇒ Object
Returns the value of attribute index.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#type ⇒ Object
Returns the value of attribute type.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
- .attrs ⇒ Object
- .define ⇒ Object
- .new_apmu_powersupply(name, attrs = {}) ⇒ Object
- .new_board_pmu(name, attrs = {}) ⇒ Object
- .new_empty(name, attrs = {}) ⇒ Object
- .new_functional(name, attrs = {}) ⇒ Object
- .new_mto_memory(name, attrs = {}) ⇒ Object
- .new_pin_pmu(name, attrs = {}) ⇒ Object
Instance Method Summary collapse
- #==(other_instance) ⇒ Object
-
#fimv? ⇒ Boolean
Returns true if instance configured for force current, measure voltage.
-
#fvmi? ⇒ Boolean
Returns true if instance configured for force voltage, measure current.
-
#initialize(name, type, attrs = {}) ⇒ TestInstance
constructor
A new instance of TestInstance.
- #inspect ⇒ Object
- #name ⇒ Object (also: #test_name)
- #name=(val) ⇒ Object
-
#set_hi_limit(lim) ⇒ Object
(also: #hi_limit=)
Set and enable the hi limit of a parametric test instance, passing in nil or false as the lim parameter will disable the hi limit.
-
#set_irange(r = nil, options = {}) ⇒ Object
Set the current range of the test instance, the following are valid:.
-
#set_lo_limit(lim) ⇒ Object
(also: #lo_limit=)
Set and enable the hi limit of a parametric test instance, passing in nil or false as the lim parameter will disable the hi limit.
-
#set_measure_mode(mode) ⇒ Object
Set the meaure mode of a parametric test instance, either: * :voltage / :fimv * :current / :fvmi.
-
#set_pre_charge(val) ⇒ Object
(also: #set_precharge)
Set and enable the pre-charge voltage of a parametric test instance.
-
#set_vrange(r = nil, options = {}) ⇒ Object
Set the voltage range of the test instance, the following are valid:.
-
#set_wait_flags(*flags) ⇒ Object
Set the cpu wait flags for the given test instance instance.set_wait_flags(:a) instance.set_wait_flags(:a, :c).
-
#to_meta ⇒ Object
Returns a hash containing key meta data about the test instance, this is intended to be used in documentation.
-
#to_s(override_name = nil) ⇒ Object
Returns the fully formatted test instance for insertion into an instance sheet.
- #unversioned_name ⇒ Object
Constructor Details
#initialize(name, type, attrs = {}) ⇒ TestInstance
Returns a new instance of TestInstance.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 48 def initialize(name, type, attrs = {}) @meta = {} @type = type @append_version = true self.name = name # Build the type specific accessors (aliases) self.class::TEST_INSTANCE_ALIASES[@type.to_sym].each do |_alias, val| define_singleton_method("#{_alias}=") do |v| send("#{val}=", v) if self.respond_to?("#{val}=", v) end define_singleton_method("#{_alias}") do send(val) if self.respond_to?(val) end end # Set the defaults self.class::TEST_INSTANCE_DEFAULTS[@type.to_sym].each do |k, v| send("#{k}=", v) if self.respond_to?("#{k}=", v) end # Then the values that have been supplied attrs.each do |k, v| send("#{k}=", v) if self.respond_to?("#{k}=", v) end end |
Instance Attribute Details
#append_version ⇒ Object
Returns the value of attribute append_version.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def append_version @append_version end |
#finalize ⇒ Object
Returns the value of attribute finalize.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def finalize @finalize end |
#index ⇒ Object
Returns the value of attribute index.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def index @index end |
#meta ⇒ Object
Returns the value of attribute meta.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def @meta end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def type @type end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 5 def version @version end |
Class Method Details
.attrs ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 36 def self.attrs @attrs ||= begin attrs = self::TEST_INSTANCE_ATTRS.dup self::TEST_INSTANCE_EXTRA_ARGS.times do |i| attrs << "arg#{i}" end attrs << 'comment' attrs end end |
.define ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 7 def self.define # Generate accessors for all attributes and their aliases attrs.each do |attr| writer = "#{attr}=".to_sym reader = attr.to_sym attr_reader attr.to_sym unless method_defined? reader attr_writer attr.to_sym unless method_defined? writer end # Define the common aliases now, the instance type specific ones will # be created when the instance type is known self::TEST_INSTANCE_ALIASES.each do |_alias, val| writer = "#{_alias}=".to_sym reader = _alias.to_sym unless val.is_a? Hash unless method_defined? writer define_method("#{_alias}=") do |v| send("#{val}=", v) end end unless method_defined? reader define_method("#{_alias}") do send(val) end end end end end |
.new_apmu_powersupply(name, attrs = {}) ⇒ Object
131 132 133 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 131 def self.new_apmu_powersupply(name, attrs = {}) new(name, :apmu_powersupply, attrs) end |
.new_board_pmu(name, attrs = {}) ⇒ Object
123 124 125 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 123 def self.new_board_pmu(name, attrs = {}) new(name, :board_pmu, attrs) end |
.new_empty(name, attrs = {}) ⇒ Object
115 116 117 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 115 def self.new_empty(name, attrs = {}) new(name, :empty, attrs) end |
.new_functional(name, attrs = {}) ⇒ Object
119 120 121 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 119 def self.new_functional(name, attrs = {}) new(name, :functional, attrs) end |
.new_mto_memory(name, attrs = {}) ⇒ Object
135 136 137 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 135 def self.new_mto_memory(name, attrs = {}) new(name, :mto_memory, attrs) end |
.new_pin_pmu(name, attrs = {}) ⇒ Object
127 128 129 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 127 def self.new_pin_pmu(name, attrs = {}) new(name, :pin_pmu, attrs) end |
Instance Method Details
#==(other_instance) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 101 def ==(other_instance) self.class == other_instance.class && unversioned_name.to_s == other_instance.unversioned_name.to_s && self.class.attrs.all? do |attr| # Exclude test name, already examined above and don't want to include # the version in the comparison if attr == 'test_name' true else send(attr) == other_instance.send(attr) end end end |
#fimv? ⇒ Boolean
Returns true if instance configured for force current, measure voltage
347 348 349 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 347 def fimv? measure_mode == 1 end |
#fvmi? ⇒ Boolean
Returns true if instance configured for force voltage, measure current
352 353 354 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 352 def fvmi? measure_mode == 0 end |
#inspect ⇒ Object
97 98 99 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 97 def inspect "<TestInstance: #{name}, Type: #{type}>" end |
#name ⇒ Object Also known as: test_name
152 153 154 155 156 157 158 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 152 def name if version && @append_version "#{@test_name}_v#{version}" else @test_name.to_s end end |
#name=(val) ⇒ Object
161 162 163 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 161 def name=(val) self.test_name = val end |
#set_hi_limit(lim) ⇒ Object Also known as: hi_limit=
Set and enable the hi limit of a parametric test instance, passing in nil or false as the lim parameter will disable the hi limit.
191 192 193 194 195 196 197 198 199 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 191 def set_hi_limit(lim) if lim self.hi_lo_limit_valid = hi_lo_limit_valid | 2 self.hi_limit = lim else self.hi_lo_limit_valid = hi_lo_limit_valid & 1 end self end |
#set_irange(r = nil, options = {}) ⇒ Object
Set the current range of the test instance, the following are valid:
Board PMU
-
2uA
-
20uA
-
200uA
-
2mA
-
20mA
-
200mA
-
:smart
Pin PMU
-
200nA
-
2uA
-
20uA
-
200uA
-
2mA
-
:auto
-
:smart
Examples
instance.set_irange(:smart)
instance.set_irange(:ua => 2)
instance.set_irange(2.uA) # Same as above
instance.set_irange(:ma => 200)
instance.set_irange(0.2) # Same as above
instance.set_irange(:a => 0.2) # Same as above
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 242 def set_irange(r = nil, = {}) r, = nil, r if r.is_a?(Hash) unless r if r = .delete(:na) || .delete(:nA) r = r / 1_000_000_000 elsif r = .delete(:ua) || .delete(:uA) r = r / 1_000_000.0 elsif r = .delete(:ma) || .delete(:mA) r = r / 1000.0 elsif r = .delete(:a) || .delete(:A) else fail "Can't determine requested irange!" end end if @type == :board_pmu if r == :smart self.irange = 6 else self.irange = case when r > 0.02 then 5 when r > 0.002 then 4 when r > 0.0002 then 3 when r > 0.00002 then 2 when r > 0.000002 then 1 else 0 end end else # :pin_pmu if r == :smart self.irange = 5 elsif r == :auto fail 'Auto range not available in FIMV mode!' if self.fimv? self.irange = 6 else if fimv? self.irange = case when r > 0.0002 then 2 else 4 end else self.irange = case when r > 0.0002 then 2 when r > 0.00002 then 4 when r > 0.000002 then 0 when r > 0.0000002 then 1 else 3 end end end end self end |
#set_lo_limit(lim) ⇒ Object Also known as: lo_limit=
Set and enable the hi limit of a parametric test instance, passing in nil or false as the lim parameter will disable the hi limit.
204 205 206 207 208 209 210 211 212 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 204 def set_lo_limit(lim) if lim self.hi_lo_limit_valid = hi_lo_limit_valid | 1 self.lo_limit = lim else self.hi_lo_limit_valid = hi_lo_limit_valid & 2 end self end |
#set_measure_mode(mode) ⇒ Object
Set the meaure mode of a parametric test instance, either:
-
:voltage / :fimv
-
:current / :fvmi
336 337 338 339 340 341 342 343 344 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 336 def set_measure_mode(mode) if mode == :current || mode == :fvmi self.measure_mode = 0 elsif mode == :voltage || mode == :fimv self.measure_mode = 1 else fail "Unknown measure mode: #{mode}" end end |
#set_pre_charge(val) ⇒ Object Also known as: set_precharge
Set and enable the pre-charge voltage of a parametric test instance.
178 179 180 181 182 183 184 185 186 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 178 def set_pre_charge(val) if val self.pre_charge_enable = 1 self.pre_charge = val else self.pre_charge_enable = 0 end self end |
#set_vrange(r = nil, options = {}) ⇒ Object
Set the voltage range of the test instance, the following are valid:
Board PMU
-
2V
-
5V
-
10V
-
24V
-
:auto
-
:smart
Examples
instance.set_vrange(:auto)
instance.set_vrange(:v => 5)
instance.set_vrange(5) # Same as above
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 312 def set_vrange(r = nil, = {}) r, = nil, r if r.is_a?(Hash) if r == :smart self.vrange = 4 elsif r == :auto self.vrange = 5 elsif !r if r = .delete(:v) || .delete(:V) else fail "Can't determine requested vrange!" end end self.vrange = case when r > 10 then 3 when r > 5 then 2 when r > 2 then 1 else 0 end self end |
#set_wait_flags(*flags) ⇒ Object
Set the cpu wait flags for the given test instance
instance.set_wait_flags(:a)
instance.set_wait_flags(:a, :c)
172 173 174 175 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 172 def set_wait_flags(*flags) # This method is tester-specific and must be overridden by the child class fail 'The #{self.class} class has not defined a set_wait_flags method!' end |
#to_meta ⇒ Object
Returns a hash containing key meta data about the test instance, this is intended to be used in documentation
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 74 def m = { 'Test' => name, 'Type' => type } if type == :functional m['Pattern'] = pattern elsif type == :board_pmu || type == :pin_pmu m['Measure'] = fvmi? ? 'current' : 'voltage' if hi_lo_limit_valid & 2 != 0 m['Hi'] = hi_limit end if hi_lo_limit_valid & 1 != 0 m['Lo'] = lo_limit end if force_cond m['Force'] = force_cond end end m['DC'] = "#{dc_category} (#{dc_selector})" m['AC'] = "#{ac_category} (#{ac_selector})" m.merge(@meta) end |
#to_s(override_name = nil) ⇒ Object
Returns the fully formatted test instance for insertion into an instance sheet
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 140 def to_s(override_name = nil) l = "\t" self.class.attrs.each do |attr| if attr == 'test_name' && override_name l += "#{override_name}\t" else l += "#{send(attr)}\t" end end "#{l}" end |
#unversioned_name ⇒ Object
165 166 167 |
# File 'lib/origen_testers/igxl_based_tester/base/test_instance.rb', line 165 def unversioned_name @test_name.to_s end |