Hi,
I'm writing assembler code for a 6713. I need to multiply 32bit with
16bit. Maybe someone has a link to some documentation.
TIA
Gustl
_____________________________________
6713 and 32bit * 16bit signed integer
Started by ●March 11, 2010
Reply by ●March 11, 20102010-03-11
Gustl-
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
I think there's an intrinsic for that... could try it and then look at the asm code that is generated?
-Jeff
_____________________________________
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
I think there's an intrinsic for that... could try it and then look at the asm code that is generated?
-Jeff
_____________________________________
Reply by ●March 11, 20102010-03-11
Sorry. Forgot to hit reply all to that last one.
On Thu, Mar 11, 2010 at 9:38 AM, William C Bonner wrote:
> SPRU733 is the TMS320C67x/C67x+ DSP CPU and Instruction Set Reference
> Guide. http://focus.ti.com/lit/ug/spru733a/spru733a.pdf
>
> I was just looking at the table of contents and it doesn't look like
> there's a multiply function that does what you want. The processor does
> load and operations as separate steps, so you'd just need to load the
> correct registers and do the operation in 32 bit.
> On Thu, Mar 11, 2010 at 9:13 AM, Jeff Brower wrote:
>
>> Gustl-
>> > I'm writing assembler code for a 6713. I need to multiply 32bit with
>> > 16bit. Maybe someone has a link to some documentation.
>>
>> I think there's an intrinsic for that... could try it and then look at the
>> asm code that is generated?
>>
>> -Jeff
>>
>>
>>
On Thu, Mar 11, 2010 at 9:38 AM, William C Bonner wrote:
> SPRU733 is the TMS320C67x/C67x+ DSP CPU and Instruction Set Reference
> Guide. http://focus.ti.com/lit/ug/spru733a/spru733a.pdf
>
> I was just looking at the table of contents and it doesn't look like
> there's a multiply function that does what you want. The processor does
> load and operations as separate steps, so you'd just need to load the
> correct registers and do the operation in 32 bit.
> On Thu, Mar 11, 2010 at 9:13 AM, Jeff Brower wrote:
>
>> Gustl-
>> > I'm writing assembler code for a 6713. I need to multiply 32bit with
>> > 16bit. Maybe someone has a link to some documentation.
>>
>> I think there's an intrinsic for that... could try it and then look at the
>> asm code that is generated?
>>
>> -Jeff
>>
>>
>>
Reply by ●March 11, 20102010-03-11
Wim-
> SPRU733 is the TMS320C67x/C67x+ DSP CPU and Instruction Set Reference
> Guide. http://focus.ti.com/lit/ug/spru733a/spru733a.pdf
>
> I was just looking at the table of contents and it doesn't look like there's
> a multiply function that does what you want. The processor does load and
> operations as separate steps, so you'd just need to load the correct
> registers and do the operation in 32 bit.
Normally in a 32 x 32 fixed-point multiply on C6x, there are 4 16-bit multiplies total, sorta like a dot product. So
I would think that if coded carefully, it could be cut to 2 for 16 x 32.
-Jeff
> On Thu, Mar 11, 2010 at 9:13 AM, Jeff Brower wrote:
>
>> Gustl-
>> > I'm writing assembler code for a 6713. I need to multiply 32bit with
>> > 16bit. Maybe someone has a link to some documentation.
>>
>> I think there's an intrinsic for that... could try it and then look at the
>> asm code that is generated?
>>
>> -Jeff
_____________________________________
> SPRU733 is the TMS320C67x/C67x+ DSP CPU and Instruction Set Reference
> Guide. http://focus.ti.com/lit/ug/spru733a/spru733a.pdf
>
> I was just looking at the table of contents and it doesn't look like there's
> a multiply function that does what you want. The processor does load and
> operations as separate steps, so you'd just need to load the correct
> registers and do the operation in 32 bit.
Normally in a 32 x 32 fixed-point multiply on C6x, there are 4 16-bit multiplies total, sorta like a dot product. So
I would think that if coded carefully, it could be cut to 2 for 16 x 32.
-Jeff
> On Thu, Mar 11, 2010 at 9:13 AM, Jeff Brower wrote:
>
>> Gustl-
>> > I'm writing assembler code for a 6713. I need to multiply 32bit with
>> > 16bit. Maybe someone has a link to some documentation.
>>
>> I think there's an intrinsic for that... could try it and then look at the
>> asm code that is generated?
>>
>> -Jeff
_____________________________________
Reply by ●March 11, 20102010-03-11
Bernhard,
A relatively simple way is to move the 16 bit value to a 32 bit register, do a 32x32 multiply into a 64 bit result.
another way is to write the desired operation in C, with an asm listing, and use the contents of the asm listing.
to avoid certain oversights, *I* would use the second method, and keep the resulting methodology for future reference.
R. Williams
---------- Original Message -----------
From: "Bernhard 'Gustl' Bauer"
To: C6x
Sent: Thu, 11 Mar 2010 13:04:54 +0100
Subject: [c6x] 6713 and 32bit * 16bit signed integer
> Hi,
>
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
>
> TIA
>
> Gustl
>
_____________________________________
A relatively simple way is to move the 16 bit value to a 32 bit register, do a 32x32 multiply into a 64 bit result.
another way is to write the desired operation in C, with an asm listing, and use the contents of the asm listing.
to avoid certain oversights, *I* would use the second method, and keep the resulting methodology for future reference.
R. Williams
---------- Original Message -----------
From: "Bernhard 'Gustl' Bauer"
To: C6x
Sent: Thu, 11 Mar 2010 13:04:54 +0100
Subject: [c6x] 6713 and 32bit * 16bit signed integer
> Hi,
>
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
>
> TIA
>
> Gustl
>
_____________________________________
Reply by ●March 11, 20102010-03-11
Richard-
> A relatively simple way is to move the 16 bit value to a
> 32 bit register, do a 32x32 multiply into a 64 bit result.
By this you mean a 32x32 floating-point multiply, correct?
-Jeff
> ---------- Original Message -----------
> From: "Bernhard 'Gustl' Bauer"
> To: C6x
> Sent: Thu, 11 Mar 2010 13:04:54 +0100
> Subject: [c6x] 6713 and 32bit * 16bit signed integer
>
>> Hi,
>>
>> I'm writing assembler code for a 6713. I need to multiply 32bit with
>> 16bit. Maybe someone has a link to some documentation.
>>
>> TIA
>>
>> Gustl
>>
>
>
> _____________________________________
>
_____________________________________
> A relatively simple way is to move the 16 bit value to a
> 32 bit register, do a 32x32 multiply into a 64 bit result.
By this you mean a 32x32 floating-point multiply, correct?
-Jeff
> ---------- Original Message -----------
> From: "Bernhard 'Gustl' Bauer"
> To: C6x
> Sent: Thu, 11 Mar 2010 13:04:54 +0100
> Subject: [c6x] 6713 and 32bit * 16bit signed integer
>
>> Hi,
>>
>> I'm writing assembler code for a 6713. I need to multiply 32bit with
>> 16bit. Maybe someone has a link to some documentation.
>>
>> TIA
>>
>> Gustl
>>
>
>
> _____________________________________
>
_____________________________________
Reply by ●March 11, 20102010-03-11
Gustl & others,
On Thu, Mar 11, 2010 at 1:41 PM, Jeff Brower wrote:
> Richard-
> > A relatively simple way is to move the 16 bit value to a
> > 32 bit register, do a 32x32 multiply into a 64 bit result.
>
> By this you mean a 32x32 floating-point multiply, correct?
>
I believe that this is supported on the 6713.
MPYID 32-Bit Integer Multiply Result Is 64 Bits
MPYID .M1 A1,A2,A5:A4
mikedunn
>
> -Jeff
> > ---------- Original Message -----------
> > From: "Bernhard 'Gustl' Bauer" >
> > To: C6x >
> > Sent: Thu, 11 Mar 2010 13:04:54 +0100
> > Subject: [c6x] 6713 and 32bit * 16bit signed integer
> >
> >> Hi,
> >>
> >> I'm writing assembler code for a 6713. I need to multiply 32bit with
> >> 16bit. Maybe someone has a link to some documentation.
> >>
> >> TIA
> >>
> >> Gustl
> >>
> >
> >
> >
>
> >
> >
> >
> > _____________________________________
> >
> >
> >
> >
> >
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
On Thu, Mar 11, 2010 at 1:41 PM, Jeff Brower wrote:
> Richard-
> > A relatively simple way is to move the 16 bit value to a
> > 32 bit register, do a 32x32 multiply into a 64 bit result.
>
> By this you mean a 32x32 floating-point multiply, correct?
>
I believe that this is supported on the 6713.
MPYID 32-Bit Integer Multiply Result Is 64 Bits
MPYID .M1 A1,A2,A5:A4
mikedunn
>
> -Jeff
> > ---------- Original Message -----------
> > From: "Bernhard 'Gustl' Bauer" >
> > To: C6x >
> > Sent: Thu, 11 Mar 2010 13:04:54 +0100
> > Subject: [c6x] 6713 and 32bit * 16bit signed integer
> >
> >> Hi,
> >>
> >> I'm writing assembler code for a 6713. I need to multiply 32bit with
> >> 16bit. Maybe someone has a link to some documentation.
> >>
> >> TIA
> >>
> >> Gustl
> >>
> >
> >
> >
>
> >
> >
> >
> > _____________________________________
> >
> >
> >
> >
> >
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
Reply by ●March 12, 20102010-03-12
Jeff,
Unless I have missed something important, I mean a 32x32 interger multiply into a 64 bit result.
R. Williams
---------- Original Message -----------
From: "Jeff Brower"
To: "Richard Williams"
Cc: c...
Sent: Thu, 11 Mar 2010 13:41:27 -0600 (CST)
Subject: Re: [c6x] 6713 and 32bit * 16bit signed integer
> Richard-
>
> > A relatively simple way is to move the 16 bit value to a
> > 32 bit register, do a 32x32 multiply into a 64 bit result.
>
> By this you mean a 32x32 floating-point multiply, correct?
>
> -Jeff
>
> > ---------- Original Message -----------
> > From: "Bernhard 'Gustl' Bauer"
> > To: C6x
> > Sent: Thu, 11 Mar 2010 13:04:54 +0100
> > Subject: [c6x] 6713 and 32bit * 16bit signed integer
> >
> >> Hi,
> >>
> >> I'm writing assembler code for a 6713. I need to multiply 32bit with
> >> 16bit. Maybe someone has a link to some documentation.
> >>
> >> TIA
> >>
> >> Gustl
Unless I have missed something important, I mean a 32x32 interger multiply into a 64 bit result.
R. Williams
---------- Original Message -----------
From: "Jeff Brower"
To: "Richard Williams"
Cc: c...
Sent: Thu, 11 Mar 2010 13:41:27 -0600 (CST)
Subject: Re: [c6x] 6713 and 32bit * 16bit signed integer
> Richard-
>
> > A relatively simple way is to move the 16 bit value to a
> > 32 bit register, do a 32x32 multiply into a 64 bit result.
>
> By this you mean a 32x32 floating-point multiply, correct?
>
> -Jeff
>
> > ---------- Original Message -----------
> > From: "Bernhard 'Gustl' Bauer"
> > To: C6x
> > Sent: Thu, 11 Mar 2010 13:04:54 +0100
> > Subject: [c6x] 6713 and 32bit * 16bit signed integer
> >
> >> Hi,
> >>
> >> I'm writing assembler code for a 6713. I need to multiply 32bit with
> >> 16bit. Maybe someone has a link to some documentation.
> >>
> >> TIA
> >>
> >> Gustl
Reply by ●March 12, 20102010-03-12
Bernhard 'Gustl' Bauer schrieb:
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
Hi all,
I think I should have been a bit more eloquent :-)
First I coded it in C, but it cost to much cycles. When you do a
(int)*(short) it is type casted to (int)*(int). So a look at the asm
doesn't help :-(
Then I switched to assembler. I tried MPYID, but it has 9-10 cycles
delay which is pretty ineffective. It costs about the same cycles as the
C code.
Afterwards I'm tried to do the thing Jeff mentioned:
32MPY16 = 2*16MPY16 + shift + ADD
But here I'm stuck with signs. Assuming the 16bit is in the lower part
of the register, the first operation must be MPYHL (Multiply Signed 16
MSB * Signed 16 LSB). The lower half of the 32bit are unsigned. So
either I do a MPYSU (Multiply Signed 16 LSB * Unsigned 16 LSB), or I do
a ABS on the 16bit and then a MPYU (Multiply Unsigned 16 LSB * Unsigned
16 LSB). I'm unsure whether I should add or subtract the result. It
depends on the signs. Is there an fast way to do this?
A link to any documentation about doing a 32bit multiplication with
16bit multipliers would help a lot.
Thanks
Gustl
_____________________________________
> I'm writing assembler code for a 6713. I need to multiply 32bit with
> 16bit. Maybe someone has a link to some documentation.
Hi all,
I think I should have been a bit more eloquent :-)
First I coded it in C, but it cost to much cycles. When you do a
(int)*(short) it is type casted to (int)*(int). So a look at the asm
doesn't help :-(
Then I switched to assembler. I tried MPYID, but it has 9-10 cycles
delay which is pretty ineffective. It costs about the same cycles as the
C code.
Afterwards I'm tried to do the thing Jeff mentioned:
32MPY16 = 2*16MPY16 + shift + ADD
But here I'm stuck with signs. Assuming the 16bit is in the lower part
of the register, the first operation must be MPYHL (Multiply Signed 16
MSB * Signed 16 LSB). The lower half of the 32bit are unsigned. So
either I do a MPYSU (Multiply Signed 16 LSB * Unsigned 16 LSB), or I do
a ABS on the 16bit and then a MPYU (Multiply Unsigned 16 LSB * Unsigned
16 LSB). I'm unsure whether I should add or subtract the result. It
depends on the signs. Is there an fast way to do this?
A link to any documentation about doing a 32bit multiplication with
16bit multipliers would help a lot.
Thanks
Gustl
_____________________________________
Reply by ●March 12, 20102010-03-12
Gustl-
> Bernhard 'Gustl' Bauer schrieb:
>> I'm writing assembler code for a 6713. I need to multiply 32bit with
>> 16bit. Maybe someone has a link to some documentation.
>
> Hi all,
>
> I think I should have been a bit more eloquent :-)
>
> First I coded it in C, but it cost to much cycles. When you do a
> (int)*(short) it is type casted to (int)*(int). So a look at the asm
> doesn't help :-(
>
> Then I switched to assembler. I tried MPYID, but it has 9-10 cycles
> delay which is pretty ineffective. It costs about the same cycles as the
> C code.
>
> Afterwards I'm tried to do the thing Jeff mentioned:
> 32MPY16 = 2*16MPY16 + shift + ADD
>
> But here I'm stuck with signs. Assuming the 16bit is in the lower part
> of the register, the first operation must be MPYHL (Multiply Signed 16
> MSB * Signed 16 LSB). The lower half of the 32bit are unsigned. So
> either I do a MPYSU (Multiply Signed 16 LSB * Unsigned 16 LSB), or I do
> a ABS on the 16bit and then a MPYU (Multiply Unsigned 16 LSB * Unsigned
> 16 LSB). I'm unsure whether I should add or subtract the result. It
> depends on the signs. Is there an fast way to do this?
>
> A link to any documentation about doing a 32bit multiplication with
> 16bit multipliers would help a lot.
Ask and ye shall receive:
http://focus.ti.com/lit/an/spra297/spra297.pdf
This is actually an app note on "extended precision FFT for C62x", but the thing is that back then (2002 time-frame)
16-bit multipliers was all TI had for fixed-point so they did some nice docs on how to maximize it for extended
precision.
-Jeff
_____________________________________
> Bernhard 'Gustl' Bauer schrieb:
>> I'm writing assembler code for a 6713. I need to multiply 32bit with
>> 16bit. Maybe someone has a link to some documentation.
>
> Hi all,
>
> I think I should have been a bit more eloquent :-)
>
> First I coded it in C, but it cost to much cycles. When you do a
> (int)*(short) it is type casted to (int)*(int). So a look at the asm
> doesn't help :-(
>
> Then I switched to assembler. I tried MPYID, but it has 9-10 cycles
> delay which is pretty ineffective. It costs about the same cycles as the
> C code.
>
> Afterwards I'm tried to do the thing Jeff mentioned:
> 32MPY16 = 2*16MPY16 + shift + ADD
>
> But here I'm stuck with signs. Assuming the 16bit is in the lower part
> of the register, the first operation must be MPYHL (Multiply Signed 16
> MSB * Signed 16 LSB). The lower half of the 32bit are unsigned. So
> either I do a MPYSU (Multiply Signed 16 LSB * Unsigned 16 LSB), or I do
> a ABS on the 16bit and then a MPYU (Multiply Unsigned 16 LSB * Unsigned
> 16 LSB). I'm unsure whether I should add or subtract the result. It
> depends on the signs. Is there an fast way to do this?
>
> A link to any documentation about doing a 32bit multiplication with
> 16bit multipliers would help a lot.
Ask and ye shall receive:
http://focus.ti.com/lit/an/spra297/spra297.pdf
This is actually an app note on "extended precision FFT for C62x", but the thing is that back then (2002 time-frame)
16-bit multipliers was all TI had for fixed-point so they did some nice docs on how to maximize it for extended
precision.
-Jeff
_____________________________________






