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/30 08:07,
18.116.20.205: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? <A HREF="http://sxlist.com/techref/ti/msp430/hardmult.htm"> TI MSP430 Microcontroller Hardware Multiplier</A> |
Did you find what you needed? |
Welcome to sxlist.com!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! |
.