Using a CPLD to consolidate 74HC-series logic - Page 1
Forum section: electronics / beginners

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 11:02:35 am
content: Have an old proprietary 8088-based computer. Would like to create some specially addressed IO registers. Know how to do this using 74HC components; I’d need 6 basic gate packages (HC00, etc.) to create address decoders, and 8 standard 74HC devices (3x HC373, 2x HC688, 1x HC74 and 2x HC00). So 14 DIP packages in total. This is all fine - but it would be great to reduce the package count.There are around 22 inputs (AD0..7, A8..15, ALE, IOM, XXX, RD, WR, EACK) and 8 outputs (AD0..7). So wondering if this could be implemented in a CPLD, a technology I know very little about in practice. It seems there are few 5 V CPLDs available these days, and many modern CPLDs have a large number of pins that would be unused.Know I could get a 3.3 V or less CPLD and use level shifters - but aiming for a single chip solution to make it worth while. Also need a package that I can hand solder, with an optimum number of pins, e.g. don’t want a 144 pin device. In my world a DIP or SOIC is still best, am OK with surface mount like 32-pin QFP but BGA (or anything socketed) wouldn't work. Being able to specify which pin is which signal would be useful. Prefer a cheap or better still free CPLD programming system.Not interested in implementing the 8088-based computer in an FPGA; that would be missing the point.So, CPLD criteria ranked below:• Package type – must be easy to hand solder (must have)• Supports 5 V directly (must have)• Optimum number of pins (would like to have)• Configurable pins (nice to have)• CostHave seen a few similar posts about using CPLDs to implement 74-series devices, but they didn’t address my specific case. Am happy to use obsolete parts, and expect this is probably the only way to meet the 5 V criterion.Is there a reasonably easy way to do this? Am hoping someone who has experience of older CPLDs can suggest an approach.David00

author: David Hess
author_rank: Super Contributor
timestamp: November 09, 2020, 12:15:18 pm
content: It is absolutely possible. One of the big applications for PLDs was address decoding.

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 12:50:21 pm
content: @David Hess - are you able to elaborate pls? I know PLDs were/are used for address decoding. I'm asking about a specific scenario with constraints.

author: RomDump
author_rank: Regular Contributor
timestamp: November 09, 2020, 01:16:24 pm
content: Quote from: David00 on November 09, 2020, 11:02:35 amPlease google Microchip ATF1508AS. Should meet your needs.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: November 09, 2020, 01:23:07 pm
content: Couple of ATF22V10s - need 2 due to number of inputs

author: Ian.M
author_rank: Super Contributor
timestamp: November 09, 2020, 01:37:44 pm
content: Microchip still have a number of ex-Atmel 5V CPLDs in current production. Seehttps://www.microchip.com/ParamChartSearch/chart.aspx?branchID=30024and select the two voltage ranges that include 5V. There's even a few DIP package devices including some that can replace 16V8 and 22V10 PALs. They also have the software required - seehttps://www.microchip.com/design-centers/fpgas-and-plds/splds-cplds/pld-design-resourcesThe official programming cable (for the ATF15xx devices) is £46 (+VAT):https://www.microchipdirect.com/product/ATDH1150USBor if you are lucky, you may already have a universal programmer that supports them, not just *claims* to support them!

author: dferyance
author_rank: Regular Contributor
timestamp: November 09, 2020, 02:33:03 pm
content: I've not used them but you should check out GreenPAK. It fits much of what you are looking for regarding consolidating chips and supporting 5V. They target very small SMD as the point is to save power, cost and space, but they do have DIP breakouts for development tools. Most of their chips are OTP but there are a few that you can reprogram. Their basic dev board is $25 so not too bad to try out.I have used ATF22V10 in vintage work. The nice thing too is it stays truer to the vintage date than something modern. The pins aren't as programmable as CPLDs but it is a much simpler device. wincupl is a pain to run on modern systems though, I had to run it in an old VM.

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 02:58:58 pm
content: @RomDump - Isn't the ATF1508AS a 100 pin device? That's too many pins...

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 03:04:22 pm
content: @mikeselectricstuff - thanks, I had been looking at an ATF750 but couldn't find a sub-$300 programmer for it. So was looking at the ATF22V10, which my old VP-280 can program. Your post has encouraged me to look even closer...

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 03:07:17 pm
content: @dferyance - thanks, you're the second person to mention the ATF22V10 which looks promising...

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 09, 2020, 03:08:52 pm
content: Quote from: David00 on November 09, 2020, 11:02:35 amJust recently I used a GAL16V8 (easily programmed with a cheapo TL866 programmer) and there are a few more devices out there with more pins.... ATF22V10?You need to be able to express your equations in a tool such as "Logic Friday" and make sure they make sense and then express in a HDL of some kind... I used ABEL... and then program.It's quite fun! (especially if you missed out on CPLDs the first time around!)

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 03:09:55 pm
content: @Ian.M - Many thanks, that's helped a lot

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 03:14:30 pm
content: NivagSwerdna - Thanks. I have/use Logic Friday. I don't feel I've missed out...

