Network Wizard for VHDL Test Benches
Loading...
Searching...
No Matches
nw_prbs_pkg Package Body Reference
Package Body >> nw_prbs_pkg

Functions

t_slv_arr   f_gen_prbs (
poly: in std_logic_vector
data_width: in positive
length: in positive
msb_first: in boolean
init: in std_logic_vector
)
 Create PRBS sequence.
t_slv_arr   f_gen_prbs (
poly: in std_logic_vector
data_width: in positive
length: in positive
msb_first: in boolean true
[ impure ]
 Create PRBS sequence.
std_logic_vector   f_gen_seed ( data_width: in positive [ impure ]
 Create random seed.
integer   f_randnat ( minval: in natural 0 , maxval: in natural integer'high[ impure ]
 Return random integer (natural)
std_logic_vector   f_randslv ( data_width: in positive [ impure ]
 Return random std_logic_vector.
std_logic_vector   f_randsel ( data: in t_slv_arr[ impure ]
 Return random element.

Member Function/Procedure/Process Documentation

◆ f_gen_prbs() [1/2]

t_slv_arr f_gen_prbs (   poly in std_logic_vector ,
  data_width in positive ,
  length in positive ,
  msb_first in boolean ,
  init in std_logic_vector  
)
Function

Create PRBS sequence.

Parameters
polyPolynomial to use
data_widthData width
lengthNumber of data words
msb_firstPack bits MSB in data words first (True), or LSB (False)
initLFSR init value
Returns
PRBS sequence in data array

Generate a PRBS sequence of given length and data width. The LFSR uses Galois configuration. Example maximum length polynomials up to order 32 can be found as constants. Init value cannot be zero (would return all zero array).

Example use

array_8bit := f_gen_prbs(C_POLY_X6_X5_1, 8, 6, C_MSB_FIRST, "1111111");

◆ f_gen_prbs() [2/2]

t_slv_arr f_gen_prbs (   poly in std_logic_vector ,
  data_width in positive ,
  length in positive ,
  msb_first in boolean true  
) impure
Function

Create PRBS sequence.

Parameters
polyPolynomial to use
data_widthData width
lengthNumber of data words
msb_firstPack bits MSB in data words first (True, default), or LSB (False)
Returns
PRBS sequence in data array

This is an overloaded verison of f_gen_prbs with init value set to a random seed using f_gen_seed().

Example use

array_8bit := f_gen_prbs(C_POLY_X6_X5_1, 8, 6);

◆ f_gen_seed()

std_logic_vector f_gen_seed (   data_width in positive  
) impure
Function

Create random seed.

Parameters
data_widthSeed vector length
Returns
Random seed

A random, non-zero seed is returned. The seed is based on the current simulation time.

Example use

seed_16bit := f_gen_seed(16);

◆ f_randnat()

integer f_randnat (   minval in natural 0 ,
  maxval in natural integer'high  
) impure
Function

Return random integer (natural)

Parameters
minvalMinimum value
maxvalMaximum value
Returns
Random integer

Return a random integer >= 0.

Example use

val := f_randnat(0, 42);

◆ f_randslv()

std_logic_vector f_randslv (   data_width in positive  
) impure
Function

Return random std_logic_vector.

Parameters
data_widthVector width
Returns
Random std_logic_vector

Return a random std_logic_vector.

Example use

val_64bit := f_randslv(64);

◆ f_randsel()

std_logic_vector f_randsel (   data in t_slv_arr  
) impure
Function

Return random element.

Parameters
dataArray
Returns
Random element

Return a random element from std_logic_vector array.

Example use

constant C_SELECTION : t_slv_arr(0 to 4)(7 downto 0) := (x"12", x"15", x"20", x"33", x"42");
val_8bit := f_randsel(C_SELECTION);

The documentation for this design unit was generated from the following file: