Dice control with GAL16V8We used a GAL16V8 to build a digital dice.
Hereby, the GAL implements three components:
To be able to use two different clock sources, we implemented a clock control with two buttons and a quartz oscillator (4.000 MHz).
Every time the grey button (STEP) is being pressed, a rising edge is given to the clock. Thus, you are able to manually switch through the states of the dice. When holding the blue button (RUN), the signal from the quartz is used as clock.
The final clock signal is routed from the clock control output to the actual clock input of the GAL (see the orange cable from Pin 12 to 1).
Using the internal D-flipflops of the GAL we build a simple three-bit binary counter with limited counting range (1-6). It is important to consider the forbidden states 0 (000b) and 7 (111b) and not to forget to include them in the equation synthesis. The binary output is visible on the LEDs on the top.
The dice decoder entity converts the binary output for the dice display (top left). Because of the symmetry of the dice numbers some LEDs can be connected and the display can be controlled with just four channels.
The real effect of throwing a dice (No, we won't throw the breadboard) is given when pressing the blue RUN button. The probability of consciously throwing the same number in sequence is virtually zero. The period length of the clock signal from the quartz is 0.25 Ás - which is so short you cannot press that with your finger.
Due to the high frequency of the quartz oscillator the LEDs seem to be active when running the quartz clock. You can see this on the three binary LEDs.
To avoid this effect on the dice display we used some additional OR gates (on the top right) to set the dice inputs to HIGH (inputs are low-active!) when the RUN button is pressed.
Of course you can also achieve this functionality with the GAL instead of using an extra chip.
If you need the equations for the counter and decoder or the circuit diagram, please let me know!