Several years ago I wrote a Gist on gitHUB describing a process for converting a ROM into a set of logic equations such that a CPLD could be used to store the ROM.
In the general scheme of things, ROMs may be used for microprogramming. However, EPROMs, UV or Flash, have pretty poor access times, and as a consequence, drive any implementation using these devices toward low clock rates. SRAMs can be used to get around this problem, but create other problems such as requiring a way to load them after each power cycle.
Of the nice features of CPLDs is that they exhibit fast pin-pin times, and can thus be used to simulate fast bipolar ROMs such as those used in high performance microprogrammed minicomputers of the 70s and 80s.
Today I decided to implement the algorithm that I described in that Gist six years ago. The result is a fairly compact Python script that reads in a ASCII Binary memory initialization file, i.e. ROM, and generates a synthesizable Verilog module.
I used the microprogram ROM from the MiniCPU project I developed for the 8-bit processor challenge that Arlet Ottens set up on anycpu.org. As a ROM, the microprogram requires 45 64x1 LUTs and 45 registers in the CLBs holding the LUTs. As a Xilinx Coolrunner-2 XC2C64-7VQ100 CPLD, the microprogram utilizes 50/64 (79%) macrocells, 144/224 (65%) p-terms, 45/64 (71%) registers, 57/64 (90%) pins, 77/160 (49%) function block inputs.
The total number of p-terms in the ROM-based implementation are 64 as that is the total number of states in the microprogram ROM. The fact that additional p-terms are needed in the CPLD is an indication that the internal architecture of the CPLD is not a full PLA, so additional terms are needed to expand / share the OR terms from adjacent macrocells. Three microprogram register values are reserved for future use, hence 45 registers instead of 48.
Overall, there is a fairly efficient mapping of the ROM onto the AND/OR architecture of the CPLD.
For anyone interested, the Python program, the input file, and the output file can be found in this repository:
https://github.com/MorrisMA/PLATool. I've released the program under the GPLv3 license; found in the repository.