Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

floating point operating in vhdl (fixed_pkg)

Hi all;

I have write a code using fixed_pkg. It compile successfully in quartus, but when I try to simulate in ModelSim an error occur.

---------------------------------------------------------------------------------------------------------------

library ieee;

library ieee_proposed;

use work.fixed_pkg.all;

use ieee.numeric_std.all;

entity fix is

port (clk: in bit;

nprev: in integer range -127 to 127;

ip1: out ufixed (8 downto -9));

end fix;

architecture fix of fix is

signal n1: ufixed (4 downto -4);

begin

process(clk)

begin

if (clk'event and clk='1') then

ip1 <= (to_ufixed(0.483,n1)) * (to_ufixed(11,n1));

end if;

end process;

end fix;

----------------------------------------------------------------------------------------------

This is the error in ModelSim:# Compile of fix.vhd failed with 2 errors.# Compile of fix_tb.vhd failed with 2 errors.# Compile of fixed_float_types_c.vhdl was successful.# Compile of fixed_pkg_c.vhdl failed with 1 errors.# Compile of fixed_synth.vhdl failed with 2 errors.

This the error when I expand it:

** Error: H:/altera/mul_try_tb/fix_tb.vhd(2): Library ieee_proposed not found.

I have add all the fixed_pkg in the project (in quartus). Need your helps..

17 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Tricky, thank you for your reply. I've appreciated your answers over the years, but rarely post myself.

    The reason I'm using David Bishop's 1993 version of fixed_pkg is because Quartus 16.1 Standard doesn't support the 2008 version. Altera Support told me that Quartus 16.1 Prime doesn't either.

    Are you suggesting that I copy the library files from my ModelSim installation (ie. the 2008 version) into my Quartus project and compile it into the IEEE library in Quartus? So I would have these lines?

    library ieee;

    use ieee.fixed_float_types.all;

    use ieee.fixed_pkg.all;

    Does Quartus Synthesis support the 2008 version? Was/is it just missing the 2008 library files? I tried compiling the 1993 version into the ieee_proposed library in my Quartus project, and it works, but my ModelSim project reports errors with fixed_pkg_c.vhdl.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can:

    A) Try to rename ieee_proposed to ieee in files like fixed_pkg_c.vhd

    OR

    B) Custom script to compile testbench that exclude fixed_pkg_c, fixed_float_types_c, etc.. files.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Tricky, thank you for your reply. I've appreciated your answers over the years, but rarely post myself.

    The reason I'm using David Bishop's 1993 version of fixed_pkg is because Quartus 16.1 Standard doesn't support the 2008 version. Altera Support told me that Quartus 16.1 Prime doesn't either.

    Are you suggesting that I copy the library files from my ModelSim installation (ie. the 2008 version) into my Quartus project and compile it into the IEEE library in Quartus? So I would have these lines?

    library ieee;

    use ieee.fixed_float_types.all;

    use ieee.fixed_pkg.all;

    Does Quartus Synthesis support the 2008 version? Was/is it just missing the 2008 library files? I tried compiling the 1993 version into the ieee_proposed library in my Quartus project, and it works, but my ModelSim project reports errors with fixed_pkg_c.vhdl.

    --- Quote End ---

    In quartus, just compile the fixed_package version you have into the ieee library, in the source tab you can select what library to compile any source into.

    You cannot use the version from modelsim, as it will not compile in quartus.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I did as Tricky suggested and both my Quartus and ModelSim projects compile! I had to rename "ieee_proposed" to "ieee" as suggested by flz47655.

    Just so I understand why this works, correct me if I'm wrong:

    - Quartus compiles the 1993 (compatible) fixed_pkg into its ieee library

    - ModelSim also compiles the 1993 (compatible) fixed_pkg into its ieee library, ignoring its 2008 version since I used the _c.vhdl files for the fixed_pkg

    - this would not have worked if the source files "fixed_float_types" and "fixed_pkg" were named the same in both projects since ModelSim has its own version of the files
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There is no reason you cannot use the 2008 version in modelsim, and 2008 version in Quartus. It doesnt matter that the file names are different, the package names are the same.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I thought Quartus doesn't support the 2008 version. Here's what Altera Support said:

    ---

    i checked in the database, the fixed_pkg is yet to be supported in qpro version or in qstandard version. and i had try one of the design using

    use ieee.fixed_pkg.all;

    but it does not work in qpro or qstandard. i do not have the detail when it will get support. however, i will go ahead and request the enhancement for this support.

    ---

    I had to use the 1993-compatible version in my Quartus project by compiling it into the ieee library. But I'm not sure what version of fixed_pkg my ModelSim project is using.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, use the 1993 version in Quartus, and the one that comes with modelsim by default (the 2008 version)

    They should both work fine,.