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

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [VHDL/] [clock_dll.vhd] - Blame information for rev 108

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

Line No. Rev Author Line
1 65 davidgb
--===========================================================================----
2
--
3
--  S Y N T H E Z I A B L E    Clock_dll for System09 - SOC.
4
--
5
--===========================================================================----
6
--
7
-- This core adheres to the GNU public license
8
-- No responsibility is taken for this design.
9
-- Use at own risk.  
10
--
11
-- File name       : Clock_dll.vhd
12
--
13
-- Purpose         : Generates Clocks for System09
14
--                   For BurchED B3-Spartan2+ and B5-X300
15
--                   Assumes a 12.5 MHz system clock input
16
--                   Generates a x1 (12.5 MHz) CPU clock 
17
--                   Generates a x2 (25.0 MHz) VGA clock 
18
--                   Generates a x4 (50.0 MHz) MEM clock 
19
--
20
-- Dependencies    : ieee.Std_Logic_1164
21
--                   ieee.std_logic_unsigned
22
--                   ieee.std_logic_arith
23
--                   ieee.numeric_std
24
--
25
--
26
-- Revision History :
27
--
28
--   Rev         : 0.1
29
--   Date        : 7th September 2008
30
--   Description : Initial version.                 
31
-- 
32
--
33
library ieee;
34
   use ieee.std_logic_1164.all;
35
   use IEEE.STD_LOGIC_ARITH.ALL;
36
   use IEEE.STD_LOGIC_UNSIGNED.ALL;
37
   use ieee.numeric_std.all;
38
library unisim;
39
        use unisim.vcomponents.all;
40
 
41
entity clock_dll is
42
  port(
43
    clk_in      : in  std_Logic;  -- System Clock input
44
    clk_cpu     : out std_logic;  -- CPU Clock Out       (x1)
45
         clk_vga     : out std_logic;  -- VGA Pixel Clock Out (x2)
46
         clk_mem     : out std_logic;   -- Memory Clock Out    (x4)
47
         locked      : out std_logic   -- DLL in lock
48
  );
49
end entity;
50
 
51
architecture RTL of clock_dll is
52
 
53
  signal CPU_CLK0    : std_ulogic;
54
  signal CPU_CLK90   : std_ulogic;
55
  signal CPU_CLK180  : std_ulogic;
56
  signal CPU_CLK270  : std_ulogic;
57
  signal CPU_CLK2X   : std_ulogic;
58
  signal CPU_CLKDV   : std_ulogic;
59
  signal CPU_LOCKED  : std_ulogic;
60
  signal CPU_CLKFB   : std_ulogic;
61
  signal CPU_CLKIN   : std_ulogic;
62
  signal CPU_RESET   : std_ulogic;
63
 
64
  signal VGA_CLK0    : std_ulogic;
65
  signal VGA_CLK90   : std_ulogic;
66
  signal VGA_CLK180  : std_ulogic;
67
  signal VGA_CLK270  : std_ulogic;
68
  signal VGA_CLK2X   : std_ulogic;
69
  signal VGA_CLKDV   : std_ulogic;
70
  signal VGA_LOCKED  : std_ulogic;
71
  signal VGA_CLKFB   : std_ulogic;
72
  signal VGA_CLKIN   : std_ulogic;
73
  signal VGA_RESET   : std_ulogic;
74
  signal VGA_RESET_N : std_ulogic;
75
 
76
-- Component Declaration for CLKDLL should be placed
77
-- after architecture statement but before begin keyword
78
 
79
component CLKDLL
80
  -- synthesis translate_off
81
  generic (
82
    CLKDV_DIVIDE          : real    := 2.0;  -- (1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 8.0, 16.0)
83
    DUTY_CYCLE_CORRECTION : Boolean := TRUE; -- (TRUE, FALSE)
84
    STARTUP_WAIT          : boolean := FALSE -- (TRUE, FALSE)
85
  );
86
  -- synthesis translate_on
87
  port (
88
    CLK0   : out STD_ULOGIC;
89
    CLK180 : out STD_ULOGIC;
90
    CLK270 : out STD_ULOGIC;
91
    CLK2X  : out STD_ULOGIC;
92
    CLK90  : out STD_ULOGIC;
93
    CLKDV  : out STD_ULOGIC;
94
    LOCKED : out STD_ULOGIC;
95
    CLKFB  : in  STD_ULOGIC;
96
    CLKIN  : in  STD_ULOGIC;
97
    RST    : in  STD_ULOGIC
98
  );
