Yes, I can post the Verilog code. It's in the attached zip file. There are 3 Quartus projects in there - Test0, Test1 and Test2. Test0 is for the ATF1502, Test1 for the 1504 and Test2 for the 1508. They are intended to run on this board:
https://www.microchip.com/developmentto ... 15XX-DK3-UThese projects were produced to meet several aims - to help me get familiar with CPLDs and Verilog, to get some idea of how much stuff you can fit in one of these chips, to validate the programming setup and to test chips obtained from sources such as ebay.
The Test0 and Test1 projects work with no issues.
The Test2 project was not so fortunate. Basically the project consists of the following:
The system clock (2MHz on that board) is fed through three prescalers - first by 625 (down to 640Hz), second by 32 (down to 20Hz), third by a variable ratio from 1 to 16. The third prescaler output is fed to a two-digit BCD up/down counter. The board has 4 7-segment displays driven by 4 bit binary to 7-segment decoder modules, with each BCD digit driving two displays.
The push buttons are used as follows:
SW1 - changes between up and down counting
SW2 - increases prescaler 3 ratio (reduces count rate)
SW3 - decreases prescaler 3 ratio (increases count rate)
SW8 - pauses the count for as long as it is held
SW7 - switches the display between the BCD counter output and the prescaler 3 ratio and count.
What I found was that it all works on an EPM7128 device. If I use pof2jed and run the output on an ATF1508 I observe the following behaviour:
1. 7 segment display 3 displays the digit 2 incorrectly - the F segment is illuminated when it should not be. All other digits and all other displays work correctly.
2. When counting down, everything works correctly. When counting up, if the most significant digit is even it never changes; if it is odd, it increments when the least significant digit rolls over from 9 to 0, as expected.
There is only one clock in the system - the 2MHz clock provided by the on board xtal oscillator. Internally a low frequency clock is used to clock some stages, but that clock is obtained by dividing down the original 2MHz so there shouldn't be any timing or metastability issues.
The buttons drive the asynchronous reset pins of flip-flops used to implement debouncers.