EasyManua.ls Logo

Altera DE1-SoC - DE1-SoC PS;2 Interface

Altera DE1-SoC
45 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
DE1-SOC COMPUTER SYSTEM WITH NIOS II For Quartus II 15.0
/********************************************************************************
* This program demonstrates use of floating-point numbers in the DE1-SoC Computer
*
* It performs the following:
* 1. reads two FP numbers from the Terminal window
* 2. performs +, 1, *, and / on the numbers, then prints results on Terminal window
********************************************************************************/
int main(void)
{
float x, y, add, sub, mult, div;
while(1)
{
printf ("Enter FP values X Y:\n");
scanf ("%f", &x);
printf ("%f ", x); // echo the typed data to the Terminal window
scanf ("%f", &y);
printf ("%f\n", y); // echo the typed data to the Terminal window
add = x + y;
sub = x y;
mult = x * y;
div = x / y;
printf ("X + Y = %f\n", add);
printf ("X - Y = %f\n", sub);
printf ("X * Y = %f\n", mult);
printf ("X / Y = %f\n", div);
}
}
Figure 38. An example of code that uses floating-point variables.
Altera Corporation - University Program
2015
41

Other manuals for Altera DE1-SoC

Related product manuals