Forum Discussion
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
Honored Contributor
what version of modelsim?
newer versions of modelsim have the fixed_pkg in the floatfixlib library, so I would delete all references to ieee_proposed and the fixed_pkg in the work library. - Altera_Forum
Honored Contributor
I use ModelSim Altera Starter Edition 6.6d..After I remove the ieee_proposed library, this error occur in ModelSim:
** Error: H:/altera/mul_try_tb/fix.vhd(3): Library floatfixlib not found. ** Error: H:/altera/mul_try_tb/fix.vhd(4): (vcom-1136) Unknown identifier "floatfixlib". Thanks for reply - Altera_Forum
Honored Contributor
you will need to create the floatfixlib, as I dont think the starter edition ships with it.
- Altera_Forum
Honored Contributor
How to create the floatfixlib? Do you have any other idea for avoid the error..
thanks for reply - Altera_Forum
Honored Contributor
on the modelsim command window (or in a tcl or do file):
vlib floatfixlib vcom fixed_float_types_c.vhdl -work floatfixlib vcom fixed_pkg_c.vhdl -work floatfixlib etc. - Altera_Forum
Honored Contributor
I write in the modelsim command window for create the ieee_proposed;
vlib ieee_propose vcom vcom fixed_float_types_c.vhdl vcom fixed_pkg_c.vhdl There are no error for line 1 and 2. But, in line 3 this error occur:# ** Error: (vcom-11) Could not find ieee_proposed.fixed_float_types.# ** Error: fixed_pkg_c.vhdl(23): (vcom-1195) Cannot find expanded name "ieee_proposed.fixed_float_types".# ** Error: fixed_pkg_c.vhdl(23): Unknown expanded name.# ** Error: fixed_pkg_c.vhdl(25): VHDL Compiler exiting# C:/altera/10.1/modelsim_ase/win32aloem/vcom failed. What my false?..thanks for reply - Altera_Forum
Honored Contributor
if you just run vcom it will add it to the work libarary. To add a file to the specific library, you need the -work option
vcom fixed_float_types_c.vhdl -work ieee_proposed vcom fixed_pkg_c.vhdl -work ieee_proposed - Altera_Forum
Honored Contributor
Okay, I understand now..Many thanks Tricky
- Altera_Forum
Honored Contributor
This thread is the closest I've found to addressing my issue, so I hope you don't mind me reviving it. I am using fixed_pkg in my VHDL design to do fixed point arithmetic. I compiled it into my Quartus work library so didn't create the ieee_proposed library:
library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use work.fixed_pkg.all; My design compiles and synthesizes successfully in Quartus 16.1.1 Standard, but not in ModelSim 10.5a: Error: (vcom-11) Could not find work.fixed_pkg. Now I've read that I can change the location of fixed_pkg from "work" to "ieee" since ModelSim supports it. However, the compilation of my project is heavily scripted, so I need to use the same source files for both the Quartus and ModelSim synthesis. How can I do this? - Altera_Forum
Honored Contributor
if you put it in work - then you will have to compile it into work youself and you wont get the nice accelerated version modelsim uses, and it wont be the 2008 version (which is where fixed_point was introduced). The version you have for quartus is a 1993 compatible version written by David Bishop (the author of the 2008 version) - but it is not an official VHDL standard.
Why not just do it properly and compile it into ieee in quartus (you can assign a library to it) and then in quartus you can just use the version that is already included in Modelsim, as it has supported the fixed_point package for a long time (from 6.6 onwards, and probably a bit before). And since about version 10.0 it has supported 2008.