Software APIs
Data Fields
rand_testutils_rng Struct Reference

A random number generator testutil type. More...

#include <sw/device/lib/testing/rand_testutils.h>

Data Fields

dif_rv_core_ibex_t * rv_core_ibex
 An rv_core_ibex DIF handle.
 
uint32_t entropy_fetch_timeout_usec
 The timeout in microseconds for fetching data from the hardware.
 
uint32_t lfsr
 The PRNG LFSR.
 
uint32_t polynomial_coefficients
 The PRNG polynomial co-efficients.
 
uint32_t reseed_frequency
 The PRNG LFSR reseed frequency.
 
uint32_t op_counter
 The LFSR operation counter. More...
 

Detailed Description

A random number generator testutil type.

Provides ability to control and maintain a random number generator. A random number is produced via a mix of hardware-based (using on-device entropy from rv_core_ibex random registers) and software-based (an LFSR-based PRNG) approaches. The initial seed value for the PRNG is fetched from the hardware. Following that, the PRNG kicks in and supplies random values sought by the test. After a number of PRNG cycles, the LFSR can be freshly reseeded from the hardware. If this frequency is set to 0, then the PRNG is rendered disabled and random data is always fetched from the hardware.

The software PRNG is faster because it consumes very few cycles compared to the hardware - it helps improve the simulation time.

Definition at line 27 of file rand_testutils.h.

Field Documentation

◆ entropy_fetch_timeout_usec

uint32_t rand_testutils_rng::entropy_fetch_timeout_usec

The timeout in microseconds for fetching data from the hardware.

Definition at line 35 of file rand_testutils.h.

◆ lfsr

uint32_t rand_testutils_rng::lfsr

The PRNG LFSR.

Definition at line 39 of file rand_testutils.h.

◆ op_counter

uint32_t rand_testutils_rng::op_counter

The LFSR operation counter.

Resets on every reseed.

Definition at line 51 of file rand_testutils.h.

◆ polynomial_coefficients

uint32_t rand_testutils_rng::polynomial_coefficients

The PRNG polynomial co-efficients.

Definition at line 43 of file rand_testutils.h.

◆ reseed_frequency

uint32_t rand_testutils_rng::reseed_frequency

The PRNG LFSR reseed frequency.

Definition at line 47 of file rand_testutils.h.

◆ rv_core_ibex

dif_rv_core_ibex_t* rand_testutils_rng::rv_core_ibex

An rv_core_ibex DIF handle.

Definition at line 31 of file rand_testutils.h.