OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [datasheet/] [soc_trng.adoc] - Diff between revs 73 and 74

Only display areas with differences | Details | Blame | View Log

Rev 73 Rev 74
<<<
<<<
:sectnums:
:sectnums:
==== True Random-Number Generator (TRNG)
==== True Random-Number Generator (TRNG)
[cols="<3,<3,<4"]
[cols="<3,<3,<4"]
[frame="topbot",grid="none"]
[frame="topbot",grid="none"]
|=======================
|=======================
| Hardware source file(s): | neorv32_trng.vhd |
| Hardware source file(s): | neorv32_trng.vhd |
| Software driver file(s): | neorv32_trng.c |
| Software driver file(s): | neorv32_trng.c |
|                          | neorv32_trng.h |
|                          | neorv32_trng.h |
| Top entity port:         | none |
| Top entity port:         | none |
| Configuration generics:  | _IO_TRNG_EN_ | implement TRNG when _true_
| Configuration generics:  | _IO_TRNG_EN_ | implement TRNG when _true_
| CPU interrupts:          | none |
| CPU interrupts:          | none |
|=======================
|=======================
**Theory of Operation**
**Theory of Operation**
The NEORV32 true random number generator provides _physical_ true random numbers.
The NEORV32 true random number generator provides _physical_ true random numbers.
Instead of using a pseudo RNG like a LFSR, the TRNG uses a simple, straight-forward ring
Instead of using a pseudo RNG like a LFSR, the TRNG uses a simple, straight-forward ring
oscillator concept as physical entropy source. Hence, voltage, thermal and also semiconductor manufacturing
oscillator concept as physical entropy source. Hence, voltage, thermal and also semiconductor manufacturing
fluctuations are used to provide a true physical entropy source.
fluctuations are used to provide a true physical entropy source.
The TRNG is based on the _neoTRNG_, which is a "spin-off project" of the
The TRNG is based on the _neoTRNG_, which is a "spin-off project" of the
NEORV32 processor. The TRNG uses the default neoTRNG configuration, which showed very good results in the
NEORV32 processor. The TRNG uses the default neoTRNG configuration, which showed very good results in the
`dieharder` battery of random number tests. More detailed information about the neoTRNG, it's architecture and a
`dieharder` battery of random number tests. More detailed information about the neoTRNG, it's architecture and a
detailed evaluation of the random number quality can be found it it's repository: https://github.com/stnolting/neoTRNG
detailed evaluation of the random number quality can be found it it's repository: https://github.com/stnolting/neoTRNG
 
 
 
.Platform Independent Architecture
[NOTE]
[NOTE]
The TRNG features a platform independent architecture without FPGA-specific primitives, macros or
The TRNG features a platform independent architecture without FPGA-specific primitives, macros or
attributes so it can be synthesized for _any_ FPGA.
attributes so it can be synthesized for _any_ FPGA.
 
 
 
.Inferring Latches
 
[NOTE]
 
The synthesis tool might emit a warning like _"inferring latches for ... neorv32_trng ..."_. This is no problem
 
as this is what we actually want (the TRNG is based on latches).
 
 
 
 
**Using the TRNG**
**Using the TRNG**
The TRNG features a single register for status and data access. When the _TRNG_CTRL_EN_ control register (`CTRL`)
The TRNG features a single register for status and data access. When the _TRNG_CTRL_EN_ control register (`CTRL`)
bit is set, the TRNG is enabled and starts operation. As soon as the _TRNG_CTRL_VALID_ bit is set, the currently
bit is set, the TRNG is enabled and starts operation. As soon as the _TRNG_CTRL_VALID_ bit is set, the currently
sampled 8-bit random data byte can be obtained from the lowest 8 bits of the `CTRL` register
sampled 8-bit random data byte can be obtained from the lowest 8 bits of the `CTRL` register
(_TRNG_CTRL_DATA_MSB_ : _TRNG_CTRL_DATA_LSB_). These bits always keep the latest valid data obtained from the TRNG
(_TRNG_CTRL_DATA_MSB_ : _TRNG_CTRL_DATA_LSB_). These bits always keep the latest valid data obtained from the TRNG
entropy source. The _TRNG_CTRL_VALID_ bit is automatically cleared when reading the control register.
entropy source. The _TRNG_CTRL_VALID_ bit is automatically cleared when reading the control register.
 
 
 
.TRNG Reset
[NOTE]
[NOTE]
The TRNG core does not provide a dedicated reset. In order to ensure correct operations, the TRNG should be
The TRNG core does not provide a dedicated reset. In order to ensure correct operations, the TRNG should be
disabled (=reset) by clearing the _TRNG_CTRL_EN_ and waiting some milliseconds before re-enabling it.
disabled (=reset) by clearing the _TRNG_CTRL_EN_ and waiting some milliseconds before re-enabling it.
.TRNG register map (`struct NEORV32_TRNG`)
.TRNG register map (`struct NEORV32_TRNG`)
[cols="<2,<2,<4,^1,<7"]
[cols="<2,<2,<4,^1,<7"]
[options="header",grid="all"]
[options="header",grid="all"]
|=======================
|=======================
| Address | Name [C] | Bit(s), Name [C] | R/W | Function
| Address | Name [C] | Bit(s), Name [C] | R/W | Function
.3+<| `0xffffffb8` .3+<| `NEORV32_TRNG.CTRL` <|`7:0` _TRNG_CTRL_DATA_MSB_ : _TRNG_CTRL_DATA_MSB_ ^| r/- <| 8-bit random data
.3+<| `0xffffffb8` .3+<| `NEORV32_TRNG.CTRL` <|`7:0` _TRNG_CTRL_DATA_MSB_ : _TRNG_CTRL_DATA_MSB_ ^| r/- <| 8-bit random data
                                             <|`30` _TRNG_CTRL_EN_                               ^| r/w <| TRNG enable
                                             <|`30` _TRNG_CTRL_EN_                               ^| r/w <| TRNG enable
                                             <|`31` _TRNG_CTRL_VALID_                            ^| r/- <| random data is valid when set
                                             <|`31` _TRNG_CTRL_VALID_                            ^| r/- <| random data is valid when set
|=======================
|=======================
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.