Class: RubyRTL::UIntLit
Instance Attribute Summary
Attributes inherited from Literal
Attributes inherited from Ast
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(val) ⇒ UIntLit
constructor
A new instance of UIntLit.
Methods inherited from Ast
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 |