mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #2340 from andy-knowles/cxxrtl-fix-alu-carryout
cxxrtl.h: Fix incorrect CarryOut in alu when Bits % 32 != 0 && Invert == False
This commit is contained in:
commit
a74a43d85d
|
@ -452,10 +452,11 @@ struct value : public expr_base<value<Bits>> {
|
|||
bool carry = CarryIn;
|
||||
for (size_t n = 0; n < result.chunks; n++) {
|
||||
result.data[n] = data[n] + (Invert ? ~other.data[n] : other.data[n]) + carry;
|
||||
if (result.chunks - 1 == n)
|
||||
result.data[result.chunks - 1] &= result.msb_mask;
|
||||
carry = (result.data[n] < data[n]) ||
|
||||
(result.data[n] == data[n] && carry);
|
||||
}
|
||||
result.data[result.chunks - 1] &= result.msb_mask;
|
||||
return {result, carry};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue