Small bugfixes and removal of redundant code.

This commit is contained in:
Honza 2022-01-07 20:36:51 +01:00
parent d9b56e8a00
commit 18b44226d8
2 changed files with 7 additions and 13 deletions

View File

@ -166,7 +166,7 @@ class UnsignedBrokenArrayMultiplier(MultiplierCircuit):
self.out.connect(self.out.N-1, obj_adder.get_carry_wire())
# Connecting the output bits generated from ommited cells to ground
if self.horizontal_cut >= self.N or self.vertical_cut >= 2*self.N:
if self.vertical_cut == 2*self.N-1:
[self.out.connect(out_id, ConstantWireValue0()) for out_id in range(self.out.N)]
else:
for grounded_out_index in range(0, max(self.horizontal_cut, self.vertical_cut)):
@ -314,7 +314,7 @@ class SignedBrokenArrayMultiplier(MultiplierCircuit):
self.out.connect(self.out.N-1, obj_xor.out)
# Connecting the output bits generated from ommited cells to ground
if self.horizontal_cut >= self.N or self.vertical_cut >= 2*self.N:
if self.vertical_cut == 2*self.N-1:
[self.out.connect(out_id, ConstantWireValue0()) for out_id in range(self.out.N)]
else:
for grounded_out_index in range(0, max(self.horizontal_cut, self.vertical_cut)):

View File

@ -139,11 +139,8 @@ class UnsignedTruncatedMultiplier(MultiplierCircuit):
self.out.connect(self.out.N-1, obj_adder.get_carry_wire())
# Connecting the output bits generated from ommited cells to ground
if self.truncation_cut >= self.N:
[self.out.connect(out_id, ConstantWireValue0()) for out_id in range(self.out.N)]
else:
for grounded_out_index in range(0, self.truncation_cut*2):
self.out.connect(grounded_out_index, ConstantWireValue0())
for grounded_out_index in range(0, self.truncation_cut*2):
self.out.connect(grounded_out_index, ConstantWireValue0())
class SignedTruncatedMultiplier(MultiplierCircuit):
"""Class representing signed truncated multiplier.
@ -269,8 +266,5 @@ class SignedTruncatedMultiplier(MultiplierCircuit):
self.out.connect(self.out.N-1, obj_xor.out)
# Connecting the output bits generated from ommited cells to ground
if self.truncation_cut >= self.N:
[self.out.connect(out_id, ConstantWireValue0()) for out_id in range(self.out.N)]
else:
for grounded_out_index in range(0, self.truncation_cut*2):
self.out.connect(grounded_out_index, ConstantWireValue0())
for grounded_out_index in range(0, self.truncation_cut*2):
self.out.connect(grounded_out_index, ConstantWireValue0())