Class: RubyRTL::IntLit

Inherits:
Literal show all
Defined in:
lib/ruby_rtl/ast.rb

Instance Attribute Summary

Attributes inherited from Literal

#type, #val

Attributes inherited from Ast

#comments

Instance Method Summary collapse

Methods inherited from Ast

#accept

Constructor Details

#initialize(val) ⇒ IntLit

Returns a new instance of IntLit.



220
221
222
223
224
# File 'lib/ruby_rtl/ast.rb', line 220

def initialize val
  val=val==0 ? 1 : val
  bitwidth=Math.log2(val).floor+1
  super(val,IntType.new)
end

Instance Method Details

#+(other) ⇒ Object



226
227
228
229
230
# File 'lib/ruby_rtl/ast.rb', line 226

def +(other)
  ret=Binary.new(self,"+",other)
  ret.type=@type
  ret
end