forked from peterotte/A2ExpTrigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock_boost.vhd
118 lines (102 loc) · 2.75 KB
/
clock_boost.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
-- check, whether all PLLs are locked: ./vmeext 0xXX004000 0x0 r
-- should be 0x3
-- To Reset the PLLs: ./vmeext 0xXX004000 0x3 w
-- Engineer: S.Minami, Peter-Bernd Otte
-- 2.4.2012
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity clock_boost is
Port ( CLKIN_N_IN : in STD_LOGIC;
CLKIN_P_IN : in STD_LOGIC;
CLK_RST_IN : in STD_LOGIC_VECTOR (3 downto 0);
CLK_LOCKED_OUT : out STD_LOGIC_VECTOR (3 downto 0);
CLK50MHz_OUT : out STD_LOGIC;
CLK100MHz_OUT : out STD_LOGIC;
CLK200MHz_OUT : out STD_LOGIC;
CLK400MHz_OUT : out STD_LOGIC;
clock1MHz_OUT : out STD_LOGIC;
clock0_5Hz_OUT : out STD_LOGIC
);
end clock_boost;
architecture Behavioral of clock_boost is
COMPONENT clkbst100to200
PORT(
CLKIN_N_IN : IN std_logic;
CLKIN_P_IN : IN std_logic;
RST_IN : IN std_logic;
CLKDV_OUT : OUT std_logic;
CLKIN_IBUFGDS_OUT : OUT std_logic;
CLK0_OUT : OUT std_logic;
CLK2X_OUT : OUT std_logic;
LOCKED_OUT : OUT std_logic
);
END COMPONENT;
COMPONENT clkbst200to400
PORT(
CLKIN_IN : IN std_logic;
RST_IN : IN std_logic;
CLK0_OUT : OUT std_logic;
CLK2X_OUT : OUT std_logic;
LOCKED_OUT : OUT std_logic
);
END COMPONENT;
signal clk50,clk100,clk200,clk400: std_logic;
signal locked, reset : std_logic_vector ( 3 downto 0);
signal locked4 : std_logic;
signal clk100_2, clk200_2: std_logic;
signal clock1MHz, clock0_5Hz : std_logic;
begin
CLK50MHz_OUT <= clk50;
CLK100MHz_OUT <= clk100;
CLK200MHz_OUT <= clk200;
CLK400MHz_OUT <= clk400;
CLK_LOCKED_OUT <= locked;
reset <= CLK_RST_IN;
Inst_clkbst100to200: clkbst100to200 PORT MAP(
CLKIN_N_IN => CLKIN_N_IN,
CLKIN_P_IN => CLKIN_P_IN,
RST_IN => reset(0),
CLKDV_OUT => clk50,
CLKIN_IBUFGDS_OUT => clk100_2,
CLK0_OUT => clk100,
CLK2X_OUT => clk200,
LOCKED_OUT => locked(0)
);
Inst_clkbst200to400: clkbst200to400 PORT MAP(
CLKIN_IN => clk200,
RST_IN => reset(1),
CLK0_OUT => clk200_2,
CLK2X_OUT => clk400,
LOCKED_OUT => locked(1)
);
process (clk50)
variable Counter : integer;
begin
if rising_edge(clk50) then
Counter := Counter +1;
if Counter > 24 then --24 gives (24+1) * 20ns long pulses
Counter := 0;
clock1MHz <= not clock1MHz;
else
clock1MHz <= clock1MHz;
end if;
end if;
end process;
clock1MHz_OUT <= clock1MHz;
process (clock1MHz)
variable Counter : integer;
begin
if rising_edge(clock1MHz) then
Counter := Counter +1;
if Counter > 1000000-1 then --1000000-1 gives (1000000) * 1µs long pulses
Counter := 0;
clock0_5Hz <= not clock0_5Hz;
else
clock0_5Hz <= clock0_5Hz;
end if;
end if;
end process;
clock0_5Hz_OUT <= clock0_5Hz;
end Behavioral;