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!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎03-29-2017

How to optimize codes using the synthesis options in HLS ?


 I want to do optimization to the codes using the synthesis options in HLS ? Can anyone explain me the concept of the optimization?


1. How to perform optimization to the codes ?

2. How to enable optimization in HLS?

0 Kudos
2 Replies
Teacher xilinxacct
Registered: ‎10-23-2018

Re: How to optimize codes using the synthesis options in HLS ?



Hope that helps

If so, please mark as solution accepted to close the issue. Kudos also welcomed. :-)

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

Re: How to optimize codes using the synthesis options in HLS ?

Also see UG902, which is the HLS user guide. In answer to your questions:


(1a) First, don't think about this as "I take code written for a CPU and optimize it for HLS". Instead it's "I take code written for a CPU, understand what effect it has, and completely rewrite it in a HLS-friendly way". Even better is to skip the CPU part completely, find some research on the topic, and select (or develop) an algorithm that is inherently HLS-friendly.

(1b) When you've implemented the algorithm, go through UG902 and apply appropriate directives. You should know (from planning a HLS-friendly algorithm) which loops you want unrolled, which loops you want pipelined (probably all the ones that aren't unrolled), which arrays need to be partitioned (and how much), which interfaces will be needed, etc.

(1c) Once that's done, synthesize the design and see whether HLS actually did what you want. Modify directives and code as appropriate to get it closer to what you want.

(2) You don't. HLS doesn't have a "-O3" compiler option like GCC does. If you want optimization, you do it by hand. There are a couple of flags you can use to tell HLS to put in more effort, but the results are marginal.



0 Kudos