Digital Dice

GreenPAK Blog
GreenPAK™
Published in
4 min readMar 19, 2021

Below we described all the consecutive steps of the project. However, you can access the IC design file of this project here. The design was created in free GUI-based GreenPAK™ Designer software.

This proejct 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 CR2032 battery. It has no power-on switch due to negligibly low power consumption when idle.

Device Architecture

The design consists of the following blocks:

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.

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.

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.

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, but 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. Because Digital 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.

Macrocell Settings

For each macrocell, settings refer to the tables below.

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.

--

--

GreenPAK Blog
GreenPAK™

Renesas’ Family of Programmable Mixed-Signal ASICs