2 IIR2 Name: IIR2.ASM Type: Assembler Macro Version: 1.0 Date Entered: 15-Jul-87 Last Change: 15-Jul-87 Description: Direct Form Second Order All Pole Filter with Scaling This macro implements a second order all pole IIR filter. The DSP56000/1 scaling modes are used to provide coefficient scaling. This allows coefficients with magnitudes less than two. This is similar in operation to the IIR1 macro. When the A or B register is read, the value is shifted left such that the value of the filter state is multiplied by 2. Since the coefficients are divided by two, the scale factors cancel. This allows coefficients in filters to have magnitudes bounded by 2 which is typical of second order sections. The difference equation for the filter is: y(n)= 2 [x(n) + a(1)y(n-1) + a(2)y(n-2)] --- ---- ---- 2 2 2 with z transform: Y(z) 1 ----- = ------------------------- X(z) -1 -2 1 - a(1) z - a(2) z where: x(n) = input sample at time nT y(n) = output of the filter at time nT a(n) = filter coefficient n T = sample period An example network to realize such a filter is shown in below. Input >----------(+)------------------------> Output x(n) ^ | y(n) | a(1) 1/z (+)<-- 0.8 -----| ^ | | a(2) 1/z (+)<-- -0.3 ----| Second Order Direct Form All Pole IIR Filter The coefficients in the example are arbitrary. The memory map for the filter is shown below: r0 | v -------------------- X: | | | | y(n-1) | y(n-2) | Filter States -------------------- -------------------- Y: | a(1) | a(2) | | .8/2 | -.3/2 | Filter Coefficients -------------------- ^ | r4 Memory Map for the Second Order All Pole Filter The modulo registers m0 and m4 are set to -1 for linear arithmetic. For an example of how to use this macro, see the test program IIR2T.ASM