Previous: IEEE library pitfalls, Up: Invoking GHDL


3.12 IEEE math packages

The ‘ieee’ math packages (‘math_real’ and ‘math_complex’) provided with GHDL are not fully compliant with the IEEE standard. They are based on an early draft which can be redistributed contrary to the final version of the package.

This is unfortunate and may generate errors as some declarations are missing or have slightly changed.

If you have bought the standard from ‘ieee’ then you can download the sources of the packages from http://standards.ieee.org/downloads/1076/1076.2-1996 (unrestricted access). You'd better to just download math_real.vhdl, math_real-body.vhdl, math_complex.vhdl and math_complex-body.vhdl. The other files are not necessary: the ‘std_logic_1164’ package has to be updated for VHDL 1993 (the xnor functions are commented out).

If you want to replace math packages for the standard version of the ieee library, do:

     $ cp math_real.vhdl math_real-body.vhdl ieee_install_dir
     $ cp math_complex.vhdl math_complex-body.vhdl ieee_install_dir
     $ cd ieee_install_dir
     $ ghdl -a --work=ieee math_real.vhdl math_real-body.vhdl
     $ ghdl -a --work=ieee math_complex.vhdl math_complex-body.vhdl

(Replace ieee_install_dir by the location of the ieee library as displayed by ‘ghdl -dispconfig’).

You can repeat this for the ‘synopsys’ version of the ieee library.

Don't forget that the math packages are only defined for the 1993 standard.