hello, I now looking for any code for implementation of levinson-durbin algorithm on fpga. Can you help me? Regards

# vhdl (verilog) code for levinson durbin algorithm

Started by ●September 27, 2011

Reply by ●September 27, 20112011-09-27

ahmadagha23 wrote:> hello, > I now looking for any code for implementation of levinson-durbin algorithm > on fpga. > Can you help me? > Regards

Reply by ●September 27, 20112011-09-27

On 9/27/11 6:54 PM, Vladimir Vassilevsky wrote:> > > ahmadagha23 wrote: > >> hello, >> I now looking for any code for implementation of levinson-durbin >> algorithm >> on fpga. >> Can you help me? >> RegardsVlad, i don't even know if this guy's a student. might just be an FPGA programmer who doesn't know what the durbin recursion thingie is. i have C code for it. comes from the Motorola (now FreeScale) Dr. Bub thingie which got it from some old IEEE Fortran code. i've posted it once or twice before. lemme know if C code is something you can translate to VHDL. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

Reply by ●September 27, 20112011-09-27

On Sep 28, 11:54�am, Vladimir Vassilevsky <nos...@nowhere.com> wrote:> ahmadagha23 wrote: > > hello, > > I now looking for any code for implementation of levinson-durbin algorithm > > on fpga. > > Can you help me? > > RegardsIt's nightime, time for Vlad the Vampire to strike his prey...

Reply by ●September 27, 20112011-09-27

robert bristow-johnson <rbj@audioimagination.com> wrote: (snip)> Vlad, i don't even know if this guy's a student. might just be an FPGA > programmer who doesn't know what the durbin recursion thingie is.> i have C code for it. comes from the Motorola (now FreeScale) Dr. Bub > thingie which got it from some old IEEE Fortran code. i've posted it > once or twice before. lemme know if C code is something you can > translate to VHDL.Usually not so easy if it needs to run much faster than in C. My favorite FPGA implementations are systolic arrays, which are often pretty different from the usual serial implementation of most algorithms. It is still better than nothing if you don't know the algorithm at all. -- glen

Reply by ●September 28, 20112011-09-28

On 9/27/11 10:54 PM, glen herrmannsfeldt wrote:> robert bristow-johnson<rbj@audioimagination.com> wrote: > >> i have C code for it. comes from the Motorola (now FreeScale) Dr. Bub >> thingie which got it from some old IEEE Fortran code. i've posted it >> once or twice before. lemme know if C code is something you can >> translate to VHDL. > > Usually not so easy if it needs to run much faster than in C. >...> It is still better than nothing if you don't know the algorithm > at all.well, i dug it up. don't ask me how it works. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." /********************************************************************** * * * Durbin Algorithm for LPC Coefficients * * * * input: * * n = LPC order * * r -> r[0] to r[n] autocorrelation values * * * * output: * * a -> a[0] to a[n] LPC coefficients, a[0] = 1.0 * * k -> k[0] to k[n] reflection coefficients, k[0] = unused * * * * * **********************************************************************/ #define N 48 /* the biggest n will ever be */ durbin(const int n, const double* r, double* a, double* k) { double a_temp[N], alpha, epsilon; /* n <= N = constant */ int i, j; k[0] = 0.0; /* unused */ a[0] = 1.0; a_temp[0] = 1.0; /* unnecessary but consistent */ alpha = r[0]; for(i=1; i<=n; i++) { epsilon = r[i]; /* epsilon = a[0]*r[i]; */ for(j=1; j<i; j++) { epsilon += a[j]*r[i-j]; } a[i] = k[i] = -epsilon/alpha; alpha = alpha*(1.0 - k[i]*k[i]); for(j=1; j<i; j++) { /* update a[..] array into temporary array */ a_temp[j] = a[j] + k[i]*a[i-j]; } for(j=1; j<i; j++) { a[j] = a_temp[j]; /* update a[..] array */ } } } /* Less concise version with inside for() loops executed at least once in the same manner as Fortran version. */ durbin(const int n, const double* r, double* a, double* k) { double a_temp[N], alpha, epsilon; /* n <= N = constant */ int i, j; k[0] = 0.0; /* unused */ a[0] = 1.0; a_temp[0] = 1.0; /* unnecessary but consistent */ a[1] = k[1] = -r[1]/r[0]; alpha = r[0]*(1.0 - k[1]*k[1]); for(i=2; i<=n; i++) { epsilon = 0.0; for(j=0; j<i; j++) { epsilon += a[j]*r[i-j]; } a[i] = k[i] = -epsilon/alpha; alpha = alpha*(1.0 - k[i]*k[i]); for(j=1; j<i; j++) { /* update a[..] array first into temporary array */ a_temp[j] = a[j] + k[i]*a[i-j]; } for(j=i-1; j>=1; j--) { a[j] = a_temp[j]; /* update a[..] array */ } } } (Nearly) original FORTRAN source program: [1] SUBROUTINE DURBIN(N,R,K,A) C C THIS ROUTINE USES THE DURBIN ALGORITHM TO C TRANSFORM THE AUTOCORRELATION COEFFICIENTS R(0) TO R(N) C TO THE REFLECTION COEFFICIENTS K(1) TO K(N) AND TO THE FILTER C COEFFICIENTS A(0) TO A(N) (A(0)=1). C REAL K(1..N),R(0..N),A(0..N) C C REAL A_TEMP(0..N),EPSILON C A(0) = 1.0 A_TEMP(0) = 1.0 K(1) = -R(1)/R(0) A(1) = K(1) ALPHA = R(0)*(1.0 - K(1)*K(1)) DO 400 I = 2,N EPSILON = 0.0 DO 100 J = 0,I-1 EPSILON = EPSILON + A(J)*R(I-J) 100 CONTINUE K(I) = - EPSILON / ALPHA A(I) = K(I) ALPHA = ALPHA*(1.0 - K(I)*K(I)) DO 200 J = 1,I-1 A_TEMP(J) = A(J) + K(I)*A(I-J) 200 CONTINUE DO 300 J = 1,I-1 A(J) = A_TEMP(J) 300 CONTINUE 400 CONTINUE RETURN END References [1] Papamichalis, Panos E., Practical Approaches to Speech Coding, Englewood Cliffs, NJ: Prentice - Hall, 1987. [2] Rabiner, L.R. and R.W. Schafer, Digital Processing of Speech Signals, Englewood Cliffs, NJ: Prentice - Hall, 1978. [3] Makhoul, John, "Linear Prediction: A Tutorial Review," Proceedings of the IEEE, Volume 63 (April,1975): pp. 561 - 580.

