Unless your distribution's package manager can handle RPM's, getting Diamond running on linux takes some manual intervention. Though I don't know the specific steps to get it running perfectly with every flavor of linux, here's the general steps I took to get it running on my system:Installation/Running Diamond
First, download the appropriate package. In my case, I needed "Diamond 3.1 64-bit for Linux"... obviously, this won't work if you have a 32-bit system. It's a 1.1GB .RPM, normally meant for distributions that use the 'yum' package manager, like CentOS, Fedora, or Red Hat. If you're using a distro with yum, check the yum docs for how to install the package and ignore most everything else in here.
Next, make a directory somewhere for Diamond to live in and extract it with an RPM extractor. Your distribution most likely has one you can install from the package manager. Google is your friend here- rpm2cpio is a popular tool. On archlinux, a package called rpmextract is available in the AUR which is basically just a wrapper script for rpm2cpio.
At this point, you can go ahead and copy or symlink everything to the appropriate paths if you want. I didn't because I just wanted to see if I could get it running, which probably accounts for some of the broken features I have. The script to get Diamond running is located at ($diamond_dir)/usr/local/diamond3.1_x64/bin/lin64/diamond, so you can 'cd' to that directory and mark it executable with 'chmod +x ./diamond'.
After that, you should be able to run it by typing in './diamond' (within that script's directory) and hitting enter.Programming the Board
Diamond's programmer talks to the FTDI chip with libftdi's D2XX drivers, which is installed by default on a lot of distributions (and I'm pretty sure is included in the kernel at this point). If it's not installed already, do that through your package manager. If you don't have a package manager or libftdi isn't in there, checkout FTDI's site at http://www.ftdichip.com/Drivers/D2XX.htm
for some guidance.
I found that for Diamond to be able to program and detect my FPGA, I had to remove the auto-loaded ftdi and usb_serial modules. After you plug in your board, these kernel modules will be automatically loaded to supposedly enable communication with the board, but for whatever reason (or maybe I'm not understanding the process correctly), they inhibit communication between the FTDI chip and Diamond.
So... back to the terminal. First check which ftdi-related modules have been loaded after you plugged in your FPGA:
$ lsmod | grep ftdi
ftdi_sio 39723 0
usbserial 30821 1 ftdi_sio
usbcore 182430 11 usblp,snd_usb_audio,usb_storage,usbserial,snd_usbmidi_lib,ehci_hcd,ehci_pci,usbhid,ftdi_sio,xhci_hcd
Then, remove these modules:
$ rmmod ftdi_sio
$ rmmod usbserial
After removing the modules, you should be able to detect and program your board through Diamond. The modules will be automatically loaded every time you plug in your FPGA, so they'll also need to be removed each time before you can program your board with Diamond. Again, I'm not sure why this is- my assumption is that Diamond has some form of FTDI drivers built-in and the default kernel modules interfere with those. If that's the case, it's probably not a great idea to install libftdi if you don't already have it... but oh well.Issues
Here's some issues that I've had, most likely related to not having things in the paths where Diamond is expecting them to be:
- Simulations don't work
- Occasional errors that prevent synthesizing and generating JEDEC files. Usually happens after programming. Save and restart program.
Other issues you might have with programming the board will most likely relate to permissions. Setting up udev properly is important- again, find specifics with Google.