604a06057e810c154d36f887fa81550219854bd4
[calu.git] / cpu / src / extension_uart_pkg.vhd
1 library IEEE;
2
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6 use work.common_pkg.all;
7 use work.extension_pkg.all;
8
9 package extension_uart_pkg is
10
11
12
13
14
15
16 --RS232
17 constant UART_WIDTH : integer := 8;
18 subtype uart_data is std_logic_vector(UART_WIDTH-1 downto 0);
19 constant BAUD_RATE_WITH : integer := 16;
20 subtype baud_rate_l is std_logic_vector(BAUD_RATE_WITH-1 downto 0);
21 --CLKs
22 constant CLK_FREQ_MHZ : real := 33.33;
23 constant BAUD_RATE : integer := 115200;
24 constant CLK_PER_BAUD : integer := integer((CLK_FREQ_MHZ * 1000000.0) / real(BAUD_RATE) - 0.5);
25
26  component extension_uart is
27         --some modules won't need all inputs/outputs
28         generic (
29                         -- active reset value
30                         RESET_VALUE : std_logic
31                         );
32         port(
33                 --System inputs
34                         clk :   in std_logic;
35                         reset : in std_logic;
36                 -- general extension interface                  
37                         ext_reg  : in extmod_rec;
38                         data_out : out gp_register_t;
39                 -- Input
40
41                 -- Ouput
42                         bus_tx : out std_logic
43                 );
44  end component extension_uart;
45
46 component rs232_tx is
47         generic (
48                 -- active reset value
49                 RESET_VALUE : std_logic
50                 );
51
52         port(
53                 --System inputs
54                 sys_clk : in std_logic;
55                 sys_res_n : in std_logic;
56
57                 --Bus
58                 bus_tx : out std_logic;
59
60                 --From/to sendlogic
61                 new_tx_data : in std_logic;
62                 tx_data : in uart_data;
63                 tx_rdy : out std_logic;
64                 bd_rate : in baud_rate_l;
65                 stop_bit : in std_logic 
66 );
67 end component rs232_tx;
68
69 end package extension_uart_pkg;