cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
definelicht
Adventurer
Adventurer
513 Views
Registered: ‎02-16-2017

Query version of HLS tool

Jump to solution

Vitis 2020.1 introduces breaking changes (#1, #2) with no forward or backwards compatible fix, so it's necessary to emit different code depending on which tool is used (vitis_hls or vivado_hls), and/or which version of the tool used to run synthesis.

Is there a way to query which version of the HLS tool is being run from the preprocessor?

I'm looking for something in the spirit of:

#if __VITIS_HLS__
// vitis_hls-compatible implementation
#elif __VIVADO_HLS__
// vivado_hls-compatible version
#else
// simulation/CPU version
#endif


It is possible to pass something manually using cflags in the synthesis script, but this does not work for library code, where it could be run in any number of environments.

0 Kudos
1 Solution

Accepted Solutions
definelicht
Adventurer
Adventurer
360 Views
Registered: ‎02-16-2017

For anyone wondering, this was answered by @ramananr in another thread:


Vitis HLS 2020.2 will contain the predefined macro "__VITIS_HLS__" and so users can use "#ifdef __VITIS_HLS__" to ensure that the code block contained in the ifdef gets executed only when running Vitis HLS.

But unfortunately, previous versions of Vitis HLS and Vivado HLS do not contain such macros and therefore, if you wish to use such macros in your library, you will have to instruct your users to add "-D__VITIS_HLS__" in the -cflags and -csimflags arguments of the add_files command.


 

View solution in original post

0 Kudos
4 Replies
baltam
Contributor
Contributor
492 Views
Registered: ‎03-13-2017

I don't know whether VITIS makes available a way to query about the version but time ago I had a similar problem with vivado HLS which did not have any direct way.
Pls, check if this helps

https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/tcl-scripting-how-get-the-vivado-hls-version-from-inside-the/m-p/804197#M10599

0 Kudos
definelicht
Adventurer
Adventurer
487 Views
Registered: ‎02-16-2017

@baltam wrote:

I don't know whether VITIS makes available a way to query about the version but time ago I had a similar problem with vivado HLS which did not have any direct way.
Pls, check if this helps

https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/tcl-scripting-how-get-the-vivado-hls-version-from-inside-the/m-p/804197#M10599


Thanks for the suggestion! I'm developing library code, some of which consists of headers included directly by user code. This means that I don't have control of how the code is included and compiled. So the only way for this to work consistently is if the tool itself exposes the version running

0 Kudos
ramananr
Xilinx Employee
Xilinx Employee
336 Views
Registered: ‎08-22-2019

Hi,

Vitis HLS 2020.2 will contain the predefined macro "__VITIS_HLS__" and so users can use "#ifdef __VITIS_HLS__" to ensure that the code block contained in the ifdef gets executed only when running Vitis HLS. 

But unfortunately, previous versions of Vitis HLS and Vivado HLS do not contain such macros and therefore, if you wish to use such macros in your library, you will have to instruct your users to add "-D__VITIS_HLS__" in the -cflags and -csimflags arguments of the add_files command.

0 Kudos
definelicht
Adventurer
Adventurer
361 Views
Registered: ‎02-16-2017

For anyone wondering, this was answered by @ramananr in another thread:


Vitis HLS 2020.2 will contain the predefined macro "__VITIS_HLS__" and so users can use "#ifdef __VITIS_HLS__" to ensure that the code block contained in the ifdef gets executed only when running Vitis HLS.

But unfortunately, previous versions of Vitis HLS and Vivado HLS do not contain such macros and therefore, if you wish to use such macros in your library, you will have to instruct your users to add "-D__VITIS_HLS__" in the -cflags and -csimflags arguments of the add_files command.


 

View solution in original post

0 Kudos