Class: RubyHDL::High::Unary

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

Overview

Describes the software implementation of an unary 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, child) ⇒ Unary

Create a new unary operation with +type+ data type, operator +operator+ and operand +child+



1723
1724
1725
1726
1727
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1723

def initialize(type,operator,child)
  super(type)
  @operator = operator.to_sym
  @child = child.to_expr
end

Instance Method Details

#to_rubyObject

Convert to ruby code.



1730
1731
1732
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1730

def to_ruby
  return RUBY_OPERATOR[@operator] % @child.to_ruby
end