Method: Numeric#to_bitstring

Defined in:
lib/origen/core_ext/numeric.rb

#to_bitstring(width) ⇒ Object

Converts a number to a String representing binary number Requires width of bit string for padding. If the width is less than the number of bits required to represent the number the width argument is meaningless.



42
43
44
# File 'lib/origen/core_ext/numeric.rb', line 42

def to_bitstring(width)
  '%0*b' % [width, self]
end