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

I NEED A SUDDEN REPLY

DEAR TO ALL, I AM DEALING WITH C8051F120 MICROCONTROLLER.UTILIZING 16 X 16 MAC ENGINE OPERATION.I AM DOING ASSEMBLY LANGUAGE PROGRAMMING USING THIS MICROCONTROLLER FOR MULTIPLICATION. IS IT POSSIBLE TO MULTIPLY TWO UNSIGNED 16 BIT INPUTS?
IF YES, THEN HOW ?

Parents
  • Your shift key seems to be stuck. All of your letters are capitals ! Can you try and see if you can fix that somehow ?

    IS IT POSSIBLE TO MULTIPLY TWO UNSIGNED 16 BIT INPUTS?

    Yes, why shouldn't it be possible ?

    IF YES, THEN HOW ?

    Just like you would perform a multiplication by hand, on paper (you know, just like in school):

    Each of the input values consists of MSB and an LSB. Let's call them MSBa, LSBa, MSBb and LSBb.

    So you need to do the following:

    1. Multiply MSBa and MSBb. Place the 16-bit result in the upper 16 bit of your 32-bit end result.
    2. Multiply MSBa and LSBb. Add the 16-bit result to the upper 24 bits of your 32-bit end result.
    3. Multiply LSBa and MSBa. Add the 16-bit result to the upper 24 bits of your 32-bit end result.
    4. Multiply LSBa and LSBb. Add the 16-bit result to your 32-bit end result.

    And that's it. As long as you know how to add variables that are longer than one byte.

Reply
  • Your shift key seems to be stuck. All of your letters are capitals ! Can you try and see if you can fix that somehow ?

    IS IT POSSIBLE TO MULTIPLY TWO UNSIGNED 16 BIT INPUTS?

    Yes, why shouldn't it be possible ?

    IF YES, THEN HOW ?

    Just like you would perform a multiplication by hand, on paper (you know, just like in school):

    Each of the input values consists of MSB and an LSB. Let's call them MSBa, LSBa, MSBb and LSBb.

    So you need to do the following:

    1. Multiply MSBa and MSBb. Place the 16-bit result in the upper 16 bit of your 32-bit end result.
    2. Multiply MSBa and LSBb. Add the 16-bit result to the upper 24 bits of your 32-bit end result.
    3. Multiply LSBa and MSBa. Add the 16-bit result to the upper 24 bits of your 32-bit end result.
    4. Multiply LSBa and LSBb. Add the 16-bit result to your 32-bit end result.

    And that's it. As long as you know how to add variables that are longer than one byte.

Children