Forum Discussion

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

Bug report: Quartus will not load correct library in VHDL

Hello, I am a software-engineer and try to design circuits as a hobby.

I had wanted to hide some modules/entities, such as C++'s namespace, or C's file-scope,

so I have written designs in Altera-extended-VHDL, and got a bug.

I have written the codes as below;

lib.vhd:


-- synthesis library my_lib
library ieee, arithmetic;
use ieee.std_logic_1164.all;
use arithmetic.std_logic_arith.all;
entity calc is
    port (
        x: in std_logic_vector(63 downto 0);
        y: in std_logic_vector(63 downto 0);
        z: out std_logic_vector(63 downto 0)
    );
end;
architecture calc of calc is
begin
    z <= x + y;
end;
-- synthesis library my_lib2
library ieee, arithmetic;
use ieee.std_logic_1164.all;
use arithmetic.std_logic_arith.all;
entity calc is
    port (
        x: in std_logic_vector(63 downto 0);
        y: in std_logic_vector(63 downto 0);
        z: out std_logic_vector(63 downto 0)
    );
end;
architecture calc of calc is
    signal b: std_logic_vector(127 downto 0);
begin
    b <= x * y;
    z <= b(63 downto 0);
end;

main.vhd:


library ieee, arithmetic;
use ieee.std_logic_1164.all;
use arithmetic.std_logic_arith.all;
entity delay is
    generic (
        L : integer
    );
    port (
        clock : in std_logic;
        x : in std_logic_vector(L - 1 downto 0);
        y : out std_logic_vector(L - 1 downto 0)
    );
end;
architecture delay of delay is
    signal d : std_logic_vector(L - 1 downto 0);
begin
    process (clock)
    begin
        if clock 'event and clock = '1' then
            d <= x;
        end if;
    end process;
    y <= d;
end;
library ieee, arithmetic;
use ieee.std_logic_1164.all;
use arithmetic.std_logic_arith.all;
library my_lib;
use my_lib.all;
use work.all;
entity main is
    port (
        CLOCK_125_p : in std_logic;
        LEDG : out std_logic_vector(7 downto 0)
    );
end;
architecture main of main is
    constant L: integer := 64;
    signal c: std_logic_vector(L - 1 downto 0)
        := (
            0 => '1',
            1 => '1',
            others => '0'
        );
    signal d: std_logic_vector(L - 1 downto 0);
begin
    i0: calc
        port map(c, c, d);
    
    i1: delay
        generic map(L => L)
        port map(CLOCK_125_p, d, c);
    
    process (CLOCK_125_p) is
    begin
        if CLOCK_125_p 'event and CLOCK_125_p = '1' then
            LEDG(7 downto 0) <= d(L - 1 downto L - 8);
        end if;
    end process;
end;

And compile... Ok, it looks additive module is loaded.

Then, edit only the main.vhd s/my_lib/my_lib2/, and re-compile...

Ok? Let us see.

Expected: my_lib2's "calc" instantiated, RTL Viewer says calc:i0 contains multiplicative module, and some DSP-blocks are used for the multiplication, and so on.

Occurred: it looks my_lib's "calc" instantiated, RTL Viewer says calc:i0 still contains additive module, and no DSP-blocks are used, and so on.

How to fix: Clean-up the project to Menu -> Project -> Clean Project..., then re-compile.

Could you please re-produce this problem?

Thank you for reading.

Environments Info:

Windows 7 Ultimate Service Pack 1

Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz

Memory: 64GiB, using about 32GiB

Quartus Prime Version 16.0.2 Build 222 07/20/2016 SJ Lite Edition

Cyclone V GX Starter Kit (5CGXFC5C6F27C7)

11 Replies

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

    > VHDL does not support polymorphism (in a programming sense).

    Sorry, word is bad.

    Select the body of the modules before the compile, not at the run-time, that I just want to say.

    > For now,...

    Hmm, I think numbering-solution still has a conflict-problem.

    Why do not you share the library? Or why do not you use many libraries that you had written?

    For example, if have sufficiently long bit vectors, the my module for simple addition is larger but faster than build-in one,

    but it defines many sub-modules and I afraid the naming conflicts.

    When the conflicts occurred, how to fix it?

    Project-level-switching-solution seems a good idea. I will consider the way.

    > And then...

    I do not like to use compile options instead of pragmas, but there are no way to recognize it. hmm...

    I am going to write a script for the libraries and the ModelSim, and reform libraries are mixed into a file.

    post script:

    I have sent the problem# 11262015 to the mySupport, but I do not have e-mail that is associated to the university/company,

    in she said "the security reason" (nevertheless I do not want to contact by e-mail), it seems rejected.

    Could you please raise if the bug is a problem, Mr. Tricky?