litex/migScope/tools/conv.py
Florent Kermarrec 4a59b63151 Clean up
2012-09-09 23:46:26 +02:00

11 lines
145 B
Python

def dec2bin(d, nb=0):
if d=="x":
return "x"*nb
elif d==0:
b="0"
else:
b=""
while d!=0:
b="01"[d&1]+b
d=d>>1
return b.zfill(nb)