UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer seecwriter
Observer
4,003 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
Scholar austin
Scholar
3,997 Views
Registered: ‎02-27-2008

Re: Need Elapsed time

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
Observer seecwriter
Observer
3,986 Views
Registered: ‎11-14-2012

Re: Need Elapsed time

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
Scholar austin
Scholar
3,984 Views
Registered: ‎02-27-2008

Re: Need Elapsed time

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
Adventurer
Adventurer
3,965 Views
Registered: ‎05-16-2012

Re: Need Elapsed time

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