Class: RubyRTL::UIntLit

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) ⇒ UIntLit

Returns a new instance of UIntLit.



234
235
236
237
238
# File 'lib/ruby_rtl/ast.rb', line 234

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

Instance Method Details

#+(other) ⇒ Object



240
241
242
243
244
# File 'lib/ruby_rtl/ast.rb', line 240

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