please dont rip this site

TI MSP430 Microcontroller

Hardware Multiplier

Found in some versions such as the MSP430F1611

C compilers do not necessarily do a good job of using it. Below is an example using pure C vs the multiplier accumulator equivalent.

typedef unsigned short      UINT16;     ///< unsigned 16-bit
typedef unsigned long       UINT32;     ///< unsigned 32-bit


    UINT32 u32Answer;
    UINT16 uX,uY,uZ;
    uX = 10;
    uY = 2;
    uZ = 40000;
The line below translates to lots of code (even with the "use multiplier"
option checked in the compiller):
    u32Answer = (UINT32)uX*3 + (UINT32)uY*4 + (UINT32)uZ*5 + (UINT32)uX*6;

Efficientcy by using multiply accumulate:

    *(INT32 *)RESLO_ = 0L; // Clear accumulator
    MAC = 3;
    OP2 = uX;
    MAC = 4;
    OP2 = uY;
    MAC = 5;
    OP2 = uZ;
    MAC = 6;
    OP2 = uX;
    NOP();
    u32Answer = *(INT32 *)RESLO_;

Code in CPU looks like:
     94              *(INT32 *)RESLO_ = 0L;
   \   000072   82433a01     MOV.W   #0x0, &0x13a
   \   000076   82433c01     MOV.W   #0x0, &0x13c
     95              MAC = 3;
   \   00007A   B24003003401 MOV.W   #0x3, &0x134
     96              OP2 = uX;
   \   000080   824E3801     MOV.W   R14, &0x138
     97              MAC = 4;
   \   000084   A2423401     MOV.W   #0x4, &0x134
     98              OP2 = uY;
   \   000088   824C3801     MOV.W   R12, &0x138
     99              MAC = 5;
   \   00008C   B24005003401 MOV.W   #0x5, &0x134
    100              OP2 = uZ;
   \   000092   824F3801     MOV.W   R15, &0x138
    101              MAC = 6;
   \   000096   B24006003401 MOV.W   #0x6, &0x134
    102              OP2 = uX;
   \   00009C   824E3801     MOV.W   R14, &0x138
    103              NOP();
   \   0000A0   0343         NOP
    104              u32Answer = *(INT32 *)RESLO_;
   \   0000A2   92423A01.... MOV.W   &0x13a, &u32Answer
   \   0000A8   92423C01.... MOV.W   &0x13c, &u32Answer + 2

See also:


file: /Techref/ti/msp430/hardmult.htm, 2KB, , updated: 2007/8/24 09:35, local time: 2024/12/23 10:46,
TOP NEW HELP FIND: 
3.139.80.194:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/ti/msp430/hardmult.htm"> TI MSP430 Microcontroller Hardware Multiplier</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .