aboutsummaryrefslogtreecommitdiff
path: root/generate_parameters.py
diff options
context:
space:
mode:
authorGravatar jadep <jade.philipoom@gmail.com>2017-10-16 11:46:03 -0400
committerGravatar jadep <jade.philipoom@gmail.com>2017-10-16 11:46:03 -0400
commitd6fc40ce9540900da91c0ac815cd4399dcd84658 (patch)
tree8ccd35dd47fc4bf4c43093a2475261e4245891f8 /generate_parameters.py
parent69973c5d98cda7caa7d9de33017504544e120f16 (diff)
bugfixes from messy rebase; remade json files
Diffstat (limited to 'generate_parameters.py')
-rw-r--r--generate_parameters.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/generate_parameters.py b/generate_parameters.py
index 8d7995fe5..9728e0ec5 100644
--- a/generate_parameters.py
+++ b/generate_parameters.py
@@ -81,10 +81,6 @@ class LimbPickingException(Exception): pass
class NonBase2Exception(Exception): pass
class UnexpectedPrimeException(Exception): pass
-# exception to be raised if we can't find an appropriate number of limbs
-class NoBaseFoundException(Exception):
- pass
-
# given a string representing one term or "tap" in a prime, returns a pair of
# integers representing the weight and coefficient of that tap
# "2 ^ y" -> [1, y]
@@ -172,7 +168,7 @@ def get_num_limbs(p, bitwidth):
choices.append((n, num_bits(p) / n))
break
if len(choices) == 0:
- raise NoBaseFoundException("Unable to pick a number of limbs for prime %s and bitwidth %s in range %s-%s limbs" %(p,bitwidth,min_limbs,5*min_limbs))
+ raise LimbPickingException("Unable to pick a number of limbs for prime %s and bitwidth %s in range %s-%s limbs" %(p,bitwidth,min_limbs,5*min_limbs))
# print (p,choices,min_limbs)
return choices[0][0]
@@ -210,7 +206,7 @@ def get_params_solinas(prime, bitwidth):
if len(p) > 2:
# do interleaved carry chains, starting at where the taps are
- starts = [(int(t[1] / base) - 1) % sz for t in p[1:]]
+ starts = [(int(t[1] / (num_bits(p) / sz)) - 1) % sz for t in p[1:]]
chain2 = []
for n in range(1,sz):
for j in starts: