Forum Discussion
Altera_Forum
Honored Contributor
18 years agocalculate pi in verilog
Im trying to develop a system which will calculate pi using verilog and using the Gregory Leibniz series. this is the equation pi = 4 x ( (-1)^n / 2n+1 ); where n = 0 to infinity ive tri...
Altera_Forum
Honored Contributor
18 years agoAs a general comment, it's much more easy to calcúlate it with a regular computer and some algebraic tool, that can handle large numbers.
In a Verilog (or another HDL), you have to select and implement a number scheme first. Verilog knows only signed and unsigned numbers, you have to introduce at least fractional signed numbers to achieve some accuracy. The advantage is, that Verilog numbers aren't a priori limited to a particular bit length, you can extend them to your needs (but within the resource restrictions of your hardware). The (-1)^n is a trivial problem, look sharp!