Reply by ●September 28, 20112011-09-28

HardySpicer wrote:> On Sep 28, 11:54 am, Vladimir Vassilevsky<nos...@nowhere.com> wrote: >> ahmadagha23 wrote: >>> hello, >>> I now looking for any code for implementation of levinson-durbin algorithm >>> on fpga. >>> Can you help me? >>> Regards > > It's nightime, time for Vlad the Vampire to strike his prey...I initially read that as "Vlad the Umpire". -- Les Cargill

Reply by ●September 28, 20112011-09-28

robert bristow-johnson <rbj@audioimagination.com> wrote:>> robert bristow-johnson<rbj@audioimagination.com> wrote:>>> i have C code for it. comes from the Motorola (now FreeScale) Dr. Bub >>> thingie which got it from some old IEEE Fortran code. i've posted it >>> once or twice before. lemme know if C code is something you can >>> translate to VHDL.(then I wrote)>> Usually not so easy if it needs to run much faster than in C.> well, i dug it up. don't ask me how it works.Some that do work well in FPGAs are convolution and correlation. It looks (especially from comments) that this does corellation, so it might work. The OP should look up references for systolic array processors, and especially (if above is right) for doing correlations. -- glen

Reply by ●September 28, 20112011-09-28

can't sleep... sheesh. On 9/28/11 12:48 AM, glen herrmannsfeldt wrote:> robert bristow-johnson<rbj@audioimagination.com> wrote: >>> robert bristow-johnson<rbj@audioimagination.com> wrote: > >>>> i have C code for it. comes from the Motorola (now FreeScale) Dr. Bub >>>> thingie which got it from some old IEEE Fortran code. i've posted it >>>> once or twice before. lemme know if C code is something you can >>>> translate to VHDL. > > (then I wrote) >>> Usually not so easy if it needs to run much faster than in C. > >> well, i dug it up. don't ask me how it works. > > Some that do work well in FPGAs are convolution and correlation. > It looks (especially from comments) that this does correlation, so > it might work.it doesn't *do* correlation, but you supply it correlation data. however you get it. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

Reply by ●September 28, 20112011-09-28

robert bristow-johnson wrote:>> ahmadagha23 wrote: >> >>> hello, >>> I now looking for any code for implementation of levinson-durbin >>> algorithm >>> on fpga. >>> Can you help me? >>> Regards > > > > Vlad, i don't even know if this guy's a student.The task is nonsense, and it is worded in the illiterate manner. Homework, no doubt.> might just be an FPGA > programmer who doesn't know what the durbin recursion thingie is.If FPGA programmer asks questions like that, better find a new FPGA programmer. BTW there are better ways to solve for auto regression coefficients on the FPGA hardware rather then Levinson-Durbin.> i have C code for it.Just about everybody has. Google returns ~200K results. VLV