Class: SystemRDL::Evaluator::BinaryOperation

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, l_operand, r_operand, token_range) ⇒ BinaryOperation

Returns a new instance of BinaryOperation.



123
124
125
126
127
128
# File 'lib/systemrdl/evaluator/operation.rb', line 123

def initialize(operator, l_operand, r_operand, token_range)
  @operator = operator
  @l_operand = l_operand
  @r_operand = r_operand
  super(token_range)
end

Instance Method Details

#connect(parent, component) ⇒ Object



130
131
132
133
134
# File 'lib/systemrdl/evaluator/operation.rb', line 130

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

#expression_widthObject



136
137
138
139
140
141
142
# File 'lib/systemrdl/evaluator/operation.rb', line 136

def expression_width
  if [:'&&', :'||', :==, :!=, :<, :>, :<=, :>=].include?(@operator)
    1
  else
    eval_expression_width
  end
end