Dave,
First of all, sorry for the (very) late reply. Been very busy at work. The good news is that I've managed to make my prototype work and I'm now beginning work on the 2nd board.
I aim on having a full SPI bus on both CPLDs this time. I'm just confused about the edge detector circuit you mentioned - I can't quite envision how it works. And do I need the flip flops external to the CPLD or can I just synthesize them inside?
The other thing I wanted to ask you was that I also need to cascade the CPLDs in order to make a larger shift register. I can't use BGA packages because pick n' place machines here don't support it. And even if I solder it using a hot-plate, it's impossible to inspect. Therefore, the goal is to cascade three 144-pin TQFP CPLDs in order to make a 300 (or so) bit shift register.
My approach is quite simple (and probably naive): have a Serial Out pin on each CPLD. The clock goes to each CPLD and if they're enabled, they shift the bit in.
--- Quote Start ---
I'm just trying to expand your horizons. What you have proposed would work, but it won't help you solve the next problem.
--- Quote End ---
I know and thank you.
--- Quote Start ---
Consider the following system;
1) Microcontroller to CPLD interface implementing using SPI. The bytes over SPI define a protocol, something like a command byte, address byte(s), and data bytes(s). Your CPLD is then an addressable memory map.
2) Within the CPLD memory map are the registers that control the test-harness tester. The test harness interface involves a tri-state buffer, output enable registers, and pin readback registers.
3) You can manually generate shift patterns to the registers, or later you could generate patterns automatically.
--- Quote End ---
Regarding having CPLDs with a "readback" function. Am I correct in my understanding is that what you're actually proposing is that instead of using different to enable different functions, I sent in a instruction via SPI. For instance, there could be a 'readback' instruction. If that is received by the CPLD, it can send in the entire stream of bits it has (but it won't be shifting anything.)
Regarding shift patterns/test vectors. There is really only one test vector: the walking one.
One other thing that I thought of was a simple LED driver. I could implement it via SPI. The MCU will send in addresses of the pins it wants enabled. The LEDs connected to those pins can then be driven by the CPLD (with a buffer in between).
Each address can be 8 bytes long. So if the MCU sends 16 bytes, the CPLD will know there are addresses for two LEDs and so on. It can also have a "Reset" instruction, something like 0xFF, which when received could shut off all LEDs.
OR
I could signal the transfer of the 2nd address by toggling a pin. I prefer the first idea though.