source:
Deliverables/D2.2/8051/tests/clight/fir4.c.expected
@
486
Last change on this file since 486 was 486, checked in by , 8 years ago | |
---|---|
File size: 1.1 KB |
Line | |
---|---|
1 | int fir4_c[] = {1129,60034,64720,5595,494,59867,65370,5724,5724,65370,59867,494,5595,64720,60034,1129}; |
2 | int fir4_in[] = {0, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7986, 8993, 1808, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096}; |
3 | |
4 | int fir4(int fir4_in[], int fir4_c[], int fir4_out[], int size) { |
5 | int i,j, tmp1, tmp2, tmp3, tmp4; |
6 | int x[16]; |
7 | int adx = 0; |
8 | int res = 0; |
9 | |
10 | for(i = 0; i < 16; i = i+1){ |
11 | x[i] = 0; |
12 | } |
13 | |
14 | for (j = 0; j < size; j = j+1) { |
15 | x[adx] = fir4_in[j]; |
16 | res = 0; |
17 | |
18 | for(i = 0; i < 16; i = i+4){ |
19 | tmp1 = (x[adx]*fir4_c[i]); |
20 | tmp2 = (x[(adx+1)%16]*fir4_c[i+1]); |
21 | tmp3 = (x[(adx+2)%16]*fir4_c[i+2]); |
22 | tmp4 = (x[(adx+3)%16]*fir4_c[i+3]); |
23 | res = res + tmp1 + tmp2 + tmp3 + tmp4; |
24 | adx = (adx+4)%16; |
25 | } |
26 | adx=(adx+1)%16; |
27 | fir4_out[j] = res >> 16; |
28 | } |
29 | return 0; |
30 | } |
31 | |
32 | int main(){ |
33 | int fir4_out[16]; |
34 | return fir4(fir4_in,fir4_c,fir4_out,16); |
35 | } |
Note: See TracBrowser
for help on using the repository browser.