<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Community: Message List - FIR filter: how to use memory?</title>
    <link>http://line6.com/support/community/support/effects/tonecore_development_kit?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Sat, 02 Mar 2013 03:32:51 GMT</pubDate>
    <generator>Jive SBS 4.5.7.0 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2013-03-02T03:32:51Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/411948?tstart=0#411948</link>
      <description>&lt;!-- [DocumentBodyStart:7a97d95e-383c-4680-af25-cda7c8f027de] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;If you are still working on this...&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;For linear phase FIR filters (typical application), the impulse response (coefficients) must be &lt;/p&gt;&lt;p&gt; symmetric:&amp;#160; h[n] = h[N-n-1]&amp;#160;&amp;#160;&amp;#160; e.g.&amp;#160;&amp;#160;&amp;#160; h[0] = h[1023], h[1] = h[1022], etc.&lt;/p&gt;&lt;p&gt;or &lt;/p&gt;&lt;p&gt;anti-symmetric: h[n] = -h[N-n-1]&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;For a 1024 tap filter, you really only need to store 512 coefficients.&amp;#160;&amp;#160; With proper addressing (modulo pointers), you can do 2 MAC operations with the same coefficient, looping 512 times.&amp;#160; When the # of coefficients is odd, you need to handle the middle coefficient as a special case, outside the filter loop at the end.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;With proper design, an IIR (recursive) filter can be used to approximate a long FIR filter, maybe only requiring 3 or 4 coefficients.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Or the DSP could be used to compute the coefficients dynamically at boot time storing them in X or Y data memory.&amp;#160; &lt;/p&gt;&lt;p&gt;Then you would not need to download them in the code image.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;Mike&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:7a97d95e-383c-4680-af25-cda7c8f027de] --&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:29:50 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/411948?tstart=0#411948</guid>
      <dc:date>2013-02-25T18:29:50Z</dc:date>
      <clearspace:dateToText>2 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/289998?tstart=0#289998</link>
      <description>&lt;!-- [DocumentBodyStart:f73a07e4-35c3-4b67-b0df-2ce160facb3f] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;One problem I see is that fir_state is starting at $100.&amp;#160; For modulo 512 addressing, the base address needs to be a multiple of 2^k.&amp;#160; For 512 taps, k=9, so the starting address should be $000 or $200. (For 100 taps, k=7 so 2^k=128 and $100 (256 decimal) is a multiple of that).&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;You can verify that all of your coefficients are loaded by copying the last coefficient from y memory to one of the read-from-DSP debug registers.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:f73a07e4-35c3-4b67-b0df-2ce160facb3f] --&gt;</description>
      <pubDate>Sat, 18 Jun 2011 02:10:37 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/289998?tstart=0#289998</guid>
      <dc:date>2011-06-18T02:10:37Z</dc:date>
      <clearspace:dateToText>1 year, 11 months ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/289433?tstart=0#289433</link>
      <description>&lt;!-- [DocumentBodyStart:0af75d94-fbfe-4630-9112-ae2027ae6aec] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;&lt;span&gt;Hi!&amp;#160; I tried to expand the memory for a 512 tap filter by &lt;span&gt;reflashing&lt;/span&gt; the &lt;span&gt;MCU&lt;/span&gt; module, but I am experiencing&amp;#160; problems ... I think that not all the coefficients are sent ...&amp;#160; This is my code: &lt;/span&gt;&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; page&amp;#160;&amp;#160;&amp;#160; 132,60&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; include "..\Ioequ.inc"&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; include "..\vectors4.inc"&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; list&lt;/p&gt;&lt;p&gt;
