summaryrefslogtreecommitdiff
path: root/booth_multiplier.py
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@gmail.com>2024-04-12 01:11:45 -0500
committerBrett Weiland <brett_weiland@gmail.com>2024-04-12 01:11:45 -0500
commitf86343b967e98b02c5ad06bb2e8c17c8ab3446b2 (patch)
tree24d10923c45afa80aa4a885a855079af767b27c9 /booth_multiplier.py
parent88a70c60e2422c2bce9246271dc083a9d02d2cdc (diff)
sleeby timez
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')
+