def to_comp1(n,v):
   bits_raw=Bits(uint=abs(v),length=n)
   if(v<0):
      bits= (bits_raw.__invert__()).bin
   else:
      bits= bits_raw.bin

   return bits
Exemple #2
0
def to_comp1(n,v):
   bits_raw=Bits(uint=abs(v),length=n)
   if(v<0):
      bits= (bits_raw.__invert__()).bin
   else:
      bits= bits_raw.bin
   
   return bits