N
niyander
Hello,
I would really appreciate if some one can tell me how to implement the
following c++ algorithm in VHDL.
for(int x = 0; x < n; x++)
{
double ca = -1.0;
double sa = 0.0;
int l1 = 1, l2 = 1;
for(int l=0;l < l2n;l++)
{
l1 = l2;
l2 *= 2;
double u1 = 1.0;
double u2 = 0.0;
for(int j = 0; j < l1; j++)
{
for(int i = j; i < n; i += l2)
{
int i1 = i + l1;
double t1 = u1 * *(GRe + m * x + i1) - u2 * *(GIm + m * x +
i1);
double t2 = u1 * *(GIm + m * x + i1) + u2 * *(GRe + m * x +
i1);
*(GRe + m * x + i1) = *(GRe + m * x + i) - t1;
*(GIm + m * x + i1) = *(GIm + m * x + i) - t2;
*(GRe + m * x + i) += t1;
*(GIm + m * x + i) += t2;
}
double z = u1 * ca - u2 * sa;
u2 = u1 * sa + u2 * ca;
u1 = z;
}
sa = sqrt((1.0 - ca) / 2.0);
if(!inverse) sa = -sa;
ca = sqrt((1.0 + ca) / 2.0);
}
}
thanks
I would really appreciate if some one can tell me how to implement the
following c++ algorithm in VHDL.
for(int x = 0; x < n; x++)
{
double ca = -1.0;
double sa = 0.0;
int l1 = 1, l2 = 1;
for(int l=0;l < l2n;l++)
{
l1 = l2;
l2 *= 2;
double u1 = 1.0;
double u2 = 0.0;
for(int j = 0; j < l1; j++)
{
for(int i = j; i < n; i += l2)
{
int i1 = i + l1;
double t1 = u1 * *(GRe + m * x + i1) - u2 * *(GIm + m * x +
i1);
double t2 = u1 * *(GIm + m * x + i1) + u2 * *(GRe + m * x +
i1);
*(GRe + m * x + i1) = *(GRe + m * x + i) - t1;
*(GIm + m * x + i1) = *(GIm + m * x + i) - t2;
*(GRe + m * x + i) += t1;
*(GIm + m * x + i) += t2;
}
double z = u1 * ca - u2 * sa;
u2 = u1 * sa + u2 * ca;
u1 = z;
}
sa = sqrt((1.0 - ca) / 2.0);
if(!inverse) sa = -sa;
ca = sqrt((1.0 + ca) / 2.0);
}
}
thanks