Hello, I have some confusion regarding the multiplication in ADSP 218x. For example, i want to multiply 1.5 * 1.5 which should give 2.25 in assembly language of ADSP 218x. to represent 1.5 , i use the 2.14 format which gives it to be 0x6000. Now when i keep MX0 = 0x6000 and MY0 = 0x6000 and give MR = MX0 * MY0, the result is MR2 = 00 MR1 = 4800 MR0 = 0000 Now the problem is how to shift the data to bring it to the format understandable by the DSP. Can anybody help me in this regard. I hope i am able to make my point clear. Or if you can suggest soem technical material for this. Thanks, SOnali __________________________________ |
floating point multiplication in ADSP 218x
Started by ●March 15, 2005
Reply by ●March 15, 20052005-03-15
On Tue, 15 Mar 2005, Sonali Agarwal wrote: > I have some confusion regarding the > multiplication in ADSP 218x. > For example, i want to multiply 1.5 * 1.5 which should > give 2.25 in assembly language of ADSP 218x. > to represent 1.5 , i use the 2.14 format which gives > it to be 0x6000. > Now when i keep MX0 = 0x6000 and MY0 = 0x6000 and give > MR = MX0 * MY0, the result is > MR2 = 00 > MR1 = 4800 > MR0 = 0000 > Now the problem is how to shift the data to bring it > to the format understandable by the DSP. > Can anybody help me in this regard. I hope i am able > to make my point clear. Or if you can suggest soem > technical material for this. the multiplier is doing things with fractions, and you want a different representation. 0x6000 = .75 and .75*.75 = 0x4800. Since you want to scale everything by 2 in each number you want to scale things by 4 in the final result. So 0x4800 is now in 3.13 format (1 bit sign and 2 bits before binary point since multiplier takes care of the sign for you). Patience, persistence, truth, Dr. mike |
Reply by ●March 16, 20052005-03-16
Hi, The 218x has a mode (M_MODE, if recall well) on which the DSP makes the shift itself, but it only works for 1.15 x 1.15 = 2.30 -> 1.31. For other formats, you'd heve to do the shift by yourself, using the barrel shifter. What result do you expect (expressed in your 2.14 format?) JaaC --- Sonali Agarwal <> wrote: > > > Hello, > I have some confusion regarding the > multiplication in ADSP 218x. > For example, i want to multiply 1.5 * 1.5 which > should > give 2.25 in assembly language of ADSP 218x. > to represent 1.5 , i use the 2.14 format which gives > it to be 0x6000. > Now when i keep MX0 = 0x6000 and MY0 = 0x6000 and > give > MR = MX0 * MY0, the result is > MR2 = 00 > MR1 = 4800 > MR0 = 0000 > Now the problem is how to shift the data to bring it > to the format understandable by the DSP. > Can anybody help me in this regard. I hope i am able > to make my point clear. Or if you can suggest soem > technical material for this. > Thanks, > SOnali Jaime Andr Aranguren Cardona __________________________________ |