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
  • my question is-- main constraints for me is execution time i want to reduce execution time too while 16x16 multiplication
    and also while writing to MAC0BL register ,MAC engine gives result
    so how i will do this shift operation?
    inputs are directly loading through serial port,so we cannt predict what is type of input? you know i need only unsigned operation there is a bit for selecting signed fractional or integer operation
    so i am asking you all that is there any bit (other than msb bit) that we can set or clear for signed or unsigned operation

    please reply

Reply
  • my question is-- main constraints for me is execution time i want to reduce execution time too while 16x16 multiplication
    and also while writing to MAC0BL register ,MAC engine gives result
    so how i will do this shift operation?
    inputs are directly loading through serial port,so we cannt predict what is type of input? you know i need only unsigned operation there is a bit for selecting signed fractional or integer operation
    so i am asking you all that is there any bit (other than msb bit) that we can set or clear for signed or unsigned operation

    please reply

Children
  • so i am asking you all that is there any bit (other than msb bit) that we can set or clear for signed or unsigned operation

    say your input value is in "int Ralph"

    and you right now do xxxxx Ralph; (I do not check for actual MAC code)

    Just change to xxxxx Ralph/2; (the compiler wikk change that to a shift 1 - or - you can, of course use ralph >>=- 1;

    are you multiplying or multiply-adding? If you are just multiplying then do this at the end
    result <<= 2; and you will be fine.

    BTW why the worry about signed/unsigned, if the values you multiply are >32k (where signed/unsigned differ) the result will not fit in an int.

    Erik

  • MOV SFRPAGE,#3
    MOV MAC0CF, #00H
    MOV MAC0AH, #0AAH ;INPUT A MSB
    MOV MAC0AL, #33H ;INPUT A LSB
    MOV MAC0BH, #73H ;INPUT B MSB
    MOV MAC0BL, #55H ;INPUT B LSB NOP NOP
    tell me what will be the answer

  • any chance to get the result same as what we are getting by calculator

    NOTE:mine is assembly coding

    please i need your help

  • "tell me what will be the answer"

    Can't you just run it in the simulator and see for yourself?

    Or, as these chips have on-chip debug, run it in the chip itself!

  • tried
    answers are different
    first input msb bit is set
    so our MAC Engine treating it as signed integer
    i dont want any signed operation
    i need only what calculator gives.
    Mr.Erac told to do shift operation.
    But how can we tell whether the inputs msb bit is set or not
    in my application data is 16 bit datas are getting from one equipment and we have to multiply the two and do further operation
    that is why i am asking you all that whether any bit setting for signed or unsigned operation in C8051F120

    PLEASE THIS ENTIRELY HARDWARE DEPENDENT QUESTION

  • that is why i am asking you all that whether any bit setting for signed or unsigned operation in C8051F120

    There isn't. At least not officially and described in the datasheet.

    However, you could break up a 16x16 unsigned multiplication into four 8x8 unsigned multiplications and a few bit-shifts and adds. That may or may not be faster than the method I described earlier, which doesn't make use of the MAC unit at all.

  • YES,I TRIED WITH THE MULTIPLICATION YOU EXPLAINED
    DO YOU KNOW ,WITH MAC ENGINE WITHIN TWO SYSTEM CYCLE WE WILL GET ANSWER
    THAT IS WHY WE OPTED C8051F120

  • "But how can we tell whether the inputs msb bit is set or not"

    The same way you'd test any bit, or the MSB in any byte, surely?

    "THIS ENTIRELY HARDWARE DEPENDENT QUESTION"

    So why are you asking it in the Keil forum - as Keil have nothing to do with this hardware?!

  • HARDWARE DEPENDENT MEANS 8051 HARDWARE
    I MEAN IT AS ASSEMPLY LANGUAGE PROGRAMING

  • Your Caps-Lock is stuck again - you're writing in ALL CAPITALS again.

    "WITH MAC ENGINE WITHIN TWO SYSTEM CYCLE WE WILL GET ANSWER"

    But, apparently, only with signed values

    "THAT IS WHY WE OPTED C8051F120"

    You missed the bit about signed values, then?
    I agree, it's very annoying when that happens - but that's life!

    :-(

  • DO YOU KNOW ,WITH MAC ENGINE WITHIN TWO SYSTEM CYCLE WE WILL GET ANSWER

    Well, the datasheet for the device clearly states that the MAC engine does 16x16 signed integer multiplications (which is quite usual for MAC units, since signed/signed is the multiplication type usually used in DSP applications).

    There's no way of getting a 16x16 unsigned/unsigned result out of the MAC engine in just two cycles, if it's supposed to be accurate. You'll have to break the multiplication up into several parts, or use the 8051's MUL command. I don't know from the top of my head which one is faster, but I guess it's going to be the former.

  • "But how can we tell whether the inputs msb bit is set or not"
    why 'tell', shift ALL inputs one right, if you do not shift ALL inputs, you will have a true mess.

    I answered your first SHOUT because you might be SHOUTING being unaware of the implications (rude and difficult to read), but when you start SHOUTING again (as below) after being asked to stop, I see no reason to help you if you persist.

    Erik

  • hi Mr.Christoph Franck and others, thank you for your reply.what is the use of MAC0RS bit in C8051f120

    I searched about that bit pdf files,but in vane
    can you help me?

  • "I searched about that bit pdf files,but in vane"

    Really?

    What about page 170?

    www.silabs.com/.../C8051F12x-13x.pdf

  • what is the use of MAC0RS bit in C8051f120

    The chips datasheet states, on page 162:

    When set to 1, the 40-bit MAC0 Accumulator register will be shifted during the next SYSCLK cycle.
    The direction of the shift (left or right) is controlled by the MAC0RS bit.
    This bit is cleared to ‘0’ by hardware when the shift is complete.
    

    Setting this bit to 1 therefore instructs the MAC engine to do a 1-bit bitshift on the accumulator of the MAC engine. The direction of this shift can be controlled with another bit in the same register.