EmbDev.net

Forum: FPGA, VHDL & Verilog Error (12007): Top-level design entity "components" is undefined


von SV V. (gaij1n)


Attached files:

Rate this post
useful
not useful
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

von Murali B. (nmb)


Rate this post
useful
not useful
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/

von SV V. (gaij1n)


Rate this post
useful
not useful
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

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
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...

von Murali B. (nmb)


Rate this post
useful
not useful
I am very sorry that I have used the word "call". The right word should 
have been Instantiation. Thank you for noting it to me.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.