cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
baltam
Contributor
Contributor
2,986 Views
Registered: ‎03-13-2017

tcl scripting: how get the vivado_hls version from inside the script ?

Jump to solution

Hi guys,

when executing a tcl script it would be useful know what vivado_hls version is running.
Unfortunately the tcl command I use in Vivado Design Tool:

[version -short]

doesn't work with vivado_hls.

Someone did find a workaround?

0 Kudos
1 Solution

Accepted Solutions
baltam
Contributor
Contributor
2,044 Views
Registered: ‎03-13-2017

I did forget about this post for some time. Meanwhile I have developed my own solution. Here the TCL procedure I use in my current scripts

#
# TCL procedure that identifies the Vivado_hls version simply looking
# inside the path environment variable. Usage example:
#      "set Vivado_ver [VivadoVer]"
#  Tested on Vivado versions: 2017.3, 2017.2, 2016.4, 2016.3, 2016.1, 2015.4, 2014.4
#
proc VivadoVer {} {
    set position_VivadoHlsVer  [lsearch [file split $::env(PATH)] Vivado_HLS]+1
    set position_VivadoVer     [lsearch [file split $::env(PATH)] Vivado]+1
    set position_SdkVer        [lsearch [file split $::env(PATH)] SDK]+1
    if {${position_VivadoHlsVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_VivadoHlsVer} ${position_VivadoHlsVer}]
        puts "\[VivadoVer{}\] Found 'Vivado_HLS' string in the path, ver: $Vivado_ver"
    } elseif  {${position_VivadoVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_VivadoVer} ${position_VivadoVer}]
        puts "\[VivadoVer{}\] Did not find 'Vivado_HLS' string in the path but have found 'Vivado', ver: $Vivado_ver"
    } elseif  {${position_SdkVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_SdkVer} ${position_SdkVer}]
        puts "\[VivadoVer{}\] Did not find 'Vivado_HLS' string in the path but have found 'SDK', ver: $Vivado_ver"
    } else {
        set Vivado_ver "UNKNOW"
        puts "\[VivadoVer{}\] Did not find any 'Vivado' string in the path, ver: $Vivado_ver"
    }
    return $Vivado_ver
}

 

Depending on the Vivado version I run, I had got different "$path" variables with or without the "Vivado_HLS" string inside. Here some usage example:

 

2017.2

$ source /soft/Xilinx/Vivado/2017.2/settings64.csh
$ tclsh
% set Vivado_ver [VivadoVer]
[VivadoVer{}] Found 'Vivado_HLS' string in the path, ver: 2017.2
2017.2 

2017.3

 

$ source /soft/Xilinx/Vivado/2017.3/settings64.csh
$ tclsh
%set Vivado_ver [VivadoVer] [VivadoVer{}] Did not find 'Vivado_HLS' string in the path but have found 'Vivado', ver: 2017.3 2017.3

 2014.4

$ source /soft/Xilinx/Vivado/2014.4/settings64.csh
$ tclsh
% set Vivado_ver [VivadoVer] [VivadoVer{}] Found 'Vivado_HLS' string in the path, ver: 2014.4 2014.4

 

Does anyone have a better solution ?

 

View solution in original post

0 Kudos
2 Replies
tkim15
Newbie
Newbie
2,068 Views
Registered: ‎10-27-2017

I had the same error but I just realized I had to run vivado, not vivado_hls.

0 Kudos
baltam
Contributor
Contributor
2,045 Views
Registered: ‎03-13-2017

I did forget about this post for some time. Meanwhile I have developed my own solution. Here the TCL procedure I use in my current scripts

#
# TCL procedure that identifies the Vivado_hls version simply looking
# inside the path environment variable. Usage example:
#      "set Vivado_ver [VivadoVer]"
#  Tested on Vivado versions: 2017.3, 2017.2, 2016.4, 2016.3, 2016.1, 2015.4, 2014.4
#
proc VivadoVer {} {
    set position_VivadoHlsVer  [lsearch [file split $::env(PATH)] Vivado_HLS]+1
    set position_VivadoVer     [lsearch [file split $::env(PATH)] Vivado]+1
    set position_SdkVer        [lsearch [file split $::env(PATH)] SDK]+1
    if {${position_VivadoHlsVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_VivadoHlsVer} ${position_VivadoHlsVer}]
        puts "\[VivadoVer{}\] Found 'Vivado_HLS' string in the path, ver: $Vivado_ver"
    } elseif  {${position_VivadoVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_VivadoVer} ${position_VivadoVer}]
        puts "\[VivadoVer{}\] Did not find 'Vivado_HLS' string in the path but have found 'Vivado', ver: $Vivado_ver"
    } elseif  {${position_SdkVer}>0} {
        set Vivado_ver [lrange [file split $::env(PATH)] ${position_SdkVer} ${position_SdkVer}]
        puts "\[VivadoVer{}\] Did not find 'Vivado_HLS' string in the path but have found 'SDK', ver: $Vivado_ver"
    } else {
        set Vivado_ver "UNKNOW"
        puts "\[VivadoVer{}\] Did not find any 'Vivado' string in the path, ver: $Vivado_ver"
    }
    return $Vivado_ver
}

 

Depending on the Vivado version I run, I had got different "$path" variables with or without the "Vivado_HLS" string inside. Here some usage example:

 

2017.2

$ source /soft/Xilinx/Vivado/2017.2/settings64.csh
$ tclsh
% set Vivado_ver [VivadoVer]
[VivadoVer{}] Found 'Vivado_HLS' string in the path, ver: 2017.2
2017.2 

2017.3

 

$ source /soft/Xilinx/Vivado/2017.3/settings64.csh
$ tclsh
%set Vivado_ver [VivadoVer] [VivadoVer{}] Did not find 'Vivado_HLS' string in the path but have found 'Vivado', ver: 2017.3 2017.3

 2014.4

$ source /soft/Xilinx/Vivado/2014.4/settings64.csh
$ tclsh
% set Vivado_ver [VivadoVer] [VivadoVer{}] Found 'Vivado_HLS' string in the path, ver: 2014.4 2014.4

 

Does anyone have a better solution ?

 

View solution in original post

0 Kudos