I'm using the Xilinx toolchain and I'd like to automate (with TCL scripts) some things. While the ISE Suite can be extensively automated via TCL and their TCL shell (xtclsh.exe
), there doesn't seem to be any way for me to programatically determine which version of the Xilinx tools are installed so I can know where the shell resides. I can't just hardcode the path since each version of the tools is installed in a subdirectory that includes the version number. I run the risk of invalidating all my scripts as soon as I update to the newest version they release. This same question has come up on the Xilinx forums, apparently to no avail. Does anyone know a way (some script/batch file/environmental variable) to get the path to the newest version of the Xilinx executable installed programatically?
1 Answer
With the newer Xilinx (12 upwards) tools, you have to run a script before running any of them. The script sets some environment variables to point to the "right version"
If you run the tools from the usual launcher icons, that script is run for you transparently. If you open your own dos box and want to run a compile within it, you have to run <path to xilinx tools>\<version>\ise_ds\settings[32|64].bat
to get the environment set up.
You then get a set of XILINX_*
environment variables set up, the most fundamental of which is called XILINX
. On my 12.4 installation it points to
XILINX=c:\Xilinx\12.4\ISE_DS\ISE
This is also then added to the path, so when you call map
, par
etc, the right one gets called. So you shouldn't need to actually know the path in your scripts, unless you want to access some of the datafiles within the installation.
How can I find the correct "root" programmatically?
In my experience, the "correct" way of operating is to require that the correct root is explicitly defined by the user. We have many different versions of ISE installed and select which one depending on the project. Once a project has started we freeze the tools used (to the extent that with production projects, the build script checks the version of the tools as a first task and bombs out of the user has selected the wrong one). Particularly between major releases, there is sufficient churn that migrating toolsets can be quite a large job, especially if you are using the wider toolset (eg EDK, system generator etc).
However, if you really want to run the the latest tools you can find all the time, I think there may be some registry keys (assuming you are a Windows user) you could iterate through. They may contain a pointer to the root which you could then use.
-
\$\begingroup\$ I ran that batch file and still don't have any environmental variables for XILINX. \$\endgroup\$– Joel BCommented Jan 12, 2012 at 18:39
-
1\$\begingroup\$ For give me if this is an obvious questions, but did you run it from a DOS window, or did you double-click it from explorer? It doesn't change the global environment, only, the local one, so you have to do the former \$\endgroup\$ Commented Jan 13, 2012 at 10:41
-
\$\begingroup\$ To run it from the DOS window I have to know what directory it is in. To know what directory it is in, I have to know what version of ISE is installed since Xilinx uses the version number in the install directory. So I'm still left with the same problem as before. I can't get these variables telling me what installs I have until I know what install I have. \$\endgroup\$– Joel BCommented Jan 13, 2012 at 14:41
-
\$\begingroup\$ The key point is that the user has to actively choose the version they wish to "enable". Your scripts then run within that environment and make use of the environment to find the data they need, which should be independent of version once the correct "root" is found. \$\endgroup\$ Commented Jan 13, 2012 at 16:01
-
\$\begingroup\$ My question asked could be paraphrased as: "How can I find the correct "root" programatically?" I need them to not be actively chosen by the end user, but to programatically find the latest version without any human interaction or a priori knowledge of the system. \$\endgroup\$– Joel BCommented Jan 13, 2012 at 17:22