[Cryptech-Commits] [user/shatov/modexpng] branch master updated: Simplified index calculation and accumulator clearing logic. Better debug printout of accumulators.
git at cryptech.is
git at cryptech.is
Sun Mar 24 09:21:57 UTC 2019
This is an automated email from the git hooks/post-receive script.
meisterpaul1 at yandex.ru pushed a commit to branch master
in repository user/shatov/modexpng.
The following commit(s) were added to refs/heads/master by this push:
new 711ffbd Simplified index calculation and accumulator clearing logic. Better debug printout of accumulators.
711ffbd is described below
commit 711ffbd6cda490d4d7da096160dd194bece4047e
Author: Pavel V. Shatov (Meister) <meisterpaul1 at yandex.ru>
AuthorDate: Sun Mar 24 12:18:47 2019 +0300
Simplified index calculation and accumulator clearing logic.
Better debug printout of accumulators.
---
modexpng_fpga_model.py | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/modexpng_fpga_model.py b/modexpng_fpga_model.py
index d3b7841..844cc86 100644
--- a/modexpng_fpga_model.py
+++ b/modexpng_fpga_model.py
@@ -353,13 +353,22 @@ class ModExpNG_WordMultiplier():
for col in range(num_cols):
- self._clear_all_macs()
- self._preset_indices(col)
+ for t in range(ab_num_words):
- if dump and DUMP_MACS_CLEARING:
- print("t= 0, col=%2d > clear > all" % (col))
+ if t == 0: self._preset_indices(col)
+ else: self._rotate_indices(ab_num_words)
+
+ if t == 0:
+ self._clear_all_macs()
+ if dump and DUMP_MACS_CLEARING:
+ print("t= 0, col=%2d > clear > all" % (col))
+ else:
+ t1 = t - 1
+ if (t1 // 8) == col:
+ self._clear_one_mac(t1 % NUM_MULTS)
+ if dump and DUMP_MACS_CLEARING:
+ print("t=%2d, col=%2d > clear > x=%d:" % (t, col, t1 % NUM_MULTS))
- for t in range(ab_num_words):
if dump and DUMP_INDICES:
print("t=%2d, col=%2d > indices:" % (t, col), end='')
@@ -377,18 +386,14 @@ class ModExpNG_WordMultiplier():
if t == (col * NUM_MULTS + x):
parts[t] = self._macs[x]
- self._clear_one_mac(x)
- if dump and DUMP_MACS_CLEARING:
- print("t=%2d, col=%2d > clear > x=%d:" % (t, col, x))
if dump and DUMP_MACS_ACCUMULATION:
+ print("t=%2d, col=%2d > "% (t, col), end='')
for i in range(NUM_MULTS):
if i > 0: print(" | ", end='')
- print("[%d]: 0x%012x" % (i, self._macs[i]), end='')
+ print("mac[%d]: 0x%012x" % (i, self._macs[i]), end='')
print("")
-
-
# save the uppers part of product at end of column,
# for the last column don't save the very last part
if t == (ab_num_words - 1):
@@ -396,8 +401,6 @@ class ModExpNG_WordMultiplier():
if not (col == (num_cols - 1) and x == (NUM_MULTS - 1)):
parts[ab_num_words + col * NUM_MULTS + x] = self._macs[x]
- self._rotate_indices(ab_num_words)
-
return parts
def multiply_triangle(self, a_wide, b_narrow, ab_num_words):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list