vipin
vipin

Reputation: 1660

Fixed and floating point in Verilog

I come from VHDL back ground. And in VHDL, there is IEEE packages for doing fixed and floating point operations. They are not synthesisable sometimes, but are pretty helpful when comes to testing.

My question is, whether Verilog has a library for doing fixed and floating point operations? It doesnt matter if its not synthesisable.

Upvotes: 0

Views: 1221

Answers (1)

dave_59
dave_59

Reputation: 42673

Real operations are built into Verilog. See section 20.8.2 Real math functions in the IEEE 1800-2012 LRM. You can also use the DPI to import many other math function from a standard C library. See https://www.doulos.com/knowhow/sysverilog/tutorial/dpi/

For fixed point, you will need to shift you values manually.

Upvotes: 1

Related Questions