Getting Started with learning Verilog using Spartixed

Once you have installed Xilinx ISE web pack, it is time to get started with a simple verilog program that will ensure that your environment is set to start learning.

We will write a simple code that will glow the LED when a push button is pressed. The Spartix has two general purpose switches SW2 and SW3 and two general purpose LEDs - LED1 and LED2

This will be something similar to this video

To be able to run the program using the Spartixed board follow the following steps. 1. Click on Start -> Xilinx Design tools -> ISE Design Suite 14.x -> ISE Design Tools -> 64 bit navigator.

2. Click on file -> New project -> and in the screen that follows give a name to the project, say ss, entand choose a directory say, C:\spartixed -> Click ok and the The Xilinx ISE will create a directory with that name.

3. Click Next and it will take you to the following screen. Choose the Family, Device, Package and speed as shown in the following figure.

Click Next and then finish. At this stage we do not have any source code. In the next step we will add source code.

4. Create a new file ss.v in the directory C:\spartixed\ss and using a text editor copy the following text into it and then save it as ss.v

module LED_Button
input button_sw2, button_sw3,
output led1,led2
assign led1 = button_sw2; 
assign led2 = button_sw3;

4. Now click on xc6slx4-2tqg144 and then right click and select Add Source

Select the file ss.v that you created. In the screen that follows -> select the default settings and click ok.

5. Double clicking LED_button(ss.v) should show a screen something like this

6. Next with will create a ucf file that will have information about the pins. Create a new file called spartixed.ucf in the directory C:\\spartixed\ss and add the following content and save

NET "led2" LOC = P131;
NET "button_sw3" LOC = P126;
NET "led1" LOC = P127;
NET "button_sw2" LOC = P124;

7. In Xilxinx ISE, now click on LED_Button(ss.v) and right click and click add source. Now select the sparixed.ucf file you created above. In the screen that follows, select default settings. You will now see + sign before LED_button(ss.v) in your project and if you expand that you should see spartixed.ucf under it.

8. Double click the LED_Button(ss.v) and then in the window below double clicl on Synthesize -XST.

It will take some time. If there is is no error, it should show a green right tick.

9. Now double click on Implement Design and the once it finishes, double click Generate Programming file. If everything is ok, it will generate a .bit file that we can download to Spartixed .

10. Notice the location of the .bit file. This is the file that needs to be programmed. There are two approaches to program the Spartixed. We will first discuss the programming option using the Reference Designer's low cost - $25 XIFT1 programmer.

Programming Spartixed with “XC3SPROG” and XIFT1

You will need to download an open source program called XC3SPROG. The complete instruction to program Xilinx device is as follows 1. Download XC3SPROG from 2. Place xc3sprog.exe to the folder of your ISE project, where .bit file is located. ( You can also place it in any other folder and the place the bit file in that folder)
3. Connect the USB Cable to one of your USB ports of the computer. Your computer should recognise it. 4. Use the JTAG Cable to connect the Spartixed with the XIFT1 programmer. 5. Open the command prompt and go to the directory that has the .bit file. Give the following command

"C:>xc3sprog.exe -c ftdi -v -p 0 YOUR_FILE.bit".
Where YOUR_FILE.bit is the bit file generated from Synthesis tool. ( Please use the correct file name in place of OUR_FILE.bit)

This youtube shows the working programmer.

Programming Spartixed with Xilinx USB Platform Cable

You need to follow this instruction if you are using the Xiling Platform Cable in place of the Reference Designer's XIFT1 programmer,
1. N Power on Spartixed with USB Micro Cable. Connect the JTAG Platform Cable with to to the Spartixed with JTAG Cable and connect the USB Cable from your computer to USB Platform Cable.

2. On the bottom left side of the Project Navigator, click on the Configure Target Device and then double click Manage Configuration Project (iMPACT)

3. It will open ISE iMPACT in a new widow. Double Click the Boundary Scan and in the right area right click and click on Initialize chain. If everything is connected it will detect the Xilinx device.

4. It will now ask - Do you want to continue and assign configuration files ? Click Yes and select the led_button.bit file from the directory led_button.bit. Click No when it asks - Do you want to attach and SPI or BPI ROM. Click Cancel on the next screen.

Now select the Xilinx green color object and right click and Select program

14. If everything goes good, your device is programmed and should be behaving as expected.