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
-
#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.
21 22 23 24 25 26 |
# File 'lib/origen/chip_mode.rb', line 21 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?
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/origen/chip_mode.rb', line 71 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.
13 14 15 |
# File 'lib/origen/chip_mode.rb', line 13 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
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/origen/chip_mode.rb', line 41 def data_rate( = {}) = { absolute_number: true }.update() # Convert the data rate to a number if !!@data_rate && !!@data_rate_unit if [:absolute_number] # The data rate unit was validated on init so it is good to go # in theory but should still check if it returns a numeric value = @data_rate.send(@data_rate_unit.to_sym) if value.is_a?(Numeric) value else Origen.log.error "@data_rate '#{@data_rate}' conversion using @data_rate_unit '#{@data_rate_unit}' did not product a Numeric, exiting..." end else @data_rate end else @data_rate end 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
28 29 30 |
# File 'lib/origen/chip_mode.rb', line 28 def name @name || @id end |
#owner ⇒ Object
Returns the object that owns the mode (the SoC instance usually)
17 18 19 |
# File 'lib/origen/chip_mode.rb', line 17 def owner @owner end |
#typical_voltage ⇒ Object Also known as: typ_voltage
Returns the value of attribute typical_voltage.
18 19 20 |
# File 'lib/origen/chip_mode.rb', line 18 def typical_voltage @typical_voltage end |
Instance Method Details
#id ⇒ Object
33 34 35 |
# File 'lib/origen/chip_mode.rb', line 33 def id @id || name.to_s.downcase.gsub(/(\s|-)+/, '_').to_sym end |
#id=(val) ⇒ Object
37 38 39 |
# File 'lib/origen/chip_mode.rb', line 37 def id=(val) @id = val.to_s.gsub(/(\s|-)+/, '_').downcase.to_sym end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
64 65 66 |
# File 'lib/origen/chip_mode.rb', line 64 def respond_to_missing?(method_name, _include_private = false) method_name[-1] == '?' end |
#to_s ⇒ Object
91 92 93 |
# File 'lib/origen/chip_mode.rb', line 91 def to_s id.to_s end |
#to_sym ⇒ Object
95 96 97 |
# File 'lib/origen/chip_mode.rb', line 95 def to_sym to_s.to_sym end |