This project describes how to design a true random number generator from 1 to 6 with a 7-segment 1-digit LED display.

Below we described steps needed to understand how the solution has been programmed to create digital dice. However, if you just want to get the result of programming, download GreenPAK™ software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit the program to design the solution.

Introduction

This project describes how to design Digital Dice, a true random number generator from 1 to 6. This device can be used instead of a commonly used dice. It has a 1-digit 7-segment LED display and two buttons: "Run" and "Display Previous". The Digital Dice can be powered from a single CR-2032 battery. It has no power-on switch due to negligibly low power consumption when idle.

Figure 1.jpg

Device Architecture

Figure 2.jpg

The design consists of the following blocks described in the consecutive sections below.

Entropy Generator

The entropy generator is built of four asynchronous oscillators. Two of which are built using an inverted closed-loop LUT with delay (1 MHz and 6.5 MHz). Two others are GreenPAK's OSC1 (2.048 MHz along with a divide by 3) and OSC2 (25 MHz divided by 2).

Inputting a few asynchronous clock signals to XNOR gate is enough to get an unpredictable signal on its output (noise or entropy). But the macrocells within the SLG46826V allow making even more complicated solutions. Using one more oscillator and DFF we get a completely random signal.

Figure 3.jpg

Linear Feedback Shift Register

The 3-bit LFSR is built using three DFFs and one XNOR gate. This block with each input clock generates a 3-bit pseudo-random number. Here, instead of a clock pulse, the noise signal goes into the LFSR's input, generating a true random 3-bit number.

Figure 4.jpg

Binary to 7-Segment Decoder

In order to convert the 3-bit random number generated by the LSFR, the Binary to 7-segment decoder is used, see Figure 3. The decoder is built of 3-bit LUTs.

Figure 5.jpg

Control Unit

The control unit is a part of the device designed to start it and stop after the 3-second period. Two pins are configured as inputs and two buttons must be connected from VDD to those pins. While the button "Run" is pressed, the device continuously generates random numbers. Right after the button is released, the generation stops and LFSR latches its outputs. The decoder subsequently drives a 7-segment display. After a 3 second period, the Digital Dice goes idle. The device is still powered on, ut because all oscillations have been turned off, the current consumption is extremely low. This allows the device to "remember" the last generated random number. If the button "Display Previous" is pressed, the last generated random number will be displayed until the button is released. BecauseDigital Dice is designed to replace usual dice, the 3-bit LUT12 is used to restart it when "0" or "7" occurs. This ensures the device will generate a random number in the range of 1 to 6.

Figure 6.jpg

Macrocell Settings

For each macrocell, settings refer to the tables below.

Table 1.jpg
Table 2.jpg
Table 3.jpg
Table 4.jpg
Table 5.jpg
Table 6.jpg
Table 7.jpg

Conclusions

The Digital Dice can be used as a replacement of usual dice in casinos or when playing any other games where dice are needed. It has an entropy generator that is constantly generating 3-bit random numbers while the button "Run" is pressed. It stops and displays the result only when the button is released, so the human factor also affects the generated random number. Four asynchronous oscillators together with human button push variability make the device completely and desirably unpredictable.

Dialog Semiconductor
Dialog Semiconductor provides a development platform based on easy-to-use hardware and software GUI that allows users to easily create custom ICs.