author: Ian.M
author_rank: Super Contributor
timestamp: November 09, 2020, 03:20:03 pm
content: I should point out that the older Atmel CPLDs that are usable as pinout compatible PAL replacements, used hardware programming tools that are no longer available from Microchip so 3rd party tools are the only option.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: November 09, 2020, 06:27:59 pm
content: Quote from: NivagSwerdna on November 09, 2020, 03:08:52 pmIf CUPL (WinCUPL) is still available I'd reccommend that - for stuff like address decoding it's pretty straightforward and you can probably find some examples to get you started. Here's an example that looks close to what you are doing :Code:Device G20V8ALCC;/************************************************************************//* This device generates the chip select signals for the I/O functions. *//* It also enables the data bus transceiver for both memory and I/O *//* write cycles. *//************************************************************************//** Inputs **/pin [2..7,9,10] = [a9..2] ; /* system addresses a2 - a9 */pin 11 = !memw ; /* memory write strobe */pin 12 = !iow ; /* i/o write strobe */pin 13 = !ioacc_in ; /* same signal as ioacc */pin 16 = !memacc ; /* on-board memory access *//** Outputs **/pin 18 = !ioacc ; /* on-board I/O being accessed */pin 19 = !parport ; /* parallel port chip select */pin 20 = !rtclk ; /* real-time clock chip select */pin 21 = !serport2 ; /* serial port #2 chip select */pin 23 = !serport1 ; /* serial port #1 chip select */pin 24 = !wrbuff ; /* xceiver enable - write cycle *//** Declarations and Intermediate Variable Definitions **/field ioaddr = [a9..2] ;serport1_eqn = ioaddr:[2F8..2FF] ; /*******************************/serport2_eqn = ioaddr:[3F8..3FF] ; /* I/O Address */rtclk_eqn = ioaddr:[100..11F] ; /* Ranges */parport_eqn = ioaddr:[1F4..1F7] ; /*******************************//** Logic Equations **/wrbuff = memacc & memw # ioacc_in & iow ;ioacc = serport1_eqn # serport2_eqn # rtclk_eqn #parport_eqn ;serport1 = serport1_eqn ;serport2 = serport2_eqn ;rtclk = rtclk_eqn ;parport = parport_eqn ;

author: David00
author_rank: Contributor
timestamp: November 09, 2020, 07:13:33 pm
content: Couple of questions:1. I need 22 inputs and 8 outputs. But those 8 outputs are for AD0..7 (8088 multiplexed Address/Data lines), which are also 8 of my inputs. If I use a single ATF22V10 which has 12 input pins and 10 I/O pins, I can allocate 8 of those I/O pins to AD0..7 for input and output, and use the remaining 2 as inputs, along with the other 12 inputs. Correct?2. I’ve downloaded WinCUPL and can see how to configure an address decoder. But for the more complex 74HC parts I want to integrate, such as the HC373, how can I represent this within WinCUPL? Have started to look through the user manual, I need to use statements like .L for a latch input, correct? Can anyone tell me all of the commands to describe an 8-bit latch?

