RNG — Random number generator

The Random number generator (RNG) generates true non-deterministic random numbers based on internal thermal noise that are suitable for cryptographic purposes. The RNG does not require a seed value.

Figure 1. Random number generator

The RNG is started by triggering the START task and stopped by triggering the STOP task. When started, new random numbers are generated continuously and written to the VALUE register when ready. A VALRDY event is generated for every new random number that is written to the VALUE register. This means that after a VALRDY event is generated the CPU has the time until the next VALRDY event to read out the random number from the VALUE register before it is overwritten by a new random number.

Bias correction

A bias correction algorithm is employed on the internal bit stream to remove any bias toward '1' or '0'. The bits are then queued into an eight-bit register for parallel readout from the VALUE register.

It is possible to enable bias correction in the CONFIG register. This will result in slower value generation, but will ensure a statistically uniform distribution of the random values.

Speed

The time needed to generate one random byte of data is unpredictable, and may vary from one byte to the next. This is especially true when bias correction is enabled.

Registers

Table 1. Instances
Base addressPeripheralInstanceDescriptionConfiguration
0x4000D000RNGRNGRandom number generator  
Table 2. Register Overview
RegisterOffsetDescription
TASKS_START0x000Task starting the random number generator 
TASKS_STOP0x004Task stopping the random number generator 
EVENTS_VALRDY0x100Event being generated for every new random number written to the VALUE register 
SHORTS0x200Shortcut register 
INTENSET0x304Enable interrupt 
INTENCLR0x308Disable interrupt 
CONFIG0x504Configuration register 
VALUE0x508Output random number 

SHORTS

Address offset: 0x200

Shortcut register

Bit number313029282726252423222120191817161514131211109876543210
Id                               A
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWVALRDY_STOP  

Shortcut between VALRDY event and STOP task

See EVENTS_VALRDY and TASKS_STOP

   Disabled0Disable shortcut
   Enabled1Enable shortcut
 

INTENSET

Address offset: 0x304

Enable interrupt

Bit number313029282726252423222120191817161514131211109876543210
Id                               A
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWVALRDY  

Write '1' to Enable interrupt for VALRDY event

See EVENTS_VALRDY

   Set1Enable
   Disabled0Read: Disabled
   Enabled1Read: Enabled
 

INTENCLR

Address offset: 0x308

Disable interrupt

Bit number313029282726252423222120191817161514131211109876543210
Id                               A
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWVALRDY  

Write '1' to Disable interrupt for VALRDY event

See EVENTS_VALRDY

   Clear1Disable
   Disabled0Read: Disabled
   Enabled1Read: Enabled
 

CONFIG

Address offset: 0x504

Configuration register

Bit number313029282726252423222120191817161514131211109876543210
Id                               A
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARWDERCEN  Bias correction
   Disabled0Disabled
   Enabled1Enabled
 

VALUE

Address offset: 0x508

Output random number

Bit number313029282726252423222120191817161514131211109876543210
Id                        AAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IdRWFieldValue IdValueDescription
ARVALUE [0..255]Generated random number
 

Electrical specification

RNG Electrical Specification

SymbolDescriptionMin.Typ.Max.Units
IRNGRun current, CPU sleeping.500µA
tRNG,STARTTime from setting the START task to generation begins. This is a one-time delay on START signal and does not apply between samples.128µs
tRNG,RAWRun time per byte without bias correction. Uniform distribution of 0 and 1 is not guaranteed.30µs
tRNG,BCRun time per byte with bias correction. Uniform distribution of 0 and 1 is guaranteed. Time to generate a byte cannot be guaranteed.120µs