1 |
5 |
sergeykhbr |
-----------------------------------------------------------------------------
|
2 |
|
|
--! @file
|
3 |
|
|
--! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
|
4 |
|
|
--! @author Sergey Khabarov - sergeykhbr@gmail.com
|
5 |
|
|
--! @brief Clock phase offset generator (90 deg) for Kintex7 FPGA.
|
6 |
|
|
------------------------------------------------------------------------------
|
7 |
|
|
|
8 |
|
|
--! Standard library
|
9 |
|
|
library ieee;
|
10 |
|
|
use ieee.std_logic_1164.all;
|
11 |
|
|
library unisim;
|
12 |
|
|
use unisim.vcomponents.all;
|
13 |
|
|
|
14 |
|
|
entity clkp90_kintex7 is
|
15 |
|
|
generic (
|
16 |
|
|
freq : integer := 125000
|
17 |
|
|
);
|
18 |
|
|
port (
|
19 |
|
|
--! Active High
|
20 |
|
|
i_rst : in std_logic;
|
21 |
|
|
i_clk : in std_logic;
|
22 |
|
|
o_clk : out std_logic;
|
23 |
|
|
o_clkp90 : out std_logic;
|
24 |
|
|
o_clk2x : out std_logic;
|
25 |
|
|
o_lock : out std_logic
|
26 |
|
|
);
|
27 |
|
|
end clkp90_kintex7;
|
28 |
|
|
|
29 |
|
|
architecture rtl of clkp90_kintex7 is
|
30 |
|
|
|
31 |
|
|
constant clk_mul : integer := 8;
|
32 |
|
|
constant clk_div : integer := 8;
|
33 |
|
|
constant period : real := 1000000.0/real(freq);
|
34 |
|
|
constant clkio_div : integer := freq*clk_mul/200000;
|
35 |
|
|
|
36 |
|
|
signal CLKFBOUT : std_logic;
|
37 |
|
|
signal CLKFBIN : std_logic;
|
38 |
|
|
signal clk_nobuf : std_logic;
|
39 |
|
|
signal clk90_nobuf : std_logic;
|
40 |
|
|
signal clkio_nobuf : std_logic;
|
41 |
|
|
|
42 |
|
|
begin
|
43 |
|
|
|
44 |
|
|
CLKFBIN <= CLKFBOUT;
|
45 |
|
|
|
46 |
|
|
PLLE2_ADV_inst : PLLE2_ADV generic map (
|
47 |
|
|
BANDWIDTH => "OPTIMIZED", -- OPTIMIZED, HIGH, LOW
|
48 |
|
|
CLKFBOUT_MULT => clk_mul, -- Multiply value for all CLKOUT, (2-64)
|
49 |
|
|
CLKFBOUT_PHASE => 0.0, -- Phase offset in degrees of CLKFB, (-360.000-360.000).
|
50 |
|
|
-- CLKIN_PERIOD: Input clock period in nS to ps resolution (i.e. 33.333 is 30 MHz).
|
51 |
|
|
CLKIN1_PERIOD => period,
|
52 |
|
|
CLKIN2_PERIOD => 0.0,
|
53 |
|
|
-- CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: Divide amount for CLKOUT (1-128)
|
54 |
|
|
CLKOUT0_DIVIDE => clk_div,
|
55 |
|
|
CLKOUT1_DIVIDE => clk_div,
|
56 |
|
|
CLKOUT2_DIVIDE => clkio_div,
|
57 |
|
|
CLKOUT3_DIVIDE => 1,
|
58 |
|
|
CLKOUT4_DIVIDE => 1,
|
59 |
|
|
CLKOUT5_DIVIDE => 1,
|
60 |
|
|
-- CLKOUT0_DUTY_CYCLE - CLKOUT5_DUTY_CYCLE: Duty cycle for CLKOUT outputs (0.001-0.999).
|
61 |
|
|
CLKOUT0_DUTY_CYCLE => 0.5,
|
62 |
|
|
CLKOUT1_DUTY_CYCLE => 0.5,
|
63 |
|
|
CLKOUT2_DUTY_CYCLE => 0.5,
|
64 |
|
|
CLKOUT3_DUTY_CYCLE => 0.5,
|
65 |
|
|
CLKOUT4_DUTY_CYCLE => 0.5,
|
66 |
|
|
CLKOUT5_DUTY_CYCLE => 0.5,
|
67 |
|
|
-- CLKOUT0_PHASE - CLKOUT5_PHASE: Phase offset for CLKOUT outputs (-360.000-360.000).
|
68 |
|
|
CLKOUT0_PHASE => 0.0,
|
69 |
|
|
CLKOUT1_PHASE => 90.0,
|
70 |
|
|
CLKOUT2_PHASE => 0.0,
|
71 |
|
|
CLKOUT3_PHASE => 0.0,
|
72 |
|
|
CLKOUT4_PHASE => 0.0,
|
73 |
|
|
CLKOUT5_PHASE => 0.0,
|
74 |
|
|
COMPENSATION => "ZHOLD", -- ZHOLD, BUF_IN, EXTERNAL, INTERNAL
|
75 |
|
|
DIVCLK_DIVIDE => 1, -- Master division value (1-56)
|
76 |
|
|
-- REF_JITTER: Reference input jitter in UI (0.000-0.999).
|
77 |
|
|
REF_JITTER1 => 0.0,
|
78 |
|
|
REF_JITTER2 => 0.0,
|
79 |
|
|
STARTUP_WAIT => "TRUE" -- Delay DONE until PLL Locks, ("TRUE"/"FALSE")
|
80 |
|
|
) port map (
|
81 |
|
|
-- Clock Outputs: 1-bit (each) output: User configurable clock outputs
|
82 |
|
|
CLKOUT0 => clk_nobuf,
|
83 |
|
|
CLKOUT1 => clk90_nobuf,
|
84 |
|
|
CLKOUT2 => clkio_nobuf,
|
85 |
|
|
CLKOUT3 => OPEN,
|
86 |
|
|
CLKOUT4 => OPEN,
|
87 |
|
|
CLKOUT5 => OPEN,
|
88 |
|
|
-- DRP Ports: 16-bit (each) output: Dynamic reconfigration ports
|
89 |
|
|
DO => OPEN,
|
90 |
|
|
DRDY => OPEN,
|
91 |
|
|
-- Feedback Clocks: 1-bit (each) output: Clock feedback ports
|
92 |
|
|
CLKFBOUT => CLKFBOUT,
|
93 |
|
|
-- Status Ports: 1-bit (each) output: PLL status ports
|
94 |
|
|
LOCKED => o_lock,
|
95 |
|
|
-- Clock Inputs: 1-bit (each) input: Clock inputs
|
96 |
|
|
CLKIN1 => i_clk,
|
97 |
|
|
CLKIN2 => '0',
|
98 |
|
|
-- Con trol Ports: 1-bit (each) input: PLL control ports
|
99 |
|
|
CLKINSEL => '1',
|
100 |
|
|
PWRDWN => '0',
|
101 |
|
|
RST => i_rst,
|
102 |
|
|
-- DRP Ports: 7-bit (each) input: Dynamic reconfigration ports
|
103 |
|
|
DADDR => "0000000",
|
104 |
|
|
DCLK => '0',
|
105 |
|
|
DEN => '0',
|
106 |
|
|
DI => "0000000000000000",
|
107 |
|
|
DWE => '0',
|
108 |
|
|
-- Feedback Clocks: 1-bit (each) input: Clock feedback ports
|
109 |
|
|
CLKFBIN => CLKFBIN
|
110 |
|
|
);
|
111 |
|
|
|
112 |
|
|
bufgclk0 : BUFG port map (I => clk_nobuf, O => o_clk);
|
113 |
|
|
bufgclk90 : BUFG port map (I => clk90_nobuf, O => o_clkp90);
|
114 |
|
|
bufgclkio : BUFG port map (I => clkio_nobuf, O => o_clk2x);
|
115 |
|
|
|
116 |
|
|
end;
|