author: pwlps
author_rank: Frequent Contributor
timestamp: November 09, 2020, 07:53:10 pm
content: Quote from: David00 on November 09, 2020, 07:13:33 pmYou might find this discussion useful:https://groups.google.com/g/sci.electronics.design/c/bxlmLQjGijM?pli=1NB. I used 22V10s (20 years ago ?), programmed them in ABEL and it was a lot of fun. I don't have any experience with WinCUPL programming but I remember at that time I found the PLD-style programming tools rather awkward compared to ABEL.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: November 09, 2020, 08:45:03 pm
content: Quote from: David00 on November 09, 2020, 07:13:33 pmfrom memory, yes, but there are a few constraints that my memory is too hazy to remember - maybe that output enables and clocks on latches are global with a fixed pin, but I may be thinking of a different deviceQuoteCUPL comes with lots of examples, have a browse through them, particularly those for 22V10 and 16V8 devices. and you will probably find most of what you need.e.g. this barrel shifter example shows how latch inputs work :Code:Name Barrel22;Partno CA0006;Date 05/11/89;Revision 02;Designer Kahl;Company Logical Devices, Inc.;Assembly None;Location None;Device g22V10;/****************************************************************//* *//* 8-Bit Registered Barrel Shifter *//* *//* This 8-bit registered barrel shifter takes 8 data inputs *//* and cyclically rotates the data from 0 to 7 places under *//* control of the select ( S0, S1, S2 ) inputs. A SET input *//* can be used to initialize the outputs to the all ones state *//****************************************************************//* Allowable Target Device Types : PAL22V10 *//****************************************************************//** Inputs **/PIN 1 = clock; /* Register Clock */PIN [2..9] = [D7..0]; /* Data Inputs */PIN [10,11,14] = [S2..0]; /* Shift Count Select Inputs */PIN 13 = !out_enable; /* Register Output Enable */PIN 23 = preset; /* Set to Ones Input *//** Outputs **/PIN [15..22] = [Q7..0]; /* Register Outputs *//** Declarations and Intermediate Variable Definitions **/field shift = [S2..0]; /* Shift Width Field */field input = [D7..0]; /* Inputs Field */field output = [Q7..0]; /* Outputs Field *//** Logic Equations **/output.d = [D7, D6, D5, D4, D3, D2, D1, D0] & shift:0# [D0, D7, D6, D5, D4, D3, D2, D1] & shift:1# [D1, D0, D7, D6, D5, D4, D3, D2] & shift:2# [D2, D1, D0, D7, D6, D5, D4, D3] & shift:3# [D3, D2, D1, D0, D7, D6, D5, D4] & shift:4# [D4, D3, D2, D1, D0, D7, D6, D5] & shift:5# [D5, D4, D3, D2, D1, D0, D7, D6] & shift:6# [D6, D5, D4, D3, D2, D1, D0, D7] & shift:7;output.sp = preset; /* synchronous preset */output.oe = out_enable; /* tri-state control */output.ar = 'h'00; /* asynchronous reset not used */

author: ebclr
author_rank: Super Contributor
timestamp: November 10, 2020, 09:18:53 am
content: https://www.xilinx.com/support/documentation/user_guides/ug445.pdf

author: BrianHG
author_rank: Super Contributor
timestamp: November 10, 2020, 11:03:04 am
content: Anything on this page should work:5v PLDs with 40-84 pinsThere is even a 40pin dip version, except, you pay for the plastic and get 24 IOs instead of 32 or more. Some have 32 logic cells while others have 64, or 128 for the larger ones. Though, bread-boarding testing may make the 7$ version good for testing until you build a PCB to hold the J-lead 44/84 pin versions.

author: Ian.M
author_rank: Super Contributor
timestamp: November 10, 2020, 11:39:26 am
content: You are referring to the ATF2500C-20PU. Excluding Vcc and Gnd, the other 14 pins are inputs, and the O.P's design needs 22 inputs, so only having 32 I/O pins in a 40 pin package shouldn't be a significant limitation. Its got just enough inputs and I/Os to implement two 8 bit ports on the O.P's bus so one port with whatever control lines are required shouldn't be a problem.

author: BrianHG
author_rank: Super Contributor
timestamp: November 10, 2020, 11:54:03 am
content: Quote from: Ian.M on November 10, 2020, 11:39:26 am24IOs, + 13 dedicated inputs + 1 clock, not 32 IO. However, since address lines can go to the dedicated inputs, this is fine. It's that ugly 7.86$ VS the 1.93$ PLCC versions. Though, there do exist 44LCC sockets which have through-hole pins on the bottom.Example:https://www.digikey.com/en/products/detail/assmann-wsw-components/A-CCS-044-Z-T/821811It still costs much less to buy the LCC PLD and the IC socket with through-hole mounting. Not to mention the LCC version of the PLD has 32IOs instead or 24IOs, both with additional dedicated input pins only. (Extra IOs allow for an additional decoded bidir 8bit port with a CLK pulse/data ready output, or direction signal.)

author: Ian.M
author_rank: Super Contributor
timestamp: November 10, 2020, 12:28:50 pm
content: Thank you for correcting my I/O pin count FUBAR. Its probably not a sufficient cost saving to make it worth messing with PLCC in a one-off or very low volume DIP through-hole project, but using TQFP-44 package CPLDs on off-the-shelf TQFP to DIL breakout boards would certainly be an option. The TQFP-44 ATF1502A looks interesting with 64 macrocells and speed grades down to 7ns.

author: BrianHG
author_rank: Super Contributor
timestamp: November 10, 2020, 01:05:57 pm
content: Quote from: Ian.M on November 10, 2020, 12:28:50 pm-> ATF1504AS-7JX44 <- This is the 64 macrocell version. At 5.71$, you are at the price of the smallest MAX10 FPGA with built in bootprom, though, 3.3v or less voltage on the IOs, or a small Lattice MachX02. Tolerable.

author: Ian.M
author_rank: Super Contributor
timestamp: November 10, 2020, 01:29:19 pm
content: You continue to pick up on my FUBARs at an alarming rate. Its a good thing I'm not ordering parts for a project at the moment isn't it!Its just random curiosity, but are there any 3.3V FPGAs still on the market with 5V tolerant I/Os (i.e. suitable for direct interfacing to 5V logic with TTL thresholds) and affordable development tools (i.e affordable enough for a hobbyist one-off project) that you could recommend?

