Class: SystemRDL::Evaluator::UnaryOperation

Inherits:
Operation
  • Object
show all
Defined in:
lib/systemrdl/evaluator/operation.rb

Instance Attribute Summary

Attributes inherited from Operation

#token_range

Attributes included from Common

#component, #parent, #token_range

Instance Method Summary collapse

Methods inherited from Operation

#evaluate

Constructor Details

#initialize(operator, operand, token_range) ⇒ UnaryOperation

Returns a new instance of UnaryOperation.



60
61
62
63
64
# File 'lib/systemrdl/evaluator/operation.rb', line 60

def initialize(operator, operand, token_range)
  @operator = operator
  @operand = operand
  super(token_range)
end

Instance Method Details

#connect(parent, component) ⇒ Object



66
67
68
69
# File 'lib/systemrdl/evaluator/operation.rb', line 66

def connect(parent, component)
  super
  @operand.connect(self, component)
end

#expression_widthObject



71
72
73
74
75
76
77
# File 'lib/systemrdl/evaluator/operation.rb', line 71

def expression_width
  if [:~, :+, :-].include?(@operator)
    @operand.expression_width
  else
    1
  end
end