fpuDemo
This example (fpuDemo directory) shows how to use the floating-point unit to perform various mathematical operations such as calculating sine, cosine, tangent, square root, and division. The demo records the number of clock cycles needed to complete each calculation. You can turn off the floating-point unit in the SoC's IP Configuration wizard to compare the FPU results with those obtained using the base I-extension.
The processing time to obtain the results are faster and the binary size is smaller when using the F/D-extension with floating-point unit.
fpu math demo !
rv32i (base-extension) is capable to perform floating-point calculation but rv32i requires
more processing time and instruction to calculate the result enable fpu with d-extension
will sharply improve processing time and decrease app binary size
sine processing clock cycles:879
cosine processing clock cycles:864
tangent processing clock cycles:1148
square root processing clock cycles:2171
division processing clock cycles:377
Input i (in rad): 0.5820
Sine result: 0.5497
Cosine result: 0.8353
Tangent result: 0.6581
Input x: 3828.1234
Square root result: 61.8718
Divsion result: 1040.5619