Altera_Forum
Honored Contributor
16 years agofloating point operations with and without Custom instruction floating point hardware
Hi
I want to test the floating point multipication execution time in Nios II with and without Custiom Instruction floating point hardware. I taught without adding Custom Instruction floating point hardware floating point additions or multiplications doesnt work in Nios II but it works Surprisingly So is this mean that it computing in sw i have written a sample code using timer for testing with and without floating point hardware # include <stdio.h># include <system.h># include "altera_avalon_timer_regs.h"# include "sys/alt_timestamp.h" int main() { float A = 32.432; float B = 23.33333; float C_MUL1,C_MUL2,C_MUL3,C_MUL4,C_MUL5,C_MUL6,C_MUL7,C_MUL8,C_MUL9,C_MUL10 = 0; alt_u32 num_ticks = 0; alt_u32 time1, time2,time_diff; if (alt_timestamp_start() < 0) { printf("Timer init failed \n"); } else { printf("Hello from Nios II!\n\n"); time1 = alt_timestamp(); C_MUL1 = A*B; C_MUL2 = A*B; C_MUL3 = A*B; C_MUL4 = A*B; C_MUL5 = A*B; C_MUL6 = A*B; C_MUL7 = A*B; C_MUL8 = A*B; C_MUL9 = A*B; C_MUL10 = A*B; C_MUL1 = A*B; C_MUL2 = A*B; C_MUL3 = A*B; C_MUL4 = A*B; C_MUL5 = A*B; C_MUL6 = A*B; C_MUL7 = A*B; C_MUL8 = A*B; C_MUL9 = A*B; C_MUL10 = A*B; C_MUL1 = A*B; C_MUL2 = A*B; C_MUL3 = A*B; C_MUL4 = A*B; C_MUL5 = A*B; C_MUL6 = A*B; C_MUL7 = A*B; C_MUL8 = A*B; C_MUL9 = A*B; C_MUL10 = A*B; time2 = alt_timestamp(); printf("time1 is %u\n",time1); printf("time2 is %u\n",time2); printf("time2-time1 = %u\n\n",time2-time1); printf("C_MUL1 = %f",C_MUL1); } return 0; } But the results are almost coming the same i am confused weather the Nios II processor is using the Floating point hardware or not How to know this regards M Kalyansrinivas