This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

addition problem

Hi,

Recently I have come across a question on bits additions.
Maximum bits in register is 32 bits.
I want to perform 4 different 8 bit parallel additions in a single 32bits.
How do I actually detect, process the overflow and put into my result?

For example, {in hexadecimal}

In a loop,

R0 changes value after each loop, R1=#0 initially,

R1(new) is R1(old) + R0

when loop ends, I want to take into account of the overflow,

return R1 into 4 separate 8 bits for the sum. { R1=aabbccdd }

R1a= aa+overflow a
R1b= bb+overflow b
R1c= cc+overflow c
R1d= dd+overflow d

Thank you very much

Regards,
Pei

Parents
  • I want to perform 4 different 8 bit parallel additions in a single 32bits.

    And did you even begin to think about whether this is even possible on whichever CPU you're actually using --- a slection which coincidentally you didn't even bother to tell us about?

    How do I actually detect, process the overflow and put into my result?

    You don't. If at all, the CPU might do that.

Reply
  • I want to perform 4 different 8 bit parallel additions in a single 32bits.

    And did you even begin to think about whether this is even possible on whichever CPU you're actually using --- a slection which coincidentally you didn't even bother to tell us about?

    How do I actually detect, process the overflow and put into my result?

    You don't. If at all, the CPU might do that.

Children
No data