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