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

Subversion Repositories uart_plb

[/] [uart_plb/] [trunk/] [pcores/] [uart_plb_v1_00_a/] [hdl/] [vhdl/] [baud.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 gavinux
-- $Id$
2
--
3
-- generates baud-rate * 16 tick
4
--
5
-- DLW = round(clk_Hz / (Desired_BaudRate x 16)) - 2
6
-- For baudrate 115200Hz :
7
-- 62.5MHz  :  DLW = 0x001F
8
-- 50.0MHz  :  DLW = 0x0019
9
--
10
-- =============================================================
11
library IEEE;
12
use IEEE.STD_LOGIC_1164.ALL;
13
use IEEE.STD_LOGIC_ARITH.ALL;
14
use IEEE.STD_LOGIC_UNSIGNED.ALL;
15
 
16
entity baudrate is
17
    port(
18
        clk   : in  std_logic;
19
        rst   : in  std_logic;
20
        dlw   : in  std_logic_vector(15 downto 0);
21
        tick  : out std_logic
22
    );
23
end entity;
24
 
25
architecture rtl of baudrate is
26
 
27
signal tick_s  : std_logic := '0';
28
signal cnt     : std_logic_vector(dlw'range) := (others => '0'); --X"0020";
29
 
30
begin
31
 
32
    tick <= tick_s;
33
 
34
    process(clk)
35
    begin
36
       if rising_edge(clk) then
37
           if (tick_s = '1') or (rst = '1') then
38
                cnt <= (others => '0');
39
            else
40
                cnt <= cnt + '1';
41
            end if;
42
        end if;
43
    end process;
44
 
45
    process(clk)
46
    begin
47
        if rising_edge(clk) then
48
            if cnt = dlw then
49
                tick_s <= '1';
50
            else
51
                tick_s <= '0';
52
            end if;
53
        end if;
54
    end process;
55
 
56
end rtl;

powered by: WebSVN 2.1.0

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