cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
4,047 Views
Registered: ‎11-14-2012

Need Elapsed time

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?

0 Kudos
4 Replies
Highlighted
Scholar
Scholar
4,041 Views
Registered: ‎02-27-2008

s,

 

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?

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Highlighted
Observer
Observer
4,030 Views
Registered: ‎11-14-2012

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?

0 Kudos
Highlighted
Scholar
Scholar
4,028 Views
Registered: ‎02-27-2008

Yes,


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.


http://www.google.com/url?sa=t&rct=j&q=spartan%206%20microblaze%20timer%20counter%20ip&source=web&cd=1&sqi=2&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.xilinx.com%2Fsupport%2Fdocumentation%2Fip_documentation%2Fxps_timer.pdf&ei=-BmVUfPYC8LJigKihoC4Cw&usg=AFQj...

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Highlighted
Adventurer
Adventurer
4,009 Views
Registered: ‎05-16-2012

Hello,

 

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

 

Regards,

Peter

0 Kudos