comb += pa.a.eq(op1)
comb += pa.b.eq(op2)
comb += pa.carry_in.eq(carry)
- return (pa.output, pa.carry_out)
+ result = PartitionedSignal.like(self)
+ comb += result.sig.eq(pa.output)
+ return result, pa.carry_out
def sub_op(self, op1, op2, carry=~0):
op1 = getsig(op1)
comb += pa.a.eq(op1)
comb += pa.b.eq(~op2)
comb += pa.carry_in.eq(carry)
- return (pa.output, pa.carry_out)
+ result = PartitionedSignal.like(self)
+ comb += result.sig.eq(pa.output)
+ return result, pa.carry_out
def __add__(self, other):
result, _ = self.add_op(self, other, carry=0)
# add
add_out, add_carry = self.a.add_op(self.a, self.b,
self.carry_in)
- comb += self.add_output.eq(add_out)
+ comb += self.add_output.eq(add_out.sig)
comb += self.add_carry_out.eq(add_carry)
# sub
sub_out, sub_carry = self.a.sub_op(self.a, self.b,
self.carry_in)
- comb += self.sub_output.eq(sub_out)
+ comb += self.sub_output.eq(sub_out.sig)
comb += self.sub_carry_out.eq(sub_carry)
# neg
- comb += self.neg_output.eq(-self.a)
+ comb += self.neg_output.eq((-self.a).sig)
# left shift
comb += self.ls_output.eq(self.a << self.b)
# right shift