At 18:18 12-10-05 -0400, you wrote:
>Hi,
>
>I have a question regarding msp430 assembly language, I am trying to do a
>big integer multiplier, wrote the following code (only the first half
>loop). The program is to compute c[] = a[] * b[].  When I compiles the
>code, the compiler reports "inconsistent operand constraints in an `asm'",
>I guess there is something wrong at indexed addressing, how can I fix the
>code?

Just another approach to your problem:
Can you try writing the code in C and see if it is fast enough for your
needs? I think the code produced by the compiler is probably better than
your assembly code.

See the following example:
void test()
{
int i,j,a,b,c;

a=1;
b=2;
for(i=0; i<1000; i++) {
 1f6:   0d 43           clr     r13             ;
        for(j=0;j<1000; j++) {
 1f8:   3e 40 e7 03     mov     #999,   r14     ;#0x03e7
                c=a*b;
 1fc:   02 12           push    r2              ;
 1fe:   32 c2           dint                    
 200:   03 43           nop                     
 202:   92 43 32 01     mov     #1,     &0x0132 ;r3 As==01
 206:   a2 43 38 01     mov     #2,     &0x0138 ;r3 As==10
 20a:   1f 42 3a 01     mov     &0x013a,r15     ;0x013a
 20e:   32 41           pop     r2              ;
 210:   3e 53           add     #-1,    r14     ;r3 As==11
 212:   3e b0 00 80     bit     #-32768,r14     ;#0x8000
 216:   f2 37           jge     $-26            ;abs 0x1fc
 218:   1d 53           inc     r13             ;
 21a:   3d 90 e8 03     cmp     #1000,  r13     ;#0x03e8
 21e:   ec 3b           jl      $-38            ;abs 0x1f8
                }
        }
}
 220:   30 41           ret                     

Nico Coesel


Reply via email to