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

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [VHDL/] [clock_div.vhd] - Blame information for rev 159

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

Line No. Rev Author Line
1 118 dilbert57
--===========================================================================
2 65 davidgb
--
3 118 dilbert57
--  clock_div.vhd - Clock divider for System09
4 65 davidgb
--
5 118 dilbert57
--===========================================================================
6
--
7
-- File name      : clock_div.vhd
8
--
9
-- Entity name    : clock_div
10 65 davidgb
--
11 118 dilbert57
-- Purpose        : Generates Clocks for System09
12
--                  For BurchED B3-Spartan2+ and B5-X300
13
--                  Divides the input clock which is normally 50MHz
14
--                  Generates a 1/1 (50.0 MHz) SYS clock 
15
--                  Generates a 1/2 (25.0 MHz) VGA clock 
16
--                  Generates a 1/4 (12.5 MHz) CPU clock 
17 65 davidgb
--
18 118 dilbert57
-- Dependencies   : ieee.Std_Logic_1164
19
--                  ieee.std_logic_unsigned
20
--                  ieee.std_logic_arith
21
--                  ieee.numeric_std
22 65 davidgb
--
23 118 dilbert57
-- Uses           : IBUFG
24
--                  BUFG
25 65 davidgb
--
26 118 dilbert57
-- Author         : John E. Kent      
27
--                  dilbert57@opencores.org      
28 65 davidgb
--
29 118 dilbert57
--  Copyright (C) 2003 - 2010 John Kent
30
--
31
--  This program is free software: you can redistribute it and/or modify
32
--  it under the terms of the GNU General Public License as published by
33
--  the Free Software Foundation, either version 3 of the License, or
34
--  (at your option) any later version.
35
--
36
--  This program is distributed in the hope that it will be useful,
37
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
38
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
--  GNU General Public License for more details.
40
--
41
--  You should have received a copy of the GNU General Public License
42
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
43
--
44
--===========================================================================
45 65 davidgb
--
46 118 dilbert57
--                              Revision History:
47
--
48
--===========================================================================
49 65 davidgb
--
50 118 dilbert57
-- Rev: Date:       Author:    Description:
51
--
52
-- 0.1  2008-09-07  John Kent  Initial version
53
-- 0.2  2010-09-14  John Kent  Updated header
54 65 davidgb
--
55 118 dilbert57
--
56 65 davidgb
library ieee;
57
   use ieee.std_logic_1164.all;
58
   use IEEE.STD_LOGIC_ARITH.ALL;
59
   use IEEE.STD_LOGIC_UNSIGNED.ALL;
60
   use ieee.numeric_std.all;
61 118 dilbert57
--library unisim;
62
--      use unisim.vcomponents.all;
63 65 davidgb
 
64
entity clock_div is
65
  port(
66
    clk_in      : in  std_Logic;  -- System Clock input
67
         sys_clk     : out std_logic;  -- System Clock Out    (1/1)
68
         vga_clk     : out std_logic;  -- VGA Pixel Clock Out (1/2)
69
    cpu_clk     : out std_logic   -- CPU Clock Out       (1/4)
70
  );
71
end entity;
72
 
73
architecture RTL of clock_div is
74
 
75
signal div_count   : std_logic_vector(1 downto 0);
76 118 dilbert57
 
77 65 davidgb
component BUFG
78
  port (
79
                i: in  std_logic;
80
                o: out std_logic
81
  );
82
end component;
83
 
84
--
85
-- Start instantiation
86
--
87
begin
88
 
89
--
90 118 dilbert57
-- 50 MHz SYS clock output
91 65 davidgb
--
92 118 dilbert57
sys_clk_buffer : BUFG
93 65 davidgb
  port map(
94
    i => clk_in,
95 118 dilbert57
         o => sys_clk
96 65 davidgb
  );
97
 
98
--
99
-- 25 MHz VGA clock output
100
--
101
vga_clk_buffer : BUFG
102
  port map(
103
    i => div_count(0),
104
         o => vga_clk
105
  );
106
 
107
--
108
-- 12.5MHz CPU clock 
109
--
110
cpu_clk_buffer : BUFG
111
  port map(
112
    i => div_count(1),
113
         o => cpu_clk
114
  );
115
 
116
--
117
-- Clock divider
118
--
119 118 dilbert57
clock_div : process( clk_in )
120 65 davidgb
begin
121 118 dilbert57
  if rising_edge( clk_in ) then
122 65 davidgb
    div_count <= div_count + "01";
123
  end if;
124
end process;
125
 
126
end architecture;
127
 

powered by: WebSVN 2.1.0

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