Hi, everyone. Where can I find good descriptions of how the math works in the ADSP2189? I figured out how the View/Debug/Plot window in VisualDSP works, so I ran some simple tests. I used DAGs set up for 256 word circular buffers to capture the data. SI = AR; // AR has the sample from a SIN wave generator routine SR = ASHIFT SI BY -2 (LO); // -12dB DM(I0,M1) = SR0; // capture "input" samples MY0 = 1; MX0 = SR0; // set up multiply MR = MX0 * MY0 (SS); // gives +6dB gain DM(I1,M1) = MR0; // capture "output" samples TX0 = MR0; // output to CODEC Things I learned and questions I generated: ASHIFT can be used to make the amplitude higher or lower by multiples of 2. LSHIFT gives weird results in this use, but does what I expect for bit banging. Why does a (MAC) multiply by 1 double the amplitude of the signal, like I would have thought a multiply by 2 would? A multiply by 2 quadruples the signal. How can I change the amplitude of a signal, up or down, by say, 1.19? Is it better to multiply, then shift down, or the other way around? Am I bumping into needing double precision? I am guessing that I if I multiply first, I don't loose bits. Then I have to shift down to get back to 16 bit for the CODEC. I have spent hours looking for decent explanations of 1.15 format on the web. I found one page with a (one way) conversion equation, but not enough examples to verify how it works, and another that lists enough to get the idea of the minimum and maximum and zero, but no explanation of "what's going on". Any idea where I might find this kind of information? Most of the DSP books and sites seem to jump right into the FFT / high level math, and don't discuss implementation in integer / assembler code. Thank you, Dave David Tiefenbrunn N1WWY Essential Telecommunications Corp. - http://www.essentialtel.com David Tiefenbrunn - http://users.abac.com/dandatief |
|
1.15 format math basics
Started by ●July 25, 2003
Reply by ●July 26, 20032003-07-26
At 03:40 PM 7/25/2003, Dave Tiefenbrunn wrote: The ADI books: Using the ADSP-2100 Family have lots of examples and a 1.15 discussion. Here is a link to resources on our website that will get you to these books: http://www.danvillesignal.com/index.php?id=dspdev_links Al Clark Danville Signal Processing, Inc. >Hi, everyone. > >Where can I find good descriptions of how the math works in the ADSP2189? > >I figured out how the View/Debug/Plot window in VisualDSP works, so I ran >some simple tests. I used DAGs set up for 256 word circular buffers to >capture the data. > > SI = AR; // AR has the sample from a SIN > wave generator routine > SR = ASHIFT SI BY -2 (LO); // -12dB > > DM(I0,M1) = SR0; // capture "input" samples > > MY0 = 1; > MX0 = SR0; // set up multiply > MR = MX0 * MY0 (SS); // gives +6dB gain > > DM(I1,M1) = MR0; // capture "output" samples > TX0 = MR0; // output to CODEC > >Things I learned and questions I generated: > >ASHIFT can be used to make the amplitude higher or lower by multiples of 2. >LSHIFT gives weird results in this use, but does what I expect for bit >banging. > >Why does a (MAC) multiply by 1 double the amplitude of the signal, like I >would have thought a multiply by 2 would? > >A multiply by 2 quadruples the signal. > >How can I change the amplitude of a signal, up or down, by say, 1.19? > >Is it better to multiply, then shift down, or the other way around? Am I >bumping into needing double precision? I am guessing that I if I multiply >first, I don't loose bits. Then I have to shift down to get back to 16 >bit for the CODEC. > >I have spent hours looking for decent explanations of 1.15 format on the >web. I found one page with a (one way) conversion equation, but not >enough examples to verify how it works, and another that lists enough to >get the idea of the minimum and maximum and zero, but no explanation of >"what's going on". Any idea where I might find this kind of >information? Most of the DSP books and sites seem to jump right into the >FFT / high level math, and don't discuss implementation in integer / >assembler code. > >Thank you, >Dave > >David Tiefenbrunn N1WWY >Essential Telecommunications Corp. - http://www.essentialtel.com >David Tiefenbrunn - http://users.abac.com/dandatief > >_____________________________________ >Note: If you do a simple "reply" with your email client, only the author >of this message will receive your answer. You need to do a "reply all" if >you want your answer to be distributed to the entire group. > >_____________________________________ >About this discussion group: > >To Join: Send an email to > >To Post: Send an email to > >To Leave: Send an email to > >Archives: http://groups.yahoo.com/group/adsp > >Other Groups: http://www.dsprelated.com/groups.php3 >">http://docs.yahoo.com/info/terms/ Al Clark Danville Signal Processing, Inc. -------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com |
|
Reply by ●December 4, 20032003-12-04
Hi All, I think I'm having a similar problem to Dave. I'm trying to implement an FIR using the ADSP 2189M Ez-Kit Lite. I'm building my code (in assembly language) on the talkthrough program supplied with the board. Here are some code snippets of what I've done: .section/data seg_input; .VAR InPut[17]; /* circular input buffer for samples from Codec */ /* Below is the test program */ .section/pm seg_code; .VAR Coeffs[17] = 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; start: imask = 0x0001; I6 = InPut; //Set I6 to the begining of the input buffer M5 = 1; // Set M5 to 1 L6 = 17; // L6 = LENGTH(InPut); CNTR = L6; // R = LENGTH (InPut); set the length of the buffer do zero until CE; // Loop through the entire page and zero zero: DM(I6,M5) = 0; // Set each memory location to zero call CodecStop; // Stop the codec call CodecInit; // Initialize the codec IMASK = 0x0001; // Disable interrupts except the timer I4=Coeffs; /* I4 points to the start of the coefficeints buffer */ L4; /* THIS IS THE INPUT BUFFER RX0 WILL BE PLACED HERE */ I6 = InPut; L6; /* L6 = LENGTH(InPut); */ IMASK = 0x0071; LOOPER: nop; IDLE; nop; JUMP LOOPER; /* End the test program */ Because I want the output to be updated every time a new sample arrives, I included the FIR routine in the receive interrupt service routine: .section/pm seg_code; SPORT0_rx_int_handler: ENA SEC_REG; fill: SI = RX0; // RX0 contains the received data SR = ASHIFT SI BY -1 (LO); // divide sample by 2^1 M6=0; dm(I6,M6) = SR0; // Store the shifted sample MR = 0; M4=1; M6=1; CNTR; do loop1 until CE; MX0 = pm(I4,M4); // Load the coefficient and increment pointer MY0 = dm(I6,M6); // Load the sample and increment pointer MR = MR + MX0*MY0 (ss); // causes a doubling -- offset above by the ASHIFT loop1: nop; MX0 = pm(I4,M4); // Load the last coefficient- pointer wraps back to start MY0 = dm(I6,M6); // Load the oldest sample- pointer wraps to newest sample MR = MR + MX0*MY0 (rnd); IF MV SAT MR; M5=-1; MODIFY(I6+=M5); // Decrement the input samples' pointer TX0 = MR1; // Transmit result RTI; /* ////////////////////////// END SPORT0 RX INTERRUPT ///////////////////////// */ From extensive testing, I found the following results: 1. For input buffer sizes (and FIR loops) of length 16 or less, I can take the result from MR0 and transmit it. The last multiplication in the loop doesn't have to be rounded (using (rnd)) in this case. This works fine and I get back the sine wave I'm putting in, modified by whatever coefficients I've specified. 2. When the length of the buffer exceeds 16, the algorithm breaks down. All I see on the oscilloscope screen is a mess. I think something's going wrong with the MAC here, as I've varied the sampling rate and the result is still the same when the buffer length exceeds 16. 3. Using the code above, I do get a sine wave back out on the scope, but only today did I realise that the coefficients are having no effect on it at all! Its magnitude response vs frequency does seem to vary as I change the length of the buffers, but I could set all the coefficients to zero and still get out the same response! Does anybody know what's going on? I'm sure it's something to do with the MAC. Could it be that the samples are being stored in one format and the coefficients in another? If so, how does one fix this? Dave, I found also that (in simple tests) the MAC caused the input wave to be doubled - did you ever find out why this is? I would appreciate any advice ye could give me, or if anybody has some FIR code that works could they please post it or e-mail it to me. Regards and thanks, Rob **************************************** --- In , Al Clark <aclark@d...> wrote: > At 03:40 PM 7/25/2003, Dave Tiefenbrunn wrote: > > The ADI books: Using the ADSP-2100 Family have lots of examples and a 1.15 > discussion. > > Here is a link to resources on our website that will get you to these books: > > http://www.danvillesignal.com/index.php?id=dspdev_links > > Al Clark > Danville Signal Processing, Inc. > >Hi, everyone. > > > >Where can I find good descriptions of how the math works in the ADSP2189? > > > >I figured out how the View/Debug/Plot window in VisualDSP works, so I ran > >some simple tests. I used DAGs set up for 256 word circular buffers to > >capture the data. > > > > SI = AR; // AR has the sample from a SIN > > wave generator routine > > SR = ASHIFT SI BY -2 (LO); // -12dB > > > > DM(I0,M1) = SR0; // capture "input" samples > > > > MY0 = 1; > > MX0 = SR0; // set up multiply > > MR = MX0 * MY0 (SS); // gives +6dB gain > > > > DM(I1,M1) = MR0; // capture "output" samples > > TX0 = MR0; // output to CODEC > > > >Things I learned and questions I generated: > > > >ASHIFT can be used to make the amplitude higher or lower by multiples of 2. > >LSHIFT gives weird results in this use, but does what I expect for bit > >banging. > > > >Why does a (MAC) multiply by 1 double the amplitude of the signal, like I > >would have thought a multiply by 2 would? > > > >A multiply by 2 quadruples the signal. > > > >How can I change the amplitude of a signal, up or down, by say, 1.19? > > > >Is it better to multiply, then shift down, or the other way around? Am I > >bumping into needing double precision? I am guessing that I if I multiply > >first, I don't loose bits. Then I have to shift down to get back to 16 > >bit for the CODEC. > > > >I have spent hours looking for decent explanations of 1.15 format on the > >web. I found one page with a (one way) conversion equation, but not > >enough examples to verify how it works, and another that lists enough to > >get the idea of the minimum and maximum and zero, but no explanation of > >"what's going on". Any idea where I might find this kind of > >information? Most of the DSP books and sites seem to jump right into the > >FFT / high level math, and don't discuss implementation in integer / > >assembler code. > > > >Thank you, > >Dave > > > >David Tiefenbrunn N1WWY > >Essential Telecommunications Corp. - http://www.essentialtel.com > >David Tiefenbrunn - http://users.abac.com/dandatief > > > > > > > >_____________________________________ > >Note: If you do a simple "reply" with your email client, only the author > >of this message will receive your answer. You need to do a "reply all" if > >you want your answer to be distributed to the entire group. > > > >_____________________________________ > >About this discussion group: > > > >To Join: Send an email to > > > >To Post: Send an email to > > > >To Leave: Send an email to > > > >Archives: http://groups.yahoo.com/group/adsp > > > >Other Groups: http://www.dsprelated.com/groups.php3 > > > > > >">http://docs.yahoo.com/info/terms/ > Al Clark > Danville Signal Processing, Inc. > ------------------------------- - > Purveyors of Fine DSP Hardware and other Cool Stuff > Available at http://www.danvillesignal.com |