n&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; equ 100 ; number of filter taps&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;then the constants are defined for the knobs, footswitches etc. The&amp;#160; memory and coefficients are defined as follows:&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; org&amp;#160;&amp;#160;&amp;#160;&amp;#160; x:$100 ;make equal to number of taps!!!!&lt;br/&gt;&lt;br/&gt;fir_state&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ds&amp;#160; n&lt;br/&gt;&lt;br/&gt;;**********************************************&lt;br/&gt;; Write your internal Y-memory allocations here&lt;br/&gt;;**********************************************&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; org&amp;#160;&amp;#160;&amp;#160;&amp;#160; y:$000&lt;br/&gt;&lt;br/&gt;fir_coeffs&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ds&amp;#160; n&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;During the initialization I clean the memory for the filter state and&amp;#160; the coefficients (even if this last is not really needed)&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; Initialize registers&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #&amp;gt;$000000,x0&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; x0,r0&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rep&amp;#160;&amp;#160;&amp;#160;&amp;#160; #28&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; x0,x:(r0)+&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; clear start of x:mem&lt;br/&gt;&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #fir_state,r0&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rep&amp;#160;&amp;#160;&amp;#160;&amp;#160; #n&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; x0,x:(r0)+&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; clear start of x:mem&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;move&amp;#160;&amp;#160;&amp;#160; #fir_coeffs,r0&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;rep&amp;#160;&amp;#160;&amp;#160;&amp;#160; #n&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;move&amp;#160;&amp;#160;&amp;#160; x0,y:(r0)+&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; clear start of x:mem&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span&gt; and I load the coefficients with the method explained by &lt;span&gt;RedPandaCurt&lt;/span&gt; (the coefficients are&amp;#160; defined at the end of the program, as previously explained) &lt;/span&gt;&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt; &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move #COEFF_0,r0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; address in program memory&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move #fir_coeffs,r4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; address in Y memory&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; do #n,init_coeffs_end ; repeat for number of entries&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move p:(r0)+,y0&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move y0,y:(r4)+&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; init_coeffs_end:&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; once during initialization:&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #fir_state,r0&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; state&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #n-1,m0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; mod(n)&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #fir_coeffs,r4&amp;#160;&amp;#160;&amp;#160; ; coefficients&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; #n-1,m4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; mod(n)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;In&amp;#160; the even interrupt section I do the following:&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;*****************************************************************************************&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; Do the processing here! x0 contains the left channel sample, x1 the right channel sample&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;*****************************************************************************************&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; movep&amp;#160;&amp;#160; x:M_RX0,x:(r0)&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; FIR&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; clr&amp;#160;&amp;#160;&amp;#160;&amp;#160; a&amp;#160;&amp;#160;&amp;#160; x:(r0)+,x0&amp;#160; y:(r4)+,y0 &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rep&amp;#160;&amp;#160;&amp;#160;&amp;#160; #n-1&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; mac&amp;#160;&amp;#160;&amp;#160;&amp;#160; x0,y0,a&amp;#160; x:(r0)+,x0&amp;#160; y:(r4)+,y0 &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; macr&amp;#160;&amp;#160;&amp;#160; x0,y0,a&amp;#160; (r0)-&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; round and shift input samples&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; a,x0&amp;#160;&amp;#160; ; output sample&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; The left channel sample to be outputted&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; x0,x:LeftTx&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; The right channel sample to be outputted&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; move&amp;#160;&amp;#160;&amp;#160; x0,x:RightTx&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;*******************&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; End of processing.&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ;*******************&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span&gt;The program, as said, works for 100 taps.&amp;#160; When I increase the number, and &lt;span&gt;reflash&lt;/span&gt; the &lt;span&gt;MCU&lt;/span&gt; according to the&amp;#160; instruction in the &lt;span&gt;TCDK&lt;/span&gt; user&amp;#160; guide, it seems some of the coefficients are not loaded ... even if I&amp;#160; have got roughly 700 words, much less than the 1024 allowed. Any&amp;#160; suggestions for this? (I really really need those 512 taps ...)&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Tank&amp;#160; you for your answer,&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;Daniele&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:0af75d94-fbfe-4630-9112-ae2027ae6aec] --&gt;</description>
      <pubDate>Thu, 16 Jun 2011 15:32:47 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/289433?tstart=0#289433</guid>
      <dc:date>2011-06-16T15:32:47Z</dc:date>
      <clearspace:dateToText>1 year, 11 months ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/288597?tstart=0#288597</link>
      <description>&lt;!-- [DocumentBodyStart:7911d77d-6bb4-4fac-a7c7-f92a5d9f69d0] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi!&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Many thanks for the answer! I finally managed to code a FIR filter (100 taps) with a windowing function. The results from frquency plots seem good ... it works !!! &lt;img height="16px" src="http://l6c.scdn.line6.net/support/4.5.7/images/emoticons/happy.gif" width="16px"/&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;I will post the code (I made some slight modifications to your suggestions) soon. Now I will try to find out how to increase the number of words which can be sent to the pedal (the maximum seems to be the size of the 2 band EQ program ...). It seems I will have to reflash the MCU ...&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Furthermore, I am checking how to downsample a .wav file, in order to compute the coefficients for the 39.0625 kHz sample frequency from standard impulse responses (44.1 kHz).&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:7911d77d-6bb4-4fac-a7c7-f92a5d9f69d0] --&gt;</description>
      <pubDate>Tue, 14 Jun 2011 16:01:37 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/288597?tstart=0#288597</guid>
      <dc:date>2011-06-14T16:01:37Z</dc:date>
      <clearspace:dateToText>1 year, 11 months ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/285631?tstart=0#285631</link>
      <description>&lt;!-- [DocumentBodyStart:054457cc-01e9-46fa-8c80-3cf61d3e80c2] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;IIRC, you will only be able to 512 taps using MACs with X/Y memory and modulo addressing, because you need to store the coefficients in program memory for initialization.&amp;#160; I describe that approach below, but you also might want to read the coefficients directly from program memory in your FIR (see the "Pitch detection/octave effect" thread for ideas).&amp;#160; &lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;You can allocate arrays in X and Y memory like the following.&amp;#160; For modulo-1024 addressing, each array needs to start at a multiple of 1024 within its address space.&amp;#160; The simplest way to do that is to put them at the beginning of the section.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; org&amp;#160;&amp;#160;&amp;#160;&amp;#160; x:$000&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;fir_state&amp;#160;&amp;#160;&amp;#160;&amp;#160; ds&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1024&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; org&amp;#160;&amp;#160;&amp;#160;&amp;#160; y:$000&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;fir_coeffs&amp;#160;&amp;#160;&amp;#160;&amp;#160; ds&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1024&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;p&gt;For initializing tables in X or Y memory from program memory, you can define a global data section after the rest of your code:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;section P_DATA_MEMORY global&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;org p:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;; Table values&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;COEFF_0 dc $000000&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;COEFF_1 dc $000001&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;.....&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;You need to be careful about using too much program memory - your global data section will get truncated without warning.&amp;#160; (Note that the DSP56k assembler allows you to initialize the coefficients directly in program memory (dc), but it won't work with the TCDDK.)&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Then in your initialization code, copy it to an address in Y memory:&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move #COEFF_0,r0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; address in program memory&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move #fir_coeffs,r4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; address in Y memory&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;do #1024,init_coeffs_end ; repeat for number of entries&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move p:(r0)+,y0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move y0,x:(r4)+&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;init_coeffs_end:&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Also, don't forget to clear the filter state.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Use post-increment addressing to increment the addresses in your FIR loop.&amp;#160; The DSP56K has a modulo addressing mode to implement the delay line; each Rn register has an Mn register that you can set to modulus-1.&amp;#160; See Section 4.5.3 of the DSP56300 Family Manual for more details.&amp;#160; You can find examples of DSP56K FIRs on the web, but the basic idea is something like this (I didn't assemble/test this):&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;; once during initialization:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160; #fir_state,r0&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; state&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160; #1023,m0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; mod(1024)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160; #fir_coeffs,r4&amp;#160;&amp;#160;&amp;#160; ; coefficients&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160; #1023,m4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; mod(1024)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;; for each sample:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160;&amp;#160; y:LeftInput,x0&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; input sample&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;; FIR&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;clr&amp;#160;&amp;#160;&amp;#160;&amp;#160; a&amp;#160;&amp;#160;&amp;#160; x0,x:(r0)+&amp;#160; y:(r4)+,y0&amp;#160; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;rep&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1023&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;mac&amp;#160;&amp;#160;&amp;#160;&amp;#160; x0,y0,a&amp;#160; x:(r0)+,x0&amp;#160; y:(r4)+,y0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;macr&amp;#160;&amp;#160;&amp;#160; x0,y0,a&amp;#160; (r0)-&amp;#160;&amp;#160;&amp;#160;&amp;#160; ; round and shift input samples&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'courier new', courier;"&gt;move&amp;#160;&amp;#160;&amp;#160;&amp;#160; a,y:RightOutput&amp;#160;&amp;#160; ; output sample&lt;/span&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:054457cc-01e9-46fa-8c80-3cf61d3e80c2] --&gt;</description>
      <pubDate>Sun, 05 Jun 2011 13:19:45 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/285631?tstart=0#285631</guid>
      <dc:date>2011-06-05T13:19:45Z</dc:date>
      <clearspace:dateToText>1 year, 11 months ago</clearspace:dateToText>
      <clearspace:replyCount>4</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>FIR filter: how to use memory?</title>
      <link>http://line6.com/support/message/285527?tstart=0#285527</link>
      <description>&lt;!-- [DocumentBodyStart:42b19924-8794-4d4c-b60e-ea545ada7906] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi all!&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;I recently bought a TCDDK, and I'm having a bit of trouble in programming ...&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;My goal is to implement a FIR filter (1024 tap) for acoustic guitar simulation. I could do something like this:&lt;/p&gt;&lt;p&gt;0. declare 1024 variables for the data at current and previous timesteps y(n), y(n-1), y(n-2) etc&lt;/p&gt;&lt;p&gt;and in the program&lt;/p&gt;&lt;ol&gt;&lt;li&gt;set the accumulator to 0&lt;/li&gt;&lt;li&gt;write 1024 times for each i=1 to n&lt;/li&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;store input value y(i) into y(i-1)&lt;/li&gt;&lt;li&gt;multiply y(i)*coefficient(i) and add to accumulator&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&lt;span&gt;&lt;/span&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;It seems a pretty bulky thing to do ... I hope there is a more elegant and effective way. I thought it could be&lt;/p&gt;&lt;ol&gt;&lt;li&gt;store all coefficient values in a 1024 table&lt;/li&gt;&lt;li&gt;allocate a vector with 1024 values in which to store all the input values for the current and previous timesteps&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;and finally multiply member by member with a repeat instruction, something like&lt;/p&gt;&lt;p&gt;REP #1024&lt;/p&gt;&lt;p&gt;mac x0,y0,a x:(i),x0 y:(i),y0&lt;/p&gt;&lt;p&gt;and i should increment automatically ... &lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Still, I haven't understood yet how to deal with memory allocation and indexing with vectors or tables ... hence my questions:&lt;/p&gt;&lt;p&gt;- how do I allocate a vector with a specified length?&lt;/p&gt;&lt;p&gt;- how do I store some given coefficients in such vector? and, for the input data, how can I save both the current input and the previous values at each timestep?&lt;/p&gt;&lt;p&gt;- what index should I use in order to access the data?&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;I hope my questions are clear, thank you in advance for your answers!&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Daniele&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:42b19924-8794-4d4c-b60e-ea545ada7906] --&gt;</description>
      <pubDate>Sat, 04 Jun 2011 21:45:29 GMT</pubDate>
      <author>support@line6.com</author>
      <guid>http://line6.com/support/message/285527?tstart=0#285527</guid>
      <dc:date>2011-06-04T21:45:29Z</dc:date>
      <clearspace:dateToText>1 year, 11 months ago</clearspace:dateToText>
      <clearspace:replyCount>5</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

