Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/gencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ static void comp_fir()

static void comp_iir()
{
printf("#define NZEROS %d\n", nzeros);
printf("#define NPOLES %d\n", npoles);
printf("#define GAIN %15.9e\n\n", pbgain);
printf("static float xv[NZEROS+1], yv[NPOLES+1];\n\n");
printf("static float filterloop(float next_input_value)\n");
printf("{\n");
printf(" const int NZEROS = %d;\n", nzeros);
printf(" const int NPOLES = %d;\n", npoles);
printf(" const float GAIN = %15.9e;\n\n", pbgain);
printf(" static float xv[NZEROS+1], yv[NPOLES+1];\n\n");
margin = 20;
printf("static void filterloop()\n");
printf(" { for (;;)\n");
printf(" { "); pr_shiftdown("xv", nzeros); putchar('\n');
printf(" xv[%d] = `next input value' / GAIN;\n", nzeros);
printf(" "); pr_shiftdown("yv", npoles); putchar('\n');
printf(" yv[%d] =", npoles);
printf(" "); pr_shiftdown("xv", nzeros); putchar('\n');
printf(" xv[%d] = next_input_value / GAIN;\n", nzeros);
printf(" "); pr_shiftdown("yv", npoles); putchar('\n');
printf(" yv[%d] =", npoles);
pr_xpart("xv"); pr_ypart("yv"); printf(";\n");
printf(" `next output value' = yv[%d];\n", npoles);
printf(" }\n");
printf(" }\n\n");
printf(" return yv[%d];\n", npoles);

printf("}\n\n");
}


Expand Down