author: BrianHG
author_rank: Super Contributor
timestamp: November 10, 2020, 04:07:55 pm
content: Quote from: Ian.M on November 10, 2020, 01:29:19 pmIf you can get away with series resistors to the IOs, ie, 100 ohm, FPGAs with internal clamp protection diodes will give you 0-3.3v out and trigger at ~1.7v making them good to interface directly with 74HCT or 74LS logic.Example ->https://www.digikey.com/en/products/detail/intel/10M02SCE144C8G/5284822Single supply 3.46v max.Built in bootprom.2000LE101 IOs110 kbit ram.ADCBuilt in PLL, over 400MHz, and RC oscillator.LVDS transceivers, though not the fastest, but still good for what the chip is.Enough gates to make an on-chip cpu.+ larger core versions in a pin-pin compatible package or 2x, 4x, 6x, 12x, 25x size on logic elements and ram.More 144pin MAX10sNow, this is not the cheapest, you pay a little premium for not needing a bootprom and only needing a single voltage supply.The cheapest is lattice with an FPGA having 589kbit ram and 12k logic elements @ 5.51$. But no 5v, you need a bootprom & 2 regulators and BGA only. Though, they have a 15$ one for 44k LE with 1.9megabit ram which is hard to beat.All the dev tools for these are free. A third party Intel USB blaster compatible programmer for the MAX10 can be purchased for 50$ from digikey, or, cheap 5$ ones from Aliexpress.Max 10 dev board:Max10 dev boardCheap USB Blaster:Intel usb programmer(LOL, I think the first 3 MAX10s, the 10M02, 10M04, 10M08 are all the same chip just like the first 2 CycloneIII/IV sizes. Just tell the compiler to compile for the larger chip and it works giving you the larger gate and ram capacity of the triple priced component.)

author: BrianHG
author_rank: Super Contributor
timestamp: November 10, 2020, 09:40:48 pm
content: Ooops, warning about the input PCI 'CLAMP' diode protection.1. There are some dedicated IOs which do not have the protection. Usually some of the JTAG programming pins and global CLK inputs or global reset. A simple resistor divider can take care of the global dedicated inputs if you use them.2. The clamp diodes need to be enabled in software when programming the IC.Also, resistor dividers packs do exist like these which can do 4-8 IO per device which will guarantee you never exceed the input 3.3v threshold, meaning connecting to any 5v logic would be safe, never need to rely on the internal diodes.These guys conveniently have spacing which just about matches the TQFP pins. Use 150 Ohm series.SMD resistor arraysTo grantee no signalling above 3.3v, you can add a second 330 Ohm resistor pack as a terminator, though the FPGA output would be fighting this pull-down resistor.The other choice is dual or quad common Cathode Schottky diodes in SOT-23-6 package reinforcing the FPGA on-die diode.Example 4 diodes in 1 package:https://www.digikey.com/en/products/detail/diodes-incorporated/BAS70DW-05-7-F/1099097

author: jmelson
author_rank: Super Contributor
timestamp: November 11, 2020, 02:56:03 am
content: Quote from: Ian.M on November 10, 2020, 01:29:19 pmThe Xilinx XC95xxXL family is a CPLD with 5V tolerant I/O and single 3.3V supply. The smallest device XC9536XL is about $1 in single quantity in 44-pin package. Pretty limited device, but very cost effective.I think the CoolRunner II family is also 5V tolerant, and somewhat larger capacity.The Spartan 3 series from Xilinx is a true FPGA, I use the smallest version XC3S50A (and non-volatile XC3S50AN) in several products. The voltatile (A) version is $10 in single quantity and TQFP144 package, might be cheaper in smaller packages. The AN version is about $13.These are supported by their older tools in the Ise line, versions 10 - 14 or so, downloadable for free in most countries. The tools run on Windows or Linux. Version 10 - 14 of Ise I think all support schematic entry with standard 74XX devices, but I don't recommend that route. Learn VHDL, it will make it possible to easily re-use designs and parts of designs.Jon

author: BrianHG
author_rank: Super Contributor
timestamp: November 11, 2020, 09:09:11 am
content: Quote from: jmelson on November 11, 2020, 02:56:03 amIf you want programming more similar to C and a bit simpler, you may choose to learn System Verilog instead.

author: Canis Dirus Leidy
author_rank: Regular Contributor
timestamp: November 11, 2020, 01:30:23 pm
content: Quote from: Ian.M on November 10, 2020, 01:29:19 pmDepends on what is meant by "tolerant". Altera's (now Intel) MAX II can directly drive 5V logic but you will need external clamp diodes and, for CMOS logic, pull-up resistors:https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/max2/max2_mii51009.pdf