1 |
2 |
slavek |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Clock output buffer ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- Author(s): ----
|
6 |
|
|
---- - Slavek Valach, s.valach@dspfpga.com ----
|
7 |
|
|
---- ----
|
8 |
|
|
----------------------------------------------------------------------
|
9 |
|
|
---- ----
|
10 |
|
|
---- Copyright (C) 2008 Authors and OPENCORES.ORG ----
|
11 |
|
|
---- ----
|
12 |
|
|
---- This source file may be used and distributed without ----
|
13 |
|
|
---- restriction provided that this copyright statement is not ----
|
14 |
|
|
---- removed from the file and that any derivative work contains ----
|
15 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
16 |
|
|
---- ----
|
17 |
|
|
---- This source file is free software; you can redistribute it ----
|
18 |
|
|
---- and/or modify it under the terms of the GNU General ----
|
19 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
20 |
|
|
---- either version 2.0 of the License, or (at your option) any ----
|
21 |
|
|
---- later version. ----
|
22 |
|
|
---- ----
|
23 |
|
|
---- This source is distributed in the hope that it will be ----
|
24 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
25 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
26 |
|
|
---- PURPOSE. See the GNU General Public License for more details.----
|
27 |
|
|
---- ----
|
28 |
|
|
---- You should have received a copy of the GNU General ----
|
29 |
|
|
---- Public License along with this source; if not, download it ----
|
30 |
|
|
---- from http://www.gnu.org/licenses/gpl.txt ----
|
31 |
|
|
---- ----
|
32 |
|
|
----------------------------------------------------------------------
|
33 |
|
|
|
34 |
|
|
library ieee;
|
35 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
36 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
37 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
38 |
|
|
library UNISIM;
|
39 |
|
|
use UNISIM.VCOMPONENTS.all;
|
40 |
|
|
|
41 |
|
|
-------------------------------------------------------------------------------
|
42 |
|
|
-- Entity section
|
43 |
|
|
-----------------------------------------------------------------------------
|
44 |
|
|
|
45 |
|
|
entity video_clk_gen is
|
46 |
|
|
Generic (
|
47 |
|
|
POLARITY : natural := 1); -- Define polarity of the output clock signal
|
48 |
|
|
port (
|
49 |
|
|
CLK : in std_logic; -- Input clock
|
50 |
|
|
RST : in std_logic; -- System reset
|
51 |
|
|
CLK_OUT : out std_logic);
|
52 |
|
|
end video_clk_gen;
|
53 |
|
|
|
54 |
|
|
-----------------------------------------------------------------------------
|
55 |
|
|
-- Architecture section
|
56 |
|
|
-----------------------------------------------------------------------------
|
57 |
|
|
architecture implementation of video_clk_gen is
|
58 |
|
|
|
59 |
|
|
constant gnd : std_logic := '0';
|
60 |
|
|
constant vcc : std_logic := '1';
|
61 |
|
|
|
62 |
|
|
component FDDRRSE
|
63 |
|
|
port (
|
64 |
|
|
Q : out std_logic;
|
65 |
|
|
D0 : in std_logic;
|
66 |
|
|
D1 : in std_logic;
|
67 |
|
|
C0 : in std_logic;
|
68 |
|
|
C1 : in std_logic;
|
69 |
|
|
CE : in std_logic;
|
70 |
|
|
R : in std_logic;
|
71 |
|
|
S : in std_logic);
|
72 |
|
|
end component;
|
73 |
|
|
|
74 |
|
|
signal clk_n : std_logic;
|
75 |
|
|
signal d0_i : std_logic;
|
76 |
|
|
signal d1_i : std_logic;
|
77 |
|
|
|
78 |
|
|
BEGIN
|
79 |
|
|
|
80 |
|
|
clk_n <= Not clk;
|
81 |
|
|
d0_i <= '1' When POLARITY = 1 Else '0';
|
82 |
|
|
d1_i <= '0' When POLARITY = 1 Else '1';
|
83 |
|
|
|
84 |
|
|
GEN_PIXEL_CLK : FDDRRSE
|
85 |
|
|
port map (
|
86 |
|
|
Q => CLK_OUT,
|
87 |
|
|
D0 => d0_i,
|
88 |
|
|
D1 => d1_i,
|
89 |
|
|
C0 => clk,
|
90 |
|
|
C1 => clk_n,
|
91 |
|
|
CE => vcc,
|
92 |
|
|
R => gnd,
|
93 |
|
|
S => gnd);
|
94 |
|
|
|
95 |
|
|
end implementation;
|