1 | -------------------------------------------------------------------------------
|
2 | --
|
3 | -- Copyright (C) 2009, 2010 Dr. Juergen Sauermann
|
4 | --
|
5 | -- This code is free software: you can redistribute it and/or modify
|
6 | -- it under the terms of the GNU General Public License as published by
|
7 | -- the Free Software Foundation, either version 3 of the License, or
|
8 | -- (at your option) any later version.
|
9 | --
|
10 | -- This code is distributed in the hope that it will be useful,
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 | -- GNU General Public License for more details.
|
14 | --
|
15 | -- You should have received a copy of the GNU General Public License
|
16 | -- along with this code (see the file named COPYING).
|
17 | -- If not, see http://www.gnu.org/licenses/.
|
18 | --
|
19 | -------------------------------------------------------------------------------
|
20 | -------------------------------------------------------------------------------
|
21 | --
|
22 | -- Module Name: io - Behavioral
|
23 | -- Create Date: 13:59:36 11/07/2009
|
24 | -- Description: the I/O of a CPU (uart and general purpose I/O lines).
|
25 | --
|
26 | -------------------------------------------------------------------------------
|
27 | --
|
28 | library IEEE; |
29 | use IEEE.STD_LOGIC_1164.ALL; |
30 | use IEEE.STD_LOGIC_ARITH.ALL; |
31 | use IEEE.STD_LOGIC_UNSIGNED.ALL; |
32 | |
33 | entity io is |
34 | port ( I_CLK : in std_logic ; |
35 | I_CLR : in std_logic; |
36 | I_ADR_IO : in std_logic_vector( 7 downto 0); |
37 | I_DIN : in std_logic_vector( 7 downto 0); |
38 | I_SWITCH : in std_logic_vector( 7 downto 0); |
39 | I_RD_IO : in std_logic; |
40 | I_RX : in std_logic; |
41 | I_WE_IO : in std_logic; |
42 | Q_7_SEGMENT : out std_logic_vector( 6 downto 0); |
43 | Q_DOUT : out std_logic_vector( 7 downto 0); |
44 | Q_INTVEC : out std_logic_vector( 5 downto 0); |
45 | Q_LEDS : out std_logic_vector( 1 downto 0); |
46 | Q_TX : out std_logic); |
47 | end io; |
48 | |
49 | architecture Behavioral of io is |
50 | |
51 | component uart |
52 | generic(CLOCK_FREQ : std_logic_vector(31 downto 0); |
53 | BAUD_RATE : std_logic_vector(27 downto 0)); |
54 | port( I_CLK : in std_logic; |
55 | I_CLR : in std_logic; |
56 | I_RD : in std_logic; |
57 | I_WE : in std_logic; |
58 | I_RX : in std_logic; |
59 | I_TX_DATA : in std_logic_vector(7 downto 0); |
60 | Q_RX_DATA : out std_logic_vector(7 downto 0); |
61 | Q_RX_READY : out std_logic; |
62 | Q_TX : out std_logic; |
63 | Q_TX_BUSY : out std_logic); |
64 | end component; |
65 | |
66 | signal U_RX_READY : std_logic; |
67 | signal U_TX_BUSY : std_logic; |
68 | signal U_RX_DATA : std_logic_vector( 7 downto 0); |
69 | |
70 | signal L_INTVEC : std_logic_vector( 5 downto 0); |
71 | signal L_LEDS : std_logic; |
72 | signal L_RD_UART : std_logic; |
73 | signal L_RX_INT_ENABLED : std_logic; |
74 | signal L_TX_INT_ENABLED : std_logic; |
75 | signal L_WE_UART : std_logic; |
76 | |
77 | begin
|
78 | urt: uart |
79 | generic map(CLOCK_FREQ => std_logic_vector(conv_unsigned(25000000, 32)), |
80 | BAUD_RATE => std_logic_vector(conv_unsigned( 38400, 28))) |
81 | port map( I_CLK => I_CLK, |
82 | I_CLR => I_CLR, |
83 | I_RD => L_RD_UART, |
84 | I_WE => L_WE_UART, |
85 | I_TX_DATA => I_DIN(7 downto 0), |
86 | I_RX => I_RX, |
87 | Q_TX => Q_TX, |
88 | Q_RX_DATA => U_RX_DATA, |
89 | Q_RX_READY => U_RX_READY, |
90 | Q_TX_BUSY => U_TX_BUSY); |
91 | |
92 | -- IO read process
|
93 | --
|
94 | iord: process(I_ADR_IO, I_SWITCH, |
95 | U_RX_DATA, U_RX_READY, L_RX_INT_ENABLED, |
96 | U_TX_BUSY, L_TX_INT_ENABLED) |
97 | begin
|
98 | -- addresses for mega8 device (use iom8.h or #define __AVR_ATmega8__).
|
99 | --
|
100 | case I_ADR_IO is |
101 | when X"2A" => Q_DOUT <= -- UCSRB: |
102 | L_RX_INT_ENABLED -- Rx complete int enabled. |
103 | & L_TX_INT_ENABLED -- Tx complete int enabled. |
104 | & L_TX_INT_ENABLED -- Tx empty int enabled. |
105 | & '1' -- Rx enabled |
106 | & '1' -- Tx enabled |
107 | & '0' -- 8 bits/char |
108 | & '0' -- Rx bit 8 |
109 | & '0'; -- Tx bit 8 |
110 | when X"2B" => Q_DOUT <= -- UCSRA: |
111 | U_RX_READY -- Rx complete |
112 | & not U_TX_BUSY -- Tx complete |
113 | & not U_TX_BUSY -- Tx ready |
114 | & '0' -- frame error |
115 | & '0' -- data overrun |
116 | & '0' -- parity error |
117 | & '0' -- double dpeed |
118 | & '0'; -- multiproc mode |
119 | when X"2C" => Q_DOUT <= U_RX_DATA; -- UDR |
120 | when X"40" => Q_DOUT <= -- UCSRC |
121 | '1' -- URSEL |
122 | & '0' -- asynchronous |
123 | & "00" -- no parity |
124 | & '1' -- two stop bits |
125 | & "11" -- 8 bits/char |
126 | & '0'; -- rising clock edge |
127 | |
128 | when X"36" => Q_DOUT <= I_SWITCH; -- PINB |
129 | when others => Q_DOUT <= X"AA"; |
130 | end case; |
131 | end process; |
132 | |
133 | -- IO write process
|
134 | --
|
135 | iowr: process(I_CLK) |
136 | begin
|
137 | if (rising_edge(I_CLK)) then |
138 | if (I_CLR = '1') then |
139 | L_RX_INT_ENABLED <= '0'; |
140 | L_TX_INT_ENABLED <= '0'; |
141 | elsif (I_WE_IO = '1') then |
142 | case I_ADR_IO is |
143 | when X"38" => Q_7_SEGMENT <= I_DIN(6 downto 0); -- PORTB |
144 | L_LEDS <= not L_LEDS; |
145 | when X"40" => -- handled by uart |
146 | when X"41" => -- handled by uart |
147 | when X"43" => L_RX_INT_ENABLED <= I_DIN(0); |
148 | L_TX_INT_ENABLED <= I_DIN(1); |
149 | when others => |
150 | end case; |
151 | end if; |
152 | end if; |
153 | end process; |
154 | |
155 | -- interrupt process
|
156 | --
|
157 | ioint: process(I_CLK) |
158 | begin
|
159 | if (rising_edge(I_CLK)) then |
160 | if (I_CLR = '1') then |
161 | L_INTVEC <= "000000"; |
162 | else
|
163 | if (L_RX_INT_ENABLED and U_RX_READY) = '1' then |
164 | if (L_INTVEC(5) = '0') then -- no interrupt pending |
165 | L_INTVEC <= "101011"; -- _VECTOR(11) |
166 | end if; |
167 | elsif (L_TX_INT_ENABLED and not U_TX_BUSY) = '1' then |
168 | if (L_INTVEC(5) = '0') then -- no interrupt pending |
169 | L_INTVEC <= "101100"; -- _VECTOR(12) |
170 | end if; |
171 | else -- no interrupt |
172 | L_INTVEC <= "000000"; |
173 | end if; |
174 | end if; |
175 | end if; |
176 | end process; |
177 | |
178 | L_WE_UART <= I_WE_IO when (I_ADR_IO = X"2C") else '0'; -- write UART UDR |
179 | L_RD_UART <= I_RD_IO when (I_ADR_IO = X"2C") else '0'; -- read UART UDR |
180 | |
181 | Q_LEDS(1) <= L_LEDS; |
182 | Q_LEDS(0) <= not L_LEDS; |
183 | Q_INTVEC <= L_INTVEC; |
184 | |
185 | end Behavioral; |
the error which I am getting is
1 | Started : "Synthesize - XST". |
2 | Running xst... |
3 | Command Line: xst -intstyle ise -ifn "C:/Users/Lovish/Desktop/MyProject/src/avr_fpga.xst" -ofn "C:/Users/Lovish/Desktop/MyProject/src/avr_fpga.syr" |
4 | Reading design: avr_fpga.prj |
5 | |
6 | ========================================================================= |
7 | * HDL Compilation * |
8 | ========================================================================= |
9 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/common.vhd" in Library work. |
10 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/reg_16.vhd" in Library work. |
11 | Architecture behavioral of Entity reg_16 is up to date. |
12 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/status_reg.vhd" in Library work. |
13 | Architecture behavioral of Entity status_reg is up to date. |
14 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/prog_mem_content.vhd" in Library work. |
15 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/alu.vhd" in Library work. |
16 | Architecture behavioral of Entity alu is up to date. |
17 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/register_file.vhd" in Library work. |
18 | Architecture behavioral of Entity register_file is up to date. |
19 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/data_mem.vhd" in Library work. |
20 | Architecture behavioral of Entity data_mem is up to date. |
21 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/prog_mem.vhd" in Library work. |
22 | Architecture behavioral of Entity prog_mem is up to date. |
23 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/uart.vhd" in Library work. |
24 | Architecture behavioral of Entity uart is up to date. |
25 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/opc_fetch.vhd" in Library work. |
26 | Architecture behavioral of Entity opc_fetch is up to date. |
27 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/opc_deco.vhd" in Library work. |
28 | Architecture behavioral of Entity opc_deco is up to date. |
29 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/data_path.vhd" in Library work. |
30 | Architecture behavioral of Entity data_path is up to date. |
31 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/cpu_core.vhd" in Library work. |
32 | Architecture behavioral of Entity cpu_core is up to date. |
33 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/io.vhd" in Library work. |
34 | Entity <io> compiled. |
35 | Entity <io> (Architecture <behavioral>) compiled. |
36 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/segment7.vhd" in Library work. |
37 | Architecture behavioral of Entity segment7 is up to date. |
38 | Compiling vhdl file "C:/Users/Lovish/Desktop/MyProject/src/avr_fpga.vhd" in Library work. |
39 | Architecture behavioral of Entity avr_fpga is up to date. |
40 | |
41 | ========================================================================= |
42 | * Design Hierarchy Analysis * |
43 | ========================================================================= |
44 | Analyzing hierarchy for entity <avr_fpga> in library <work> (architecture <behavioral>). |
45 | |
46 | Analyzing hierarchy for entity <cpu_core> in library <work> (architecture <behavioral>). |
47 | |
48 | Analyzing hierarchy for entity <io> in library <work> (architecture <behavioral>). |
49 | "C:/Users/Lovish/Desktop/MyProject/src/io.vhd" line 78: In entity <io> |
50 | ERROR:Xst:2585 - Port <I_CLK> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
51 | ERROR:Xst:2585 - Port <I_CLR> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
52 | ERROR:Xst:2585 - Port <I_RD> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
53 | ERROR:Xst:2585 - Port <I_RX> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
54 | ERROR:Xst:2585 - Port <I_TX_DATA> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
55 | ERROR:Xst:2585 - Port <I_WE> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
56 | ERROR:Xst:2585 - Port <Q_RX_DATA> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
57 | ERROR:Xst:2585 - Port <Q_RX_READY> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
58 | ERROR:Xst:2585 - Port <Q_TX> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
59 | ERROR:Xst:2585 - Port <Q_TX_BUSY> of instance <urt> does not exist in definition <uart>. Please compare the definition of block <uart> to its component declaration to detect the mismatch. |
60 | entity <uart> with generics: |
61 | BAUD_RATE: from generic/parameter on instance : array unsigned [27 downto 0] of bit := "0000000000001001011000000000" |
62 | CLOCK_FREQ: from generic/parameter on instance : array unsigned [31 downto 0] of bit := "00000001011111010111100001000000" |
63 | --> |
64 | |
65 | Total memory usage is 257036 kilobytes |
66 | |
67 | Number of errors : 10 ( 0 filtered) |
68 | Number of warnings : 0 ( 0 filtered) |
69 | Number of infos : 0 ( 0 filtered) |
70 | |
71 | |
72 | Process "Synthesize - XST" failed |
please help me out