- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hii..
i would like to ask if there is any library that have a function to generate numbers randomly within certain range..??? i wanna make a component that takes an input once add to its value 15 and subtract from it 15 and gives output within this range randomly i.e --> output= rand[input+15, input-15] i've no problem with the design except of the part of random value generation i did some work arround to do so that i'm not satisfied with.. here is what i did --> xoring 2 bits putting the result in another place.. any idea how can i do this.. all your helps highly appreciated.. thanks, Niveen..Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Questions:
1. Should this block be synthesisable? 2. How "random" does it need to be? I ask these questions because: 1. VHDL has a random number generator, but it is not synthesisable and only meant for testbenches 2. Have you looked into a LFSR? http://en.wikipedia.org/wiki/lfs with this you can create a pseudo random sequence. This would be the easiest logic solution. I have heard of others before but they often involve rlocs and require good knowledge on oscilators. One solution (i havent done it, but had it described) is to route a clock though some logic as far apart as possible. Then sample the clock at a given rate, to try and give a random bit (it was described to me a long time ago, so I may have some details wrong).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Questions: 1. Should this block be synthesisable? --- Quote End --- no just testing --- Quote Start --- Questions: 2. How "random" does it need to be? --- Quote End --- i want to generate 36 output values with only 1 input --- Quote Start --- Questions: I ask these questions because: 1. VHDL has a random number generator, but it is not synthesisable and only meant for testbenches --- Quote End --- would plz tell me about it, and if it take range or not?? --- Quote Start --- Questions: 2. Have you looked into a LFSR? http://en.wikipedia.org/wiki/lfs with this you can create a pseudo random sequence. This would be the easiest logic solution. I have heard of others before but they often involve rlocs and require good knowledge on oscilators. One solution (i havent done it, but had it described) is to route a clock though some logic as far apart as possible. Then sample the clock at a given rate, to try and give a random bit (it was described to me a long time ago, so I may have some details wrong). --- Quote End --- the work arround i did was similar to LFSR.. execuse me, i couldn't get the rest of this.. thanks, Niveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Per Tricky's comments, if an LFSR is sufficient, there is a tutorial and code here:
http://www.ovro.caltech.edu/~dwh/correlator/pdf/lfsr_tutorial.pdf http://www.ovro.caltech.edu/~dwh/correlator/pdf/lfsr_tutorial_src.zip You would need to decide whether you want uniform or Gaussian(-like) noise, and then just scale it to the numeric range you describe above. Cheers, Dave- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's a synthesizable random number generator using an inverter chain in the Altera cookbook: http://www.altera.com/literature/manual/stx_cookbook.pdf
See chapter 14- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks alot Dave for the tutorial.. :)
whenever i try to post any "reply with quote" it dissapear once i click "post".. any idea why does this happen thanks, Niveen..- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks alot jederrick for the cookbook link.. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- whenever i try to post any "reply with quote" it dissapear once i click "post".. any idea why does this happen --- Quote End --- Works fine for me - WinXP + Firefox. Cheers, Dave

Reply
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