class HDLRuby::Low::Ref

Describes a reference expression.

NOTE: this is an abstract class which is not to be used directly.

Describes a reference expression.

NOTE: this is an abstract class which is not to be used directly.

Extends the Ref class with generation of C text.

Extends the Ref class with generation of hdr text.

Add the conversion to high.

Extends the Ref class with generation of HDLRuby::High text.

Extends the Ref class with fixing of types and constants.

Describes a reference expression.

NOTE: this is an abstract class which is not to be used directly.

Extends RefIndex with the capability of finding the object it refered to.

Public Instance Methods

each_expression(&ruby_block)
Alias for: each_node
each_node(&ruby_block) click to toggle source

Iterates over the reference children if any.

# File lib/HDLRuby/hruby_low.rb, line 5184
def each_node(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_node) unless ruby_block
    # A ruby block? Apply it on the children: default none.
end
Also aliased as: each_expression
each_node_deep(&ruby_block) click to toggle source

Iterates over the nodes deeply if any.

# File lib/HDLRuby/hruby_low.rb, line 5193
def each_node_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_node_deep) unless ruby_block
    # A ruby block? First apply it to current.
    ruby_block.call(self)
    # And that's all.
end
eql?(obj) click to toggle source

Comparison for hash: structural comparison.

Calls superclass method
# File lib/HDLRuby/hruby_low.rb, line 5156
def eql?(obj)
    # General comparison.
    return false unless super(obj)
    # Specific comparison.
    return false unless obj.is_a?(Ref)
    return true
end
explicit_types(type = nil) click to toggle source

Explicit the types conversions in the reference where type is the expected type of the condition if any.

# File lib/HDLRuby/hruby_low_fix_types.rb, line 342
def explicit_types(type = nil)
    raise "Should implement explicit_types for class #{self.class}."
end
hash() click to toggle source

Hash function.

Calls superclass method
# File lib/HDLRuby/hruby_low.rb, line 5165
def hash
    super
end
map_nodes!(&ruby_block) click to toggle source

Maps on the children.

# File lib/HDLRuby/hruby_low_mutable.rb, line 1695
def map_nodes!(&ruby_block)
    # Nothing to do.
end
path_each(&ruby_block) click to toggle source

Iterates over the names of the path indicated by the reference.

NOTE: this is not a method for iterating over all the names included in the reference. For instance, this method will return nil without iterating if a RefConcat or is met.

Returns an enumerator if no ruby block is given.

# File lib/HDLRuby/hruby_low.rb, line 5176
def path_each(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:path_each) unless ruby_block
    # A ruby block? Apply it on... nothing by default.
    return nil
end
resolve() click to toggle source

Resolves the name of the reference (if any) and return the corresponding object. NOTE: return nil if could not resolve.

# File lib/HDLRuby/hruby_low_resolve.rb, line 94
def resolve
    # By default cannot resolve.
    return nil
end
to_c(level = 0, left = false) click to toggle source

Generates the C text of the equivalent HDLRuby code. level is the hierachical level of the object and left tells if it is a left value or not.

# File lib/HDLRuby/hruby_low2c.rb, line 1873
def to_c(level = 0, left = false)
    # Should never be here.
    raise AnyError, "Internal error: to_c should be implemented in class :#{self.class}"
end
to_hdr(level = 0) click to toggle source

Generates the text of the equivalent hdr text. level is the hierachical level of the object.

# File lib/HDLRuby/hruby_low2hdr.rb, line 653
def to_hdr(level = 0)
    # Should never be here.
    raise AnyError, "Internal error: to_high should be implemented in class :#{self.class}"
end
to_vhdl(level = 0) click to toggle source

Generates the text of the equivalent HDLRuby::High code. level is the hierachical level of the object.

# File lib/HDLRuby/hruby_low2vhd.rb, line 1412
def to_vhdl(level = 0)
    # Should never be here.
    raise AnyError, "Internal error: to_vhdl should be implemented in class :#{self.class}"
end