This test is when you need a very steep transitionband.
First out is a 10 order butterworth transformed to Second Order Sections - just to check how much roundoff noise we get with
int64 + int32*int32 => int64 (compared to double prec. without internal casting)
Code: Select all
#include <xs1.h>
#define BANKS 5
int X[BANKS][3]={{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
int Y[BANKS][2]={{0,0},{0,0},{0,0},{0,0},{0,0}};
int IIRfix64(int x){
const int B[BANKS][3]={ {8409818, 16819636, 8409818} , {8136995 ...
const int A[BANKS][2]={ {1949207645, -1784570915} , {18859734 ...
int Xin,h;
unsigned int l,k;
Xin=x<<6;
for(k=0;k<BANKS;k++){
h=0;l=0;
{h, l} = macs(B[k][0], Xin , h, l);
{h, l} = macs(B[k][1], X[k][1], h, l);
{h, l} = macs(B[k][2], X[k][2], h, l);
{h, l} = macs(A[k][0], Y[k][0]<<1, h, l);
{h, l} = macs(A[k][1], Y[k][1], h, l);
X[k][2]=X[k][1];
X[k][1]=Xin;
Y[k][1]=Y[k][0];
Xin=h<<1;
Y[k][0]=Xin;
}
return (Xin>>6);
}
The SOS sections looks like this with a -3 dB at 1 kHz @48 kHz fs And the cumulative sections forms to this one. One important thing here is that each cumulation never gets above 0 dB. Othervise clipping could occur in between the links. Scaling for fixed represenation can be done in many different ways. The one above is not the optimal one regarding to Hi Q-value polepars.