diff --git a/ariths_gen/multi_bit_circuits/others/compare.py b/ariths_gen/multi_bit_circuits/others/compare.py index 6e92ce1..a7e5a31 100644 --- a/ariths_gen/multi_bit_circuits/others/compare.py +++ b/ariths_gen/multi_bit_circuits/others/compare.py @@ -189,6 +189,6 @@ class UnsignedCompareGTE(GeneralCircuit): res[self.N] = psum # or all equal (xor) - red = self.add_component(OrReduce(res, prefix=f"{self.prefix}_orred", inner_component=True)) + red = self.add_component(OrReduce(res, prefix=f"{self.prefix}_orred", inner_component=True, parent_component=self)) self.out.connect_bus(red.out) \ No newline at end of file diff --git a/ariths_gen/multi_bit_circuits/others/popcount.py b/ariths_gen/multi_bit_circuits/others/popcount.py index 4721bce..af0bfb8 100644 --- a/ariths_gen/multi_bit_circuits/others/popcount.py +++ b/ariths_gen/multi_bit_circuits/others/popcount.py @@ -68,8 +68,8 @@ class UnsignedPopCount(GeneralCircuit): return a else: half = a.N // 2 - b_in = Bus(N=half, prefix=f"b_inn{depth}A") - c_in = Bus(N=a.N - half, prefix=f"b_inn{depth}B") + b_in = Bus(N=half, prefix=f"b_inn{branch}_{depth}A") + c_in = Bus(N=a.N - half, prefix=f"c_inn{branch}_{depth}B") #print(a, half, a.N) @@ -81,7 +81,9 @@ class UnsignedPopCount(GeneralCircuit): b = create_tree(b_in, depth=depth + 1, branch = branch + "A") c = create_tree(c_in, depth= depth + 1, branch = branch + "B") - d = self.adder(a=b, b=c, prefix = f"{self.prefix}_add{branch}_{depth}") + d = self.adder(a=b, b=c, + prefix = f"{self.prefix}_add{branch}_{depth}", inner_component=True, + parent_component=self) self.add_component(d) return d.out