# Contents of ROM of a second order digital biquad filter

Status
Not open for further replies.

#### rinaishlene

##### Junior Member level 3
Referring to this paper

A NEW HARDWARE REALIZATION OF DIGITAL FILTER
by Abraham Peled & Bede Liu
IEEE Transactions on Acoustics,Speech And Signal Processing,December 1974

In this example, a0 = 0.095, a2 = -0.1665478,
a3 = 0.095, b1 = -1.5050353, and b2 = 0.9129197. Thefive columns of the “memory address” correspond to the five binary arguments of the function,. The first bit in the contents is the sign bit and the binary point is the right of the sign bit.
Here the function has been scaled down by 2.

The function and table is in the attached file.

I don't understand how the contents of the ROM is obtain based on the function given and what does it mean by 'the function has been scaled down by 2'?does it a binary scaling?

Thanks

I found and studied this paper
The table can be obtained by this matlab code

%% Check true table
% A New Hardware Realization of Digital Filters

a0=0.095;
a1=-0.1665478;
a2=0.095;
b1=-1.8080353;
b2=0.9129197;

phiphi=zeros(2^5,1);
gg=zeros(2^5,8);

for i=0:2^5-1,
% binary representation
a=dec2bin(i,5);
b=zeros(1,5);
b(find(a=='1'))=1;

% phi function
phi=[a0 a1 a2 -b1 -b2]*b';
c=round(phi*2^7)/2;
s=sign(c);
if c>=0
d=c;
else
d=2^7+c;
end

% phi binary representation
e=dec2bin(d,7);
f=zeros(1,7);
f(find(e=='1'))=1;

g=[(-s+1)/2 f];

phiphi(i+1)=phi;
gg(i+1, =g;
end

If you investigate values of phi, you can remark, that its absolute value is bounded by 2. It seems that why author made scaling by 2. In my code it is also presented.
phiphi =
0
-0.9129
1.8080
0.8951
0.0950
-0.8179
1.9030
0.9901
-0.1665
-1.0795
1.6415
0.7286
-0.0715
-0.9845
1.7365
0.8236
0.0950
-0.8179
1.9030
0.9901
0.1900
-0.7229
1.9980
1.0851
-0.0715
-0.9845
1.7365
0.8236
0.0235
-0.8895
1.8315
0.9186

Smiles corrupted code

gg=zeros(2^5, 8 );

gg(i+1, : )=g;

Thanx for the reply.I'll try to implement the code using MATLAB.

Ok..but based on the table given,when i converted it to decimal number it doesn't appear to be the decimal number that phi function represented.Can u explain that?

All is correct
for example

trying to convert second row to decimal representation:
>> gg(2, ans =
1 1 0 0 0 1 0 1
>> -(2^7-gg(2,2:end)*2.^[7-1:-1:0]')/2^7*2
ans =
-0.9219

and
>> phiphi(2)
ans =
-0.9129
>>

Result is correct

Actually result in the paper you studying, can be regarded as extantion of sequential multiplier. Why? Imagine that in your biquad only coeff a0 is nonzero. Then result of filtering is equivalent to multiplying by a0.
If you investigate algorithm described in the paper, it will be degenerated to sequential multiplier
1. table is degenerated to multiplying by 0 or 1
2. functionality of accumulator will remain the same
It is equivalent to long multiplication of two numbers.
Hence, algorithm described in the paper can be regarded as extension of long multiplication algorithm (realized as sequential multiplier) on the case of weighted summation of 5 numbers.

Hi,

There are few lines in your matlab code that I don't understand

1)From this code, c=round(phi*2^7)/2; why the phi must be multiplied by 2^7?

2)And I don't quite understand the function of find command in these code b(find(a=='1'))=1; and f(find(e=='1'))=1;, ?

There's another thing

Since you studied the paper,refer to the figure 2 in the paper,I could see that the shift registers used are two 2 bit SIPO shift registers which would generate 5 bit address for the ROM but the contents of ROM (phi ) is the 8 bit numbers and the operation in adder (to find yn) also involves 8 bit numbers .So I guess there are some contradiction since isn't the shift registers supposed to be 8 bit too?

Thank you

Rina

Status
Not open for further replies.