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: 
Highlighted
393 Views
Registered: ‎04-10-2019

How to keep track of time ?

Jump to solution

I am new to HLS and I am using it in my Bacheor project where now I need to keep track of time while the code is executing so how can I do so ?

Further explanation : My target is to implement odometry of a robotic vehicle on HLS then export it to have an IP on vivado so I can use it with other IPs to burn them on the PL of the PYNQ-z1 board , therfore I have a variable in all my equations which is (dt) , so I need to know how can I do this to work with the zynq processor ?

I know that ctime.h and time.h C++ libraries can't be synthesized so what can I do ?

Mohamed Taher
0 Kudos
1 Solution

Accepted Solutions
Scholar u4223374
Scholar
319 Views
Registered: ‎04-26-2015

Re: How to keep track of time ?

Jump to solution

mohamed.ellaithy@student.guc.edu.eg  I already answered this in your other thread...

 

The short answer is that HLS has no way to do this internally. HLS is "emulating" a single-threaded C program; single-threaded implies that there can't be a separate task running a timer. You can do it with an external timer, but that won't be synthesizable.

5 Replies
Teacher xilinxacct
Teacher
386 Views
Registered: ‎10-23-2018

Re: How to keep track of time ?

Jump to solution

mohamed.ellaithy@student.guc.edu.eg 

It depends on the granularity of time you need. The 'host' side if the testbench does not need to be fully synthesizeable, so it you want capture the execution time of the call, you are fine. In fact, the cosimulation will get you clock level estimations. Alternatively, the performance estimates will give you the basic timing bounds.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed. :-)

0 Kudos
342 Views
Registered: ‎04-10-2019

Re: How to keep track of time ?

Jump to solution

Thank you for replying but as I said I am new to this so I didn't understand what you said , I simply want to achieve something like what is done here in the attached picture to be used as a variable in an equation in a project and then run synthesis and package the whole module as an ip to burn on the PYNQ-z1 PL later .

So is this achievable ?

Mohamed Taher
Screenshot from 2019-06-20 07-28-49.png
0 Kudos
Teacher xilinxacct
Teacher
325 Views
Registered: ‎10-23-2018

Re: How to keep track of time ?

Jump to solution

mohamed.ellaithy@student.guc.edu.eg 

If wall clock gives you enough accuracy, and you are measuring the time that the host makes the call and returns, then yes... the delta time is fine... 

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed. :-)

0 Kudos
Scholar u4223374
Scholar
320 Views
Registered: ‎04-26-2015

Re: How to keep track of time ?

Jump to solution

mohamed.ellaithy@student.guc.edu.eg  I already answered this in your other thread...

 

The short answer is that HLS has no way to do this internally. HLS is "emulating" a single-threaded C program; single-threaded implies that there can't be a separate task running a timer. You can do it with an external timer, but that won't be synthesizable.

Voyager
Voyager
305 Views
Registered: ‎08-16-2018

Re: How to keep track of time ?

Jump to solution

First, HLS is not software, right?

There is a number of approaches. When using FPGA, data is typically pipelined, so there are different pieces of it circulating through an IP at any time. Many processes, even written in HLS will have a fixed interval (time between input and output), so what you may do is packetise your data and stick a timestamp. Every time a block processes a packet, reads the timestamp, add its interval and puts that timestamp in the output packet.

While this may not be as simple as a C function, it has the minimum granularity and maximum flexibility.

Odometry projects in HLS with doubts about basic stuff like counting clock cycles... new generations are awesome.

0 Kudos