summaryrefslogtreecommitdiff
path: root/booth_multiplier.py
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@gmail.com>2024-04-12 15:41:55 -0500
committerBrett Weiland <brett_weiland@gmail.com>2024-04-12 15:41:55 -0500
commitb0b2eb6ff181ae84d7a83807f47c3cec25451969 (patch)
treeac26bfaf5e8a665c30fc640970496f89654c222b /booth_multiplier.py
parent302ed2955552ca681afec3d79e3a3630d0c61a09 (diff)
need to re-read and spellcheck
Diffstat (limited to 'booth_multiplier.py')
-rwxr-xr-xbooth_multiplier.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/booth_multiplier.py b/booth_multiplier.py
index 6f47b60..b3fda6a 100755
--- a/booth_multiplier.py
+++ b/booth_multiplier.py
@@ -29,7 +29,7 @@ def twoscomp_to_int(num, length):
return num & (1 << length) - 1
def debug(results):
- headers = ['multiplicand bin', 'multiplier bin', 'multiplicand dec', 'multiplier dec', 'expected bin', 'expected dec', 'booth if correct', 'booth mod if correct']
+ headers = ['multiplicand bin', 'multiplier bin', 'multiplicand dec', 'multiplier dec', 'expected bin', 'expected dec', 'booth', 'mod booth']
table = []
for [multiplicand_bin, multiplier_bin, result_booth, result_booth_mod, length] in results:
multiplicand = twoscomp_to_int(multiplicand_bin, length)
@@ -40,6 +40,8 @@ def debug(results):
success_bm = [bin(result_booth_mod), "PASS"] [result_booth_mod == expected_bin]
table.append([bin(multiplicand_bin), bin(multiplier_bin), multiplicand, multiplier, bin(expected_bin), expected, success_b, success_bm])
+ with open("report/debug_table.tex", "w") as f:
+ f.write(tabulate(table, headers, tablefmt="latex_longtable"))
print("\nCHECKS: \n", tabulate(table, headers), "\n")
@@ -161,7 +163,7 @@ if __name__ == "__main__":
})
# generate table for operations vs operand length
- plt.title("Operations vs Operand Length")
+ plt.gcf().set_size_inches(w=4.5, h=3.5)
plt.plot(lengths, ops_booth, '^--m', label='booths algorithim')
plt.plot(lengths, ops_mod_booth, 'v--c', label='modified booths algorithim')
plt.gca().set_xlabel("Length of Operands")
@@ -178,6 +180,7 @@ if __name__ == "__main__":
iters_mod_booth.append(int(length / 2))
plt.figure()
+ plt.gcf().set_size_inches(w=4.5, h=3.5)
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")