- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
hi all,
I want to implement this operation, in NIOS II :
float a,b,c,registre;
clock_t temps_initial,temps_final;
float temps_cpu;
a=2.45;
b=3.48;
temps_initial =clock();
registre=a/b;
c=asin(registre);
temps_final=clock();
temps_cpu=(temps_final-temps_initial)/CLOCKS_PER_SEC;
printf("temps_cpu=%f\n",temps_cpu);
printf("resultat=%f\n", c);
but it didn't work, anybody has an idea about how can we implement floating numbers in nios ?
i define these libraries at the top of the programm
#include <stdio.h>
#include <unistd.h>
#include "math.h"
#include <time.h>
#include <float.h>
is there anything missing ?
thank you all
- Tag:
- Include
Link copiato
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
no , it print random values of 'time_cpu'(per sec) , you can see below the values of results with a good resolution and time taken by cpu to do this operation :
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
it should normally print, the time taken by the cpu to do the operation but, I found that the result is not logic, because I get 2058186 s for cpu time to do this operation which is normally not possible, the issue is how can we calculate the operation time taken by cpu .
Thank you
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
I get ' undefined reference to alt_timestamp_...', even If declared the libraries, do you have an idea about what's missing ?
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
Yes I've included the timer in QSys platform,
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
Have you selected any timer in "timestamp_timer" setting in your BSP editor?
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
thank youuu , yes I just do it right now, but even though i cannot visualize the time and the result, alt_timestamp_start is always <0 so I got this:
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
Have you included the NIOS2 floating point hardware modules along with the timer mentioned in the prev post? If not, you need to add these two modules to perform floating point calculations as well as to calculate clock ticks/cycles.
Post a screenshot of your Qsys system setup here . We maybe able to help you after checking that.
- Contrassegnare come Nuovo
- Preferito
- Iscriversi
- Disattiva notifiche
- Iscriversi a feed RSS
- Evidenziare
- Stampare
- Segnalare contenuto inappropriato
No , I did it with an other example but it didn't work, I don't know exactly how to use it, and which libraries we have to include ?
- Iscriversi a feed RSS
- Contrassegnare la discussione come nuova
- Contrassegnare la discussione come letta
- Sposta questo Discussione per l'utente corrente
- Preferito
- Iscriversi
- Pagina in versione di stampa