2023-06-27 14:18:37 +03:00
|
|
|
import bitutilities as bu
|
2023-06-26 00:24:47 +03:00
|
|
|
import timeit
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2023-06-27 14:18:37 +03:00
|
|
|
reg: bu.BasicRegister = bu.BasicRegister(bu.get_memory("memory"))
|
2023-06-26 00:24:47 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
print("Register 1:")
|
2023-06-26 00:24:47 +03:00
|
|
|
print(reg)
|
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
reg2: bu.BasicRegister = bu.BasicRegister(bu.get_memory("more memory"))
|
2023-06-26 00:24:47 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
print("Register 2:")
|
|
|
|
print(reg2)
|
2023-06-26 00:24:47 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
reg3: bu.BasicRegister = bu.binary_sum(reg, reg2)
|
2023-06-26 21:05:45 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
print("Sum:")
|
|
|
|
print(reg3)
|
2023-06-26 21:05:45 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
carry_sum_test: tuple[bu.BasicRegister, int] = bu.binary_sum(reg, reg2, True)
|
2023-06-26 21:05:45 +03:00
|
|
|
|
2023-06-27 14:18:37 +03:00
|
|
|
print()
|
|
|
|
print("Sum & carry:")
|
|
|
|
# print(type(carry_sum_test))
|
|
|
|
print(carry_sum_test)
|