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!

AR# 54135

Vivado HLS 2012: Why the top-level function cannot be a template, by example


Why can the top-level function not be a template?


With the current release of the VHLS tools, everything needs to be static at compile time.


Taking as an example, a templated FIR filter:

template<TAPS_number, type> fir (type new_input) {core}


This cannot be a top level function.

However, the following would be a valid top level:


int top_type1(int x) {

   return fir<2,int>(x);



double top_type2(double x) {

   return fir<10000,double>(x);



It should be clear that top_type1 and top_type2 would be very different in size and performance.

As shown in this example, the tool cannot be expected to generate both top_type1 and top_type2 or any other combination on demand.


AR# 54135
Date Created 02/05/2013
Last Updated 03/25/2015
Status Active
Type General Article
  • Vivado Design Suite