[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [f-cpu] Re: generic adder



Hi #4,

gaetan@xeberon.net wrote:
[...]
In fact, in effective addition, rounding to + infinity mode and positive number (or rounding to -infinity mode and negative number), overflow from the compound adder, and (LSB+g+r+s)='1', we need to select A+B+2 ("round up at position [L-1]"). and if we only change the Carry bit (not overflow), we just have round up at position L (so we take the A+B+1 result)...
Wait a minute... you want to handle adding, carry-out and rounding at the same time? Like this:

My := Ma + Mb;
Mz := Ma + Mb + 1; -- incremented adder output
if (carry_out = '1') then
round_up := My(LSB) or g or r or s;
if (round_up = '1') then
My := Mz + 1; -- double increment
end if;
My := rshift(My, 1, '1');
Ey := Ey + 1;
else
round_up := g or r or s;
if (round_up = '1') then
My := Mz;
end if;
end if;

Right? I'm afraid you'll have to increment Mz one more time in that case.

Michael.

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu in the body. http://f-cpu.seul.org/