+ ret = 0
+ out_len = len(self.bits)
+ for out_bit in range(0, out_len):
+ in_bit = self.bits[out_bit]
+ # shift this bit down to the LSB (and mask the rest)
+ i = (value >> (reg_width - in_bit - 1)) & 1
+ # shift back to the output position in the field
+ i <<= out_len - out_bit - 1
+ ret |= i
+ return ret