Using the Xilinx Alliance 3.1i/3.3i Tools under Linux

Table of Contents

  1. Introduction
  2. Why Use Linux/Wine for Executing the Xilinx Tools?
  3. Installing Wine-20010510
  4. Capturing a Xilinx Install to Work with Linux
  5. Setting Up Your Environment
  6. Running the Tools
  7. Speed
  8. Addendum: Xilinx Alliance 4.1i


Introduction

In the BYU Configurable Computing Laboratory, we have been using Linux to process Xilinx designs since December 1999 (see Using the Xilinx Alliance 2.1i Tools Under Linux). Since that time we have used the Xilinx Alliance 2.1i and 3.1i/3.3i tools with various versions of the Wine emulator, including versions 991212, 20000821, and 20010510. Though the Xilinx Alliance tools are not compiled for Linux, many of the tools appear to work just fine under Wine. In particular, Version 20010510 appears to provide a number of improvements over previous versions of Wine, including versions 20000821 and 991212 which we have used extensively in the lab. As you might expect, though, a few caveats exist when using Wine for executing the command-line and GUI-based Alliance tools, which I will discuss later in this document.

Before describing how to do all of this, I should put forth the following disclaimer. This information is provided as an aid for using the Xilinx tools under Linux. We are not "supporting" this information, though, if you have questions, we would be glad to help as time allows. Xilinx would probably laugh if you contacted them for support of this arrangement. Further, as always, you should stay within your number of contracted Xilinx licenses to remain legal and supported. This information should be in no way used to circumvent or ignore the license agreements for Xilinx software.


Why Use Linux/Wine for Executing the Xilinx Tools?

You might ask, "Why would I even want to mess with trying to execute the Xilinx tools under Linux using Wine?" Here are several possible reasons:
Linux is your main desktop platform.
Due to the several advantages of using Linux over NT or other UNIX variants, Linux may be your main desktop platform.
Linux provides a better multi-user PC environment than NT.
Due to the X Windows environment and the UNIX heritage of Linux, Linux is designed to handle several users simultaneously on the same PC. NT can also provide this, but not as inexpensively, simply, or reliably (in my opinion). We have tens of Linux machines, some in a 16-node Linux cluster of dual-processor Pentium-III machines, and Linux provides us a good way of allowing multiple users to utilize these machines.
The speed of the tools on inexpensive PCs is very good, even when compared to large (expensive) UNIX workstations.
Now that PCs can have 1 GB or more of RAM, it is quite feasible to use PCs for even the largest designs. The section Speed provides some of our experiences when it comes to the speed of the tools under Linux with Wine on a PC as compared to a dual-processor HP Workstation.
There are many other possible reasons. Some time ago, some researchers at Virginia Tech even noted that one of their designs which wouldn't complete properly on a Windows NT machine with a large amount of RAM (1 GB ?) completed just fine under Linux and Wine. Actually, under Windows NT, the whole machine just locked up---go figure.

