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_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(level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby::High code.
-
#to_high(level = 0) ⇒ Object
Generates the text of the equivalent HDLRuby::High code.
-
#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!, #leftvalue?, #map_nodes!, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #statement, #use_name?
Methods included from Low2Symbol
Methods included from Hparent
Constructor Details
#initialize(type, operator) ⇒ Operation
Creates a new operation with +type+ applying +operator+. def initialize(operator)
4058 4059 4060 4061 4062 |
# File 'lib/HDLRuby/hruby_low.rb', line 4058 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.
4054 4055 4056 |
# File 'lib/HDLRuby/hruby_low.rb', line 4054 def operator @operator end |
Instance Method Details
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
4065 4066 4067 4068 4069 4070 4071 4072 |
# File 'lib/HDLRuby/hruby_low.rb', line 4065 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.
225 226 227 |
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 225 def explicit_types(type = nil) raise "Should implement explicit_types for class #{self.class}." end |
#hash ⇒ Object
Hash function.
4075 4076 4077 |
# File 'lib/HDLRuby/hruby_low.rb', line 4075 def hash return [super,@operator].hash end |
#set_operator!(operator) ⇒ Object
Sets the operator.
1362 1363 1364 1365 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 1362 def set_operator!(operator) # Check and set the operator. @operator = operator.to_sym end |
#to_c(level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.
1530 1531 1532 1533 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 1530 def to_c(level = 0) # Should never be here. raise AnyError, "Internal error: to_c should be implemented in class :#{self.class}" end |
#to_high(level = 0) ⇒ Object
Generates the text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.
578 579 580 581 |
# File 'lib/HDLRuby/hruby_low2high.rb', line 578 def to_high(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.
1212 1213 1214 1215 |
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 1212 def to_vhdl(level = 0) # Should never be here. raise AnyError, "Internal error: to_vhdl should be implemented in class :#{self.class}" end |