NEORV32 - Software Framework Documentation
neorv32_trng.h File Reference

True Random Number Generator (TRNG) HW driver header file. More...

Go to the source code of this file.


int neorv32_trng_available (void)
void neorv32_trng_enable (void)
void neorv32_trng_disable (void)
void neorv32_trng_fifo_clear (void)
int neorv32_trng_get (uint8_t *data)
int neorv32_trng_check_sim_mode (void)

Detailed Description

True Random Number Generator (TRNG) HW driver header file.

These functions should only be used if the TRNG unit was synthesized (IO_TRNG_EN = true).

Function Documentation

◆ neorv32_trng_available()

int neorv32_trng_available ( void  )

Check if TRNG unit was synthesized.

0 if TRNG was not synthesized, 1 if TRNG is available.

◆ neorv32_trng_check_sim_mode()

int neorv32_trng_check_sim_mode ( void  )

Check if TRNG is implemented using SIMULATION mode.

In simulation mode the physical entropy source is replaced by a PRNG (LFSR) with very bad random quality.
Simulation mode active when not zero.

◆ neorv32_trng_disable()

void neorv32_trng_disable ( void  )

Disable true random number generator.

◆ neorv32_trng_enable()

void neorv32_trng_enable ( void  )

Enable true random number generator. The TRNG control register bits are listed in NEORV32_TRNG_CTRL_enum.

◆ neorv32_trng_fifo_clear()

void neorv32_trng_fifo_clear ( void  )

Clear TRNG random data "pool" (data FIFO).

◆ neorv32_trng_get()

int neorv32_trng_get ( uint8_t *  data)

Get random data byte from TRNG.

[in,out]datauint8_t pointer for storing random data byte.
Data is valid when 0 and invalid otherwise.