Another option, of course, would be to run VMWare or Win4Lin instead of Wine under Linux. The tools should run faithfully under Linux in either of those scenarios, but these approaches, of course, costs more (Wine is free while VMWare and Win4Lin aren't) and I would expect VMWare and Win4Lin to require more resources and overhead than running Wine, meaning the command-line tools might run faster under Wine.


Installing Wine-20010510

From the results I have seen so far, Wine-20010510 seems to be the best yet for running the Xilinx tools, especially, when it comes to the ease of applying service packs and other updates. For the sake of this discussion, I will assume that Wine will be installed in /mirrors/usr/wine-20010510 and the files which will be mapped as the Windows "C" drive will be located in /mirrors/usr/wine-c-20010510. Of course, for people outside of our lab, these two installation directories may be called something completely different, so please replace these paths as appropriate to your local installation.

The installation for these tools was very simple under RedHat 6.2. I simply:

  1. Downloaded the source for Wine-20010510 from one of the mirrors mentioned at www.winehq.com and unarchived the source into a local directory.
  2. Configured the source using the "--prefix" option to relocate the installation to /mirrors/usr/wine-20010510. I recommend installating Wine in its own directories rather than in /usr/local so that it is easier to replace and upgrade. Otherwise, you have the problem of trying to figure out what to uninstall when that time comes.
  3. Built the source using "make depend && make".
  4. Installed Wine using "make install" executed as the "root" user.
  5. Unarchived the xilinx-wrappers.tar in /mirrors/usr/wine-20010510/bin. This file contains wrapper scripts for making it simpler to invoke the Xilinx tools with Wine (see below).
  6. Created the directories /mirrors/usr/wine-c-20010510, /mirrors/usr/wine-c-20010510/windows, and /mirrors/usr/wine-c-20010510/windows/system to act as the global Windows "C" drive for our installation.
I believe that pre-built RPMs and DEBs of Wine-20010510 are available via FTP or HTTP, so you might consider using someone else's binaries. These would make updating Wine easier for most people. I do prefer to build Wine myself since, sometimes, the dependencies for other people's binary distributions can be a bit onerous.

Just so you know, I tried compiling Wine-20010629 under a somewhat-updated RedHat 6.2 installation of Linux, but there were some problems which could not be resolved quickly. I was getting Signal 11 problems during the compile of wine-20010629/dlls/shlwapi/ordinal.c on 3 or more different machines; as such, I don't believe it is a hardware-related issue. I suppose egcs-1.1.2-30 from RedHat is having problems. The new version of Wine might be interesting to try, if you can get it to build.


Capturing a Xilinx Install to Work with Linux

For Wine-20000821, the Java-based installation program for the Xilinx Alliance 3.1i tools actually worked. It did have some wierd GUI problems, but I was able to select the tools to install and complete the installation without any significant problems. I wasn't ever able to get the Service Packs to install for 3.1i.

For Wine-20010510, the Xilinx Alliance 3.1i installation program also worked fine. The big news is that the Service Pack installers also work as well as the Device Update installer for Virtex 2. Further, the GUI for the installers looked close to perfect. The only extra work that I had to for installation was to add a few Windows DLLs to the "windows\system" directory for Wine. I tried two different sets of DLLs:

Windows NT 4.0 with Service Pack 6a
For this version of Windows, I had to add netapi32.dll, netrap.dll, and samlib.dll to /mirrors/usr/wine-c-20010510/windows/system. With these DLLs, though, I noticed that Wine complained that it couldn't find some other DLLs while running par. The par program completed just fine despite the complaints. So, for a complete setup, some other DLLs might need to be added.
Windows 98 Second Edition
For this version of Windows, I added only two DLLs, NETAPI32.DLL and NETBIOS.DLL, to /mirrors/usr/wine-c-20010510/windows/system. With these two DLLs, the tools seem to run without any complaints from Wine regarding missing DLLs.
Before you can install using Wine, you will need to setup your Wine environment. I suggest following the steps below in Setting Up Your Environment: Alliance 3.1i/3.3i to setup your account to use Wine. Of course, I would skip step 5 since the installation process will generate the registry entries for you based upon your particular installation.

One issue you will probably run into is that you will need to mount the Xilinx CD-ROMs using the "-o norock" option. Apparently, the Rock Ridge extensions to ISO9660 used to create the software distribution CDs for the Xilinx tools are kind of broken. By using the "-o norock" option, the embedded Rock Ridge extensions are ignored and all should work fine. By the way, if you are wondering what to do to invoke the various installers, you simply change directories to the mounted CD-ROM data and execute the installer using Wine. For instance, you would do the following for the Device Update installation:

  1. Put the Device Update CD into the CD-ROM drive and mount it using something like
          mount -o norock -o ro /dev/cdrom /mnt/cdrom
          
  2. Change to the directory where you mounted the CD-ROM by executing something like
          cd /mnt/cdrom
          
  3. Run the setup.exe program with Wine by executing
          wine setup.exe
          
Of course, this assumes that the CD-ROM drive mount point is properly mapped to a Windows drive in your ~/.wine/config file. If you followed the environment set-up instructions provided in Setting Up Your Environment: Alliance 3.1i/3.3i, you should be fine.

During the installation, I would not recommend having the installation program for the Alliance 3.1i tools try to modify the "Xilinx" or "PATH" environment variables for you. This has already been taken care of by the process described in Setting Up Your Environment: Alliance 3.1i/3.3i. I am not sure what this would even do---probably nothing useful. For that matter, I suspect trying to view the release notes after installation will also fail, so it probably isn't worth trying.

Additionally, with this newer version of Wine, you can now define global registry settings for the installation---this way it is easier to maintain the settings centrally. Therefore, after I installed the Xilinx tools under Wine, I copied the ~/.wine/system.reg file created during the installation process to /mirrors/usr/wine-20010510/etc/wine.systemreg---note that this file's name is not "wine.system.reg". I noticed that after I executed Wine as a new user, this file appeared to be copied to my local ~/.wine directory as system.reg. Apparently, with this new system, the user doesn't have to worry about registry maintenance quite as much since it can be centrally administered. I would suggest looking at the Wine User Guide to learn more about this.

Also, after the installation process, I suggest making the ~/.wine/user.reg created during the installation process available to the users of your installation. For instance, I have provided the ~/.wine/user.reg file created during the Xilinx installation process to our users via the Web (see the next section).


Setting Up Your Environment: Alliance 3.1i/3.3i

I will briefly describe the process of setting up a user's environment to execute the Xilinx Alliance 3.1i tools installed using the process described above. The setup is significantly different with the latest install of the Alliance tools and Wine, so please read these setup suggestions carefully.

I should reiterate that, for the sake of this discussion, I will assume that Wine has been installed in /mirrors/usr/wine-20010510 and the files which have been mapped as the Windows "C" drive are located in /mirrors/usr/wine-c-20010510. Of course, for people outside of our lab, these two installation directories may be called something completely different, so please replace these paths as appropriate to your local installation.

With this said, I recommend the following for your Wine setup:

  1. If you have an old Wine setup, you will need to move your existing ~/.winerc to some other name, such as ~/.winerc-20000821.
  2. Set your $path or $PATH variable to point to /mirrors/usr/wine-20010510/bin. To make sure everything works right, I suggest putting this first in your path. This directory contains the wine binaries for Linux and the new Xilinx wrapper scripts.
  3. Create a new, empty ~/.wine directory. I suggest you save your old setup somehow, just in case you need it later. For instance, you might move the old .wine to .wine-20000821 so you know which version of Wine it was for.
  4. Create a reasonable ~/.wine/config file which has [Drive C] set to point to /mirrors/usr/wine-c-20010510. I have created a fairly generic config file that should be adequate for most users. Just copy the file into your ~/.wine as config---the name of the file you download will be slightly different. Unlike previous set-ups, the $HOME environment variable is used to ensure that each user's home directory has a Windows drive mapping. Also, I have set up the PATH environment variable for Windows in this config file to include c:\Xilinx\bin\nt. I should also mention that the [afmdirs] directive in the file has been set up for our local RedHat 6.2 installations---the directories listed in the file may be quite different for other Linux installations.
  5. Set up your Wine registry entries for the Alliance 3.1i/3.3i tools. I have (or the system administrator has) setup a global system.reg, so you don't have to worry about copying a system.reg file into your ~/.wine directory. I would suggest copying this user.reg registry file into your ~/.wine directory as user.reg---the name of the file you download will be slightly different.
  6. Set the XILINX environment variable to "C:\Xilinx" according to your shell:
  7. Set your LD_LIBRARY_PATH environment variable to include /mirrors/usr/wine-20010510/lib. If don't have this environment variable, create it; otherwise, just add the aforementioned path to the variable. Note: This path list is colon (:) separated much like the $PATH variable.
  8. Set your DISPLAY environment variable appropriately. Even if you are only using command-line tools, Wine still needs to connect to your display. If I find a way around this, I will let you know.

Running the Tools

With your environment setup, you should be ready to run the tools. There are a few caveats to running the tools. Here I provide a few suggestions and workarounds.

Executing a Program

I have created wrapper scripts for the most commonly used Xilinx Alliance tools. A tar file of these wrapper scripts, xilinx-wrappers.tar, is available, if you would like to modify them. To provide some insight into what these wrapper scripts do, let's assume that we are not using the wrapper scripts for the moment and want to explicitly call the Xilinx programs using Wine. To execute a program such as ngdbuild without the wrapper scripts, you can execute it using the following command:
     wine ngdbuild
If you need to execute a Windows program with arguments (as we often need to do), you should provide the arguments after a -- to indicate to Wine that the arguments belong to the Windows program and not Wine itself. For instance, you can execute fpga_editor on pe1_Counters.par.ncd as follows:
     wine fpga_editor -- pe1_Counters.par.ncd
A wine option you might like for some of the GUI programs is the -managed option; this allows the window to be managed by your window manager rather than the Wine environment. For example:
     wine -managed fpga_editor -- pe1_Counters.par.ncd
The ~/.wine/config file referred to above makes "managed" the default mode for windows created by Wine.

In executing programs, you might have to deal with the mixing of UNIX and Windows-style paths. Wine itself doesn't mind commands like

     wine /mirrors/usr/wine-c-20010510/Xilinx/bin/nt/ngdbuild 
since it can do the translation to Windows paths, assuming, of course, the subdirectory is mapped to a Windows drive in the ~/.wine/config file. To be safe, I use strictly Windows-style paths for environment variables used by Windows programs as well as for options passed to the Windows programs.

If you use the wrapper scripts to execute the Xilinx tools, you can simply do the following:

     fpga_editor pe1_Counters.par.ncd
or
     bitgen -w -g StartupClk:Cclk -g readback -g persist:X8 -l -m -g DONE_cycle:6 X0.par.ncd

Caveats and Work-arounds

To begin with I should mention that, in the past, we have come across some designs that did not complete under our old Wine setups (Wine-991212 with Alliance 2.1i and Wine-20000821 with Alliance 3.1i). Thankfully, Wine continues to mature and we have noticed that several designs which didn't complete under Wine/Linux in the past complete just fine now. I believe that part of the problems in the past had to do with the fact that we could not easily keep up with the Xilinx service packs since they did not install directly under Wine. Now that the service packs install under Wine and Wine itself has matured some, I expect that we will see even better results. In the past, about 97% or more of the designs were successfully processed through the Xilinx Alliance tools under Linux. Considering that we use the tools a lot, the Wine/Linux environment has been quite productive for us. To this point, we have not encountered any designs that won't process with our new Wine setup (Wine-20010510) for the Xilinx tools, but we might encounter a few---you never know.

When executing programs with Wine, you may receive errors and messages like the following:

err:win32:DeleteCriticalSection Deleting owned critical section (0x40ec0ab4)
err:win32:DeleteCriticalSection Deleting owned critical section (0x40ec0a54)
err:win32:DeleteCriticalSection Deleting owned critical section (0x40ec09f4)
err:win32:DeleteCriticalSection Deleting owned critical section (0x40ec0994)
err:win32:DeleteCriticalSection Deleting owned critical section (0x78040e88)
or
fixme:console:SetConsoleCtrlHandler (0x7800dd30,1) - no error checking or testing yet
These are common and to be expected. They are just messages from Wine relating debugging information and partially implemented emulation code. The 20010510 version of Wine has considerably fewer of these messages.

In the past, one of the biggest shortcomings of Wine as far as executing the Xilinx tools was concerned was that Wine didn't spawn other Windows programs properly; we had to deal with this when using Wine-991212. This had to do with the fact that Wine couldn't properly spawn other Windows programs when the programs had been stripped of their symbols. I am glad to say that since about May 2000, this support has improved and most Windows programs are able to successfully execute other Windows programs whether or not the symbols have been stripped from the binaries. For example, you can actually run the Xilinx Alliance 3.1i installer and Service Packs under Wine now. This is fairly amazing since the installers for the tools and Service Packs both spawn multiple Java processes to install and unpack things.

Unfortunately, I have noticed that ngdbuild can spawn its helper programs, but, for some reason, ngdbuild doesn't appear to know that the spawning worked. If you run ngdbuild several times it will eventually complete, depending on the number netlists which must be converted to the .ngd format from XNF, EDIF, etc. For now I would recommend the execution of the ngdbuild helper programs (xnf2ngd, edif2ngd, etc.) still be explicit in Makefiles and scripts.

As an example, with the Wildforce environment, there are a few XNF drop-ins. In this case, ngdbuild tries to spawn xnf2ngd to translate those files. Since I use Makefiles to process my design files, I just execute xnf2ngd, edif2ngd, and the other translators before calling ngdbuild. Note that your main design file must be translated as well as drop-ins before executing ngdbuild.

Unlike with Wine-991212, map under Wine-20000821 and Wine-20010510 is able to spawn m1map for XC4000 designs properly. As a little background, I have noticed that map actually spawns m1map for XC4000 designs, while it doesn't for Virtex. With previous versions of Wine, due to the process spawning limitations mentioned above, I replaced references to map in my UNIX/Linux Makefiles with m1map as a workaround for XC4000 designs. For Virtex designs, map worked just fine under Wine. With the later versions of Wine, you can just use map for both XC4000 and Virtex designs without any problem since the process spawning capabilities have greatly improved. If you start having problems with process spawning and map for XC4000 designs, you might consider using m1map again instead.

One small problem that I discovered with bitgen is that it writes out file names which only have lower case letters, even if the original design's file name had some capital letters. Of course, in Windows, this is not a problem since the tools tend to be case insensitive when it comes to file names. Under Linux, though, this complicates Makefiles and scripts, but it can be handled fairly easily if you know of the problem beforehand.

I'm happy to report that the problems with fpga_editor and the "open file" dialog boxes appears to have been solved under Wine-20000821 and later versions. In previous versions of Wine (version 991212, specifically), the file of interest would appear to be appropriately entered in the dialog box once selected, but it couldn't actually be viewed unless it was in the root directory for the emulated Windows drive. With these previous versions of Wine, if you would really wanted to view a file you had to do one of two things:

With Wine-20000821 and Wine-20010510, the GUI selection of files to edit works. Unfortunately, with Wine-20010510, I have noticed that the buttons on the main toolbar in fpga_editor don't appear to work. This is not a big problem since all of the functionality provided by the toolbar is available through menus. The toolbar in "Edit Block" windows does seem to work, however. Strangely, I believe that the main toolbar buttons worked in Wine-20000821. I am sure there are some other GUI-related problems, but things are working well in general.

Also, when running fpga_editor, you will notice errors and messages such as:

fixme:mdi:MDIRefreshMenu partially function stub
err:heap:HeapValidate Heap 41700000: block ffffffff is not inside heap
Again, these are common and to be expected, though, you should see fewer of these message under Wine-20010510 than earlier versions.

Previously, with the Windows process spawning problems of Wine, programs like dsgnmgr wouldn't work at all. I have tried dsgnmgr under Wine-20000821 and Wine-20010510 and things work better, but due to OLE problems (with revengine.exe), dsgnmgr doesn't appear to be able to talk to programs that it spawns or some problem like that. If you are interested, the messages that Design Manager and Wine give, respectively, are:

The OLE initialization program: revengine.exe failed.  This program is
used for inter-process communication. Please check your installation.

fixme:ole:CoCreateInstance no instance created for {00000000-0000-0000-c000-000000000046}, hres is 0x80040154
fixme:ole:CoRegisterMessageFilter stub
Makefiles and scripts are probably the best methods for building designs under Linux.

As a final note, the files generated by the Windows Xilinx tools, of course, follow the DOS/Windows file conventions--CR/LF pairs appear in the text files, for instance. For some applications, we like to make text files more Linux/UNIX compliant. In Makefiles and scripts, I often do things like the following to deal with the issue:

tr -d '\r' < x0.ll >x0.tmp.ll 
mv x0.tmp.ll x0_fpadd.ll

Speed (very old results)

Here are some quick comparisons for run time on a single counter placed in an XC4062 part. The results are provided by executing a time make on this simple design.
Linux PII 333 (All files retrieved over NFS) 
1.480u 3.090s 5:51.61 1.2%      0+0k 0+0io 7394pf+0w
              -------

Linux PIII 500 (All files retrieved over NFS) 
0.940u 3.010s 5:24.94 1.2%      0+0k 0+0io 7372pf+0w
              -------

HP-UX J2240 (local design files) 
190.30u 10.15s 4:09.03 80.4%
               -------

Linux PII 333 (local design files) 
1.600u 2.840s 2:56.70 2.5%      0+0k 0+0io 7394pf+0w
              -------

Linux PIII 500 (local design files) 
1.020u 2.910s 1:53.01 3.4%      0+0k 0+0io 7372pf+0w
              -------
Clearly, NFS on Linux is really killing us for this tiny design since much of the time is spent actually reading and writing files. In previous tests in which much of the time is spent computing, these I/O related problems were not as dominant and the Linux numbers look better even with the NFS issues.

Here are some comparisons provided by other members of the lab on much larger designs:

Design: CDI (Virtex)

HP-UX J2240 (All local files), no (default?) effort level:
1 hr. 37 min.

Linux PIII 500 (local design files), no (default?) effort level:
17 min.

HP-UX J2240, highest effort level, 2 delay/2 clean-up passes:
approx. 30 hrs.

Linux PIII 500 (local design files), highest effort, 2 delay/2 clean-up passes:
29 min. 18 sec.


Design: Superquant, XC4085
Linux PIII 500
76.170u 832.670s 42:33:38.53 0.5%       0+0k 0+0io 7422pf+0w
                 -----------

HP-UX J2240
346142.79u 338.91s 97:17:38.16 0.8%
                   -----------
From these larger design, it's clear that the Xilinx tools under Linux run quite fast even using the wine emulator. Just imagine how fast they would be if they were compiled for Linux.

Addendum: Xilinx Alliance 4.1i

I have been able to successfully install the Xilinx Alliance 4.1i tools under Wine-20010510. I have not seen any significant problems at this point.

To jump start usage of the tools, new system.reg and user.reg files are available to place in your ~/.wine directory. I suggest backing up the old files before adding the new ones. Also, the files that you download may have a slightly different name than Wine expects; you need to make sure that they are named system.reg and user.reg exactly. Finally, for those at BYU, you will also need to point your C: drive in your ~/.wine/config file to point to /mirrors/usr/wine-c---this is a link pointing to the latest version of the tools. All of the other settings from Setting Up Your Environment should be fine.


Go to the CCL Home Page
grahamp@ee.byu.edu
Last modified: Fri Oct 5 10:31:23 MDT 2001