[digg=http://digg.com/hardware/Getting_started_with_Xilinx_s_XC9536_CPLD]
First let me tell you, I am not expert in VHDL, just recently I started working on CPLDs and it was very exciting and hence sharing this experience with you all.
Overview
CPLDs(or FPGA) are very interesting devices, you can put any digital circuit of your choice in them, provided it fits within available resources. We can implement simple circuits like adders, counters, PWM generators and even complex microprocessors on CPLDs ! In this tutorial we will implement simple MOD-4 counter and see how to use Xilinx’s XC9536 CPLD.
Tools and components
-
Xilinx ISE WebPack : This is free design solution from xilinx. We will use this to write VHDL code, synthesize it and then burn it on CPLD. Its huge package ~ 1.7GB. Download and install it.
-
JTAG cable : We need this to burn our code into CPLD. This is the schematic diagram for the JTAG cable, I got it from net.
Ignore FPGA header part. You can also skip 300E resistors connected to D25 socket. Although my JTAG cable works fine without these resistors , I would advise to construct a cable as shown. Important : Length of the ribben cable between D25M connector and board should be less than 2Ft. -
CPLD daughter board : You just can’t connect wires directly to CPLD. You have to put it in a PLCC socket. Again you can’t solder wires to this socket nor you can put it in Bread board. Thus you need ready made PCB for mounting PLCC44 socket or you have to make one at home. These PCBs are quite common and will be available in decent electronics shop.
- Few LEDs, 470E resistors, microswitch, 7805, 47uF caps and connecting wires.
Writing code for MOD-4 counter
Mod4 counter has one input ‘clk’ and two outputs ‘count[0]’ and ‘count[1]’ . On rising edge of clock, counter will increment by 1. It goes through 00,01,10,11 states on successive pulses.
I assume that you have downloaded and installed xilinx ISE WebPack. Now lets write the VHDL code for simple MOD-4 counter. | ![]() |
This illustration shows how you can write the code in Xilinx ISE WebPack. Download it for proper viewing. |
![]() |
Adding Constraints
Now, we have to add constraints to our design. By specifiying constraints we can assign suitable pins of XC9536 to input and output signals. We will assign Pin1 to clk, Pin2 to count[0] and Pin3 to count[1].
This illustration shows how to specify constraints. Download it for proper viewing. |
![]() |
Downloading code into XC9536
Once you have finished with above mentioned steps, now you are ready to download the code into device.
Connect your CPLD to JTAG cable. i.e. connect TCK, TDI, TDO,TMS of JTAG cable to respective pins on CPLD. For XC9536 in PLCC44 package : TCK = pin17; TDI = pin15; TDO = pin30; TMS = pin16 |
![]() |
Now follow this illustration to download code into CPLD using iMTACT tool. Download it for proper viewing. |
![]() |
Testing
Now connect three wires to pin1,pin2 and pin3 of CPLD. As we have specified, pin1 is clock, pin2 is MSB of count and pin3 is LSB of count. Connect two LEDs with 470E series resistance to pin2 and pin3. Give clock input to pin1 by simple switch / using microcontroller / using signal generator and observe the output.
This shows my test results. I have used my AVR development board to generate 1Hz clock. | ![]() |
Trouble shooting
– CPLD getting HOT : you have reversed VCC and GND connections / applied more than 5V to VCC pins.
– CPLD not getting detected in iMPACT : Check all connections / JTAG cable is not powered up / CPLD is not powered up / Length of cable between LPT port and JTAG circuit is more than 2Ft / other pins of CPLD are connected to LEDs or VCC or GND. For proper programming only connect VCC, GND and JTAG pins of CPLD, remove all other connections.
– Program is not getting executed properly : Problem with clock. Give proper SQUARE wave waveform as a clock using another micro or signal generator.
Download complete code from here .
…. And finally, if you found this tutorial helpful or have any suggestions … do leave a comment.
#
I have the XC9536 on pcb.
Must i programm it before start kit and with why ?
http://www.jcwolfram.de/downloads/files/ax82/ax82_035-binary.tar.gz
Than you help
#
brother plzz help me….
our college has given us a cpld kit..
dey hav asked us to burn a vhdl program on it..
only few days r remaining…ddey hav asked for a calculator and program encoding and decoding
#
You can make the JTAG cable as mentioned in the article. It is easy. That can be used to program the CPLD.
#
any idea where i can get xc2c64a coolrunner 2 cpld in lamington road?
#
Hi frd am veera from india i want jtag program for cpld 9536
#
i want to download the code in to cpld9536 by using jtag chain ,i am using db25male connector cable ,tell me the steps to follow
#
Good article. Hope to see more cpld & fpga related articles in the future.
#
Thanks very useful..
#
Do you know anyplace where I can find the USB-Jtag cable for cheap? (Otherwise I will just by a parallel port card.)
#
Hi,
tut is really gud for beginners.
gud work done.
#
thank you
#
Hi
I am Jeffrey. I am from kerala. I like your tutorial. Nice work. Keep it up.
In kerala these CPLD and their sockets are not available.
If possible can you do a help for me?
Can you buy me a CPLD XC9536 and its PLCC44 socket? I will pay you the amount for it by bank account or by sending
DD. Can you tell the total cost for the CPLD XC9536, its PLCC44 socket and courier charges?
IT WOULD BE A GREAT THANKS IF YOU COULD DO THIS HELP
Please give your e-mail address for further contacts
#
Hi Jeffrey, Check your e-mail.
#
where did you get the cpld ?? i would love to buy one as well.
nice tutorial
#
Please check the other post labeled “Component Prices at lamington road”. You will find the CPLD price over there. CPLD is available at Visha Electronics/Cirkit Electronics (@ Lamington Road, Mumbai).
#
Thanks very useful..
#
Good article. Hope to see more cpld & fpga related articles in the future.