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,
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.