lib/origen/core_ext/numeric.rb
# Reverses the bit representation of a number and returns
# the new value.  Useful when changing register data based on bit order
Reverses the bit representation of a number and returns
the new value.  Useful when changing register data based on bit order
Reverses the bit representation of a number and returns the new value . Useful when changing register data based on bit order
def reverse_bits(width)
    result = 0
    0.upto(width - 1) do |i|
      result += self[i] * 2**(width - 1 - i)
    end
    result
  end
def reverse_bits ( width ) result = 0 0 . upto ( width - 1 ) do | i | result += self [ i ] * 2 ** ( width - 1 - i ) end result end
Reverses the bit representation of a number and returns
the new value.
Reverses the bit representation of a number and returns the new value .
width
<not_specific>