What is the most sensible way to time C code running over FemtoRV on LiteOs? #105
Replies: 3 comments 1 reply
-
LiteX has timer logic, controlled by LiteX CSRs (not to be confused with Risc-V CSRs).
Then use as follows:
Note that ticks is a 32 bits counter, so it may wrap-around, so I recommend to call it for portions of the computation, and accumulate kiloticks in another variable, for instance:
In the end you can display the elapsed time as follows:
How I figured out: I have seen that the memory test at the beginning of LiteX boot displays timings, so I took a look at Hope this helps, |
Beta Was this translation helpful? Give feedback.
-
The only way I see is creating a 64 bits counter in LiteX (it is doable but will require diving a little bit inside the code of the SOC in Amaranth). |
Beta Was this translation helpful? Give feedback.
-
Florent mentioned this on the LiteX Dischord chat:
It seems that we can have 64 bit timers! |
Beta Was this translation helpful? Give feedback.
-
What is the best way to time C code running over LiteOs? I tried the standard time.c way of doing it but I got an error because of the cut down version of stdlib that the Makefile uses:
Would it be a good idea to try to use the full stdlib or is there some more simple timer functionality I can make use of to accurately time my programs?
Beta Was this translation helpful? Give feedback.
All reactions