OpenCores
URL https://opencores.org/ocsvn/uart16750/uart16750/trunk

Subversion Repositories uart16750

[/] [uart16750/] [trunk/] [rtl/] [vhdl/] [uart_baudgen.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 hasw
--
2
-- UART Baudrate generator
3
--
4
-- Author:   Sebastian Witt
5
-- Date:     27.01.2008
6
-- Version:  1.0
7
--
8
-- This code is free software; you can redistribute it and/or
9
-- modify it under the terms of the GNU Lesser General Public
10
-- License as published by the Free Software Foundation; either
11
-- version 2.1 of the License, or (at your option) any later version.
12
--
13
-- This code is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
-- Lesser General Public License for more details.
17
--
18
-- You should have received a copy of the GNU Lesser General Public
19
-- License along with this library; if not, write to the
20
-- Free Software  Foundation, Inc., 59 Temple Place, Suite 330,
21
-- Boston, MA  02111-1307  USA
22
--
23
 
24
LIBRARY IEEE;
25
USE IEEE.std_logic_1164.all;
26
USE IEEE.std_logic_unsigned.all;
27
USE IEEE.numeric_std.all;
28
 
29
-- Serial UART baudrate generator
30
entity uart_baudgen is
31
    port (
32
        CLK         : in std_logic;                                 -- Clock
33
        RST         : in std_logic;                                 -- Reset
34
        CE          : in std_logic;                                 -- Clock enable
35
        CLEAR       : in std_logic;                                 -- Reset generator (synchronization)
36
        DIVIDER     : in std_logic_vector(15 downto 0);             -- Clock divider
37
        BAUDTICK    : out std_logic                                 -- 16xBaudrate tick
38
    );
39
end uart_baudgen;
40
 
41
architecture rtl of uart_baudgen is
42
    -- Signals
43
    signal iCounter : std_logic_vector(15 downto 0);
44
begin
45
    -- Baudrate counter
46
    BG_COUNT: process (CLK, RST)
47
    begin
48
        if (RST = '1') then
49
            iCounter <= (others => '0');
50
            BAUDTICK <= '0';
51
        elsif (CLK'event and CLK = '1') then
52
            if (CLEAR = '1') then
53
                iCounter <= (others => '0');
54
            elsif (CE = '1') then
55
                iCounter <= iCounter + '1';
56
            end if;
57
 
58
            BAUDTICK <= '0';
59
            if (iCounter = DIVIDER) then
60
                iCounter <= (others => '0');
61
                BAUDTICK <= '1';
62
            end if;
63
        end if;
64
    end process;
65
 
66
end rtl;
67
 
68
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.