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

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [VHDL/] [BaudClock.vhd] - Blame information for rev 152

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

Line No. Rev Author Line
1 99 davidgb
--===========================================================================--
2
--                                                                           --
3
--  BaudClock.vhd - Synthesizable Baud Rate Clock Divider                    --
4
--                                                                           --
5
--===========================================================================--
6 19 dilbert57
--
7 99 davidgb
--  File name      : BaudClock.vhd
8 19 dilbert57
--
9 99 davidgb
--  Purpose        : Implements a baud rate clock divider for a 6850 compatible
10
--                   Asynchronous Communications Interface Adapter 
11
--                  
12
--  Dependencies   : ieee.std_logic_1164
13
--                   ieee.std_logic_arith
14
--                   ieee.std_logic_unsigned
15
--                   ieee.numeric_std
16
--                   unisim.vcomponents
17
--
18
--  Author         : John E. Kent
19
--
20
--  Email          : dilbert57@opencores.org      
21
--
22
--  Web            : http://opencores.org/project,system09
23
--
24
--  BaudClock.vhd is baud rate clock divider for a 6850 compatible ACIA core.
25
-- 
26
--  Copyright (C) 2003 - 2010 John Kent
27
--
28
--  This program is free software: you can redistribute it and/or modify
29
--  it under the terms of the GNU General Public License as published by
30
--  the Free Software Foundation, either version 3 of the License, or
31
--  (at your option) any later version.
32
--
33
--  This program is distributed in the hope that it will be useful,
34
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
35
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36
--  GNU General Public License for more details.
37
--
38
--  You should have received a copy of the GNU General Public License
39
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
40
--
41
--===========================================================================--
42
--                                                                           --
43
--                              Revision  History                            --
44
--                                                                           --
45
--===========================================================================--
46
--
47
-- Revision Name          Date             Description
48
-- 0.1      John E. Kent  unknown          Initial version
49
-- 1.0      John E. Kent  30th May 2010    Added GPL Header
50
--
51 19 dilbert57
library ieee;
52
   use ieee.std_logic_1164.all;
53 99 davidgb
   use ieee.std_logic_arith.all;
54
   use ieee.std_logic_unsigned.all;
55 19 dilbert57
   use ieee.numeric_std.all;
56
library unisim;
57
        use unisim.vcomponents.all;
58
 
59
entity ACIA_Clock is
60
  generic (
61
     SYS_Clock_Frequency  : integer;
62
          BAUD_Clock_Frequency : integer
63
  );
64
  port(
65
    clk      : in  Std_Logic;  -- System Clock input
66
         ACIA_Clk : out Std_Logic   -- ACIA Clock output
67
  );
68
end ACIA_Clock;
69
 
70
-------------------------------------------------------------------------------
71
-- Architecture for ACIA_Clock
72
-------------------------------------------------------------------------------
73
architecture rtl of ACIA_Clock is
74
 
75
constant full_cycle : integer :=  (SYS_Clock_Frequency / BAUD_Clock_Frequency) - 1;
76
constant half_cycle : integer :=  (full_cycle / 2) - 1;
77
--
78
-- Baud Rate Clock Divider
79
--
80
-- 25MHz / 27  = 926,000 KHz = 57,870Bd * 16
81
-- 50MHz / 54  = 926,000 KHz = 57,870Bd * 16
82
--
83
my_baud_clock: process( SysClk )
84
begin
85
    if(SysClk'event and SysClk = '0') then
86
                if( BaudCount = 53 )    then
87
                        baudclk <= '0';
88
                   BaudCount <= "000000";
89
                else
90
                   if( BaudCount = 26 ) then
91
                                baudclk <='1';
92
                        else
93
                                baudclk <=baudclk;
94
                        end if;
95
                   BaudCount <= BaudCount + 1;
96
                end if;
97
    end if;
98
end process;

powered by: WebSVN 2.1.0

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