summaryrefslogtreecommitdiff
path: root/booth_multiplier.py
diff options
context:
space:
mode:
Diffstat (limited to 'booth_multiplier.py')
-rwxr-xr-xbooth_multiplier.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/booth_multiplier.py b/booth_multiplier.py
index c17c2f8..dab58d0 100755
--- a/booth_multiplier.py
+++ b/booth_multiplier.py
@@ -158,5 +158,20 @@ if __name__ == "__main__":
plt.gca().set_ylabel("Number of Additions and Subtractions")
plt.legend(loc='upper left')
plt.savefig('report/performance.pgf')
+
+ iters_booth = []
+ iters_mod_booth = []
+ for length in lengths:
+ iters_booth.append(length)
+ iters_mod_booth.append(int(length / 2))
+
+ plt.figure()
+ plt.plot(lengths, lengths, '^--m', label='booths algorithim')
+ plt.plot(lengths, [int(l/2) for l in lengths], 'v--c', label='modified booths algorithim')
+ plt.gca().set_xlabel("Operand Length")
+ plt.gca().set_ylabel("Number of iterations")
+ plt.legend(loc='upper left')
+ plt.savefig('report/iterations.pgf')
+