2 * Milkymist VJ SoC (Software)
3 * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <fpvm/fpvm.h>
21 #include <fpvm/gfpus.h>
22 #include <fpvm/pfpu.h>
25 int main(int argc, char *argv[])
27 struct fpvm_fragment frag;
28 unsigned int registers[PFPU_REG_COUNT];
29 unsigned int code[PFPU_PROGSIZE];
32 printf("libFPVM version: %s\n\n", fpvm_version());
34 printf("******* SIMPLE TEST *******\n");
36 fpvm_assign(&frag, "_Xo", "(_Xi+1)*5.8");
37 fpvm_assign(&frag, "_Yo", "(_Yi+3)*1.4");
38 if(frag.last_error[0] != 0)
39 printf("Reported error: %s\n", frag.last_error);
43 len = gfpus_schedule(&frag, code, registers);
47 printf("\n******* TEST 2 *******\n");
49 printf("Variable foo bound to R%04d\n", fpvm_bind(&frag, "foo"));
50 fpvm_set_xin(&frag, "x");
51 fpvm_set_yin(&frag, "y");
52 fpvm_set_xout(&frag, "dx");
53 fpvm_set_yout(&frag, "dy");
54 fpvm_assign(&frag, "bar", "foo+65+x");
55 fpvm_assign(&frag, "troll", "(y-6)*cos((45+x)*sin(4*bar))");
56 fpvm_assign(&frag, "dx", "troll*bar");
57 fpvm_assign(&frag, "dy", "(troll+x)*above(bar, 6)");
58 if(frag.last_error[0] != 0)
59 printf("Reported error: %s\n", frag.last_error);
63 len = gfpus_schedule(&frag, code, registers);