Class: Origen::ChipMode
Overview
Represents an SoC DFT/Operating mode - e.g. SCAN, RAMBIST, etc.
Instance Attribute Summary collapse
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#brief_description ⇒ Object
Returns the value of attribute brief_description.
-
#data_rate(options = {}) ⇒ Object
Returns the value of attribute data_rate.
-
#data_rate_unit ⇒ Object
Returns the value of attribute data_rate_unit.
-
#description ⇒ Object
Returns the value of attribute description.
-
#minimum_version_enabled ⇒ Object
Returns the value of attribute minimum_version_enabled.
- #name ⇒ Object (also: #full_name)
-
#owner ⇒ Object
Returns the object that owns the mode (the SoC instance usually).
-
#typical_voltage ⇒ Object
(also: #typ_voltage)
Returns the value of attribute typical_voltage.
Instance Method Summary collapse
- #id ⇒ Object
- #id=(val) ⇒ Object
-
#initialize(name, options = {}) ⇒ ChipMode
constructor
A new instance of ChipMode.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Implements methods like:.
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ ChipMode
Returns a new instance of ChipMode.
19 20 21 22 23 24 |
# File 'lib/origen/chip_mode.rb', line 19 def initialize(name, = {}) .each { |k, v| instance_variable_set("@#{k}", v) } (block.arity < 1 ? (instance_eval(&block)) : block.call(self)) if block_given? @name = name validate_args end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Implements methods like:
if $dut.mode.rambist?
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/origen/chip_mode.rb', line 69 def method_missing(method_name, *arguments, &block) ivar = "@#{method_name.to_s.gsub('=', '')}" ivar_sym = ":#{ivar}" if method_name[-1] == '?' return id == method_name[0..-2].to_sym elsif method_name[-1] == '=' define_singleton_method(method_name) do |val| instance_variable_set(ivar, val) end elsif instance_variables.include? ivar_sym instance_variable_get(ivar) else define_singleton_method(method_name) do instance_variable_get(ivar) end end send(method_name, *arguments, &block) end |
Instance Attribute Details
#audience ⇒ Object
Returns the value of attribute audience.
12 13 14 |
# File 'lib/origen/chip_mode.rb', line 12 def audience @audience end |
#brief_description ⇒ Object
Returns the value of attribute brief_description.
4 5 6 |
# File 'lib/origen/chip_mode.rb', line 4 def brief_description @brief_description end |
#data_rate(options = {}) ⇒ Object
Returns the value of attribute data_rate.
7 8 9 |
# File 'lib/origen/chip_mode.rb', line 7 def data_rate @data_rate end |
#data_rate_unit ⇒ Object
Returns the value of attribute data_rate_unit.
8 9 10 |
# File 'lib/origen/chip_mode.rb', line 8 def data_rate_unit @data_rate_unit end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/origen/chip_mode.rb', line 5 def description @description end |
#minimum_version_enabled ⇒ Object
Returns the value of attribute minimum_version_enabled.
9 10 11 |
# File 'lib/origen/chip_mode.rb', line 9 def minimum_version_enabled @minimum_version_enabled end |
#name ⇒ Object Also known as: full_name
26 27 28 |
# File 'lib/origen/chip_mode.rb', line 26 def name @name || @id end |
#owner ⇒ Object
Returns the object that owns the mode (the SoC instance usually)
15 16 17 |
# File 'lib/origen/chip_mode.rb', line 15 def owner @owner end |
#typical_voltage ⇒ Object Also known as: typ_voltage
Returns the value of attribute typical_voltage.
16 17 18 |
# File 'lib/origen/chip_mode.rb', line 16 def typical_voltage @typical_voltage end |
Instance Method Details
#id ⇒ Object
31 32 33 |
# File 'lib/origen/chip_mode.rb', line 31 def id @id || name.to_s.downcase.gsub(/(\s|-)+/, '_').to_sym end |
#id=(val) ⇒ Object
35 36 37 |
# File 'lib/origen/chip_mode.rb', line 35 def id=(val) @id = val.to_s.gsub(/(\s|-)+/, '_').downcase.to_sym end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
62 63 64 |
# File 'lib/origen/chip_mode.rb', line 62 def respond_to_missing?(method_name, _include_private = false) method_name[-1] == '?' end |
#to_s ⇒ Object
88 89 90 |
# File 'lib/origen/chip_mode.rb', line 88 def to_s id.to_s end |
#to_sym ⇒ Object
92 93 94 |
# File 'lib/origen/chip_mode.rb', line 92 def to_sym to_s.to_sym end |