CPLD Upgrade and new Toolchain
Since we introduced our new banking logic to access 512k RAM, our glue logic is being accommodated by a Xilinx XC9572 (without XL) CPLD. This component has long been deprecated when we started using it, because it was what we had available. The upgrade path would be the successor family XC95..XL. Those have been rather expensive lately, and finally AMD/Xilinx has axed it’s whole CPLD line in 2024, leaving us at a dead end. Where do we go from here?
The market for CPLD is not exactly growing. Only a few manufacturers are still actively producing CPLD chips.
One of our main design goals has always been to use available components, either new or sufficient NoS (New old Stock), to make it easy for others to build their own Steckschwein. It has already become hard enough to get the V9958 Video Display Processor, so let’s at least look at a CPLD that is being actively produced and affordable.
This article will document our replacement choice and usage of the toolchain we decided to use.
We need another CPLD
Most prominent with a large following in the retro computing scene are the ATF150xAS-Series by Microchip, formerly Atmel. These are still being actively produced, and even run natively on 5V. The manufacturer confirmed, that there are no plans to discontinue the ATF150x and that it is indeed advisable to use them in new designs. Also, they are quite cheap compared to the last Xilinx prices.
The top of the line model is the ATF1508, which has 128 macrocells, and is available in PLCC84, TQFP-100 and other packages. This places it between the Xilinx XC95108XL and the XC95288XL. While 128 macrocells are still a significant upgrade from the 72 we have now, it also means the end of the line. If we are ever going to need more than 128 macrocells, it would be time for another switch. But for now, it’s going to be the ATF1508, for it’s availability and pricing.
The Toolchain
This is going to be the bigger headache. With Xilinx ISE, we had everything we need, running on Linux. The Microchip/Atmel-Toolchain however provides a bunch of tools and IDEs, which unfortunately are available for Windows only1:
WinCUPL
CUPL is a rather arcane language for logic terms, just a little less arcane than out trusty old GalASM. We are looking for VHDL, so CUPL is out.ProChip Designer
This is the VHDL IDE from Atmel/Microchip.
Next part of the toolchain is the JTAG adapter / download cable. The Atmel one goes for about 90€, and is out of stock at most vendors we checked.
The alternative Toolchain
To avoid any license and pricing issues, as well as Windows based tools, we are going another route.
Altera Quartus II
The ATF150x CPLDs are somewhat compatible to the long deprecated Altera EPM7xxx line. The latest available Version of their IDE, Quartus II 13.1 does not include support for those chips. But the Version before, 13.0sp1 does. And it is also available for Linux!2
The trick is to select a corresponding device from the EPM7xxx line:
EPM7xxx | ATF150x |
---|---|
EPM7032 | ATF1502 |
EPM7064 | ATF1504 |
EPM7128 | ATF1508 |
Microchip POF2JED
Unlike Xilinx ISE, Quartus will not generate a .JED file to program the device, but a .POF file. This needs to be converted to an ATF1508-compatible .JED-File by an Atmel/Microchip-tool “POF2JED”. There is an application note3 that provides details about which Altera Chip is compatible with which member of the ATF150x family, and describes every feature of POF2JED. This tool is available for Windows only, but works flawlessly on Wine. It comes in two flavours: POF2JED.exe and WinPOF2JED.exe. The latter one is a GUI driven application while POF2JED.exe is a command line app, so it can be transparently used in scripts or Makefiles.
If the installation on Wine fails with an error message about some missing DLL, there is a fix using winetricks:
$ winetricks vcrun6sp6
I installed it right unter C:\POF2JED. Now, using wine, it can be used like any other Linux command line tool:
$ wine ~/.wine/drive_c/POF2JED/bin/POF2JED.exe -i output_files/chuck.pof -o output_files/chuck.jed
0084:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\H2OFFT": c0000142
Microchip POF2JED Version 4.45.1 Mar 13 2018
Copyright 2018 Microchip. All Rights Reserved.
EPM7128SLI84-10 --> ATF1508ASPLCC84
Input file : output_files/chuck.pof
Output file : output_files/chuck.jed
Conversion Report file : output_files/chuck.txt
WARNING: If conversion is for a low voltage device,
please use the -power_reset option.
***************************************************************
Error! POF Conversion may not be correct.
Please contact to Atmel EPLD Hotline (408)436-4333, or
email address (pld@atmel.com)
***************************************************************
POF2JED processed 0 seconds
Conversion is completed
Programming the ATF1508
Now we have our .JED file to program an ATF1508 with. There are several options to do this. One is using the Microchip Download Cable4 with Microchip’s ATMISP7 tool5. Since this goes for around 90$, and we are cheap, we chose another option - The Adafruit FT232H Breakout Adapter6. The big benefit is not only that it’s very affordable (about 15-20$), using the right software it can be used to program just about any device. One of the programs that can be used for this is OpenOCD7.
There is also a very cheap solution using an FT232R based adapter8. Those are even cheaper (around 3$), but also slower.
Converting the JED to SVF
OpenOCD can not use .JED files to program the target device. There is one more step involved: Converting the .JED file into an .SVF file. SVF stands for “Serial Vector Format”9.
ATMISP7
One way to do this is by using the same ATMISP7-Tool that also drives the Atmel Download Cable. Again, ATMISP7 is a Windows based program, and this time we need to use the GUI. Fortunately again, ATMISP7 runs well on Wine:
fuseconv
Another way is using the fuseconv tool by whitequark10. Usage seems very straightforward:
$ python3 -m util.fuseconv -d ATF1508AS chuck.jed chuck.svf
However, their documentation lists support for the ATF1508AS as somewhat incomplete11. According to Whitequark, fuseconv should work fine for the ATF1508 - the incomplete part is only related to bitstream functionality extraction12. This is awesome.
Programming the ATF1508, finally
Now we have the .SVF file that OpenOCD can use to program the device. We need to submit a couple of parameters. The first one is a script that comes with OpenOCD that will set up the Adafruit FT232H Breakout adapter. Then we provide commands to create the JTAG connection and execute the .SVF file using multiple “-c” parameters.
$ openocd -f /usr/share/openocd/scripts/interface/ftdi/um232h.cfg \
-c "adapter speed 400" \
-c "transport select jtag" \
-c "jtag newtap ATF1508AS tap -irlen 3 -expected-id 0x0150803f" \
-c init \
-c "svf chuck.svf" \
-c "sleep 200" \
-c shutdown
Test
To test the whole process, we used the excellent ATF1508 PLCC84 breakout board by adrienkohlbecker on github13. We just changed the JTAG connector to a 6 pin one because why not.
ATF1508 breakout board and the Adafruit FT232H breakout board playing together. There will be some breadboarding again as we plan to put an SPI controller and also an interrupt controller (as space allows) on the new CPLD.
Conclusion
The whole process is a bit more involved than using the Xilinx ISE toolchain. On the other hand, once the .SVF-file is generated, the CPLD can be programmed using a free tool and affordable hardware. So in the end, building your own Steckschwein will become easier and cheaper and independent of vendor specific programming tools.
https://github.com/peterzieba/5Vpld/?tab=readme-ov-file#quartus-free-verilog-vhdl-schematic-capture-indirect-support-for-atf150x-linux-or-windows ↩︎
https://ww1.microchip.com/downloads/en/AppNotes/DOC0916.PDF ↩︎
https://www.microchip.com/en-us/development-tool/ATDH1150USB ↩︎
https://www.hackup.net/2020/01/erasing-and-programming-the-atf1504-cpld/ ↩︎
https://jacobncalvert.com/blog-archive/2020/02/04/jtag-on-the-cheap-with-the-ftdi-ft232r/ ↩︎
https://whitequark.github.io/prjbureau/intro.html#supported-devices ↩︎
https://github.com/adrienkohlbecker/atf1508_plcc84_breakout ↩︎