The idea here is to connect a 65C02 to a CPLD over a "private bus" with 8 data lines, 16 address lines, and control lines. The CPLD would then present a "public bus" to the rest of the system using 8 data lines, 20 (or more) address lines, and various chip selects and strobes as needed. The CPLD would also provide a way for a "controller" -- in my case a PIC, but no reason why an AVR couldn't be used -- to hold the 65C02 in reset at power up, load the RAM with an initial program, write protect the RAM, and then take the 65C02 out of reset in order to start it up. For a device connected to mass storage, the initial program could be a boot loader which bootstraps software from the mass storage device (e.g. a microSD card for example).
The purpose of the CPLD then would be to provide the following interfaces and services to the system:
- Isolate the 65C02 bus from the rest of the system
- Provide a controller MCU the ability to initialize the system (e.g. ROM-ulate or bootstrap as you wish)
- Provide a basic MMU to the system to allow it to address a lot more memory, and to designate various banks of memory as read-only
- Provide a public bus with 20 (or more) bits of address, and 8-bits of data to the rest of the system, along with any needed chip selects, strobes, and wait state generators for slow I/O devices
- Provide limited hardware reconfigurability to allow the system to be adapted to unanticipated needs in the future (via the CPLD).
One CPLD family I have experience with and am contemplating using is the Xilinx Coolrunner II family. The XC2C256 part has 256 macrocells and a T(pd) of 6.7 nS. Of course it only runs at 3.3 volts, and in order to limit the complexity of the system I'd run everything at 3.3 volts, but there is no reason why the more ambitious couldn't add a bunch of voltage translators in order to make it work with 5V-only devices.
With 256 macrocells, it even becomes possible to even contemplate a simple VGA subsystem and in fact I have thrown together some HDL which implements a simple 320x200 bitmapped display with a single 32K RAM that fits on a 128-macrocell devices. If fewer than 128 macrocells are needed to implement basic system functionality, then some additional circuitry could be added to provide an analog VGA output as well. I'm probably thinking too far ahead here and perhaps a better VGA subsystem could be implemented on a small FPGA instead of using the CPLD. That would allow for some hardware acceleration and other features along the lines of what Brad is doing with his Vulcan74 project. I think for my first pass at such a system I'll stick with a CPLD and consider the VGA add-on an optional "nice-to-have if there's room when everything else is working."
I've seen a number of other people use programmable logic (mostly PALs) to replace glue logic on their 6502-based systems. I believe 8BIT (Daryl) used a CPLD to make a "65SPI" device but I've not seen others using CPLDs as ambitiously as I'm proposing above. However, I've only been here a short while and may well have missed someone's project. If so, I'd love to benefit from their own experience and would appreciate a pointer.
Edit: Changed the title to reflect that both CPLDs and FPGAs are being considered.