Class: RubyHDL::High::Binary

Inherits:
Expression show all
Defined in:
lib/HDLRuby/std/sequencer_sw.rb

Overview

Describes the software implementation of an binary operation.

Instance Attribute Summary

Attributes inherited from Expression

#type

Instance Method Summary collapse

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+.



1739
1740
1741
1742
1743
1744
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1739

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_rubyObject

Convert to ruby code.



1747
1748
1749
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1747

def to_ruby
  return RUBY_OPERATOR[@operator] % [ @left.to_ruby, @right.to_ruby ]
end