From b0b2eb6ff181ae84d7a83807f47c3cec25451969 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Fri, 12 Apr 2024 15:41:55 -0500 Subject: need to re-read and spellcheck --- booth_multiplier.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'booth_multiplier.py') 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") -- cgit v1.2.3