Signed 16x18 pasm multiply
richaj45
Posts: 179
Hello:
Could some one help me.
I want a singed 16-bit x 18-bit integer multiply in PASM that is as fast as possible.
In use the format of the integers is:
16-bit: s.fff_ffff_ffff_ffff Range: +.99999, -1.0000
18-bit: si.ffff_ffff_ffff_ffff Range: +1.99999, -2.0000
The results format is:
34-bits ssi.fff_ffff_ffff_ffff_ffff_ffff_ffff_ffff Range: +0.999999999, -2.00000000
Since there is no need for two sign bits the output can be cut to 33-bits.
The actual number of nine is just an aproximate to show it is close to 1 but not since it is one fractional LSB less. However the -2 is exactly -2.
Thanks for any PASM you can contribute to this. It is for digital filtering were the coefficients are realtime updated.
Regards,
rich
Could some one help me.
I want a singed 16-bit x 18-bit integer multiply in PASM that is as fast as possible.
In use the format of the integers is:
16-bit: s.fff_ffff_ffff_ffff Range: +.99999, -1.0000
18-bit: si.ffff_ffff_ffff_ffff Range: +1.99999, -2.0000
The results format is:
34-bits ssi.fff_ffff_ffff_ffff_ffff_ffff_ffff_ffff Range: +0.999999999, -2.00000000
Since there is no need for two sign bits the output can be cut to 33-bits.
The actual number of nine is just an aproximate to show it is close to 1 but not since it is one fractional LSB less. However the -2 is exactly -2.
Thanks for any PASM you can contribute to this. It is for digital filtering were the coefficients are realtime updated.
Regards,
rich
Comments
Of course there are more knowledgeable heads around here than me who may have a more appropriate solution.
The input is in registers signal (16bit) and coeff (18bit).
The output is a 32bit result for the absolute part and the sign bit in a sign-register. (=33 bits together)
This is just a draft and not tested!
Andy
Edit: If you can make the signal 15 bits signed, or the coefficients only 17bits then the result would fit in one long.
Yes reducing the sizes make thinks fit into 32 bits but i am doing audio filtering and more this is a bare minimum of bits as it is. When i do it in FPGA land i use 24-bits X 24-bits.
Thanks for the code.
regards,
rich