Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- FPGAs and Programmable Solutions
- FPGA Intellectual Property
- Simple RNG for the DE2 board

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-11-2011
11:56 AM

862 Views

Simple RNG for the DE2 board

I need a process to produce a seemingly random integer, is it possible to use the rand function and if so, what library do i need to use?

Thanks for any helpLink Copied

2 Replies

Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-11-2011
08:20 PM

53 Views

What kind of statistics? Uniform distribution, or normal distribution? A uniform distribution is fairly easy to generate using a linear feedback shift register. A normal (Gaussian) distribution can be generated by summing multiple LFSRs, or LFSR samples, or by filtering an LFSR. It depends on the rate at which you want to generate the random data.

Alternatively, you can always write a block of data to RAM, and then process that data. This method is nice for testing identical data in MATLAB, Modelsim, and in hardware. Cheers, Dave
Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-11-2011
11:24 PM

53 Views

Fixed it by using a 8 bit counter at 50 MHz and taking out the bit code when my state machine resets

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.