Forum Discussion

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

Instantiation Components Compile error

Hi,

I'm new to Quartus 6.1 Web Edition software. I bought the CYCLONE FPGA Starter Board and tries to learn how to use Quartus 6.1 that came with the board.

The problem I'm having is with my functions, parts and component libraries. For example, when I try to compile the following VHDL code which is a FULL_ADDER, I keep getting the following error message :

vhdl error at full_adder.vhd(18): object "xor_3" is used but not declared

Before compiling the code, I've included the necessary libraries during the project creation. Despite everything I've tried, I'm still getting the same error message. It does not matter whether I include or not the use clauses for the libraries needed in my root page, I get the same error message. It just does not see my instantiated components.

I've to stress that the same code compiles and runs on ORCAD FPGA Simulation, but not on QUARTUS. Why is it so difficult to get things run normally with Quartus while they run smootly on all other simulators I've been working on so many years? - Strange...

I've followed all Quartus recommandations on the subject and I'm still anable to solve this issue.

Thanks to show me what to do in order to use my libraries with QUARTUS. Below is the program without the parts and components libraries needed.

library ieee;

use ieee.std_logic_1164.all;

-- I do not have to use the parts and components libraries below with ORCAD.

--library parts_lib;

--use parts_lib.all;

--library comp_pkg;

--use comp_pkg.all;

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

entity full_adder is

port(

a, b, cin : in std_logic;

sum, co : out std_logic

);

end full_adder;

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

architecture full_adder_arch of full_adder is

signal sig1, sig2, sig3 : std_logic;

begin

U1 : component xor_3 port map(

x1 => a, x2 => b, x3 => cin,

y => sum

);

U2 : component and_2 port map(

x1 => a, x2 => b,

y => sig1

);

U3 : component or_2 port map(

x1 => a, x2 => b,

y => sig2

);

U4 : component and_2 port map(

x1 => sig2, x2 => cin,

y => sig3

);

U5 : component or_2 port map(

x1 => sig1, x2 => sig3,

y => co

);

end full_adder_arch;

26 Replies

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

    You are right, Quartus II Synthesis is not able to generate logic to implement a dual-edge register in a device. So you may need to use a double-frequency clock and work on its positive edges instead.

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

    Another way could be to use two separate process blocks as follows

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

    ARCHITECTURE arc OF test1 IS

    begin

    process (C)

    begin

    if (C'EVENT and C='1') then

    if V='0' then

    A <= '1';

    else

    A <= '0';

    end if;

    end if;

    end process;

    process (C)

    begin

    if (C'EVENT and C='0') then

    end if;

    end process;

    end arc;

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

    Of course you will have to fill in the suitable sequential statements in the last if block.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You must not necessarily use two process blocks, but it improves readability, I think.

    As you previously mentioned, you can't have dual-edge sensitive registers. So you need separate registers for both edges and asynchronous logic to combine both register outputs. There are classical examples as factor 2.5 clock dividers. Some precaution is necessary to avoid glitches in this kind of design.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    YES, it works with 2 process!!!:):p

    Actually, use dual-edge sensitive registers is allowed in VHDL without Quartus II? Can we use all VHDL'syntaxs possible with Quartus II?

    Really thank you FvM.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Every Integrated Synthesis tool has limitations compared to the official VHDL and Verilog implementations so typically not every construct is synthesizable by all the tools. This limitation is due to the Quartus II synthesizer, but as you have seen here, there are some workarounds which help you synthesizing the dual-edge logic as well.

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

    The restriction basically isn't by Quartus but by the FPGA hardware. It's similar with any other vendors FPGA or ASIC. The only unrestricted usage of HDL is in simulation. Here you can define delays without needing a clock or design dual-edge sensitive registers.

    To my opinion, it's important to understand how a HDL construct can be inferred in FPGA hardware, cause it helps you to avoid such constructs, that behave different in simulation and synthesis.