Forum Discussion
Altera_Forum
Honored Contributor
20 years agoclock cycles on + - * /
Hei, I try to figure out how many clock cycles that is needed to do + - * / on both int and float. I have used the : nios2_51\examples\vhdl\niosII_cycloneII_2c35\full_featured nios2_51\ex...
Altera_Forum
Honored Contributor
20 years agoI change in code with the same result:
for(i = 0; i < 100; i ++){
for(j = 0; j < 100; j ++){
a = a + 1;
b = b + a;
}
context = alt_irq_disable_all();
IOWR_PRE_AVALON_COUNTER(0x01211160, 0);
data0 = IORD_PRE_AVALON_COUNTER(0x01211160);
for(j = 0; j < 100; j ++){
c = b + a;
}
data1 = IORD_PRE_AVALON_COUNTER(0x01211160);
alt_irq_enable_all(context);
data2 = (data1 - data0)/100;
printf("%d \n", data2);
}