- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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. thanksLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As 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!
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