Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12420 Discussions

floating point in quartus and nios

Altera_Forum
Honored Contributor II
881 Views

i wanted to add floating point in my sopc desgin.so I selected floating point hw in sopc builder.After compiling i wrote a code for floating point in nios ide.my code shown below. 

# include <stdio.h># include <system.h># include <math.h># include "altera_avalon_timer_regs.h"# include "sys/alt_timestamp.h"# include "floating_point.h"# include <float.h> 

int main() 

float A = 32.223; 

float B = 23.333; 

float C_MUL1=0; 

alt_u32 num_ticks = 0; 

alt_u32 time1,time2; 

if (alt_timestamp_start() < 0) 

printf("Timer init failed \n"); 

else 

printf("Floating point checking!\n\n"); 

 

 

time1 = alt_timestamp(); 

 

C_MUL1 = A*B; 

time2 = alt_timestamp(); 

printf("C_MUL1= %f\n",C_MUL1); 

 

printf("time1 is %u\n",time1); 

printf("time2 is %u\n",time2); 

 

 

 

 

return 0; 

 

 

 

 

 

 

 

 

My qstion is whether my code is correct or not?Whether i needed to use custum instruction for accessing floating point? 

 

 

 

regards, 

Nasik
0 Kudos
0 Replies
Reply