I
isnullpr
If I had a 16 bit processor, how do I add two 32 bit numbers with it?
If I had a 16 bit processor, how do I add two 32 bit numbers with it?
If I had a 16 bit processor, how do I add two 32 bit numbers with it?
IsNull said:but how do I separate the upper bits from
the lower bits? is there some operation or instruction for that?
something like a ShiftR or ShiftL?
IsNull said:OK, so first I add the lower 16 bits of each number.Then add the top 16
bits of each number, and to that I add the carry-out from adding the
bottom 16 bits...correct?... but how do I separate the upper bits from
the lower bits? is there some operation or instruction for that?
something like a ShiftR or ShiftL?
thanks for the help!
IsNull said:OK, so first I add the lower 16 bits of each number.Then add the top 16
bits of each number, and to that I add the carry-out from adding the
bottom 16 bits...correct?... but how do I separate the upper bits from
the lower bits? is there some operation or instruction for that?
something like a ShiftR or ShiftL?
thanks for the help!
I don't know if you are doing this with a processor or in HDL of some
description.
Here it is in pseudocode for a processor
we have two numbers - a and b, made up of a[low], a[high], b[low],
b[high], and a result r[low], r[high].
I'll note an important point at the end
Add a[low], b[low] -> r[low]. This may generate a carry, which we use below
add a[high], b[high], carry -> r[high]
There may be a final carry. If you add two values of precision n bits,
the result can have n+1 bits. That's why you chain the carry from the
low order addition.
In HDL, it's not any more work (especially if you use the primitives
with most compilers).
Cheers
PeteS
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.