Altera_Forum
Honored Contributor
17 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 tried my best but cant seem to go anywhere. i couldnt find any verilog operator that calculates the power of a number, for example (-1)^3. another question is, can verilog execute any calculations except binary? for example fractional numbers. if no then how will i implement the above equation? im suposed to implement this into quartus and simulate it. in simulation i only saw an output if my calculation was in binary.i tried to multiply 2 decimal numbers (10 & 12) but i got 0 in output. for binary 10&10 i got 100. please help me. if any one can provide me with the coding, that will be great or at least the equation coding so that it execute in simulation. thanks