Class: HDLRuby::Low::Operation
- Inherits:
-
Expression
- Object
- Base::Expression
- Expression
- HDLRuby::Low::Operation
- 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_low2high.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb,
lib/HDLRuby/hruby_low_fix_types.rb
Overview
Extends the Operation class with fixing of types and constants.
Constant Summary
Constants included from Low2Symbol
Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#operator ⇒ Object
readonly
The operator of the operation.
Attributes inherited from Expression
Attributes included from Hparent
Instance Method Summary collapse
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#explicit_types(type = nil) ⇒ Object
Explicit the types conversions in the operation where +type+ is the expected type of the condition if any.
-
#hash ⇒ Object
Hash function.
-
#initialize(type, operator) ⇒ Operation
constructor
Creates a new operation with +type+ applying +operator+.
-
#set_operator!(operator) ⇒ Object
Sets the operator.
-
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code.
-
#to_hdr(level = 0) ⇒ Object
Generates the text of the equivalent hdr text.
-
#to_vhdl(level = 0) ⇒ Object
Generates the text of the equivalent HDLRuby::High code.
Methods inherited from Expression
#boolean?, #break_types!, #clone, #each_node, #each_node_deep, #each_ref_deep, #extract_selects_to!, #immutable?, #leftvalue?, #map_nodes!, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #statement, #to_c_expr, #to_high, #use_name?
Methods included from Low2Symbol
Methods included from Hparent
#hierarchy, #no_parent!, #scope
Constructor Details
#initialize(type, operator) ⇒ Operation
Creates a new operation with +type+ applying +operator+. def initialize(operator)
4897 4898 4899 4900 4901 |
# File 'lib/HDLRuby/hruby_low.rb', line 4897 def initialize(type,operator) super(type) # Check and set the operator. @operator = operator.to_sym end |
Instance Attribute Details
#operator ⇒ Object (readonly)
The operator of the operation.
4893 4894 4895 |
# File 'lib/HDLRuby/hruby_low.rb', line 4893 def operator @operator end |
Instance Method Details
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
4904 4905 4906 4907 4908 4909 4910 4911 |
# File 'lib/HDLRuby/hruby_low.rb', line 4904 def eql?(obj) # General comparison. return false unless super(obj) # Specific comparison. return false unless obj.is_a?(Operation) return false unless @operator.eql?(obj.operator) return true end |
#explicit_types(type = nil) ⇒ Object
Explicit the types conversions in the operation where +type+ is the expected type of the condition if any.
258 259 260 |
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 258 def explicit_types(type = nil) raise "Should implement explicit_types for class #{self.class}." end |
#hash ⇒ Object
Hash function.
4914 4915 4916 |
# File 'lib/HDLRuby/hruby_low.rb', line 4914 def hash return [super,@operator].hash end |
#set_operator!(operator) ⇒ Object
Sets the operator.
1444 1445 1446 1447 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 1444 def set_operator!(operator) # Check and set the operator. @operator = operator.to_sym end |
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code. +level+ is the hierachical level of the object. def to_c(level = 0)
2188 2189 2190 2191 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 2188 def to_c(res,level = 0) # Should never be here. raise AnyError, "Internal error: to_c should be implemented in class :#{self.class}" end |
#to_hdr(level = 0) ⇒ Object
Generates the text of the equivalent hdr text. +level+ is the hierachical level of the object.
578 579 580 581 |
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 578 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) ⇒ Object
Generates the text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.
1248 1249 1250 1251 |
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 1248 def to_vhdl(level = 0) # Should never be here. raise AnyError, "Internal error: to_vhdl should be implemented in class :#{self.class}" end |