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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [io/] [uart_clk.vhdl] - Blame information for rev 33

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

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY IEEE;
21
USE IEEE.STD_LOGIC_1164.ALL;
22
USE IEEE.numeric_std.ALL;
23
USE work.system_package.ALL;
24
 
25
ENTITY uart_clock IS
26
    PORT (
27
      reset   : IN  STD_LOGIC;
28
      clock   : IN  STD_LOGIC;
29
      baudout : OUT STD_LOGIC);
30
END uart_clock;
31
 
32
ARCHITECTURE Behavioral OF uart_clock IS
33
 
34
  SIGNAL div_ctr : INTEGER RANGE 0 TO 650 := 0;
35
 
36
BEGIN
37
 
38
  -- purpose: Divide 100 MHz Atlys clock by 651
39
  -- type   : sequential
40
  -- inputs : clock, reset
41
  -- outputs: baudout
42
  baudgen: PROCESS (clock, reset)
43
  BEGIN  -- PROCESS baudgen
44
    IF reset = '0' THEN                 -- asynchronous reset (active low)
45
      div_ctr <= 0;
46
      baudout <= '1';
47
    ELSIF rising_edge(clock) THEN  -- rising clock edge
48
      IF div_ctr >= 650 THEN
49
        div_ctr <= 0;
50
        baudout <= '1';
51
      ELSE
52
        div_ctr <= div_ctr + 1;
53
        baudout <= '0';
54
      END IF;
55
    END IF;
56
  END PROCESS baudgen;
57
 
58
END Behavioral;

powered by: WebSVN 2.1.0

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