Module: Origen::Parameters
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/origen/parameters.rb,
lib/origen/parameters/set.rb,
lib/origen/parameters/live.rb,
lib/origen/parameters/missing.rb
Defined Under Namespace
Modules: ClassMethods
Classes: Live, Missing, Set
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
Returns the value of attribute current.
9
10
11
|
# File 'lib/origen/parameters.rb', line 9
def current
@current
end
|
Instance Method Details
#_live_parameter_requested? ⇒ Boolean
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
97
98
99
|
# File 'lib/origen/parameters.rb', line 97
def _live_parameter_requested?
@_live_parameter_requested
end
|
#_parameter_current ⇒ Object
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/origen/parameters.rb', line 73
def _parameter_current
if path = self.class.parameters_context
case path
when :top, :dut
Origen.top_level._parameter_current
else
eval(path)._parameter_current
end
else
@_parameter_current || :default
end
end
|
#_parameter_sets ⇒ Object
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
87
88
89
|
# File 'lib/origen/parameters.rb', line 87
def _parameter_sets
@_parameter_sets ||= {}
end
|
#_request_live_parameter ⇒ Object
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
92
93
94
|
# File 'lib/origen/parameters.rb', line 92
def _request_live_parameter
@_live_parameter_requested = true
end
|
#define_params(name, options = {}, &block) ⇒ Object
Also known as:
define_parameters
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/origen/parameters.rb', line 28
def define_params(name, options = {}, &block)
if _parameter_sets[name]
fail 'Parameter sets cannot be re-opened once originally defined!'
else
_parameter_sets[name] = Set.new(top_level: true, owner: self)
if options[:inherit]
kontext = _validate_parameter_set_name(options[:inherit])
parent = kontext[:obj]._parameter_sets[kontext[:context]]
_parameter_sets[name].copy_defaults_from(parent)
_parameter_sets[name].define(parent, &block)
else
_parameter_sets[name].define(&block)
end
end
end
|
#has_params? ⇒ Boolean
68
69
70
|
# File 'lib/origen/parameters.rb', line 68
def has_params?
_parameter_sets.empty? ? false : true
end
|
#params(context = nil) ⇒ Object
Also known as:
parameters
52
53
54
55
56
|
# File 'lib/origen/parameters.rb', line 52
def params(context = nil)
@_live_parameter_requested = false
context ||= _parameter_current
_parameter_sets[context] || Missing.new(owner: self)
end
|
#params=(name) ⇒ Object
Also known as:
parameters=
59
60
61
62
63
64
65
|
# File 'lib/origen/parameters.rb', line 59
def params=(name)
@_parameter_current = name
end
|
#with_params(name, _options = {}) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/origen/parameters.rb', line 45
def with_params(name, _options = {})
orig = _parameter_current
self.params = name
yield
self.params = orig
end
|