Can I use regular C?
You may use most of the C language
features except for a limited list of features including recursive
functions, structs, pointers to functions and library function calls
(printf, malloc, etc). These cannot be represented in hardware.
You MAY define multiple functions as long as you declare them as
'static inline'.
You MAY use any of the standard types (array, pointers, int) but
may NOT use float/double types.
You may not declare global variables and arrays which are local to the function.
All of your arrays must be declared as parameters of your function.
Only one-dimensional arrays are supported.
You can find more code samples in the Examples page.
The code below is fine:
unsigned int fib(unsigned int A[], unsigned int n) {
unsigned int last, prelast, curr;
prelast = 0;
last = 1;
unsigned int i;
for (i = 2; i < n; i++) {
curr = prelast + last;
prelast = last;
last = curr;
A[i] = curr;
}
return curr;
}