Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/HDLRuby/hruby_tools.rb

Overview

Extends the Integer class for computing the bit width.

Instance Method Summary collapse

Instance Method Details

#widthObject

Gets the bit width



32
33
34
# File 'lib/HDLRuby/hruby_tools.rb', line 32

def width
    return Math.log2(self+1).ceil
end