Error (12007): Top-level design entity "components" is undefined

OP #3310692
1
LIBRARY ieee ;
2
USE ieee.std_logic_1164.all ;
3
PACKAGE components IS
4
  -- 2-to-1 multiplexer
5
  COMPONENT mux2to1 
6
    PORT (  w0, w1   : IN   STD_LOGIC ;
7
        s     : IN   STD_LOGIC ;
8
        f     : OUT   STD_LOGIC ) ;
9
  END COMPONENT ;
10
  -- D flip-flop with 2-to-1 multiplexer connected to D
11
  COMPONENT muxdff
12
    PORT (  D0, D1, Sel, Clock   : IN   STD_LOGIC ;
13
        Q       : OUT   STD_LOGIC ) ;
14
  END COMPONENT ;
15
  -- n-bit register with enable
16
  COMPONENT regne  
17
    GENERIC ( N : INTEGER := 4 ) ;
18
    PORT (  R     : IN   STD_LOGIC_VECTOR(N-1 DOWNTO 0) ;
19
        Resetn   : IN   STD_LOGIC ;
20
        E, Clock   : IN   STD_LOGIC ;
21
        Q     : OUT   STD_LOGIC_VECTOR(N-1 DOWNTO 0) ) ;
22
  END COMPONENT ;
23
-- n-bit right-to-left shift register with parallel load and enable
24
  COMPONENT shiftlne  
25
    GENERIC ( N : INTEGER := 4 ) ;
26
    PORT (  R     : IN     STD_LOGIC_VECTOR(N-1 DOWNTO 0) ;
27
        L, E, w  : IN     STD_LOGIC ;
28
        Clock  : IN     STD_LOGIC ;
29
        Q     : BUFFER   STD_LOGIC_VECTOR(N-1 DOWNTO 0) ) ;
30
  END COMPONENT ;
31

32
  -- n-bit left-to-right shift register with parallel load and enable
33
  COMPONENT shiftrne  
34
    GENERIC ( N : INTEGER := 4 ) ;
35
    PORT (  R     : IN     STD_LOGIC_VECTOR(N-1 DOWNTO 0) ;
36
        L, E, w  : IN     STD_LOGIC ;
37
        Clock  : IN     STD_LOGIC ;
38
        Q     : BUFFER   STD_LOGIC_VECTOR(N-1 DOWNTO 0) ) ;
39
  END COMPONENT ;
40
-- up-counter that counts from 0 to modulus-1
41
  COMPONENT upcount  
42
    GENERIC  ( modulus : INTEGER := 8 ) ;
43
    PORT  (   Resetn     : IN     STD_LOGIC ;
44
          Clock, E, L  : IN     STD_LOGIC ;
45
          R       : IN     INTEGER RANGE 0 TO modulus-1 ;
46
          Q       : BUFFER   INTEGER RANGE 0 TO modulus-1 ) ;
47
  END COMPONENT ;
48

49
  -- down-counter that counts from modulus-1 down to 0
50
  COMPONENT downcnt 
51
    GENERIC  ( modulus : INTEGER := 8 ) ;
52
    PORT (  Clock, E, L  : IN       STD_LOGIC ;
53
        Q       : BUFFER   INTEGER RANGE 0 TO modulus-1 ) ;
54
  END COMPONENT ;
55

56
END components ;

I just recently started to learn vhdl and I found this code online as I 
was  researching on how to use components. When I try to run it, I get 
that error.
Error (12007): Top-level design entity "components" is undefined
how do i fix it
I have attached the source file too its on page 8, thanks for your help 
in advance
Attached files:
#3312224
What he is basically telling you is to create package out of modules. To 
use a component you need not necessarily use a package. Just create a 
module, for example, and call that in your other modules where you want 
to use it (of course it should be added in your project).

See this for example: 
http://www.cs.fredonia.edu/zubairi/training/vhdlcompo.html

and this: 
http://www.doulos.com/knowhow/vhdl_designers_guide/components_and_port_maps/
OP #3312684
Thank you very much, I eventually figured out how to do it with the help 
of the second link. I came across it as I was trying to figure it out. 
This helps boost my confidence in my capabilities with VHDL, 1 step at a 
time, thanks again
Moderator (Company: Titel) #3313102
Murali BN wrote:
> Just create a module, for example, and call that in your other modules
> where you want to use it (of course it should be added in your project).
VHDL is no programming language where you "call" a component!!!
VHDL is a hardware description language. Here you must have a "picture" 
of a hardware inside your brain or on a sheet of paper (also called 
schematic), and this picture can afterwards be described with VHDL. If 
you cannot imagine what you are describing at the moment of typing, your 
VHDL code will result in problems...

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.