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