Experiments with Gomti

Running the RNG to evaluate the output

In the Gomti collection, there are a few Verilog implementations for multiple targets. Currently, those implementations are under evaluation.

The RNG is "bare" version, with no conditioning component. That is, in the actual use case, it is assumed that adding conditioning component after the bare RNG.

In this article, I explain how to use an entry in Gomti, with a concrete example with TEC0117. (Other options are Tang Nano 9K and iCE40 boards.)

Tools to build

  • Yosys
  • NextPnR-gowin
  • gowin_pack / Apycula

You need to install yosys. On Debian system, you can do that by apt install yosys.

You need to build and install nextpnr-gowin yourself, as it's new. It's available from https://github.com/YosysHQ/nextpnr.git See the explanation how to build nextpnr-gowin.

To build nextpnr-gowin, you need to install Project Apicula from https://github.com/YosysHQ/apicula. To build Apicula, it assumes having a proprietary tool from vendor. Using pip, you can install Apycula . If you don't have the vendor tool on your system, simply do pip install Apycula. Apycula includes the tool gowin_pack.

Tools to flash

openFPGAloader is needed to flash bitstream to FPGA. On Debian system, you can do that by apt install openfpgaloader.

Tools to test

Please install https://github.com/usnistgov/SP800-90B_EntropyAssessment

Also, ent and dieharder are useful.

Get TEC0117

TEC0117 is a FPGA Module with GW1NR-9, which has FTDI 2232 chip.

https://shop.trenz-electronic.de/en/TEC0117-01-A-FPGA-Module-with-GOWIN-LittleBee-and-8-MByte-internal-SDRAM

Please purchase multiple boards of this.

Connect TEC0117 to host PC

Using USB cable, please connect TEC0117 to your host PC. You can see it's connected by lsusb.

In the output of the command, you can see something like:

Bus 001 Device 010: ID 0403:6010 Future Technology Devices International, Ltd FT2232C/D/H Dual UART/FIFO IC

Clone Gomti Repo.

Please clone the code:

$ git clone https://git.sr.ht/~gniibe/gomti
$ cd gomti

The one for TEC0117 is here:

$ cd a192-192-425

Flash the bitstream

You can flash the bitstream like:

$ openFPGALoader -b tec0117 2023-03-09-gniibe-03/gomti-a192-192-425-uart-tec0117.fs

TTY setting

The TEC0117 board has FT2232 chip. It can be seen as /dev/ttyUSB* on your host PC. When it's /dev/ttyUSB1, please configure the TTY by:

$ stty -F /dev/ttyUSB1 raw parenb -parodd -cstopb ignpar inpck -echo -echonl 2000000

Observe the RNG output

You can observe the output:

$ hd /dev/ttyUSB1

Simple evaluation by ent can be:

$ dd if=/dev/ttyUSB1 bs=65536 iflag=fullblock count=64 | ent

You can even run dieharder (which takes a month or more):

$ dd if=/dev/ttyUSB1 iflag=fullblock bs=65534 | dieharder -g 200 -a | tee 2023-03-09-gniibe-03/3-dieharder.txt | grep --color=auto -E -e 'FAIL.*$|$'