Class: HDLRuby::Low::RefThis

Inherits:
Ref show all
Defined in:
lib/HDLRuby/hruby_db.rb,
lib/HDLRuby/hruby_low.rb,
lib/HDLRuby/hruby_low2c.rb,
lib/HDLRuby/hruby_low2hdr.rb,
lib/HDLRuby/hruby_low2vhd.rb,
lib/HDLRuby/hruby_verilog.rb,
lib/HDLRuby/hruby_low2high.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb,
lib/HDLRuby/hruby_low_fix_types.rb,
lib/HDLRuby/hruby_low_bool2select.rb,
lib/HDLRuby/hruby_low_casts_without_expression.rb

Overview

Extends the RefThis class with functionality for converting booleans in assignments to select operators.

Direct Known Subclasses

High::RefThis

Constant Summary

Constants included from Low2Symbol

Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable

Instance Attribute Summary

Attributes inherited from Expression

#type

Attributes included from Hparent

#parent

Instance Method Summary collapse

Methods inherited from Ref

#each_node, #each_node_deep, #path_each, #resolve, #to_vhdl

Methods inherited from Expression

#boolean?, #break_types!, #each_node, #each_node_deep, #each_ref_deep, #extract_selects_to!, #immutable?, #initialize, #leftvalue?, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #signal2subs!, #statement, #to_c_expr, #to_vhdl, #use_name?

Methods included from Low2Symbol

#to_sym

Methods included from Hparent

#hierarchy, #no_parent!, #scope

Constructor Details

This class inherits a constructor from HDLRuby::Low::Expression

Instance Method Details

#boolean_in_assign2selectObject

Converts booleans in assignments to select operators.



339
340
341
342
# File 'lib/HDLRuby/hruby_low_bool2select.rb', line 339

def boolean_in_assign2select
    # Simply clone.
    return self.clone
end

#casts_without_expression!Object

Extracts the expressions from the casts.



356
357
358
359
360
# File 'lib/HDLRuby/hruby_low_casts_without_expression.rb', line 356

def casts_without_expression!
    # # Simply clone.
    # return self.clone
    return self
end

#cloneObject

Clones this.



6138
6139
6140
# File 'lib/HDLRuby/hruby_low.rb', line 6138

def clone
    return RefThis.new
end

#each_deep(&ruby_block) ⇒ Object

Iterates over each object deeply.

Returns an enumerator if no ruby block is given.



6128
6129
6130
6131
6132
6133
6134
6135
# File 'lib/HDLRuby/hruby_low.rb', line 6128

def each_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_deep) unless ruby_block
    # A ruby block? First apply it to current.
    ruby_block.call(self)
    # Then apply on the type.
    self.type.each_deep(&ruby_block)
end

#eql?(obj) ⇒ Boolean

Comparison for hash: structural comparison.

Returns:

  • (Boolean)


6143
6144
6145
# File 'lib/HDLRuby/hruby_low.rb', line 6143

def eql?(obj)
    return obj.is_a?(RefThis)
end

#explicit_types(type = nil) ⇒ Object

Explicit the types conversions in the index ref where +type+ is the expected type of the condition if any.



468
469
470
471
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 468

def explicit_types(type = nil)
    # Simply duplicate.
    return self.clone
end

#hashObject

Hash function.



6148
6149
6150
# File 'lib/HDLRuby/hruby_low.rb', line 6148

def hash
    return super
end

#map_nodes!(&ruby_block) ⇒ Object Also known as: map_expressions!

Maps on the children.



1995
1996
1997
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 1995

def map_nodes!(&ruby_block)
    # Nothing to do.
end

#to_another_verilogObject



1720
1721
1722
# File 'lib/HDLRuby/hruby_verilog.rb', line 1720

def to_another_verilog
    return ""
end

#to_c(res, level = 0, left = false) ⇒ Object

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. def to_c(level = 0, left = false)



3137
3138
3139
3140
3141
# File 'lib/HDLRuby/hruby_low2c.rb', line 3137

def to_c(res,level = 0, left = false)
    # return "this()"
    res << "this()"
    return res
end

#to_c_signal(res, level = 0) ⇒ Object

Generates the C text for reference as left value to a signal. +level+ is the hierarchical level of the object. def to_c_signal(level = 0)



3146
3147
3148
3149
3150
# File 'lib/HDLRuby/hruby_low2c.rb', line 3146

def to_c_signal(res,level = 0)
    # return "this()"
    res << "this()"
    return res
end

#to_hdr(level = 0) ⇒ Object

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



723
724
725
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 723

def to_hdr(level = 0)
    return ""
end

#to_highObject

Creates a new high ref this.



506
507
508
# File 'lib/HDLRuby/hruby_low2high.rb', line 506

def to_high
    return HDLRuby::High::RefThis.new
end