Search code examples
armfpgazynq

random number generator on Zedboard (Xilinx Zynq-7020)


I was wondering what would be the fastest way to generate a random number on the zedboard (Xilinx Zynq-7020) which has an ARM processor as well as an FPGA, that to my understanding both can do this.

Thanks,


Solution

  • If you are developing a FPGA only or a bare metal application + FPGA project, I would generate the (pseudo)random number in the FPGA. If you are using Linux and building an embedded application + FPGA, I would generate the number in software.

    If you generate the number in the FPGA, Then you can use a code template built into Xilinx ISE! Odds are you're using ISE because I doubt anything else supports Zynq yet.

    Generate a LFSR in ISE like this: From the menu at the top: Edit -> Language Templates. In the language templates tree-view: (VHDL or Verilog) -> Synthesis Constructs -> Coding Examples -> Counters -> LFSR. One of the 4 templates is 32 bits. You will need to provide a seed number and a clock line.

    If you generate the random number from a Linux app, there must be tons of different ways to do this. From a C application, there is a rand function in cstdlib.