1 task t1(StartupObject s{initialstate}) {
2 //System.printString("task t1\n");
10 float r[] = new float[N_sim];
11 for (i=0;i<N_sim;i++) {
15 for(j = 0; j < N_ch; j++) {
16 FilterBankAtom fba = new FilterBankAtom(j, N_ch, N_col, N_sim, N_samp, r/*, H, F*/){tosamp};
18 FilterBank fb = new FilterBank(N_sim, N_ch){!finish};
20 taskexit(s{!initialstate});
23 task t2(FilterBankAtom fba{tosamp}) {
24 //System.printString("task t2\n");
29 taskexit(fba{!tosamp, tomerge});
32 task t3(FilterBank fb{!finish}, FilterBankAtom fba{tomerge}) {
33 //System.printString("task t3\n");
35 boolean finish = fb.merge(fba.vF);
38 taskexit(fb{finish, print}, fba{!tomerge});
40 taskexit(fba{!tomerge});
44 task t4(FilterBank fb{print}) {
45 //System.printString("task t4\n");
52 public class FilterBank {
60 public FilterBank(int snum, int cnum) {
62 this.y = new float[N_sim];
63 for(int i=0; i < N_sim; i++) {
69 public boolean merge(float[] result) {
70 for(int i = 0; i < this.N_sim; i++) {
71 this.y[i] += result[i];
75 return this.counter == 0;
79 /*for(int i = 0; i < this.N_sim; i++) {
80 //System.printI((int)this.y[i]);
85 public class FilterBankAtom {
103 public FilterBankAtom(int cindex, int N_ch, int N_col, int N_sim, int N_samp, float[] r/*, float[] H, float[] F*/) {
104 this.ch_index = cindex;
108 this.N_samp = N_samp;
112 this.vH = new float[this.N_sim];
113 this.vDn = new float[(int) this.N_sim/this.N_samp];
114 this.vUp = new float[this.N_sim];
115 this.vF = new float[this.N_sim];
116 /*this.H[] = new float[N_col];
117 this.F[] = new float[N_col];
118 for(int i = 0; i < N_col; i++) {
119 H[i]=i*N_col+j*N_ch+j+i+j+1;
125 int j = this.ch_index;
126 this.H = new float[this.N_col];
127 this.F = new float[this.N_col];
128 for(int i = 0; i < this.N_col; i++) {
129 this.H[i]=i*this.N_col+j*this.N_ch+j+i+j+1;
130 this.F[i]=i*j+j*j+j+i;
134 public void FBCore() {
138 for (j=0; j< N_sim; j++) {
140 for (k=0; ((k<this.N_col) && ((j-k)>=0)); k++) {
141 this.vH[j]+=this.H[k]*this.r[j-k];
146 for (j=0; j < this.N_sim/this.N_samp; j++) {
147 this.vDn[j]=this.vH[j*this.N_samp];
151 for (j=0; j < this.N_sim; j++) {
154 for (j=0; j < this.N_sim/this.N_samp; j++) {
155 this.vUp[j*this.N_samp]=this.vDn[j];
159 for (j=0; j< this.N_sim; j++) {
161 for (k=0; ((k<this.N_col) && ((j-k)>=0)); k++) {
162 this.vF[j]+=this.F[k]*this.vUp[j-k];