99
end component;
100
 
101
component IBUFG
102
  port (
103
                i: in  std_logic;
104
                o: out std_logic
105
  );
106
end component;
107
 
108
component BUFG
109
  port (
110
                i: in  std_logic;
111
                o: out std_logic
112
  );
113
end component;
114
 
115
component SRL16
116
  port (
117
    Q   : out std_logic;
118
    D   : in  std_logic;
119
    CLK : in  std_logic;
120
    A0  : in  std_logic;
121
    A1  : in  std_logic;
122
    A2  : in  std_logic;
123
    A3  : in  std_logic
124
  );
125
end component;
126
 
127
--
128
-- Start instantiation
129
--
130
begin
131
 
132
--
133
-- 12.5MHz CPU clock input
134
--
135
cpu_clkin_buffer : IBUFG
136
  port map(
137
    i => clk_in,
138
         o => CPU_CLKIN
139
  );
140
 
141
--
142
-- 12.5MHz CPU clock input
143
--
144
cpu_clkout_buffer : BUFG
145
  port map(
146
    i => CPU_CLKIN,
147
         o => clk_cpu
148
  );
149
 
150
--
151
-- 25 MHz VGA clock input
152
--
153
cpu_clkfb_buffer : BUFG
154
  port map(
155
    i => CPU_CLK2X,
156
         o => CPU_CLKFB
157
  );
158
 
159
CLKDLL_CPU : CLKDLL
160
  -- synthesis translate_off
161
  generic map (
162
    CLKDV_DIVIDE          => 2.0,  -- (1.5,2,2.5,3,4,5,8,16)
163
    DUTY_CYCLE_CORRECTION => TRUE, -- (TRUE, FALSE)
164
    STARTUP_WAIT          => FALSE  -- (TRUE, FALSE)
165
  );
166
  -- synthesis translate_on
167
  port map (
168
    CLK0   => CPU_CLK0,
169
    CLK90  => CPU_CLK90,
170
    CLK180 => CPU_CLK180,
171
    CLK270 => CPU_CLK270,
172
    CLK2X  => CPU_CLK2X,
173
    CLKDV  => CPU_CLKDV,
174
    LOCKED => CPU_LOCKED,
175
    CLKFB  => CPU_CLKFB,
176
    CLKIN  => CPU_CLKIN,
177
    RST    => CPU_RESET
178
  );
179
 
180
--
181
-- 25 MHz VGA clock output
182
--
183
vga_clkfb_buffer : BUFG
184
  port map(
185
    i => VGA_CLK2X,
186
         o => VGA_CLKFB
187
  );
188
 
189
CLKDLL_VGA : CLKDLL
190
  -- synthesis translate_off
191
  generic map (
192
    CLKDV_DIVIDE          => 2.0,    -- (1.5,2,2.5,3,4,5,8,16)
193
    DUTY_CYCLE_CORRECTION => TRUE, -- (TRUE, FALSE)
194
    STARTUP_WAIT          => FALSE  -- (TRUE, FALSE)
195
  );
196
  -- synthesis translate_on
197
  port map (
198
    CLK0   => VGA_CLK0,
199
    CLK90  => VGA_CLK90,
200
    CLK180 => VGA_CLK180,
201
    CLK270 => VGA_CLK270,
202
    CLK2X  => VGA_CLK2X,
203
    CLKDV  => VGA_CLKDV,
204
    LOCKED => VGA_LOCKED,
205
    CLKFB  => VGA_CLKFB,
206
    CLKIN  => VGA_CLKIN,
207
    RST    => VGA_RESET
208
  );
209
 
210
my_srl16 : SRL16 port map (
211
  Q   => VGA_RESET_N,
212
  D   => CPU_LOCKED,
213
  CLK => CPU_CLKFB,
214
  A0  => '1',
215
  A1  => '1',
216
  A2  => '1',
217
  A3  => '1'
218
  );
219
 
220
clock_dll_assign : process( VGA_RESET_N, VGA_LOCKED,
221
                            clk_in, CPU_CLKFB, VGA_CLKFB )
222
begin
223
  VGA_RESET <= not VGA_RESET_N;
224
  VGA_CLKIN <= CPU_CLKFB;
225
  CPU_RESET <= '0';
226
  clk_vga   <= CPU_CLKFB;
227
  clk_mem   <= VGA_CLKFB;
228
  locked    <= VGA_LOCKED;
229
end process;
230
 
231
end architecture;
232
 

powered by: WebSVN 2.1.0

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