Wednesday, July 3, 2013

[Tech] Xilinx ISE, Vivado, and Fedora 19

[technical post warning :]

Once upon a time I took a sequence of classes in which I got a taste of what a class of microchips--FPGAs--could do. I have further seen their use in high-performance professional and research work. In simple terms, these chips allow you to try out microchip designs before spending a few million getting them actually made (with a few obligatory gotchas).

So, when the university I was attending decided to upgrade to Digilent Spartan 3E Starter Boards, I made a point of buying one of their old Digilent Spartan 3 Boards, featuring the Xilinx XC3S200-ft256 (Spartan 3) FPGA.

About a year and a half later, I'm just now getting to trying to play with it. As it turns out, older versions of Ubuntu don't play nice with ISE (a previous post described some of my problems), so I upgraded from Ubuntu 10.04 to Fedora 19 to start working.

Tip 1: Vivado is distinctly not ISE. Vivado is their high-level SoC design tool, while ISE has less power and more control...and easier licensing. ISE WebPack is what they offer for free. Save yourself a 6GB download and don't download Vivado--download ISE. I got ISE 14.5.

Tip 2: Once I got ISE downloaded and installed, I figured out that the cable driver installation and the "Simulate Behavioral Model" function both rely on having GCC handy. In Fedora, I found a good post here showing this one command:

sudo yum groupinstall "Development Tools"

that is somewhat analogous to Debian and Ubuntu's "build-essential" package. This gets the simulator working.

Narrative: From here I went on to writing a small Verilog test that merely wired an input to an output. I also pulled in the UCF for the Spartan 3 Board (that Digilient no longer seems to host), configured it, and got it through the Synthesize - XST, Implement Design, and Generate Programming File phases without a hitch. (Not even a warning...except for an unused signal I forgot to take out.)

The next phase was "Configure Target Device," which pulls up Xilinx' Impact programmer tool...which didn't recognize my cable. Big surprise--it had told me driver installation failed.

Tip 3: use Tip 2 PRIOR to installation. If you didn't (or like micromicromanaging things), simply run (assuming you used the default root installation target):

cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/digilent
sudo bash ./install_digilent.sh

answer its questions, and smile. 

Tip 4: I'm not sure what problems it might cause (I was find all the way through launching Impact), but do remember to modify your environment. In my case, I simply added these lines to .bashrc:

# set up environment for Xilinx tools
. /opt/Xilinx/14.5/ISE_DS/settings64.sh
# because I didn't use the default
export DIGILENT_ADEPT_CONF="/usr/local/etc/digilent-adept.conf"

Tip 5: OS Not Supported
Dear Xilinx, >:-P Love, Jon

If you dig around, you will likely find and try

cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/install_script/install_drivers
sudo ./install_drivers

which fails miserably because

linux_common.h:29:4: error: #error "This kernel is too recent: not supported by this file"

So, off I traipsed to http://rmdir.de/~michael/xilinx/ where I learned I could run

sudo yum install libusb-devel # or your distro's variant; solves "missing usb.h" problem
git clone git://git.zerfleddert.de/usb-driver
cd usb-driver
make
LD_PRELOAD=/home/username/tmp/usb-driver/usb-driver $STUFF/ise

Now when I launch Impact, I can do a boundary scan and talk to the FPGA.

Next problem was "DONE pin did not go high." 

I tried FPGA Start Clock, High-Z unused devices, power cycling...but the next day it worked. (This was after a full power cycle of my aging P4-era box.) Make sure that Start Clock is set to JTAG, power on the FPGA, THEN connect the programming cable. That fixed it for me, anyways.

3 comments:

  1. Could you explain more about this?

    What are you actually linking??? What is $STUFF???

    LD_PRELOAD=/home/username/tmp/usb-driver/usb-driver $STUFF/ise

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. @valajbeg, sorry about the confusion. $STUFF is merely the path to the ISE executable; in my case I think I used /opt/Xilinx/ISE/bin/lin64.

    ldd loads the libraries listed under LD_PRELOAD before it parses the executable for symbols to resolve. This means that, when the dynamic linker looks for unresolved symbols, it checks in the listed libraries first. This effectively replaces the Xilinx lib with the working, OSS one.

    ReplyDelete