05-16-2013 09:12 AM
I'm using XilKernel on a Microblaze. I need to be able to measure elapsed time in milliseconds, out to about 60-seconds. Is that functionality available?
05-16-2013 09:57 AM
Of course. Measuring time is as simple as running a counter of a reference frequency, and then reading its value at the beginning, and at the end, and subtracting.
Making counters and registers in the FPGA device is trivial. Registering their outputs is similarly trivial. Starting and stopping, or capturing is based on how you detect "begin" and "end." Are they addresses that are read/written? Are they commands given by a line of code?
05-16-2013 10:33 AM
I'm not understanding your statements about addresses and commands. I would like a free-running 32-bit counter that incremented every millisecond. I would then read the current value and save it, then each time through the function read the current value and see how much time had elapsed. Very simple, as you say. But I don't see that functionality in the XiKernel. Do I have to get the FPGA designed to add a 32-bit timer and generate a 1ms clock to drive it?
05-16-2013 10:40 AM
Or, you can look at the IP blocks available to interface with the MicoBlaze. I suspect there are counter/timers already designed you might integrate into your design.
05-17-2013 12:28 AM
Or much easier without needing to modify the FPGA:
If you're running Linux you can use the function clock_gettime and use the clock: CLOCK_MONOTONIC.
You should be able to find examples how to use this function very easily