Guest
Please any one give me the idea how i can generate prime number in verilog without the use of for loop. i computed in this way that a prime number is not divisible by its previous prime number.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Please any one give me the idea how i can generate prime number in
verilog without the use of for loop. i computed in this way that a prime
number is not divisible by its previous prime number.
Please any one give me the idea how i can generate prime number in
verilog without the use of for loop. i computed in this way that a prime
number is not divisible by its previous prime number.
On Fri, 26 Dec 2014 08:35:25 -0800, mawais2011 wrote:
Please any one give me the idea how i can generate prime number in
verilog without the use of for loop. i computed in this way that a
prime number is not divisible by its previous prime number.
Assuming you want this to be synthesisable, may I suggest the Sieve of
Eratosthenes <http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
In common with other sieve algorithms, it requires that you know the
upper limit in advance and have enough memory to hold a flag for each
number up to that upper limit. As such, it is not suited to a design
that has to produce a continuous stream of prime numbers without bound.
Allan
On Sat, 27 Dec 2014 04:59:51 +0000, Allan Herriman wrote:
On Fri, 26 Dec 2014 08:35:25 -0800, mawais2011 wrote:
Please any one give me the idea how i can generate prime number in
verilog without the use of for loop. i computed in this way that a
prime number is not divisible by its previous prime number.
Assuming you want this to be synthesisable, may I suggest the Sieve of
Eratosthenes <http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
Well, a flag for each number up to the square root of the upper limit, if
you really want to be stingy.
Is there _any_ prime-finding algorithm that doesn't require you to store
more and more history as you go, or to repeat calculations that you
wouldn't otherwise have to repeat?
On Sat, 27 Dec 2014 04:59:51 +0000, Allan Herriman wrote:
On Fri, 26 Dec 2014 08:35:25 -0800, mawais2011 wrote:
Please any one give me the idea how i can generate prime number in
verilog without the use of for loop. i computed in this way that a
prime number is not divisible by its previous prime number.
Assuming you want this to be synthesisable, may I suggest the Sieve of
Eratosthenes <http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
In common with other sieve algorithms, it requires that you know the
upper limit in advance and have enough memory to hold a flag for each
number up to that upper limit. As such, it is not suited to a design
that has to produce a continuous stream of prime numbers without bound.
Allan
Well, a flag for each number up to the square root of the upper limit,
if you really want to be stingy.
Is there _any_ prime-finding algorithm that doesn't require you to store
more and more history as you go, or to repeat calculations that you
wouldn't otherwise have to repeat?
The crypto folk (well, those still using RSA) generate their big primes
by generating random numbers then testing them.
Generating big random numbers is quick, and the primality test is pretty
quick too (particularly if one can trade off accuracy and let a
pseudoprime through occasionally).