Search code examples
vhdlintel-fpgaquartus

VHDL - direct instantiation for PLL


I am trying to make a VGA controller on a DE0 board and have made the following code:

LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;

ENTITY VGA is 
PORT (clk                       :   IN   std_logic;
        vga_hs, vga_vs          :   OUT std_logic;
        vga_r, vga_g, vga_b :   OUT std_logic_vector(3 DOWNTO 0));
END ENTITY VGA;

ARCHITECTURE A1 OF VGA IS
SIGNAL rst, clk25   :   std_logic;
BEGIN
SYNC1   :   ENTITY work.sync(A1)
            PORT MAP (clk25, vga_hs, vga_vs, vga_r, vga_g, vga_b);
CLK_25  :   ENTITY work.pll(rtl)
            PORT MAP (clk, rst, clk25);

END ARCHITECTURE A1;

When I compile the model I get the following error message:

Error (12006): Node instance "altpll_0" instantiates undefined entity "PLL_altpll_0"

I'm instantiating two components the first SYNC1 is the synchronisation counts for a 640 x 480 display the second (CLK_25) is PLL clock generated by quartus II. With the following model:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity PLL is
port (
    clk_clk    : in  std_logic := '0'; --    clk.clk
    rst_reset  : in  std_logic := '0'; --    rst.reset
    clk_25_clk : out std_logic         -- clk_25.clk
);
end entity PLL;

architecture rtl of PLL is
component PLL_altpll_0 is
    port (
        clk       : in  std_logic                     := 'X';             --    clk
        reset     : in  std_logic                     := 'X';             -- reset
        read      : in  std_logic                     := 'X';             -- read
        write     : in  std_logic                     := 'X';             -- write
        address   : in  std_logic_vector(1 downto 0)  := (others => 'X'); -- address
        readdata  : out std_logic_vector(31 downto 0);                    -- readdata
        writedata : in  std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
        c0        : out std_logic;                                        -- clk
        areset    : in  std_logic                     := 'X';             -- export
        locked    : out std_logic;                                        -- export
        phasedone : out std_logic                                         -- export
    );
end component PLL_altpll_0;

begin

altpll_0 : component PLL_altpll_0
    port map (
        clk       => clk_clk,    --       inclk_interface.clk
        reset     => rst_reset,  -- inclk_interface_reset.reset
        read      => open,       --             pll_slave.read
        write     => open,       --                      .write
        address   => open,       --                      .address
        readdata  => open,       --                      .readdata
        writedata => open,       --                      .writedata
        c0        => clk_25_clk, --                    c0.clk
        areset    => open,       --        areset_conduit.export
        locked    => open,       --        locked_conduit.export
        phasedone => open        --     phasedone_conduit.export
    );

end architecture rtl; -- of PLL

How can i directly instantiate pll(rtl) from the working library ?


Solution

  • Generate the PLL with the MegaWizard in Quartus Prime, and then include the generated .qip file in the design. I assume that the MegaWizard is used to generate PLL_altpll_0 in your example.

    The generated PLL entity is then compiled into work (or another library which is then shown in the .qip file), and you can then instantiate the PLL with entity instantiation, and thus leave out the redundant component declaration in the architecture that uses the generated PLL. Code like, assuming workPLL_altpll_0 is compiled to work library:

    altpll_0 : entity work.PLL_altpll_0
      port map (