1 -- `Deep Thought', a softcore CPU implemented on a FPGA
3 -- Copyright (C) 2010 Markus Hofstaetter <markus.manrow@gmx.at>
4 -- Copyright (C) 2010 Martin Perner <e0725782@student.tuwien.ac.at>
5 -- Copyright (C) 2010 Stefan Rebernig <stefan.rebernig@gmail.com>
6 -- Copyright (C) 2010 Manfred Schwarz <e0725898@student.tuwien.ac.at>
7 -- Copyright (C) 2010 Bernhard Urban <lewurm@gmail.com>
9 -- This program is free software: you can redistribute it and/or modify
10 -- it under the terms of the GNU General Public License as published by
11 -- the Free Software Foundation, either version 3 of the License, or
12 -- (at your option) any later version.
14 -- This program is distributed in the hope that it will be useful,
15 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
16 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 -- GNU General Public License for more details.
19 -- You should have received a copy of the GNU General Public License
20 -- along with this program. If not, see <http://www.gnu.org/licenses/>.
24 use IEEE.std_logic_1164.all;
25 use IEEE.numeric_std.all;
27 use work.common_pkg.all;
28 use work.extension_pkg.all;
30 package extension_uart_pkg is
38 constant UART_WIDTH : integer := 8;
39 subtype uart_data is std_logic_vector(UART_WIDTH-1 downto 0);
40 constant BAUD_RATE_WIDTH : integer := 16;
41 subtype baud_rate_l is std_logic_vector(BAUD_RATE_WIDTH-1 downto 0);
43 --constant CLK_FREQ_MHZ : real := 33.33;
44 --constant BAUD_RATE : integer := 115200;
45 --constant CLK_PER_BAUD : integer := integer((CLK_FREQ_MHZ * 1000000.0) / real(BAUD_RATE) - 0.5);
46 -- constant CLK_PER_BAUD : integer := 434;
47 -- constant CLK_PER_BAUD : integer := 2083; -- @uni, bei 20MHz und 9600 Baud
48 -- constant CLK_PER_BAUD : integer := 50; -- @modelsim
50 component extension_uart is
51 --some modules won't need all inputs/outputs
54 RESET_VALUE : std_logic;
55 CLK_PER_BAUD : integer
61 -- general extension interface
62 ext_reg : in extmod_rec;
63 data_out : out gp_register_t;
65 uart_int : out std_logic;
67 bus_rx : in std_logic;
69 bus_tx : out std_logic
71 end component extension_uart;
76 RESET_VALUE : std_logic
81 sys_clk : in std_logic;
82 sys_res_n : in std_logic;
85 bus_tx : out std_logic;
88 new_tx_data : in std_logic;
89 tx_data : in uart_data;
90 tx_rdy : out std_logic;
91 bd_rate : in baud_rate_l;
92 stop_bit : in std_logic
94 end component rs232_tx;
99 RESET_VALUE : std_logic;
100 SYNC_STAGES : integer range 2 to integer'high
105 sys_clk : in std_logic;
106 sys_res_n : in std_logic;
109 bus_rx_unsync : in std_logic;
112 new_rx_data : out std_logic;
113 rx_data : out uart_data;
114 bd_rate : in baud_rate_l
116 end component rs232_rx;
120 end package extension_uart_pkg;