Skip to content

Commit

Permalink
fixes pyrpl-fpga#505 where people were seeing divide by zero errors o…
Browse files Browse the repository at this point in the history
…n initialisation
  • Loading branch information
peteasa committed Nov 8, 2024
1 parent e4f5aa8 commit f0c96a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyrpl/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,12 @@ def clog2(x):
return 32
else:
return int(np.floor(np.log2(float(x))))+1
return clog2(125000000.0/float(self._MINBW(obj)))
divider = float(self._MINBW(obj))

if divider == 0:
return clog2(125000000.0/10) # some default value to stop error, see issue #505
else:
return clog2(125000000.0/divider)

#def _ALPHABITS(self, obj):
# return int(np.ceil(np.log2(125000000.0 / self._MINBW(obj))))
Expand Down

0 comments on commit f0c96a8

Please sign in to comment.