Module: HDLRuby::Low::Hparent
- Included in:
- Behavior, Chunk, Code, Delay, Event, Expression, Program, Scope, SignalI, Statement, SystemI, SystemT, Type, When
- Defined in:
- lib/HDLRuby/hruby_low.rb
Overview
Gives parent definition and access properties to an hardware object.
Instance Attribute Summary collapse
-
#parent ⇒ Object
The parent.
Instance Method Summary collapse
-
#absolute_ref ⇒ Object
Get an absolute reference to the object.
-
#hierarchy ⇒ Object
Get the full parents hierachy.
-
#no_parent! ⇒ Object
Clears the parent.
-
#scope ⇒ Object
Get the parent scope.
Instance Attribute Details
#parent ⇒ Object
The parent.
45 46 47 |
# File 'lib/HDLRuby/hruby_low.rb', line 45 def parent @parent end |
Instance Method Details
#absolute_ref ⇒ Object
Get an absolute reference to the object.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/HDLRuby/hruby_low.rb', line 85 def absolute_ref # puts "absolute_ref for self=#{self}" # Get the full hierarchy up to the object. path = self.hierarchy # Create the reference. # return path.reduce(RefThis.new) do |ref,node| return path.reverse_each.reduce(RefThis.new) do |ref,node| # puts "node=#{node}" # puts "name=#{node.name}" if node.respond_to?(:name) if node.respond_to?(:name) then typ = node.respond_to?(:type) ? node.type : void RefName.new(typ,ref,node.name) else ref end end end |
#hierarchy ⇒ Object
Get the full parents hierachy.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/HDLRuby/hruby_low.rb', line 73 def hierarchy res = [] cur = self while(cur) do # puts "cur=#{cur} cur.parent=#{cur.parent}" res << cur cur = cur.parent end return res end |
#no_parent! ⇒ Object
Clears the parent.
61 62 63 |
# File 'lib/HDLRuby/hruby_low.rb', line 61 def no_parent! @parent = nil end |
#scope ⇒ Object
Get the parent scope.
66 67 68 69 70 |
# File 'lib/HDLRuby/hruby_low.rb', line 66 def scope cur = self.parent cur = cur.parent until cur.is_a?(Scope) return cur end |