Class: RubyHDL::High::Binary
- Inherits:
-
Expression
- Object
- Expression
- RubyHDL::High::Binary
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes the software implementation of an binary operation.
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(type, operator, left, right) ⇒ Binary
constructor
Create a new binary operation with +type+ data type, operator +operator+ and operands +left+ and +right+.
-
#to_c ⇒ Object
Convert to C code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
Methods inherited from Expression
#<=, #[], #mux, #sdownto, #seach, #stimes, #supto, #to_expr, #to_value
Constructor Details
#initialize(type, operator, left, right) ⇒ Binary
Create a new binary operation with +type+ data type, operator +operator+ and operands +left+ and +right+.
1843 1844 1845 1846 1847 1848 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1843 def initialize(type,operator,left,right) super(type) @operator = operator.to_sym @left = left.to_expr @right = right.to_expr end |
Instance Method Details
#to_c ⇒ Object
Convert to C code.
1856 1857 1858 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1856 def to_c return C_OPERATOR[@operator] % [ @left.to_c, @right.to_c ] end |
#to_ruby ⇒ Object
Convert to Ruby code.
1851 1852 1853 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1851 def to_ruby return RUBY_OPERATOR[@operator] % [ @left.to_ruby, @right.to_ruby ] end |