Radian Converter
/*
This example is a simple hardware system that converts all the values from the
input stream from degrees to radians.
*/
void RadianConverterSystem(float* degrees, float* radians)
{
int i;
for(i = 0; i < 100; ++i)
{
radians[i] = degrees[i] * 3.14 / 180;
}
}
Description
The C code for the Radian Converter System is shown above. A system is generally composed of one or more input streams (degrees in this example) and one or more output streams (radians in this example) as well as any number of input and output scalars. Note that system code assumes connections to the outside world via memories or streams declared as pointers treated as arrays.
All of the system logic is done inside a for loop in which the stream data is accessed by using the loop index plus any constant offset. The number of loop iterations done and amount of memory accessed are dependent on the loop conditional and the index step size.