Search code examples
randomvhdlintel-fpga

how to randomize the elements of a array in vhdl code?


I have a table with a known number of elements. I would like to randomize its elements so that each time I display it, its elements are displayed in random order. in vhdl using Fpga stratix3


Solution

  • There is no easy VHDL langage solution to generate random numbers on hardware. To generate a pseudo random number, you can use a LFSR. See for example: Pseudo Random Number Generator using LFSR in VHDL

    To generate a true random number, you must create a ring oscillator random number generator. See for example: https://security.stackexchange.com/questions/81843/ring-oscillator-true-random-number-generator-trng-vs-physically-unclonable-fu

    For simulation there is built-in support for random numbers in VHDL. See for example: Generating random integer in vhdl

    You can then use the generated random numbers to randomize your array.